helix

package module
v2.28.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 20 Imported by: 69

README

helix

A Twitch Helix API client written in Go (Golang).

Tests and Coverage Coverage Status Go Reference

Twitch is always expanding and improving the available endpoints and features for the Helix API. The maintainers of this package will make a best effort approach to implementing new changes as they are released by the Twitch team.

See here for a list of endpoints and features this package supports.

Documentation & Examples

All documentation and usage examples for this package can be found here. If you are looking for the Twitch API docs, see the Twitch Developer website.

Support

Have a question? Need some assistance? Check out our dedicated channel in the Twitch API Discord.

Supported Go Versions

Our support of Go versions is aligned with Go's version release policy. So we will support a major version of Go until there are two newer major releases. We no longer support building this package with unsupported Go versions, as these contain security vulnerabilities which will not be fixed.

Contributions

PRs are very much welcome. Where possible, please include unit tests for any code that is introduced by your PRs. It's also helpful if you can include usage examples in the docs directory.

License

This package is distributed under the terms of the MIT license.

Documentation

Index

Constants

View Source
const (
	SUCCESSFULLY_REDEEMED EntitlementCodeStatus = "SUCCESSFULLY_REDEEMED"
	ALREADY_CLAIMED                             = "ALREADY_CLAIMED"
	EXPIRED                                     = "EXPIRED"
	USER_NOT_ELIGIBLE                           = "USER_NOT_ELIGIBLE"
	NOT_FOUND                                   = "NOT_FOUND"
	INACTIVE                                    = "INACTIVE"
	UNUSED                                      = "UNUSED"
	INCORRECT_FORMAT                            = "INCORRECT_FORMAT"
	INTERNAL_ERROR                              = "INTERNAL_ERROR"
)
View Source
const (
	EventSubStatusEnabled                      = "enabled"
	EventSubStatusPending                      = "webhook_callback_verification_pending"
	EventSubStatusFailed                       = "webhook_callback_verification_failed"
	EventSubStatusNotificationFailuresExceeded = "notification_failures_exceeded"
	EventSubStatusAuthorizationRevoked         = "authorization_revoked"
	EventSubStatusUserRemoved                  = "user_removed"

	EventSubTypeChannelGoalBegin                          = "channel.goal.begin"
	EventSubTypeChannelGoalProgress                       = "channel.goal.progress"
	EventSubTypeChannelGoalEnd                            = "channel.goal.end"
	EventSubTypeChannelUpdate                             = "channel.update"
	EventSubTypeChannelFollow                             = "channel.follow"
	EventSubTypeChannelSubscription                       = "channel.subscribe"
	EventSubTypeChannelSubscriptionEnd                    = "channel.subscription.end"
	EventSubTypeChannelSubscriptionGift                   = "channel.subscription.gift"
	EventSubTypeChannelSubscriptionMessage                = "channel.subscription.message"
	EventSubTypeChannelCheer                              = "channel.cheer"
	EventSubTypeChannelRaid                               = "channel.raid"
	EventSubTypeChannelBan                                = "channel.ban"
	EventSubTypeChannelUnban                              = "channel.unban"
	EventSubTypeModeratorAdd                              = "channel.moderator.add"
	EventSubTypeModeratorRemove                           = "channel.moderator.remove"
	EventSubTypeChannelPointsCustomRewardAdd              = "channel.channel_points_custom_reward.add"
	EventSubTypeChannelPointsCustomRewardUpdate           = "channel.channel_points_custom_reward.update"
	EventSubTypeChannelPointsCustomRewardRemove           = "channel.channel_points_custom_reward.remove"
	EventSubTypeChannelPointsCustomRewardRedemptionAdd    = "channel.channel_points_custom_reward_redemption.add"
	EventSubTypeChannelPointsCustomRewardRedemptionUpdate = "channel.channel_points_custom_reward_redemption.update"
	EventSubTypeChannelChatClear                          = "channel.chat.clear"
	EventSubTypeChannelChatClearUserMessages              = "channel.chat.clear_user_messages"
	EventSubTypeChannelChatMessage                        = "channel.chat.message"
	EventSubTypeChannelChatMessageDelete                  = "channel.chat.message_delete"
	EventSubTypeChannelChatNotification                   = "channel.chat.notification"
	EventSubTypeChannelPollBegin                          = "channel.poll.begin"
	EventSubTypeChannelPollProgress                       = "channel.poll.progress"
	EventSubTypeChannelPollEnd                            = "channel.poll.end"
	EventSubTypeChannelPredictionBegin                    = "channel.prediction.begin"
	EventSubTypeChannelPredictionProgress                 = "channel.prediction.progress"
	EventSubTypeChannelPredictionLock                     = "channel.prediction.lock"
	EventSubTypeChannelPredictionEnd                      = "channel.prediction.end"
	EventSubExtensionBitsTransactionCreate                = "extension.bits_transaction.create"
	EventSubTypeHypeTrainBegin                            = "channel.hype_train.begin"
	EventSubTypeHypeTrainProgress                         = "channel.hype_train.progress"
	EventSubTypeHypeTrainEnd                              = "channel.hype_train.end"
	EventSubTypeCharityDonation                           = "channel.charity_campaign.donate"
	EventSubTypeCharityProgress                           = "channel.charity_campaign.progress"
	EventSubTypeCharityStop                               = "channel.charity_campaign.stop"
	EventSubTypeCharityStart                              = "channel.charity_campaign.start"
	EventSubTypeStreamOnline                              = "stream.online"
	EventSubTypeStreamOffline                             = "stream.offline"
	EventSubTypeUserAuthorizationRevoke                   = "user.authorization.revoke"
	EventSubTypeUserUpdate                                = "user.update"
	EventSubShoutoutCreate                                = "channel.shoutout.create"
	EventSubShoutoutReceive                               = "channel.shoutout.receive"
)

EventSub helper Variables for Types and Status

View Source
const (
	// DefaultAPIBaseURL is the base URL for composing API requests.
	DefaultAPIBaseURL = "https://api.twitch.tv/helix"

	// AuthBaseURL is the base URL for composing authentication requests.
	AuthBaseURL = "https://id.twitch.tv/oauth2"
)

Variables

View Source
var (
	UserFollowsRegexp        = regexp.MustCompile("helix/users/follows\\?first=1(&from_id=(?P<from_id>\\d+))?(&to_id=(?P<to_id>\\d+))?>")
	StreamChangedRegexp      = regexp.MustCompile("helix/streams\\?user_id=(?P<user_id>\\d+)>")
	UserChangedRegexp        = regexp.MustCompile("helix/users\\?id=(?P<id>\\d+)>")
	GameAnalyticsRegexp      = regexp.MustCompile("helix/analytics\\?game_id=(?P<game_id>\\w+)>")
	ExtensionAnalyticsRegexp = regexp.MustCompile("helix/analytics\\?extension_id=(?P<extension_id>\\w+)>")
)

Regular expressions used for parsing webhook link headers

Functions

func GetWebhookTopicValuesFromRequest

func GetWebhookTopicValuesFromRequest(req *http.Request, topic WebhookTopic) map[string]string

GetWebhookTopicValuesFromRequest inspects the "Link" request header to determine if it matches against any recognised webhooks topics and returns the unique values specified in the header.

For example, say we receive a "User Follows" webhook event from Twitch. Its "Link" header value look likes the following:

<https://api.twitch.tv/helix/webhooks/hub>; rel="hub", <https://api.twitch.tv/helix/users/follows?first=1&from_id=111116&to_id=22222>; rel="self"

From which GetWebhookTopicValuesFromRequest will return a map with the values of from_id and to_id:

map[from_id:111116 to_id:22222]

This is particularly useful for webhooks events that do not have a distinguishable JSON payload, such as the "Stream Changed" down event.

Additionally, if topic is not known you can pass -1 as its value and

func VerifyEventSubNotification

func VerifyEventSubNotification(secret string, header http.Header, message string) bool

Verifys that a notification came from twitch using the a signature and the secret used when creating the subscription

Types

type AccessCredentials

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

type AdDetails

type AdDetails struct {
	Length     AdLengthEnum `json:"length"`
	Message    string       `json:"message"`
	RetryAfter int          `json:"retry_after"`
}

type AdLengthEnum

type AdLengthEnum int
const (
	AdLen30 AdLengthEnum
	AdLen60
	AdLen90
	AdLen120
	AdLen150
	AdLen180
)

type AddBlockedTermParams added in v2.10.0

type AddBlockedTermParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	ModeratorID   string `query:"moderator_id"`
	Text          string `json:"text"`
}

type AddBlockedTermResponse added in v2.10.0

type AddBlockedTermResponse struct {
	ResponseCommon
	Data ManyAddBlockedTerms
}

type AddChannelModeratorParams added in v2.22.0

type AddChannelModeratorParams struct {
	UserID        string `query:"user_id"`
	BroadcasterID string `query:"broadcaster_id"`
}

type AddChannelModeratorResponse added in v2.22.0

type AddChannelModeratorResponse struct {
	ResponseCommon
}

type AddChannelVipParams added in v2.17.0

type AddChannelVipParams struct {
	UserID        string `query:"user_id"`        // required
	BroadcasterID string `query:"broadcaster_id"` // required
}

type AddChannelVipResponse added in v2.17.0

type AddChannelVipResponse struct {
	ResponseCommon
}

type AppAccessTokenResponse

type AppAccessTokenResponse struct {
	ResponseCommon
	Data AccessCredentials
}

type AuthorizationURLParams

type AuthorizationURLParams struct {
	ResponseType string   // (Required) Options: "code" or "token"
	Scopes       []string // (Required)
	State        string   // (Optional)
	ForceVerify  bool     // (Optional)
}

type BadgeVersion

type BadgeVersion struct {
	ID         string `json:"id"`
	ImageUrl1x string `json:"image_url_1x"`
	ImageUrl2x string `json:"image_url_2x"`
	ImageUrl4x string `json:"image_url_4x"`
}

type Ban

type Ban struct {
	UserID    string `json:"user_id"`
	UserLogin string `json:"user_login"`
	UserName  string `json:"user_name"`
	ExpiresAt Time   `json:"expires_at"`
}

ExpiresAt must be parsed manually since an empty string means perma ban

type BanUser added in v2.9.0

type BanUser struct {
	BoardcasterId string `json:"broadcaster_id"`
	CreatedAt     Time   `json:"created_at"`
	EndTime       Time   `json:"end_time"`
	ModeratorId   string `json:"moderator_id"`
	UserId        string `json:"user_id"`
}

type BanUserParams added in v2.9.0

type BanUserParams struct {
	BroadcasterID string             `query:"broadcaster_id"`
	ModeratorId   string             `query:"moderator_id"`
	Body          BanUserRequestBody `json:"data"`
}

type BanUserRequestBody added in v2.9.0

type BanUserRequestBody struct {
	Duration int    `json:"duration,omitempty"` // optional
	Reason   string `json:"reason"`             // required
	UserId   string `json:"user_id"`            // required
}

type BanUserResponse added in v2.9.0

type BanUserResponse struct {
	ResponseCommon
	Data ManyBanUser
}

type BannedUsersParams

type BannedUsersParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	// Filter by provided UserIDs
	UserID []string `query:"user_id"`
	After  string   `query:"after"`
	Before string   `query:"before"`
}

BroadcasterID must match the auth tokens user_id

type BannedUsersResponse

type BannedUsersResponse struct {
	ResponseCommon
	Data ManyBans
}

type BitsLeaderboardParams

type BitsLeaderboardParams struct {
	Count     int       `query:"count,10"`   // Maximum 100
	Period    string    `query:"period,all"` // "all" (default), "day", "week", "month" and "year"
	StartedAt time.Time `query:"started_at"`
	UserID    string    `query:"user_id"`
}

type BitsLeaderboardResponse

type BitsLeaderboardResponse struct {
	ResponseCommon
	Data ManyUserBitTotals
}

type BlockUserParams

type BlockUserParams struct {
	TargetUserID  string `query:"target_user_id"`
	SourceContext string `query:"source_context"` // Valid values: "chat", "whisper"
	Reason        string `query:"reason"`         // Valid values: "spam", "harassment", "other"
}

type BlockUserResponse

type BlockUserResponse struct {
	ResponseCommon
}

type BlockedTerm added in v2.10.0

type BlockedTerm struct {
	BroadcasterID string `json:"broadcaster_id"`
	CreatedAt     Time   `json:"created_at"`
	ExpiresAt     Time   `json:"expires_at"`
	ID            string `json:"id"`
	ModeratorID   string `json:"moderator_id"`
	Text          string `json:"text"`
	UpdatedAt     Time   `json:"updated_at"`
}

type BlockedTermsParams added in v2.10.0

type BlockedTermsParams struct {
	// Required
	BroadcasterID string `query:"broadcaster_id"`
	ModeratorID   string `query:"moderator_id"`

	// Optional
	After string `query:"after"`
	First int    `query:"first"`
}

type BlockedTermsResponse added in v2.10.0

type BlockedTermsResponse struct {
	ResponseCommon
	Data ManyBlockedTerms
}

type CancelRaidParams added in v2.19.0

type CancelRaidParams struct {
	BroadcasterID string `query:"broadcaster_id"`
}

CancelRaidParams are the parameters for CancelRaid

type CancelRaidResponse added in v2.19.0

type CancelRaidResponse struct {
	ResponseCommon
}

CancelRaidResponse is the response from StartRaid

type Category added in v2.18.0

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

Category describes a category from SearchCategory

type Channel

type Channel struct {
	ID               string   `json:"id"`
	GameID           string   `json:"game_id"`
	GameName         string   `json:"game_name"`
	BroadcasterLogin string   `json:"broadcaster_login"`
	DisplayName      string   `json:"display_name"`
	Language         string   `json:"broadcaster_language"`
	Title            string   `json:"title"`
	Tags             []string `json:"tags"`
	ThumbnailURL     string   `json:"thumbnail_url"`
	IsLive           bool     `json:"is_live"`
	StartedAt        Time     `json:"started_at"`
	TagIDs           []string `json:"tag_ids"`
}

Channel describes a channel from SearchChannel

type ChannelCustomReward

type ChannelCustomReward struct {
	BroadcasterID                     string                      `json:"broadcaster_id"`
	BroadcasterLogin                  string                      `json:"broadcaster_login"`
	BroadcasterName                   string                      `json:"broadcaster_name"`
	ID                                string                      `json:"id"`
	Title                             string                      `json:"title"`
	Prompt                            string                      `json:"prompt"`
	Cost                              int                         `json:"cost"`
	Image                             RewardImage                 `json:"image"`
	BackgroundColor                   string                      `json:"background_color"`
	DefaultImage                      RewardImage                 `json:"default_image"`
	IsEnabled                         bool                        `json:"is_enabled"`
	IsUserInputRequired               bool                        `json:"is_user_input_required"`
	MaxPerStreamSetting               MaxPerStreamSettings        `json:"max_per_stream_setting"`
	MaxPerUserPerStreamSetting        MaxPerUserPerStreamSettings `json:"max_per_user_per_stream_setting"`
	GlobalCooldownSetting             GlobalCooldownSettings      `json:"global_cooldown_setting"`
	IsPaused                          bool                        `json:"is_paused"`
	IsInStock                         bool                        `json:"is_in_stock"`
	ShouldRedemptionsSkipRequestQueue bool                        `json:"should_redemptions_skip_request_queue"`
	RedemptionsRedeemedCurrentStream  int                         `json:"redemptions_redeemed_current_stream"`
	CooldownExpiresAt                 string                      `json:"cooldown_expires_at"`
}

type ChannelCustomRewardResponse

type ChannelCustomRewardResponse struct {
	ResponseCommon
	Data ManyChannelCustomRewards
}

type ChannelCustomRewardsParams

type ChannelCustomRewardsParams struct {
	BroadcasterID                     string `query:"broadcaster_id"`
	Title                             string `json:"title"`
	Cost                              int    `json:"cost"`
	Prompt                            string `json:"prompt"`
	IsEnabled                         bool   `json:"is_enabled"`
	BackgroundColor                   string `json:"background_color,omitempty"`
	IsUserInputRequired               bool   `json:"is_user_input_required"`
	IsMaxPerStreamEnabled             bool   `json:"is_max_per_stream_enabled"`
	MaxPerStream                      int    `json:"max_per_stream"`
	IsMaxPerUserPerStreamEnabled      bool   `json:"is_max_per_user_per_stream_enabled"`
	MaxPerUserPerStream               int    `json:"max_per_user_per_stream"`
	IsGlobalCooldownEnabled           bool   `json:"is_global_cooldown_enabled"`
	GlobalCooldownSeconds             int    `json:"global_cooldown_seconds"`
	ShouldRedemptionsSkipRequestQueue bool   `json:"should_redemptions_skip_request_queue"`
}

type ChannelCustomRewardsRedemption added in v2.21.0

type ChannelCustomRewardsRedemption struct {
	ID               string              `json:"id"`
	BroadcasterID    string              `json:"broadcaster_id"`
	BroadcasterLogin string              `json:"broadcaster_login"`
	BroadcasterName  string              `json:"broadcaster_name"`
	UserID           string              `json:"user_id"`
	UserName         string              `json:"user_name"`
	UserLogin        string              `json:"user_login"`
	UserInput        string              `json:"user_input"`
	Status           string              `json:"status"`
	RedeemedAt       Time                `json:"redeemed_at"`
	Reward           ChannelCustomReward `json:"reward"`
}

type ChannelCustomRewardsRedemptionResponse added in v2.21.0

type ChannelCustomRewardsRedemptionResponse struct {
	ResponseCommon
	Data ManyChannelCustomRewardsRedemptions
}

type ChannelEditor

type ChannelEditor struct {
	UserID    string `json:"user_id"`
	UserName  string `json:"user_name"`
	CreatedAt Time   `json:"created_at"`
}

ChannelEditor

type ChannelEditorsParams

type ChannelEditorsParams struct {
	BroadcasterID string `query:"broadcaster_id"`
}

type ChannelEditorsResponse

type ChannelEditorsResponse struct {
	ResponseCommon
	Data ManyChannelEditors
}

type ChannelFollow added in v2.16.0

type ChannelFollow struct {
	UserID    string `json:"user_id"`
	Username  string `json:"user_name"`
	UserLogin string `json:"user_login"`
	Followed  Time   `json:"followed_at"`
}

Channel describes a follow of a channel

type ChannelInformation

type ChannelInformation struct {
	BroadcasterID       string   `json:"broadcaster_id"`
	BroadcasterName     string   `json:"broadcaster_name"`
	BroadcasterLanguage string   `json:"broadcaster_language"`
	GameID              string   `json:"game_id"`
	GameName            string   `json:"game_name"`
	Title               string   `json:"title"`
	Delay               int      `json:"delay"`
	Tags                []string `json:"tags"`
}

type ChannelVips added in v2.17.0

type ChannelVips struct {
	UserID    string `json:"user_id"`
	UserName  string `json:"user_name"`
	UserLogin string `json:"user_login"`
}

type ChannelVipsResponse added in v2.17.0

type ChannelVipsResponse struct {
	ResponseCommon
	Data ManyChannelVips
}

type CharityCampaignAmount added in v2.7.0

type CharityCampaignAmount struct {
	Value         int64  `json:"value"`
	DecimalPlaces int64  `json:"decimal_places"`
	Currency      string `json:"currency"`
}

type CharityCampaignData added in v2.7.0

type CharityCampaignData struct {
	ID               string                `json:"id"`
	BroadcasterID    string                `json:"broadcaster_id"`
	BroadcasterName  string                `json:"broadcaster_name"`
	BroadcasterLogin string                `json:"broadcaster_login"`
	Name             string                `json:"charity_name"`
	Description      string                `json:"charity_description"`
	LogoUrl          string                `json:"charity_logo"`
	WebsiteUrl       string                `json:"charity_website"`
	TargetAmount     CharityCampaignAmount `json:"target_amount"`
	CurrentAmount    CharityCampaignAmount `json:"current_amount"`
}

type CharityCampaignsParams added in v2.7.0

type CharityCampaignsParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	After         string `query:"after"`
	First         int    `query:"first,20"` // Limit 100
}

type CharityCampaignsResponse added in v2.7.0

type CharityCampaignsResponse struct {
	ResponseCommon
	Data ManyCharityCampaigns
}

type CharityDonationData added in v2.12.0

type CharityDonationData struct {
	CampaignID string                `json:"campaign_id"`
	DonationID string                `json:"id"`
	UserID     string                `json:"user_id"`
	UserName   string                `json:"user_name"`
	UserLogin  string                `json:"user_login"`
	Amount     CharityCampaignAmount `json:"amount"`
}

type CharityDonationParams added in v2.12.0

type CharityDonationParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	After         string `query:"after"`
	First         int    `query:"first,20"` // Limit 100
}

type CharityDonationsResponse added in v2.12.0

type CharityDonationsResponse struct {
	ResponseCommon
	Data ManyCharityDonations
}

type ChatBadge

type ChatBadge struct {
	SetID    string         `json:"set_id"`
	Versions []BadgeVersion `json:"versions"`
}

type ChatChatter added in v2.8.0

type ChatChatter struct {
	UserLogin string `json:"user_login"`
	UserID    string `json:"user_id"`
	Username  string `json:"user_name"`
}

type ChatMessage added in v2.26.0

type ChatMessage struct {
	// The message id for the message that was sent
	MessageID string `json:"message_id"`

	// If the message passed all checks and was sent
	IsSent bool `json:"is_sent"`

	// The reason the message was dropped, if any
	DropReasons ManyDropReasons `json:"drop_reason"`
}

type ChatMessageResponse added in v2.26.0

type ChatMessageResponse struct {
	ResponseCommon

	Data ManyChatMessages
}

type ChatSettings added in v2.14.0

type ChatSettings struct {
	BroadcasterID string `json:"broadcaster_id"`

	EmoteMode bool `json:"emote_mode"`

	FollowerMode bool `json:"follower_mode"`
	// Follower mode duration in minutes
	FollowerModeDuration int `json:"follower_mode_duration"`

	SlowMode bool `json:"slow_mode"`
	// Slow mode wait time in seconds
	SlowModeWaitTime int `json:"slow_mode_wait_time"`

	SubscriberMode bool `json:"subscriber_mode"`

	UniqueChatMode bool `json:"unique_chat_mode"`

	// Only included if the user access token includes the `moderator:read:chat_settings` scope
	ModeratorID string `json:"moderator_id"`

	// Boolean value denoting whether the "Non moderator chat delay" setting is enabled.
	// Only included if the request specifies a user access token that includes the moderator:read:chat_settings scope and the user in the moderator_id query parameter is one of the broadcaster’s moderators.
	NonModeratorChatDelay bool `json:"non_moderator_chat_delay"`
	// The amount of time, in seconds, that messages are delayed before appearing in chat.
	// Only included if the request specifies a user access token that includes the moderator:read:chat_settings scope and the user in the moderator_id query parameter is one of the broadcaster’s moderators.
	NonModeratorChatDelayDuration int `json:"non_moderator_chat_delay_duration"`
}

type CheermoteTierImages

type CheermoteTierImages struct {
	Dark  TierImageTypes `json:"dark"`
	Light TierImageTypes `json:"light"`
}

type CheermoteTiers

type CheermoteTiers struct {
	MinBits        uint                `json:"min_bits"`
	ID             string              `json:"id"`
	Color          string              `json:"color"`
	Images         CheermoteTierImages `json:"images"`
	CanCheer       bool                `json:"can_cheer"`
	ShowInBitsCard bool                `json:"show_in_bits_card"`
}

type Cheermotes

type Cheermotes struct {
	Prefix       string           `json:"prefix"`
	Tiers        []CheermoteTiers `json:"tiers"`
	Type         string           `json:"type"` // global_first_party, global_third_party, channel_custom, display_only, sponsored
	Order        uint             `json:"order"`
	LastUpdated  Time             `json:"last_updated"`
	IsCharitable bool             `json:"is_charitable"`
}

type CheermotesParams

type CheermotesParams struct {
	BroadcasterID string `query:"broadcaster_id"` // optional
}

type CheermotesResponse

type CheermotesResponse struct {
	ResponseCommon
	Data ManyCheermotes
}

type Client

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

func NewClient

func NewClient(options *Options) (*Client, error)

NewClient returns a new Twitch Helix API client. It returns an if clientID is an empty string. It is concurrency safe.

func NewClientWithContext added in v2.14.0

func NewClientWithContext(ctx context.Context, options *Options) (*Client, error)

func (*Client) AddBlockedTerm added in v2.10.0

func (c *Client) AddBlockedTerm(params *AddBlockedTermParams) (*AddBlockedTermResponse, error)

AddBlockedTerm Adds a word or phrase to the broadcaster’s list of blocked terms. These are the terms that broadcasters don’t want used in their chat room. Required scope: moderator:manage:blocked_terms

func (*Client) AddChannelModerator added in v2.22.0

func (c *Client) AddChannelModerator(params *AddChannelModeratorParams) (*AddChannelModeratorResponse, error)

func (*Client) AddChannelVip added in v2.17.0

func (c *Client) AddChannelVip(params *AddChannelVipParams) (*AddChannelVipResponse, error)

AddChannelVip Adds the specified user as a VIP in the broadcaster’s channel. Required scope: channel:manage:vips Rate Limits: The broadcaster may add a maximum of 10 VIPs within a 10-second window.

func (*Client) BanUser added in v2.9.0

func (c *Client) BanUser(params *BanUserParams) (*BanUserResponse, error)

BanUser Bans a user from participating in a broadcaster’s chat room, or puts them in a timeout. Required scope: moderator:manage:banned_users

func (*Client) BlockUser

func (c *Client) BlockUser(params *BlockUserParams) (*BlockUserResponse, error)

BlockUser : Blocks the specified user on behalf of the authenticated user.

Required scope: user:manage:blocked_users

func (*Client) CancelRaid added in v2.19.0

func (c *Client) CancelRaid(params *CancelRaidParams) (*CancelRaidResponse, error)

CancelRaid cancels a pending raid. Required scope: channel:manage:raids Rate limit: 10 requests within a 10-minute window.

func (*Client) CheckUserSubscription

func (c *Client) CheckUserSubscription(params *UserSubscriptionsParams) (*UserSubscriptionResponse, error)

CheckUserSubscription Check if a specific user is subscribed to a specific channel

Required scope: user:read:subscriptions

func (*Client) CreateClip

func (c *Client) CreateClip(params *CreateClipParams) (*CreateClipResponse, error)

CreateClip creates a clip programmatically. This returns both an ID and an edit URL for the new clip. Clip creation takes time. We recommend that you query Get Clip, with the clip ID that is returned here. If Get Clip returns a valid clip, your clip creation was successful. If, after 15 seconds, you still have not gotten back a valid clip from Get Clip, assume that the clip was not created and retry Create Clip.

Required scope: clips:edit

func (*Client) CreateCustomReward

func (c *Client) CreateCustomReward(params *ChannelCustomRewardsParams) (*ChannelCustomRewardResponse, error)

CreateCustomReward : Creates a Custom Reward on a channel. Required scope: channel:manage:redemptions

func (*Client) CreateEntitlementsUploadURL

func (c *Client) CreateEntitlementsUploadURL(manifestID, entitlementType string) (*EntitlementsUploadResponse, error)

CreateEntitlementsUploadURL return a URL where you can upload a manifest file and notify users that they have an entitlement. Entitlements are digital items that users are entitled to use. Twitch entitlements are granted to users gratis or as part of a purchase on Twitch.

func (*Client) CreateEventSubSubscription

func (c *Client) CreateEventSubSubscription(payload *EventSubSubscription) (*EventSubSubscriptionsResponse, error)

Creates an EventSub subscription

func (*Client) CreateExtensionSecret

func (c *Client) CreateExtensionSecret(params *ExtensionSecretCreationParams) (*ExtensionSecretCreationResponse, error)

func (*Client) CreatePoll

func (c *Client) CreatePoll(params *CreatePollParams) (*PollsResponse, error)

Required scope: channel:manage:polls

func (*Client) CreatePrediction

func (c *Client) CreatePrediction(params *CreatePredictionParams) (*PredictionsResponse, error)

Required scope: channel:manage:predictions

func (*Client) CreateScheduleSegment added in v2.24.0

func (c *Client) CreateScheduleSegment(params *CreateScheduleSegmentParams) (*CreateScheduleSegmentResponse, error)

Updates the broadcaster’s schedule settings, such as scheduling a vacation

func (*Client) CreateStreamMarker

func (c *Client) CreateStreamMarker(params *CreateStreamMarkerParams) (*CreateStreamMarkerResponse, error)

CreateStreamMarker creates a stream marker for a live stream at the current time. The user has to be the stream owner or an editor. Stream markers cannot be created in some cases, see: https://dev.twitch.tv/docs/api/reference/#create-stream-marker

Required Scope: user:edit:broadcast

func (*Client) DeleteAllChatMessages added in v2.14.0

func (c *Client) DeleteAllChatMessages(params *DeleteAllChatMessagesParams) (*DeleteAllChatMessagesResponse, error)

DeleteAllChatMessages Removes all chat messages from the broadcaster’s chat room. Required scope: moderator:manage:chat_messages

func (*Client) DeleteChatMessage added in v2.14.0

func (c *Client) DeleteChatMessage(params *DeleteChatMessageParams) (*DeleteChatMessageResponse, error)

DeleteChatMessage Removes a single chat message from the broadcaster’s chat room. Required scope: moderator:manage:chat_messages

func (*Client) DeleteCustomRewards

func (c *Client) DeleteCustomRewards(params *DeleteCustomRewardsParams) (*DeleteCustomRewardsResponse, error)

DeleteCustomRewards : Deletes a Custom Rewards on a channel Required scope: channel:manage:redemptions

func (*Client) DeleteScheduleSegment added in v2.24.0

func (c *Client) DeleteScheduleSegment(params *DeleteScheduleSegmentParams) (*DeleteScheduleSegmentResponse, error)

Removes a broadcast segment from the broadcaster’s streaming schedule

func (*Client) DeleteVideos

func (c *Client) DeleteVideos(params *DeleteVideosParams) (*DeleteVideosResponse, error)

DeleteVideos delete one or more videos (max 5) Required scope: channel:manage:videos

func (*Client) EditChannelInformation

func (c *Client) EditChannelInformation(params *EditChannelInformationParams) (*EditChannelInformationResponse, error)

func (*Client) EndPoll

func (c *Client) EndPoll(params *EndPollParams) (*PollsResponse, error)

Required scope: channel:manage:polls

func (*Client) EndPrediction

func (c *Client) EndPrediction(params *EndPredictionParams) (*PredictionsResponse, error)

Required scope: channel:manage:predictions

func (*Client) ExtensionCreateClaims

func (c *Client) ExtensionCreateClaims(
	params *ExtensionCreateClaimsParams,
) (
	*TwitchJWTClaims,
	error,
)

CreateClaims will construct a claims suitable for generating a JWT token, containing necessary information required by the Twitch Helix Extension API endpoints.

func (*Client) ExtensionJWTSign

func (c *Client) ExtensionJWTSign(claims *TwitchJWTClaims) (tokenString string, err error)

ExtensionJWTSign Sign the a JWT Claim to produce a base64 token.

func (*Client) ExtensionJWTVerify

func (c *Client) ExtensionJWTVerify(token string) (claims *TwitchJWTClaims, err error)

ExtensionJWTVerify validates a extension client side twitch base64 token and converts it into a twitch claim type, containing relevant information.

func (*Client) FormBroadcastSendPubSubPermissions

func (c *Client) FormBroadcastSendPubSubPermissions() *PubSubPermissions

FormBroadcastSendPubSubPermissions create the pubsub permissions for publishing a broadcast message type

func (*Client) FormGenericPubSubPermissions

func (c *Client) FormGenericPubSubPermissions() *PubSubPermissions

FormGenericPubSubPermissions create the pubsub permissions for publishing to message for any target type

func (*Client) FormGlobalSendPubSubPermissions

func (c *Client) FormGlobalSendPubSubPermissions() *PubSubPermissions

FormGlobalSendPubSubPermissions create the pubsub permissions for publishing a global targeted message

func (*Client) FormWhisperSendPubSubPermissions

func (c *Client) FormWhisperSendPubSubPermissions(opaqueId string) *PubSubPermissions

FormWhisperSendPubSubPermissions create the pubsub permissions for publishing a whisper message type

func (*Client) GetAppAccessToken

func (c *Client) GetAppAccessToken() string

GetAppAccessToken returns the current app access token.

func (*Client) GetAuthorizationURL

func (c *Client) GetAuthorizationURL(params *AuthorizationURLParams) string

func (*Client) GetBannedUsers

func (c *Client) GetBannedUsers(params *BannedUsersParams) (*BannedUsersResponse, error)

GetBannedUsers returns all banned and timed-out users in a channel.

Required scope: moderation:read

func (*Client) GetBitsLeaderboard

func (c *Client) GetBitsLeaderboard(params *BitsLeaderboardParams) (*BitsLeaderboardResponse, error)

GetBitsLeaderboard gets a ranked list of Bits leaderboard information for an authorized broadcaster.

Required Scope: bits:read

func (*Client) GetBlockedTerms added in v2.10.0

func (c *Client) GetBlockedTerms(params *BlockedTermsParams) (*BlockedTermsResponse, error)

GetBlockedTerms Gets the broadcaster’s list of non-private, blocked words or phrases. These are the terms that the broadcaster or moderator added manually, or that were denied by AutoMod. Required scope: moderator:read:blocked_terms

func (*Client) GetChannelChatBadges

func (c *Client) GetChannelChatBadges(params *GetChatBadgeParams) (*GetChatBadgeResponse, error)

func (*Client) GetChannelChatChatters added in v2.8.0

func (c *Client) GetChannelChatChatters(params *GetChatChattersParams) (*GetChatChattersResponse, error)

Required scope: moderator:read:chatters

func (*Client) GetChannelEditors

func (c *Client) GetChannelEditors(params *ChannelEditorsParams) (*ChannelEditorsResponse, error)

GetChannelEditors Get a list of users who have editor permissions for a specific channel Required scope: channel:read:editors

func (*Client) GetChannelEmotes

func (c *Client) GetChannelEmotes(params *GetChannelEmotesParams) (*GetChannelEmotesResponse, error)

func (*Client) GetChannelFollows added in v2.16.0

func (c *Client) GetChannelFollows(params *GetChannelFollowsParams) (*GetChannelFollowersResponse, error)

GetChannelFollows Gets a list of users that follow the specified broadcaster. You can also use this endpoint to see whether a specific user follows the broadcaster.. requires moderator:read:followers

func (*Client) GetChannelInformation

func (c *Client) GetChannelInformation(params *GetChannelInformationParams) (*GetChannelInformationResponse, error)

func (*Client) GetChannelVips added in v2.17.0

func (c *Client) GetChannelVips(params *GetChannelVipsParams) (*ChannelVipsResponse, error)

GetChannelVips Gets a list of the broadcaster’s VIPs. Required scope: channel:read:vips

func (*Client) GetCharityCampaigns added in v2.7.0

func (c *Client) GetCharityCampaigns(params *CharityCampaignsParams) (*CharityCampaignsResponse, error)

Required scope: channel:read:charity

func (*Client) GetCharityDonations added in v2.12.0

func (c *Client) GetCharityDonations(params *CharityDonationParams) (*CharityDonationsResponse, error)

Required scope: channel:read:charity

func (*Client) GetChatSettings added in v2.14.0

func (c *Client) GetChatSettings(params *GetChatSettingsParams) (*GetChatSettingsResponse, error)

GetChatSettings gets the chat settings for the broadcaster's chat room. Optional scope: moderator:read:chat_settings

func (*Client) GetCheermotes

func (c *Client) GetCheermotes(params *CheermotesParams) (*CheermotesResponse, error)

func (*Client) GetClips

func (c *Client) GetClips(params *ClipsParams) (*ClipsResponse, error)

GetClips returns information about a specified clip.

func (*Client) GetCreatorGoals added in v2.2.0

func (c *Client) GetCreatorGoals(payload *GetCreatorGoalsParams) (*CreatorGoalsResponse, error)

Required scope: channel:read:goals

func (*Client) GetCustomRewards

func (c *Client) GetCustomRewards(params *GetCustomRewardsParams) (*ChannelCustomRewardResponse, error)

GetCustomRewards : Get Custom Rewards on a channel Required scope: channel:read:redemptions

func (*Client) GetDropsEntitlements

func (c *Client) GetDropsEntitlements(params *GetDropEntitlementsParams) (*GetDropsEntitlementsResponse, error)

GetDropsEntitlements returns a list of entitlements, which have been awarded to users by your organization. Filtering by UserID returns all of the entitlements related to that specific user. Filtering by GameID returns all of the entitlements related to that game. Filtering by GameID and UserID returns all of the entitlements related to that game and that user. Filtering by FulfillmentStatus returns all of the entitlements with the specified fulfillment status. Entitlements are digital items that users are entitled to use. Twitch entitlements are granted based on viewership engagement with a content creator, based on the game developers' campaign.

func (*Client) GetEmoteSets

func (c *Client) GetEmoteSets(params *GetEmoteSetsParams) (*GetEmoteSetsResponse, error)

GetEmoteSets

func (*Client) GetEntitlementCodeStatus

func (c *Client) GetEntitlementCodeStatus(params *CodesParams) (*CodeResponse, error)

GetEntitlementCodeStatus Per https://dev.twitch.tv/docs/api/reference#get-code-status Access is controlled via an app access token on the calling service. The client ID associated with the app access token must be approved by Twitch as part of a contracted arrangement. Callers with an app access token are authorized to redeem codes on behalf of any Twitch user account.

func (*Client) GetEventSubSubscriptions

func (c *Client) GetEventSubSubscriptions(params *EventSubSubscriptionsParams) (*EventSubSubscriptionsResponse, error)

Get all EventSub Subscriptions

func (*Client) GetExtensionAnalytics

func (c *Client) GetExtensionAnalytics(params *ExtensionAnalyticsParams) (*ExtensionAnalyticsResponse, error)

GetExtensionAnalytics returns a URL to the downloadable CSV file containing analytics data. Valid for 5 minutes.

func (*Client) GetExtensionConfigurationSegment

func (c *Client) GetExtensionConfigurationSegment(params *ExtensionGetConfigurationParams) (*ExtensionGetConfigurationSegmentResponse, error)

func (*Client) GetExtensionLiveChannels added in v2.3.0

func (c *Client) GetExtensionLiveChannels(params *ExtensionLiveChannelsParams) (*ExtensionLiveChannelsResponse, error)

func (*Client) GetExtensionSecrets

func (c *Client) GetExtensionSecrets(params *GetExtensionSecretParams) (*GetExtensionSecretResponse, error)

func (*Client) GetExtensionSignedJWTToken

func (c *Client) GetExtensionSignedJWTToken() string

GetAppAccessToken returns the current app access token.

func (*Client) GetExtensionTransactions

func (c *Client) GetExtensionTransactions(params *ExtensionTransactionsParams) (*ExtensionTransactionsResponse, error)

GetExtensionTransactions allows extension back end servers to fetch a list of transactions that have occurred for their extension across all of Twitch. A transaction is a record of a user exchanging Bits for an in-Extension digital good.

See https://dev.twitch.tv/docs/api/reference/#get-extension-transactions

func (*Client) GetFollowedChannels added in v2.16.0

func (c *Client) GetFollowedChannels(params *GetFollowedChannelParams) (*GetFollowedChannelResponse, error)

GetFollowedChannels Gets a list of broadcasters that the specified user follows. You can also use this endpoint to see whether a user follows a specific broadcaster. requires user:read:follows

func (*Client) GetFollowedStream

func (c *Client) GetFollowedStream(params *FollowedStreamsParams) (*StreamsResponse, error)

GetFollowedStream : Gets information about active streams belonging to channels that the authenticated user follows. Streams are returned sorted by number of current viewers, in descending order. Across multiple pages of results, there may be duplicate or missing streams, as viewers join and leave streams.

Required scope: user:read:follows

func (*Client) GetGameAnalytics

func (c *Client) GetGameAnalytics(params *GameAnalyticsParams) (*GameAnalyticsResponse, error)

GetGameAnalytics returns a URL to the downloadable CSV file containing analytics data for the specified game. Valid for 5 minutes.

func (*Client) GetGames

func (c *Client) GetGames(params *GamesParams) (*GamesResponse, error)

func (*Client) GetGlobalChatBadges

func (c *Client) GetGlobalChatBadges() (*GetChatBadgeResponse, error)

func (*Client) GetGlobalEmotes

func (c *Client) GetGlobalEmotes() (*GetChannelEmotesResponse, error)

func (*Client) GetHypeTrainEvents

func (c *Client) GetHypeTrainEvents(params *HypeTrainEventsParams) (*HypeTrainEventsResponse, error)

Required scope: channel:read:hype_train

func (*Client) GetModerators added in v2.14.0

func (c *Client) GetModerators(params *GetModeratorsParams) (*ModeratorsResponse, error)

GetModerators Gets all users allowed to moderate the broadcaster’s chat room. Required scope: moderation:read

func (*Client) GetPolls

func (c *Client) GetPolls(params *PollsParams) (*PollsResponse, error)

Required scope: channel:read:polls

func (*Client) GetPredictions

func (c *Client) GetPredictions(params *PredictionsParams) (*PredictionsResponse, error)

Required scope: channel:read:predictions

func (*Client) GetRefreshToken added in v2.25.0

func (c *Client) GetRefreshToken() string

GetRefreshToken returns the current refresh token.

func (*Client) GetSchedule added in v2.24.0

func (c *Client) GetSchedule(params *GetScheduleParams) (*GetScheduleResponse, error)

Gets the broadcaster’s streaming schedule. You can get the entire schedule or specific segments of the schedule

func (*Client) GetStreamKey added in v2.4.0

func (c *Client) GetStreamKey(params *StreamKeyParams) (*StreamKeysResponse, error)

GetStreamKey : Returns the secret stream key of the broadcaster

Required scope: channel:read:stream_key

func (*Client) GetStreamMarkers

func (c *Client) GetStreamMarkers(params *StreamMarkersParams) (*StreamMarkersResponse, error)

GetStreamMarkers gets stream markers of a VOD or of the current live stream of an user being recorded as VOD.

Required Scope: user:read:broadcast

func (*Client) GetStreams

func (c *Client) GetStreams(params *StreamsParams) (*StreamsResponse, error)

GetStreams returns a list of live channels based on the search parameters. To query offline channels, use SearchChannels.

func (*Client) GetSubscriptions

func (c *Client) GetSubscriptions(params *SubscriptionsParams) (*SubscriptionsResponse, error)

GetSubscriptions gets subscriptions about one Twitch broadcaster. Broadcasters can only request their own subscriptions.

Required scope: channel:read:subscriptions

func (*Client) GetTopGames

func (c *Client) GetTopGames(params *TopGamesParams) (*TopGamesResponse, error)

func (*Client) GetUserAccessToken

func (c *Client) GetUserAccessToken() string

GetUserAccessToken returns the current user access token.

func (*Client) GetUserActiveExtensions

func (c *Client) GetUserActiveExtensions(params *UserActiveExtensionsParams) (*UserActiveExtensionsResponse, error)

GetUserActiveExtensions Gets information about active extensions installed by a specified user, identified by a user ID or Bearer token.

Optional scope: user:read:broadcast or user:edit:broadcast

func (*Client) GetUserChatColor added in v2.20.0

func (c *Client) GetUserChatColor(params *GetUserChatColorParams) (*UserChatColorResponse, error)

GetUserChatColor fetches the color used for the user’s name in chat.

func (*Client) GetUserExtensions

func (c *Client) GetUserExtensions() (*UserExtensionsResponse, error)

GetUserExtensions gets a list of all extensions (both active and inactive) for a specified user, identified by a Bearer token

Required scope: user:read:broadcast

func (*Client) GetUsers

func (c *Client) GetUsers(params *UsersParams) (*UsersResponse, error)

GetUsers gets information about one or more specified Twitch users. Users are identified by optional user IDs and/or login name. If neither a user ID nor a login name is specified, the user is looked up by Bearer token.

Optional scope: user:read:email

func (*Client) GetUsersBlocked

func (c *Client) GetUsersBlocked(params *UsersBlockedParams) (*UsersBlockedResponse, error)

GetUsersBlocked : Gets a specified user’s block list.

Required scope: user:read:blocked_users

func (*Client) GetUsersFollows

func (c *Client) GetUsersFollows(params *UsersFollowsParams) (*UsersFollowsResponse, error)

GetUsersFollows gets information on follow relationships between two Twitch users. Information returned is sorted in order, most recent follow first. This can return information like “who is lirik following,” “who is following lirik,” or “is user X following user Y.”

func (*Client) GetVideos

func (c *Client) GetVideos(params *VideosParams) (*VideosResponse, error)

GetVideos gets video information by video ID (one or more), user ID (one only), or game ID (one only).

func (*Client) GetWebhookSubscriptions

func (c *Client) GetWebhookSubscriptions(params *WebhookSubscriptionsParams) (*WebhookSubscriptionsResponse, error)

GetWebhookSubscriptions gets webhook subscriptions, in order of expiration. Requires an app access token.

func (*Client) ModerateHeldMessage

func (c *Client) ModerateHeldMessage(params *HeldMessageModerationParams) (*HeldMessageModerationResponse, error)

Required scope: moderator:manage:automod

func (*Client) OnUserAccessTokenRefreshed added in v2.25.0

func (c *Client) OnUserAccessTokenRefreshed(f func(newAccessToken, newRefreshToken string))

func (*Client) PostWebhookSubscription

func (c *Client) PostWebhookSubscription(payload *WebhookSubscriptionPayload) (*WebhookSubscriptionResponse, error)

func (*Client) RedeemEntitlementCode

func (c *Client) RedeemEntitlementCode(params *CodesParams) (*CodeResponse, error)

RedeemEntitlementCode Per https://dev.twitch.tv/docs/api/reference/#redeem-code Access is controlled via an app access token on the calling service. The client ID associated with the app access token must be approved by Twitch. Callers with an app access token are authorized to redeem codes on behalf of any Twitch user account.

func (*Client) RefreshUserAccessToken

func (c *Client) RefreshUserAccessToken(refreshToken string) (*RefreshTokenResponse, error)

RefreshUserAccessToken submits a request to have the longevity of an access token extended. Twitch OAuth2 access tokens have expirations. Token-expiration periods vary in length. You should build your applications in such a way that they are resilient to token authentication failures.

func (*Client) RemoveBlockedTerm added in v2.10.0

func (c *Client) RemoveBlockedTerm(params *RemoveBlockedTermParams) (*RemoveBlockedTermResponse, error)

RemoveBlockedTerm Removes the word or phrase that the broadcaster is blocking users from using in their chat room. Required scope: moderator:manage:blocked_terms

func (*Client) RemoveChannelModerator added in v2.22.0

func (c *Client) RemoveChannelModerator(params *RemoveChannelModeratorParams) (*RemoveChannelModeratorResponse, error)

func (*Client) RemoveChannelVip added in v2.17.0

func (c *Client) RemoveChannelVip(params *RemoveChannelVipParams) (*RemoveChannelVipResponse, error)

RemoveChannelVip : Removes the specified user as a VIP in the broadcaster’s channel. Required scope: channel:manage:vips Rate Limits: The broadcaster may remove a maximum of 10 VIPs within a 10-second window.

func (*Client) RemoveEventSubSubscription

func (c *Client) RemoveEventSubSubscription(id string) (*RemoveEventSubSubscriptionParamsResponse, error)

Remove an EventSub Subscription

func (*Client) RequestAppAccessToken

func (c *Client) RequestAppAccessToken(scopes []string) (*AppAccessTokenResponse, error)

func (*Client) RequestUserAccessToken

func (c *Client) RequestUserAccessToken(code string) (*UserAccessTokenResponse, error)

func (*Client) RevokeUserAccessToken

func (c *Client) RevokeUserAccessToken(accessToken string) (*RevokeAccessTokenResponse, error)

RevokeUserAccessToken submits a request to Twitch to have an access token revoked.

Both successful requests and requests with bad tokens return 200 OK with no body. Requests with bad tokens return the same response, as there is no meaningful action a client can take after sending a bad token.

func (*Client) SearchCategories added in v2.18.0

func (c *Client) SearchCategories(params *SearchCategoriesParams) (*SearchCategoriesResponse, error)

SearchCategories searches for Twitch categories based on the given search query

func (*Client) SearchChannels

func (c *Client) SearchChannels(params *SearchChannelsParams) (*SearchChannelsResponse, error)

SearchChannels searches for Twitch channels based on the given search parameters. Unlike GetStreams, this can also return offline channels.

func (*Client) SendChatAnnouncement added in v2.6.0

func (c *Client) SendChatAnnouncement(params *SendChatAnnouncementParams) (*SendChatAnnouncementResponse, error)

SendChatAnnouncement sends an announcement to the broadcaster’s chat room. Required scope: moderator:manage:announcements

func (*Client) SendChatMessage added in v2.26.0

func (c *Client) SendChatMessage(params *SendChatMessageParams) (*ChatMessageResponse, error)

Requires an app access token or user access token that includes the user:write:chat scope. If app access token used, then additionally requires user:bot scope from chatting user, and either channel:bot scope from broadcaster or moderator status

func (*Client) SendExtensionChatMessage

func (c *Client) SendExtensionChatMessage(params *ExtensionSendChatMessageParams) (*ExtensionSendChatMessageResponse, error)

SendExtensionChatMessage Sends a specified chat message to a specified channel. The message will appear in the channel’s chat as a normal message, The author of the message is the Extension name.

see https://dev.twitch.tv/docs/api/reference#send-extension-chat-message

func (*Client) SendExtensionPubSubMessage

func (c *Client) SendExtensionPubSubMessage(params *ExtensionSendPubSubMessageParams) (*ExtensionSendPubSubMessageResponse, error)

func (*Client) SendShoutout added in v2.15.0

func (c *Client) SendShoutout(params *SendShoutoutParams) (*SendShoutoutResponse, error)

SendShoutout sends a Shoutout to the specified broadcaster. Required scope: moderator:manage:shoutouts The broadcaster may send a Shoutout once every 2 minutes. They may send the same broadcaster a Shoutout once every 60 minutes.

func (*Client) SendUserWhisper added in v2.13.0

func (c *Client) SendUserWhisper(params *SendUserWhisperParams) (*SendUserWhisperResponse, error)

SendUserWhisper Requires user access token with user:manage:whispers scope. The user sending the whisper must have a verified phone number. The API may silently drop whispers that it suspects of violating Twitch policies 204 still returned. You may whisper to a maximum of 40 unique recipients per day. Within the per day limit. You may whisper a maximum of 3 whispers per second and a maximum of 100 whispers per minute. Message character limit:

  • Max 500 chars to new recipient
  • Max 10,000 if recurring recipient,
  • > 10,000 chars are truncated.

func (*Client) SetAppAccessToken

func (c *Client) SetAppAccessToken(accessToken string)

func (*Client) SetExtensionSignedJWTToken

func (c *Client) SetExtensionSignedJWTToken(jwt string)

func (*Client) SetRedirectURI

func (c *Client) SetRedirectURI(uri string)

func (*Client) SetRefreshToken added in v2.25.0

func (c *Client) SetRefreshToken(refreshToken string)

func (*Client) SetUserAccessToken

func (c *Client) SetUserAccessToken(accessToken string)

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(userAgent string)

func (*Client) StartCommercial

func (c *Client) StartCommercial(params *StartCommercialParams) (*StartCommercialResponse, error)

StartCommercial starts a commercial on a specified channel OAuth Token required Requires channel:edit:commercial scope

func (*Client) StartRaid added in v2.19.0

func (c *Client) StartRaid(params *StartRaidParams) (*RaidResponse, error)

StartRaid raids another channel by sending the broadcaster’s viewers to the targeted channel. When called, the Twitch UX pops up a window at the top of the chat room that identifies the number of viewers in the raid. The raid occurs when the broadcaster clicks Raid Now or after the 90-second countdown expires. Required scope: channel:manage:raids Rate limit: 10 requests within a 10-minute window.

func (*Client) UnbanUser added in v2.9.0

func (c *Client) UnbanUser(params *UnbanUserParams) (*UnbanUserResponse, error)

UnbanUser Removes the ban or timeout that was placed on the specified user Required scope: moderator:manage:banned_users

func (*Client) UnblockUser

func (c *Client) UnblockUser(params *UnblockUserParams) (*BlockUserResponse, error)

UnblockUser : Unblocks the specified user on behalf of the authenticated user.

Required scope: user:manage:blocked_users

func (*Client) UpdateChannelCustomRewardsRedemptionStatus added in v2.21.0

func (c *Client) UpdateChannelCustomRewardsRedemptionStatus(params *UpdateChannelCustomRewardsRedemptionStatusParams) (*ChannelCustomRewardsRedemptionResponse, error)

UpdateChannelCustomRewardsRedemptionStatus : Update a Custom Reward Redemption status on a channel. Required scope: channel:manage:redemptions

func (*Client) UpdateChatSettings added in v2.17.0

func (c *Client) UpdateChatSettings(params *UpdateChatSettingsParams) (*UpdateChatSettingsResponse, error)

UpdateChatSettings updates the broadcaster's chat settings. Required scope: moderator:manage:chat_settings

func (*Client) UpdateCustomReward added in v2.14.0

func (c *Client) UpdateCustomReward(params *UpdateChannelCustomRewardsParams) (*ChannelCustomRewardResponse, error)

UpdateCustomReward : Update a Custom Reward on a channel. Required scope: channel:manage:redemptions

func (*Client) UpdateDropsEntitlements added in v2.1.0

func (c *Client) UpdateDropsEntitlements(params *UpdateDropsEntitlementsParams) (*UpdateDropsEntitlementsResponse, error)

UpdateDropsEntitlements updates the fulfillment status of a set of entitlements, owned by the authenticated user or your organization. It returns a list of the entitlement ids requested, grouped by a status code used to indicate partial success. "SUCCESS" means the entitlement was successfully updated, "INVALID_ID" means invalid format for the entitlement, "NOT_FOUND" means the entitlement was not found, "UNAUTHORIZED" means entitlement is not owned by the organization or the user when called with a user OAuth token and "UPDATE_FAILED" indicates a possible transient error and the operation should be retried again later. Entitlements are digital items that users are entitled to use. Twitch entitlements are granted based on viewership engagement with a content creator, based on the game developers' campaign.

func (*Client) UpdateSchedule added in v2.24.0

func (c *Client) UpdateSchedule(params *UpdateScheduleParams) (*UpdateScheduleResponse, error)

Updates the broadcaster’s schedule settings, such as scheduling a vacation

func (*Client) UpdateScheduleSegment added in v2.24.0

func (c *Client) UpdateScheduleSegment(params *UpdateScheduleSegmentParams) (*UpdateScheduleSegmentResponse, error)

Updates the broadcaster’s schedule settings, such as scheduling a vacation

func (*Client) UpdateUser

func (c *Client) UpdateUser(params *UpdateUserParams) (*UsersResponse, error)

UpdateUser updates the description of a user specified by a Bearer token.

Required scope: user:edit

func (*Client) UpdateUserChatColor added in v2.20.0

func (c *Client) UpdateUserChatColor(params *UpdateUserChatColorParams) (*UpdateUserChatColorResponse, error)

UpdateUserChatcolor updates the color used for the user’s name in chat.

Required scope: user:manage:chat_color

Prime and Turbo users can specify a Hex color code, everyone can use the default colors:

  • blue
  • blue_violet
  • cadet_blue
  • chocolate
  • coral
  • dodger_blue
  • firebrick
  • golden_rod
  • green
  • hot_pink
  • orange_red
  • red
  • sea_green
  • spring_green
  • yellow_green

func (*Client) UpdateUserExtensions

func (c *Client) UpdateUserExtensions(payload *UpdateUserExtensionsPayload) (*UserActiveExtensionsResponse, error)

UpdateUserExtensions Updates the activation state, extension ID, and/or version number of installed extensions for a specified user, identified by a Bearer token. If you try to activate a given extension under multiple extension types, the last write wins (and there is no guarantee of write order).

Required scope: user:edit:broadcast

func (*Client) ValidateToken

func (c *Client) ValidateToken(accessToken string) (bool, *ValidateTokenResponse, error)

ValidateToken - Validate access token

type Clip

type Clip struct {
	ID              string  `json:"id"`
	URL             string  `json:"url"`
	EmbedURL        string  `json:"embed_url"`
	BroadcasterID   string  `json:"broadcaster_id"`
	BroadcasterName string  `json:"broadcaster_name"`
	CreatorID       string  `json:"creator_id"`
	CreatorName     string  `json:"creator_name"`
	Duration        float64 `json:"duration"`
	VideoID         string  `json:"video_id"`
	GameID          string  `json:"game_id"`
	Language        string  `json:"language"`
	Title           string  `json:"title"`
	ViewCount       int     `json:"view_count"`
	CreatedAt       string  `json:"created_at"`
	ThumbnailURL    string  `json:"thumbnail_url"`
	VodOffset       int     `json:"vod_offset"`
}

type ClipEditURL

type ClipEditURL struct {
	ID      string `json:"id"`
	EditURL string `json:"edit_url"`
}

type ClipsParams

type ClipsParams struct {
	// One of the below
	BroadcasterID string   `query:"broadcaster_id"`
	GameID        string   `query:"game_id"`
	IDs           []string `query:"id"` // Limit 100

	// Optional
	First     int    `query:"first,20"` // Maximum 100
	After     string `query:"after"`
	Before    string `query:"before"`
	StartedAt Time   `query:"started_at"`
	EndedAt   Time   `query:"ended_at"`
}

type ClipsResponse

type ClipsResponse struct {
	ResponseCommon
	Data ManyClips
}

type CodeResponse

type CodeResponse struct {
	ResponseCommon
	Data ManyCodes
}

type CodeStatus

type CodeStatus struct {
	Code   string                `json:"code"`
	Status EntitlementCodeStatus `json:"status"`
}

type CodesParams

type CodesParams struct {
	// One of the below
	UserID string   `query:"user_id"`
	Codes  []string `query:"code"` // Limit 20
}

type CreateClipParams

type CreateClipParams struct {
	BroadcasterID string `query:"broadcaster_id"`

	// Optional
	HasDelay bool `query:"has_delay,false"`
}

type CreateClipResponse

type CreateClipResponse struct {
	ResponseCommon
	Data ManyClipEditURLs
}

func (*CreateClipResponse) GetClipsCreationRateLimit

func (ccr *CreateClipResponse) GetClipsCreationRateLimit() int

GetClipsCreationRateLimit returns the "Ratelimit-Helixclipscreation-Limit" header as an int.

func (*CreateClipResponse) GetClipsCreationRateLimitRemaining

func (ccr *CreateClipResponse) GetClipsCreationRateLimitRemaining() int

GetClipsCreationRateLimitRemaining returns the "Ratelimit-Helixclipscreation-Remaining" header as an int.

type CreatePollParams

type CreatePollParams struct {
	BroadcasterID              string            `json:"broadcaster_id"`
	Title                      string            `json:"title"`                         // Maximum: 60 characters.
	Choices                    []PollChoiceParam `json:"choices"`                       // Minimum: 2 choices. Maximum: 5 choices.
	Duration                   int               `json:"duration"`                      // Minimum: 15. Maximum: 1800.
	BitsVotingEnabled          bool              `json:"bits_voting_enabled"`           // Default: false
	BitsPerVote                int               `json:"bits_per_vote"`                 // Minimum: 0. Maximum: 10000.
	ChannelPointsVotingEnabled bool              `json:"channel_points_voting_enabled"` // Default: false
	ChannelPointsPerVote       int               `json:"channel_points_per_vote"`       // Minimum: 0. Maximum: 1000000.
}

type CreatePredictionParams

type CreatePredictionParams struct {
	BroadcasterID    string                  `json:"broadcaster_id"`
	Title            string                  `json:"title"`             // Maximum: 45 characters.
	Outcomes         []PredictionChoiceParam `json:"outcomes"`          // 2 choices mandatory
	PredictionWindow int                     `json:"prediction_window"` // Minimum: 1. Maximum: 1800.
}

type CreateScheduleSegmentData added in v2.24.0

type CreateScheduleSegmentData struct {
	Schedule ScheduleData `json:"data"`
}

type CreateScheduleSegmentParams added in v2.24.0

type CreateScheduleSegmentParams struct {
	BroadcasterID string `json:"broadcaster_id"`
	StartTime     Time   `json:"start_time"`
	Timezone      string `json:"timezone"`
	Duration      string `json:"duration"`
	IsRecurring   bool   `json:"is_recurring"`
	CategoryID    string `json:"category_id"`
	Title         string `json:"title"`
}

type CreateScheduleSegmentResponse added in v2.24.0

type CreateScheduleSegmentResponse struct {
	ResponseCommon

	Data CreateScheduleSegmentData
}

type CreateStreamMarker

type CreateStreamMarker struct {
	ID              string `json:"id"`
	CreatedAt       Time   `json:"created_at"`
	Description     string `json:"description"`
	PositionSeconds int    `json:"position_seconds"`
}

type CreateStreamMarkerParams

type CreateStreamMarkerParams struct {
	UserID string `query:"user_id"`

	// Optional
	Description string `query:"description"`
}

type CreateStreamMarkerResponse

type CreateStreamMarkerResponse struct {
	ResponseCommon
	Data ManyCreateStreamMarkers
}

type CreatorGoalsResponse added in v2.2.0

type CreatorGoalsResponse struct {
	ResponseCommon
	Data ManyGoals
}

type DateRange

type DateRange struct {
	StartedAt Time `json:"started_at"`
	EndedAt   Time `json:"ended_at"`
}

DateRange is a generic struct used by various responses.

type DeleteAllChatMessagesParams added in v2.14.0

type DeleteAllChatMessagesParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	ModeratorID   string `query:"moderator_id"`
}

type DeleteAllChatMessagesResponse added in v2.14.0

type DeleteAllChatMessagesResponse struct {
	ResponseCommon
}

type DeleteChatMessageParams added in v2.14.0

type DeleteChatMessageParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	ModeratorID   string `query:"moderator_id"`
	MessageID     string `query:"message_id"`
}

type DeleteChatMessageResponse added in v2.14.0

type DeleteChatMessageResponse struct {
	ResponseCommon
}

type DeleteCustomRewardsParams

type DeleteCustomRewardsParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	ID            string `query:"id"`
}

type DeleteCustomRewardsResponse

type DeleteCustomRewardsResponse struct {
	ResponseCommon
}

Response for removing a custom reward

type DeleteScheduleSegmentParams added in v2.24.0

type DeleteScheduleSegmentParams struct {
	BroadcasterID string `json:"broadcaster_id"`
	ID            string `json:"id"`
}

type DeleteScheduleSegmentResponse added in v2.24.0

type DeleteScheduleSegmentResponse struct {
	ResponseCommon
}

type DeleteVideosParams

type DeleteVideosParams struct {
	IDs []string `query:"id"` // Limit 5
}

type DeleteVideosResponse

type DeleteVideosResponse struct {
	ResponseCommon
}

type DropReason added in v2.26.0

type DropReason struct {
	// Code for why the message was dropped
	Code string `json:"code"`

	// Message for why the message was dropped
	Message string `json:"message"`
}

type EditChannelInformationParams

type EditChannelInformationParams struct {
	BroadcasterID       string   `query:"broadcaster_id" json:"-"`
	GameID              string   `json:"game_id,omitempty"`
	BroadcasterLanguage string   `json:"broadcaster_language,omitempty"`
	Title               string   `json:"title,omitempty"`
	Delay               int      `json:"delay,omitempty"`
	Tags                []string `json:"tags,omitempty"`
}

type EditChannelInformationResponse

type EditChannelInformationResponse struct {
	ResponseCommon
}

type Emote

type Emote struct {
	ID         string     `json:"id"`
	Name       string     `json:"name"`
	Images     EmoteImage `json:"images"`
	Tier       string     `json:"tier"`
	EmoteType  string     `json:"emote_type"`
	EmoteSetId string     `json:"emote_set_id"`
}

type EmoteImage

type EmoteImage struct {
	Url1x string `json:"url_1x"`
	Url2x string `json:"url_2x"`
	Url4x string `json:"url_4x"`
}

type EmoteWithOwner

type EmoteWithOwner struct {
	Emote
	OwnerID string `json:"owner_id"`
}

type EndPollParams

type EndPollParams struct {
	BroadcasterID string `json:"broadcaster_id"`
	ID            string `json:"id"`
	Status        string `json:"status"`
}

type EndPredictionParams

type EndPredictionParams struct {
	BroadcasterID    string `json:"broadcaster_id"`
	ID               string `json:"id"`
	Status           string `json:"status"`
	WinningOutcomeID string `json:"winning_outcome_id"`
}

type Entitlement

type Entitlement struct {
	ID                string `json:"id"`
	BenefitID         string `json:"benefit_id"`
	Timestamp         Time   `json:"timestamp"`
	UserID            string `json:"user_id"`
	GameID            string `json:"game_id"`
	FulfillmentStatus string `json:"fulfillment_status"` // Valid values "CLAIMED", "FULFILLED"
	UpdatedAt         Time   `json:"updated_at"`
}

type EntitlementCodeStatus

type EntitlementCodeStatus string

type EntitlementsUploadResponse

type EntitlementsUploadResponse struct {
	ResponseCommon
	Data ManyEntitlementsUploadURLs
}

type EntitlementsUploadURL

type EntitlementsUploadURL struct {
	URL string `json:"url"`
}

type EventSubBitVoting

type EventSubBitVoting struct {
	IsEnabled     bool `json:"is_enabled"`
	AmountPerVote int  `json:"amount_per_vote"`
}

type EventSubChannelBanEvent

type EventSubChannelBanEvent 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"`
	ModeratorUserID      string `json:"moderator_user_id"`
	ModeratorUserLogin   string `json:"moderator_user_login"`
	ModeratorUserName    string `json:"moderator_user_name"`
	Reason               string `json:"reason"`
	EndsAt               Time   `json:"ends_at"`
	IsPermanent          bool   `json:"is_permanent"`
}

Data for a channel ban notification

type EventSubChannelChatClearEvent added in v2.27.0

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

Data for a chat clear event

type EventSubChannelChatClearUserMessagesEvent added in v2.27.0

type EventSubChannelChatClearUserMessagesEvent struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	TargetUserID         string `json:"target_user_id"`
	TargetUserLogin      string `json:"target_user_login"`
	TargetUserName       string `json:"target_user_name"`
}

Data for a chat clear user messages event

type EventSubChannelChatMessageDeleteEvent added in v2.27.0

type EventSubChannelChatMessageDeleteEvent struct {
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	TargetUserID         string `json:"target_user_id"`
	TargetUserLogin      string `json:"target_user_login"`
	TargetUserName       string `json:"target_user_name"`
	MessageID            string `json:"message_id"`
}

Data for a chat message delete event

type EventSubChannelChatMessageEvent added in v2.27.0

type EventSubChannelChatMessageEvent struct {
	BroadcasterUserID           string                   `json:"broadcaster_user_id"`
	BroadcasterUserLogin        string                   `json:"broadcaster_user_login"`
	BroadcasterUserName         string                   `json:"broadcaster_user_name"`
	ChatterUserID               string                   `json:"chatter_user_id"`
	ChatterUserLogin            string                   `json:"chatter_user_login"`
	ChatterUserName             string                   `json:"chatter_user_name"`
	MessageID                   string                   `json:"message_id"`
	Message                     EventSubChatMessage      `json:"message"`
	MessageType                 EventSubChatMessageType  `json:"message_type"`
	Badges                      []EventSubChatBadge      `json:"badges"`
	Cheer                       EventSubChatMessageCheer `json:"cheer"`
	Color                       string                   `json:"color"`
	Reply                       EventSubChatMessageReply `json:"reply"`
	ChannelPointsCustomRewardID string                   `json:"channel_points_custom_reward_id"`
}

Data for a chat message

type EventSubChannelChatNotificationAnnouncement added in v2.27.0

type EventSubChannelChatNotificationAnnouncement struct {
	Color string `json:"color"`
}

type EventSubChannelChatNotificationBitsBadgeTier added in v2.27.0

type EventSubChannelChatNotificationBitsBadgeTier struct {
	Tier int64 `json:"tier"`
}

type EventSubChannelChatNotificationCharityDonation added in v2.27.0

type EventSubChannelChatNotificationCharityDonation struct {
	CharityName string                                               `json:"charity_name"`
	Amount      EventSubChannelChatNotificationCharityDonationAmount `json:"amount"`
}

type EventSubChannelChatNotificationCharityDonationAmount added in v2.27.0

type EventSubChannelChatNotificationCharityDonationAmount struct {
	Value        int64  `json:"value"`
	DecimalPlace int64  `json:"decimal_place"`
	Currency     string `json:"currency"`
}

type EventSubChannelChatNotificationCommunitySubGift added in v2.27.0

type EventSubChannelChatNotificationCommunitySubGift struct {
	ID              string `json:"id"`
	Total           int    `json:"total"`
	SubTier         string `json:"sub_tier"`
	CumulativeTotal int    `json:"cumulative_total"`
}

type EventSubChannelChatNotificationEvent added in v2.27.0

type EventSubChannelChatNotificationEvent struct {
	BroadcasterUserID    string                                          `json:"broadcaster_user_id"`
	BroadcasterUserLogin string                                          `json:"broadcaster_user_login"`
	BroadcasterUserName  string                                          `json:"broadcaster_user_name"`
	ChatterUserID        string                                          `json:"chatter_user_id"`
	ChatterUserLogin     string                                          `json:"chatter_user_login"`
	ChatterUserName      string                                          `json:"chatter_user_name"`
	ChatterIsAnonymous   bool                                            `json:"chatter_is_anonymous"`
	Color                string                                          `json:"color"`
	Badges               []EventSubChatBadge                             `json:"badges"`
	SystemMessage        string                                          `json:"system_message"`
	MessageID            string                                          `json:"message_id"`
	Message              EventSubChatNotificationMessage                 `json:"message"`
	NoticeType           EventSubChannelChatNotificationType             `json:"notice_type"`
	Sub                  EventSubChannelChatNotificationSub              `json:"sub"`
	Resub                EventSubChannelChatNotificationResub            `json:"resub"`
	SubGift              EventSubChannelChatNotificationSubGift          `json:"sub_gift"`
	CommunitySubGift     EventSubChannelChatNotificationCommunitySubGift `json:"community_sub_gift"`
	GiftPaidUpgrade      EventSubChannelChatNotificationGiftPaidUpgrade  `json:"gift_paid_upgrade"`
	PrimePaidUpgrade     EventSubChannelChatNotificationPrimePaidUpgrade `json:"prime_paid_upgrade"`
	Raid                 EventSubChannelChatNotificationRaid             `json:"raid"`
	Unraid               EventSubChannelChatNotificationUnraid           `json:"unraid"`
	PayItForward         EventSubChannelChatNotificationPayItForward     `json:"pay_it_forward"`
	Announcement         EventSubChannelChatNotificationAnnouncement     `json:"announcement"`
	CharityDonation      EventSubChannelChatNotificationCharityDonation  `json:"charity_donation"`
	BitsBadgeTier        EventSubChannelChatNotificationBitsBadgeTier    `json:"bits_badge_tier"`
}

Data for a chat notification event

type EventSubChannelChatNotificationGiftPaidUpgrade added in v2.27.0

type EventSubChannelChatNotificationGiftPaidUpgrade struct {
	GifterIsAnonymous bool   `json:"gifter_is_anonymous"`
	GifterUserID      string `json:"gifter_user_id"`
	GifterUserLogin   string `json:"gifter_user_login"`
	GifterUserName    string `json:"gifter_user_name"`
}

type EventSubChannelChatNotificationPayItForward added in v2.27.0

type EventSubChannelChatNotificationPayItForward struct {
	GifterIsAnonymous bool   `json:"gifter_is_anonymous"`
	GifterUserID      string `json:"gifter_user_id"`
	GifterUserLogin   string `json:"gifter_user_login"`
	GifterUserName    string `json:"gifter_user_name"`
}

type EventSubChannelChatNotificationPrimePaidUpgrade added in v2.27.0

type EventSubChannelChatNotificationPrimePaidUpgrade struct {
	SubTier string `json:"sub_tier"`
}

type EventSubChannelChatNotificationRaid added in v2.27.0

type EventSubChannelChatNotificationRaid struct {
	UserID          string `json:"user_id"`
	UserLogin       string `json:"user_login"`
	UserName        string `json:"user_name"`
	ViewerCount     int64  `json:"viewer_count"`
	ProfileImageURL string `json:"profile_image_url"`
}

type EventSubChannelChatNotificationResub added in v2.27.0

type EventSubChannelChatNotificationResub struct {
	CumulativeMonths  int    `json:"cumulative_months"`
	DurationMonths    int    `json:"duration_months"`
	StreakMonths      int    `json:"streak_months"`
	SubTier           string `json:"sub_tier"`
	IsPrime           bool   `json:"is_prime"`
	IsGift            bool   `json:"is_gift"`
	GifterIsAnonymous bool   `json:"gifter_is_anonymous"`
	GifterUserID      string `json:"gifter_user_id"`
	GifterUserLogin   string `json:"gifter_user_login"`
	GifterUserName    string `json:"gifter_user_name"`
}

type EventSubChannelChatNotificationSub added in v2.27.0

type EventSubChannelChatNotificationSub struct {
	SubTier        string `json:"sub_tier"`
	IsPrime        bool   `json:"is_prime"`
	DurationMonths int    `json:"duration_months"`
}

type EventSubChannelChatNotificationSubGift added in v2.27.0

type EventSubChannelChatNotificationSubGift struct {
	DurationMonths     int    `json:"duration_months"`
	CumulativeTotal    int    `json:"cumulative_total"`
	RecipientUserID    string `json:"recipient_user_id"`
	RecipientUserLogin string `json:"recipient_user_login"`
	RecipientUserName  string `json:"recipient_user_name"`
	SubTier            string `json:"sub_tier"`
	CommunityGiftID    string `json:"community_gift_id"`
}

type EventSubChannelChatNotificationType added in v2.27.0

type EventSubChannelChatNotificationType string
const (
	EventSubChannelNotificationSub              EventSubChannelChatNotificationType = "sub"
	EventSubChannelNotificationResub            EventSubChannelChatNotificationType = "resub"
	EventSubChannelNotificationSubGift          EventSubChannelChatNotificationType = "sub_gift"
	EventSubChannelNotificationCommunitySubGift EventSubChannelChatNotificationType = "community_sub_gift"
	EventSubChannelNotificationGiftPaidUpgrade  EventSubChannelChatNotificationType = "gift_paid_upgrade"
	EventSubChannelNotificationPrimePaidUpgrade EventSubChannelChatNotificationType = "prime_paid_upgrade"
	EventSubChannelNotificationRaid             EventSubChannelChatNotificationType = "raid"
	EventSubChannelNotificationUnraid           EventSubChannelChatNotificationType = "unraid"
	EventSubChannelNotificationPayItForward     EventSubChannelChatNotificationType = "pay_it_forward"
	EventSubChannelNotificationAnnouncement     EventSubChannelChatNotificationType = "announcement"
	EventSubChannelNotificationBitsBadgeTier    EventSubChannelChatNotificationType = "bits_badge_tier"
	EventSubChannelNotificationCharityDonation  EventSubChannelChatNotificationType = "charity_donation"
)

type EventSubChannelChatNotificationUnraid added in v2.27.0

type EventSubChannelChatNotificationUnraid struct{}

type EventSubChannelCheerEvent

type EventSubChannelCheerEvent struct {
	IsAnonymous          bool   `json:"is_anonymous"`
	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"`
	Message              string `json:"message"`
	Bits                 int    `json:"bits"`
}

Data for a channel cheer notification

type EventSubChannelFollowEvent

type EventSubChannelFollowEvent 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   `json:"followed_at"`
}

Data for a channel follow notification

type EventSubChannelGoalEndEvent added in v2.2.0

type EventSubChannelGoalEndEvent struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	Type                 string `json:"type"`
	Description          string `json:"description"`
	IsAchieved           bool   `json:"is_achieved"`
	CurrentAmount        int    `json:"current_amount"`
	TargetAmount         int    `json:"target_amount"`
	StartedAt            Time   `json:"started_at"`
	EndedAt              Time   `json:"ended_at"`
}

type EventSubChannelGoalProgressEvent added in v2.2.0

type EventSubChannelGoalProgressEvent struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	Type                 string `json:"type"`
	Description          string `json:"description"`
	CurrentAmount        int    `json:"current_amount"`
	TargetAmount         int    `json:"target_amount"`
	StartedAt            Time   `json:"started_at"`
}

type EventSubChannelGoalStartEvent added in v2.2.0

type EventSubChannelGoalStartEvent struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	Type                 string `json:"type"`
	Description          string `json:"description"`
	CurrentAmount        int    `json:"current_amount"`
	TargetAmount         int    `json:"target_amount"`
	StartedAt            Time   `json:"started_at"`
}

type EventSubChannelPointsCustomRewardEvent

type EventSubChannelPointsCustomRewardEvent struct {
	ID                                string                 `json:"id"`
	BroadcasterUserID                 string                 `json:"broadcaster_user_id"`
	BroadcasterUserLogin              string                 `json:"broadcaster_user_login"`
	BroadcasterUserName               string                 `json:"broadcaster_user_name"`
	IsEnabled                         bool                   `json:"is_enabled"`
	IsPaused                          bool                   `json:"is_paused"`
	IsInStock                         bool                   `json:"is_in_stock"`
	Title                             string                 `json:"title"`
	Cost                              int                    `json:"cost"`
	Prompt                            string                 `json:"prompt"`
	IsUserInputRequired               bool                   `json:"is_user_input_required"`
	ShouldRedemptionsSkipRequestQueue bool                   `json:"should_redemptions_skip_request_queue"`
	MaxPerStream                      EventSubMaxPerStream   `json:"max_per_stream"`
	MaxPerUserPerStream               EventSubMaxPerStream   `json:"max_per_user_per_stream"`
	BackgroundColor                   string                 `json:"background_color"`
	Image                             EventSubImage          `json:"image"`
	DefaultImage                      EventSubImage          `json:"default_image"`
	GlobalCooldown                    EventSubGlobalCooldown `json:"global_cooldown"`
	CooldownExpiresAt                 Time                   `json:"cooldown_expires_at"`
	RedemptionsRedeemedCurrentStream  int                    `json:"redemptions_redeemed_current_stream"`
}

Data for a channel points custom reward notification

type EventSubChannelPointsCustomRewardRedemptionEvent

type EventSubChannelPointsCustomRewardRedemptionEvent struct {
	ID                   string         `json:"id"`
	BroadcasterUserID    string         `json:"broadcaster_user_id"`
	BroadcasterUserLogin string         `json:"broadcaster_user_login"`
	BroadcasterUserName  string         `json:"broadcaster_user_name"`
	UserID               string         `json:"user_id"`
	UserLogin            string         `json:"user_login"`
	UserName             string         `json:"user_name"`
	UserInput            string         `json:"user_input"`
	Status               string         `json:"status"`
	Reward               EventSubReward `json:"reward"`
	RedeemedAt           Time           `json:"redeemed_at"`
}

Data for a channel points custom reward redemption notification

type EventSubChannelPointsVoting

type EventSubChannelPointsVoting = EventSubBitVoting

type EventSubChannelPollBeginEvent

type EventSubChannelPollBeginEvent struct {
	ID                   string                      `json:"id"`
	BroadcasterUserID    string                      `json:"broadcaster_user_id"`
	BroadcasterUserLogin string                      `json:"broadcaster_user_login"`
	BroadcasterUserName  string                      `json:"broadcaster_user_name"`
	Title                string                      `json:"title"`
	Choices              []PollChoice                `json:"choices"`
	BitsVoting           EventSubBitVoting           `json:"bits_voting"`
	ChannelPointsVoting  EventSubChannelPointsVoting `json:"channel_points_voting"`
	StartedAt            Time                        `json:"started_at"`
	EndsAt               Time                        `json:"ends_at"`
}

Data for a channel poll begin event

type EventSubChannelPollEndEvent

type EventSubChannelPollEndEvent struct {
	ID                   string                      `json:"id"`
	BroadcasterUserID    string                      `json:"broadcaster_user_id"`
	BroadcasterUserLogin string                      `json:"broadcaster_user_login"`
	BroadcasterUserName  string                      `json:"broadcaster_user_name"`
	Title                string                      `json:"title"`
	Choices              []PollChoice                `json:"choices"`
	BitsVoting           EventSubBitVoting           `json:"bits_voting"`
	ChannelPointsVoting  EventSubChannelPointsVoting `json:"channel_points_voting"`
	Status               string                      `json:"status"`
	StartedAt            Time                        `json:"started_at"`
	EndedAt              Time                        `json:"ended_at"`
}

Data for a channel poll end event

type EventSubChannelPollProgressEvent

type EventSubChannelPollProgressEvent = EventSubChannelPollBeginEvent

Data for a channel poll progress event, it's the same as the channel poll begin event

type EventSubChannelPredictionBeginEvent

type EventSubChannelPredictionBeginEvent struct {
	ID                   string            `json:"id"`
	BroadcasterUserID    string            `json:"broadcaster_user_id"`
	BroadcasterUserLogin string            `json:"broadcaster_user_login"`
	BroadcasterUserName  string            `json:"broadcaster_user_name"`
	Title                string            `json:"title"`
	Outcomes             []EventSubOutcome `json:"outcomes"`
	StartedAt            Time              `json:"started_at"`
	LocksAt              Time              `json:"locks_at"`
}

Data for a channel prediction begin event

type EventSubChannelPredictionEndEvent

type EventSubChannelPredictionEndEvent struct {
	ID                   string            `json:"id"`
	BroadcasterUserID    string            `json:"broadcaster_user_id"`
	BroadcasterUserLogin string            `json:"broadcaster_user_login"`
	BroadcasterUserName  string            `json:"broadcaster_user_name"`
	Title                string            `json:"title"`
	WinningOutcomeID     string            `json:"winning_outcome_id"`
	Outcomes             []EventSubOutcome `json:"outcomes"`
	Status               string            `json:"status"`
	StartedAt            Time              `json:"started_at"`
	EndedAt              Time              `json:"ended_at"`
}

Data for a channel prediction end event

type EventSubChannelPredictionLockEvent

type EventSubChannelPredictionLockEvent struct {
	ID                   string            `json:"id"`
	BroadcasterUserID    string            `json:"broadcaster_user_id"`
	BroadcasterUserLogin string            `json:"broadcaster_user_login"`
	BroadcasterUserName  string            `json:"broadcaster_user_name"`
	Title                string            `json:"title"`
	WinningOutcomeID     string            `json:"winning_outcome_id"`
	Outcomes             []EventSubOutcome `json:"outcomes"`
	Status               string            `json:"status"`
	StartedAt            Time              `json:"started_at"`
	LockedAt             Time              `json:"locked_at"`
}

Data for a channel prediction lock event

type EventSubChannelPredictionProgressEvent

type EventSubChannelPredictionProgressEvent = EventSubChannelPredictionBeginEvent

Data for a channel prediction progress event

type EventSubChannelRaidEvent

type EventSubChannelRaidEvent struct {
	FromBroadcasterUserID    string `json:"from_broadcaster_user_id"`
	FromBroadcasterUserLogin string `json:"from_broadcaster_user_login"`
	FromBroadcasterUserName  string `json:"from_broadcaster_user_name"`
	ToBroadcasterUserID      string `json:"to_broadcaster_user_id"`
	ToBroadcasterUserLogin   string `json:"to_broadcaster_user_login"`
	ToBroadcasterUserName    string `json:"to_broadcaster_user_name"`
	Viewers                  int    `json:"viewers"`
}

Data for a channel raid notification

type EventSubChannelSubscribeEvent

type EventSubChannelSubscribeEvent 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"`
	Tier                 string `json:"tier"`
	IsGift               bool   `json:"is_gift"`
}

Data for a channel subscribe notification

type EventSubChannelSubscriptionGiftEvent

type EventSubChannelSubscriptionGiftEvent 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"`
	Total                int    `json:"total"`
	Tier                 string `json:"tier"`
	CumulativeTotal      int    `json:"cumulative_total"`
	IsAnonymous          bool   `json:"is_anonymous"`
}

EventSubChannelSubscriptionGiftEvent

type EventSubChannelSubscriptionMessageEvent

type EventSubChannelSubscriptionMessageEvent 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"`
	Tier                 string          `json:"tier"`
	Message              EventSubMessage `json:"message"`
	CumulativeMonths     int             `json:"cumulative_months"`
	StreakMonths         int             `json:"streak_months"`
	DurationMonths       int             `json:"duration_months"`
}

EventSubChannelSubscriptionMessageEvent

type EventSubChannelUnbanEvent

type EventSubChannelUnbanEvent 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"`
	ModeratorUserID      string `json:"moderator_user_id"`
	ModeratorUserLogin   string `json:"moderator_user_login"`
	ModeratorUserName    string `json:"moderator_user_name"`
}

Data for a channel unban notification

type EventSubChannelUpdateEvent

type EventSubChannelUpdateEvent 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"`
}

Data for a channel update notification

type EventSubCharityAmount added in v2.7.0

type EventSubCharityAmount struct {
	Value         int64  `json:"value"`
	DecimalPlaces int64  `json:"decimal_places"`
	Currency      string `json:"currency"`
}

type EventSubCharityDonationEvent added in v2.7.0

type EventSubCharityDonationEvent struct {
	DonationID           string                `json:"id"`
	CharityCampaignID    string                `json:"campaign_id"`
	CharityDescription   string                `json:"campaign_description"`
	CharityWebsite       string                `json:"campaign_website"`
	CharityName          string                `json:"charity_name"`
	CharityLogoURL       string                `json:"charity_logo"`
	BroadcasterUserID    string                `json:"broadcaster_user_id"`
	BroadcasterUserName  string                `json:"broadcaster_user_name"`
	BroadcasterUserLogin string                `json:"broadcaster_user_login"`
	UserID               string                `json:"user_id"`
	UserName             string                `json:"user_name"`
	UserLogin            string                `json:"user_login"`
	Amount               EventSubCharityAmount `json:"amount"`
}

type EventSubCharityProgressEvent added in v2.12.0

type EventSubCharityProgressEvent struct {
	CharityCampaignID    string                `json:"campaign_id"`
	CharityDescription   string                `json:"campaign_description"`
	CharityWebsite       string                `json:"campaign_website"`
	CharityName          string                `json:"charity_name"`
	CharityLogoURL       string                `json:"charity_logo"`
	BroadcasterUserID    string                `json:"broadcaster_id"`
	BroadcasterUserName  string                `json:"broadcaster_name"`
	BroadcasterUserLogin string                `json:"broadcaster_user_login"`
	UserID               string                `json:"user_id"`
	UserName             string                `json:"user_name"`
	UserLogin            string                `json:"user_login"`
	Amount               EventSubCharityAmount `json:"amount"`
}

type EventSubCharityStartEvent added in v2.12.0

type EventSubCharityStartEvent struct {
	CharityCampaignID    string                `json:"campaign_id"`
	CharityDescription   string                `json:"campaign_description"`
	CharityWebsite       string                `json:"campaign_website"`
	CharityName          string                `json:"charity_name"`
	CharityLogoURL       string                `json:"charity_logo"`
	BroadcasterUserID    string                `json:"broadcaster_id"`
	BroadcasterUserName  string                `json:"broadcaster_name"`
	BroadcasterUserLogin string                `json:"broadcaster_login"`
	UserID               string                `json:"user_id"`
	UserName             string                `json:"user_name"`
	UserLogin            string                `json:"user_login"`
	CurrentAmount        EventSubCharityAmount `json:"current_amount"`
	TargetAmount         EventSubCharityAmount `json:"target_amount"`
	StartedAt            Time                  `json:"started_at"`
}

type EventSubCharityStopEvent added in v2.12.0

type EventSubCharityStopEvent struct {
	CharityCampaignID    string                `json:"campaign_id"`
	CharityDescription   string                `json:"campaign_description"`
	CharityWebsite       string                `json:"campaign_website"`
	CharityName          string                `json:"charity_name"`
	CharityLogoURL       string                `json:"charity_logo"`
	BroadcasterUserID    string                `json:"broadcaster_id"`
	BroadcasterUserName  string                `json:"broadcaster_name"`
	BroadcasterUserLogin string                `json:"broadcaster_login"`
	UserID               string                `json:"user_id"`
	UserName             string                `json:"user_name"`
	UserLogin            string                `json:"user_login"`
	CurrentAmount        EventSubCharityAmount `json:"current_amount"`
	TargetAmount         EventSubCharityAmount `json:"target_amount"`
	StoppedAt            Time                  `json:"stopped_at"`
}

type EventSubChatBadge added in v2.27.0

type EventSubChatBadge struct {
	SetID string `json:"set_id"`
	ID    string `json:"id"`
	Info  string `json:"info"`
}

type EventSubChatMessage added in v2.27.0

type EventSubChatMessage struct {
	Text      string                        `json:"text"`
	Fragments []EventSubChatMessageFragment `json:"fragment"`
}

type EventSubChatMessageCheer added in v2.27.0

type EventSubChatMessageCheer struct {
	Bits int64 `json:"bits"`
}

type EventSubChatMessageCheermote added in v2.27.0

type EventSubChatMessageCheermote struct {
	Prefix string `json:"prefix"`
	Bits   int64  `json:"bits"`
	Tier   int    `json:"tier"`
}

type EventSubChatMessageEmote added in v2.27.0

type EventSubChatMessageEmote struct {
	ID         string `json:"id"`
	EmoteSetID string `json:"emote_set_id"`
	OwnerID    string `json:"owner_id"`
	Format     string `json:"format"`
}

type EventSubChatMessageFragment added in v2.27.0

type EventSubChatMessageFragment struct {
	Type      EventSubChatMessageFragmentType `json:"type"`
	Text      string                          `json:"text"`
	Cheermote EventSubChatMessageCheermote    `json:"cheermote"`
	Emote     EventSubChatMessageEmote        `json:"emote"`
	Mention   EventSubChatMessageMention      `json:"mention"`
}

type EventSubChatMessageFragmentType added in v2.27.0

type EventSubChatMessageFragmentType string
const (
	EventSubChatMessageFragmentTypeText      EventSubChatMessageFragmentType = "text"
	EventSubChatMessageFragmentTypeCheermote EventSubChatMessageFragmentType = "cheermote"
	EventSubChatMessageFragmentTypeEmote     EventSubChatMessageFragmentType = "emote"
	EventSubChatMessageFragmentTypeMention   EventSubChatMessageFragmentType = "mention"
)

type EventSubChatMessageMention added in v2.27.0

type EventSubChatMessageMention struct {
	UserID    string `json:"user_id"`
	UserName  string `json:"user_name"`
	UserLogin string `json:"user_login"`
}

type EventSubChatMessageReply added in v2.27.0

type EventSubChatMessageReply struct {
	ParentMessageID   string `json:"parent_message_id"`
	ParentMessageBody string `json:"parent_message_body"`
	ParentUserID      string `json:"parent_user_id"`
	ParentUserName    string `json:"parent_user_name"`
	ParentUserLogin   string `json:"parent_user_login"`
	ThreadMessageID   string `json:"thread_message_id"`
	ThreadUserID      string `json:"thread_user_id"`
	ThreadUserName    string `json:"thread_user_name"`
	ThreadUserLogin   string `json:"thread_user_login"`
}

type EventSubChatMessageType added in v2.27.0

type EventSubChatMessageType string
const (
	EventSubChatMessageTypeText                     EventSubChatMessageType = "text"
	EventSubChatMessageTypeChannelPointsHighlighted EventSubChatMessageType = "channel_points_highlighted"
	EventSubChatMessageTypeChannelPointsSubOnly     EventSubChatMessageType = "channel_points_sub_only"
	EventSubChatMessageTypeUserIntro                EventSubChatMessageType = "user_intro"
)

type EventSubChatNotificationMessage added in v2.27.0

type EventSubChatNotificationMessage struct {
	Text      string                        `json:"text"`
	Fragments []EventSubChatMessageFragment `json:"fragment"`
}

type EventSubCondition

type EventSubCondition struct {
	BroadcasterUserID     string `json:"broadcaster_user_id"`
	FromBroadcasterUserID string `json:"from_broadcaster_user_id"`
	ModeratorUserID       string `json:"moderator_user_id"`
	ToBroadcasterUserID   string `json:"to_broadcaster_user_id"`
	RewardID              string `json:"reward_id"`
	ClientID              string `json:"client_id"`
	ExtensionClientID     string `json:"extension_client_id"`
	UserID                string `json:"user_id"`
}

Conditions for a subscription, not all are necessary and some only apply to some subscription types, see https://dev.twitch.tv/docs/eventsub/eventsub-reference

type EventSubContribution

type EventSubContribution struct {
	UserID    string `json:"user_id"`
	UserLogin string `json:"user_login"`
	UserName  string `json:"user_name"`
	Type      string `json:"type"`
	Total     int64  `json:"total"`
}

This belongs to a hype train and defines a user contribution

type EventSubEmote

type EventSubEmote struct {
	Begin int    `json:"begin"`
	End   int    `json:"end"`
	ID    string `json:"id"`
}

EventSubEmote

type EventSubExtensionBitsTransactionCreateEvent

type EventSubExtensionBitsTransactionCreateEvent struct {
	ExtensionClientID    string          `json:"extension_client_id"`
	ID                   string          `json:"id"`
	BroadcasterUserID    string          `json:"broadcaster_user_id"`
	BroadcasterUserLogin string          `json:"broadcaster_user_login"`
	BroadcasterUserName  string          `json:"broadcaster_user_name"`
	UserID               string          `json:"user_id"`
	UserLogin            string          `json:"user_login"`
	UserName             string          `json:"user_name"`
	Product              EventSubProduct `json:"product"`
}

Data for an extension bits transaction creation

type EventSubGlobalCooldown

type EventSubGlobalCooldown struct {
	IsEnabled bool `json:"is_enabled"`
	Seconds   int  `json:"seconds"`
}

This belongs to a custom reward and defines it's cooldown

type EventSubHypeTrainBeginEvent

type EventSubHypeTrainBeginEvent struct {
	BroadcasterUserID    string                 `json:"broadcaster_user_id"`
	BroadcasterUserLogin string                 `json:"broadcaster_user_login"`
	BroadcasterUserName  string                 `json:"broadcaster_user_name"`
	Total                int                    `json:"total"`
	Progress             int                    `json:"progress"`
	Goal                 int                    `json:"goal"`
	TopContributions     []EventSubContribution `json:"top_contributions"`
	LastContribution     EventSubContribution   `json:"last_contribution"`
	StartedAt            Time                   `json:"started_at"`
	ExpiresAt            Time                   `json:"expires_at"`
}

Data for a hype train begin notification

type EventSubHypeTrainEndEvent

type EventSubHypeTrainEndEvent struct {
	ID                   string                 `json:"id"`
	BroadcasterUserID    string                 `json:"broadcaster_user_id"`
	BroadcasterUserLogin string                 `json:"broadcaster_user_login"`
	BroadcasterUserName  string                 `json:"broadcaster_user_name"`
	Level                int                    `json:"level"`
	Total                int                    `json:"total"`
	TopContributions     []EventSubContribution `json:"top_contributions"`
	StartedAt            Time                   `json:"started_at"`
	EndedAt              Time                   `json:"ended_at"`
	CooldownEndsAt       Time                   `json:"cooldown_ends_at"`
}

Data for a hype train end notification

type EventSubHypeTrainProgressEvent

type EventSubHypeTrainProgressEvent struct {
	BroadcasterUserID    string                 `json:"broadcaster_user_id"`
	BroadcasterUserLogin string                 `json:"broadcaster_user_login"`
	BroadcasterUserName  string                 `json:"broadcaster_user_name"`
	Level                int                    `json:"level"`
	Total                int                    `json:"total"`
	Progress             int                    `json:"progress"`
	Goal                 int                    `json:"goal"`
	TopContributions     []EventSubContribution `json:"top_contributions"`
	LastContribution     EventSubContribution   `json:"last_contribution"`
	StartedAt            Time                   `json:"started_at"`
	ExpiresAt            Time                   `json:"expires_at"`
}

Data for a hype train progress notification

type EventSubImage

type EventSubImage struct {
	Url1x string `json:"url_1x"`
	Url2x string `json:"url_2x"`
	Url4x string `json:"url_4x"`
}

This also belongs to a custom reward and defines the image urls

type EventSubMaxPerStream

type EventSubMaxPerStream struct {
	IsEnabled bool `json:"is_enabled"`
	Value     int  `json:"value"`
}

This belongs to a custom reward and defines if it is limited per stream

type EventSubMessage

type EventSubMessage struct {
	Text   string          `json:"text"`
	Emotes []EventSubEmote `json:"emotes"`
}

EventSubMessage

type EventSubModeratorAddEvent

type EventSubModeratorAddEvent = EventSubChannelFollowEvent

Data for a channel moderator add notification, it's the same as the channel follow notification

type EventSubModeratorRemoveEvent

type EventSubModeratorRemoveEvent = EventSubChannelFollowEvent

Data for a channel moderator remove notification, it's the same as the channel follow notification

type EventSubOutcome

type EventSubOutcome struct {
	ID            string                 `json:"id"`
	Title         string                 `json:"title"`
	Color         string                 `json:"color"`
	Users         int                    `json:"users"`
	ChannelPoints int                    `json:"channel_points"`
	TopPredictors []EventSubTopPredictor `json:"top_predictors"`
}

This belong to a channel prediction and defines the outcomes

type EventSubProduct

type EventSubProduct struct {
	Name          string `json:"name"`
	Bits          int    `json:"bits"`
	Sku           string `json:"sku"`
	InDevelopment bool   `json:"in_development"`
}

type EventSubReward

type EventSubReward struct {
	ID     string `json:"id"`
	Title  string `json:"title"`
	Cost   int    `json:"cost"`
	Prompt string `json:"prompt"`
}

This belongs to a reward redemption and defines the reward redeemed

type EventSubShoutoutCreateEvent added in v2.15.0

type EventSubShoutoutCreateEvent struct {
	BroadcasterUserID      string `json:"broadcaster_user_id"`
	BroadcasterUserName    string `json:"broadcaster_user_name"`
	BroadcasterUserLogin   string `json:"broadcaster_user_login"`
	ModeratorUserID        string `json:"moderator_user_id"`
	ModeratorUserName      string `json:"moderator_user_name"`
	ModeratorUserLogin     string `json:"moderator_user_login"`
	ToBroadcasterUserID    string `json:"to_broadcaster_user_id"`
	ToBroadcasterUserName  string `json:"to_broadcaster_user_name"`
	ToBroadcasterUserLogin string `json:"to_broadcaster_user_login"`
	StartedAt              Time   `json:"started_at"`
	ViewerCount            int64  `json:"viewer_count"`
	CooldownEndsAt         Time   `json:"cooldown_ends_at"`
	TargetCooldownEndsAt   Time   `json:"target_cooldown_ends_at"`
}

type EventSubShoutoutReceiveEvent added in v2.15.0

type EventSubShoutoutReceiveEvent struct {
	BroadcasterUserID        string `json:"broadcaster_user_id"`
	BroadcasterUserName      string `json:"broadcaster_user_name"`
	BroadcasterUserLogin     string `json:"broadcaster_user_login"`
	FromBroadcasterUserID    string `json:"from_broadcaster_user_id"`
	FromBroadcasterUserName  string `json:"from_broadcaster_user_name"`
	FromBroadcasterUserLogin string `json:"from_broadcaster_user_login"`
	ViewerCount              int64  `json:"viewer_count"`
	StartedAt                Time   `json:"started_at"`
}

type EventSubStreamOfflineEvent

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

Data for a stream offline notification

type EventSubStreamOnlineEvent

type EventSubStreamOnlineEvent 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   `json:"started_at"`
}

Data for a stream online notification

type EventSubSubscription

type EventSubSubscription struct {
	ID        string            `json:"id"`
	Type      string            `json:"type"`
	Version   string            `json:"version"`
	Status    string            `json:"status"`
	Condition EventSubCondition `json:"condition"`
	Transport EventSubTransport `json:"transport"`
	CreatedAt Time              `json:"created_at"`
	Cost      int               `json:"cost"`
}

Represents a subscription

type EventSubSubscriptionsParams

type EventSubSubscriptionsParams struct {
	Status string `query:"status"`
	Type   string `query:"type"`
	UserID string `query:"user_id"`
	After  string `query:"after"`
}

Parameter for filtering subscriptions, currently only the status is filterable

type EventSubSubscriptionsResponse

type EventSubSubscriptionsResponse struct {
	ResponseCommon
	Data ManyEventSubSubscriptions
}

Response for getting all current subscriptions

type EventSubTopPredictor

type EventSubTopPredictor struct {
	UserID            string `json:"user_id"`
	UserLogin         string `json:"user_login"`
	UserName          string `json:"user_name"`
	ChannelPointWon   int    `json:"channel_points_won"`
	ChannelPointsUsed int    `json:"channel_points_used"`
}

This belong to an outcome and defines user reward

type EventSubTransport

type EventSubTransport struct {
	Method    string `json:"method"`
	Callback  string `json:"callback"`
	Secret    string `json:"secret"`
	SessionID string `json:"session_id"`
}

Transport for the subscription, currently the only supported Method is "webhook". Secret must be between 10 and 100 characters

type EventSubUserAuthenticationRevokeEvent

type EventSubUserAuthenticationRevokeEvent struct {
	ClientID  string `json:"client_id"`
	UserID    string `json:"user_id"`
	UserLogin string `json:"user_login"`
	UserName  string `json:"user_name"`
}

Data for an user authentication revoke notification, this means the user has revoked the access token and if you need to comply with gdpr you need to delete your user data belonging to the user.

type EventSubUserUpdateEvent

type EventSubUserUpdateEvent struct {
	UserID      string `json:"user_id"`
	UserLogin   string `json:"user_login"`
	UserName    string `json:"user_name"`
	Email       string `json:"email"`
	Description string `json:"description"`
}

Data for an user update notification

type ExtensionAnalytic

type ExtensionAnalytic struct {
	ExtensionID string    `json:"extension_id"`
	URL         string    `json:"URL"`
	Type        string    `json:"type"`
	DateRange   DateRange `json:"date_range"`
}

type ExtensionAnalyticsParams

type ExtensionAnalyticsParams struct {
	ExtensionID string `query:"extension_id"`
	First       int    `query:"first,20"`
	After       string `query:"after"`
	StartedAt   Time   `query:"started_at"`
	EndedAt     Time   `query:"ended_at"`
	Type        string `query:"type"`
}

type ExtensionAnalyticsResponse

type ExtensionAnalyticsResponse struct {
	ResponseCommon
	Data ManyExtensionAnalytics
}

type ExtensionConfigurationSegment

type ExtensionConfigurationSegment struct {
	Segment ExtensionSegmentType `json:"segment"`
	Version string               `json:"version"`
	Content string               `json:"content"`
}

type ExtensionCreateClaimsParams

type ExtensionCreateClaimsParams struct {
	// ChannelID if this value is empty it will default to 'all'
	ChannelID string
	// PubSub is the pubsub permission to attach to the claim
	PubSub *PubSubPermissions
	// Expiration is the epoch of jwt expiration, default 3 minutes from time.Now
	Expiration int64
}

type ExtensionGetConfigurationParams

type ExtensionGetConfigurationParams struct {
	ExtensionID   string                 `query:"extension_id"`
	BroadcasterID string                 `query:"broadcaster_id"`
	Segments      []ExtensionSegmentType `query:"segment"`
}

type ExtensionGetConfigurationSegmentResponse

type ExtensionGetConfigurationSegmentResponse struct {
	ResponseCommon
	Data ManyExtensionConfigurationSegments
}

type ExtensionLiveChannel added in v2.3.0

type ExtensionLiveChannel struct {
	BroadcasterID   string `json:"broadcaster_id"`
	BroadcasterName string `json:"broadcaster_name"`
	GameName        string `json:"game_name"`
	GameID          string `json:"game_id"`
	Title           string `json:"title"`
}

type ExtensionLiveChannelsParams added in v2.3.0

type ExtensionLiveChannelsParams struct {
	ExtensionID string `query:"extension_id"` // Required
	After       string `query:"after"`        // Optional
	First       int    `query:"first,20"`     // Optional, Limit 100
}

type ExtensionLiveChannelsResponse added in v2.3.0

type ExtensionLiveChannelsResponse struct {
	ResponseCommon
	Data ManyExtensionLiveChannels
}

type ExtensionOptions

type ExtensionOptions struct {
	OwnerUserID    string
	Secret         string
	SignedJWTToken string
}

type ExtensionPubSubPublishType

type ExtensionPubSubPublishType string

PublishType The Pub/Sub broadcast type

const (
	ExtensionPubSubGenericPublish   ExtensionPubSubPublishType = "*"
	ExtensionPubSubBroadcastPublish ExtensionPubSubPublishType = "broadcast"
	ExtensionPubSubGlobalPublish    ExtensionPubSubPublishType = "global"
)

Types of Pub/Sub Permissions or targets

func (ExtensionPubSubPublishType) String

type ExtensionSecretCreationParams

type ExtensionSecretCreationParams struct {
	ActivationDelay int    `query:"delay,300"` // min 300
	ExtensionID     string `query:"extension_id"`
}

type ExtensionSecretCreationResponse

type ExtensionSecretCreationResponse struct {
	Data ManyExtensionSecrets
	ResponseCommon
}

GetExtensionSecretResponse response structure received when generating or querying for generated secrets

type ExtensionSegmentType

type ExtensionSegmentType string

SegmentType A segment configuration type

const (
	ExtensionConfigrationBroadcasterSegment ExtensionSegmentType = "broadcaster"
	ExtensionConfigurationDeveloperSegment  ExtensionSegmentType = "developer"
	ExtensionConfigurationGlobalSegment     ExtensionSegmentType = "global"
)

Types of segments datastores for the configuration service

func (ExtensionSegmentType) String

func (s ExtensionSegmentType) String() string

type ExtensionSendChatMessageParams

type ExtensionSendChatMessageParams struct {
	BroadcasterID    string `query:"broadcaster_id" json:"-"`
	Text             string `json:"text"` // Limit 280
	ExtensionVersion string `json:"extension_version"`
	ExtensionID      string `json:"extension_id"`
}

type ExtensionSendChatMessageResponse

type ExtensionSendChatMessageResponse struct {
	ResponseCommon
}

type ExtensionSendPubSubMessageParams

type ExtensionSendPubSubMessageParams struct {
	BroadcasterID     string                       `json:"broadcaster_id"`
	Message           string                       `json:"message"`
	Target            []ExtensionPubSubPublishType `json:"target"`
	IsGlobalBroadcast bool                         `json:"is_global_broadcast"`
}

type ExtensionSendPubSubMessageResponse

type ExtensionSendPubSubMessageResponse struct {
	ResponseCommon
}

type ExtensionSetConfigurationParams

type ExtensionSetConfigurationParams struct {
	Segment     ExtensionSegmentType `json:"segment"`
	ExtensionID string               `json:"extension_id"`
	// BroadcasterID is only populated if segment is of type 'developer' || 'broadcaster'
	BroadcasterID string `json:"broadcaster_id,omitempty"`
	Version       string `json:"version"`
	Content       string `json:"content"`
}

type ExtensionSetConfigurationResponse

type ExtensionSetConfigurationResponse struct {
	ResponseCommon
}

type ExtensionSetRequiredConfigurationParams

type ExtensionSetRequiredConfigurationParams struct {
	BroadcasterID         string `query:"broadcaster_id" json:"-"`
	ExtensionID           string `json:"extension_id"`
	RequiredConfiguration string `json:"required_version"`
	ExtensionVersion      string `json:"extension_version"`
	ConfigurationVersion  string `json:"configuration_version"`
}

type ExtensionSetRequiredConfigurationResponse

type ExtensionSetRequiredConfigurationResponse struct {
	ResponseCommon
}

type ExtensionTransaction

type ExtensionTransaction struct {
	ID               string `json:"id"`
	Timestamp        Time   `json:"timestamp"`
	BroadcasterID    string `json:"broadcaster_id"`
	BroadcasterLogin string `json:"broadcaster_login"`
	BroadcasterName  string `json:"broadcaster_name"`
	UserID           string `json:"user_id"`
	UserLogin        string `json:"user_login"`
	UserName         string `json:"user_name"`
	ProductType      string `json:"product_type"`
	ProductData      struct {
		Domain     string `json:"domain"`
		Broadcast  bool   `json:"broadcast"`
		Expiration string `json:"expiration"`
		SKU        string `json:"sku"`
		Cost       struct {
			Amount int    `json:"amount"`
			Type   string `json:"type"`
		} `json:"cost"`
		DisplayName   string `json:"displayName"`
		InDevelopment bool   `json:"inDevelopment"`
	} `json:"product_data"`
}

type ExtensionTransactionsParams

type ExtensionTransactionsParams struct {
	ExtensionID string   `query:"extension_id"` // Required
	ID          []string `query:"id"`           // Optional, Limit 100
	After       string   `query:"after"`        // Optional
	First       int      `query:"first,20"`     // Optional, Limit 100
}

type ExtensionTransactionsResponse

type ExtensionTransactionsResponse struct {
	ResponseCommon
	Data ManyExtensionTransactions
}

type FollowedChannel added in v2.16.0

type FollowedChannel struct {
	BroadcasterID   string `json:"broadcaster_id"`
	BroadcasterName string `json:"broadcaster_name"`
	BroadcaserLogin string `json:"broadcaster_login"`
	Followed        Time   `json:"followed_at"`
}

Channel describes a followed channel

type FollowedStreamsParams

type FollowedStreamsParams struct {
	After  string `query:"after"`
	Before string `query:"before"`
	First  int    `query:"first,20"` // Limit 100
	UserID string `query:"user_id"`
}

type Game

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

type GameAnalytic

type GameAnalytic struct {
	GameID    string    `json:"game_id"`
	URL       string    `json:"URL"`
	Type      string    `json:"type"`
	DateRange DateRange `json:"date_range"`
}

type GameAnalyticsParams

type GameAnalyticsParams struct {
	GameID    string `query:"game_id"`
	First     int    `query:"first,20"`
	After     string `query:"after"`
	StartedAt Time   `query:"started_at"`
	EndedAt   Time   `query:"ended_at"`
	Type      string `query:"type"`
}

type GameAnalyticsResponse

type GameAnalyticsResponse struct {
	ResponseCommon
	Data ManyGameAnalytics
}

type GamesParams

type GamesParams struct {
	IDs   []string `query:"id"`   // Limit 100
	Names []string `query:"name"` // Limit 100
}

type GamesResponse

type GamesResponse struct {
	ResponseCommon
	Data ManyGames
}

type GetChannelEmotesParams

type GetChannelEmotesParams struct {
	BroadcasterID string `query:"broadcaster_id"`
}

type GetChannelEmotesResponse

type GetChannelEmotesResponse struct {
	ResponseCommon
	Data ManyEmotes
}

type GetChannelFollowersResponse added in v2.16.0

type GetChannelFollowersResponse struct {
	ResponseCommon
	Data ManyChannelFollows
}

SearchChannelsResponse is the response from SearchChannels

type GetChannelFollowsParams added in v2.16.0

type GetChannelFollowsParams struct {
	BroadcasterID string `query:"broadcaster_id"` // required
	UserID        string `query:"user_id"`
	First         int    `query:"first"` // max 100
	After         string `query:"after"`
}

type GetChannelInformationParams

type GetChannelInformationParams struct {
	// Deprecated: BroadcasterID will be removed in a future version. Use BroadcasterIDs instead.
	BroadcasterID  string   `query:"broadcaster_id"`
	BroadcasterIDs []string `query:"broadcaster_id"` // Limit 100
}

type GetChannelInformationResponse

type GetChannelInformationResponse struct {
	ResponseCommon
	Data ManyChannelInformation
}

type GetChannelVipsParams added in v2.17.0

type GetChannelVipsParams struct {
	UserID        string `query:"user_id"`
	BroadcasterID string `query:"broadcaster_id"` // required
	First         int    `query:"first"`
	After         string `query:"after"`
}

type GetChatBadgeParams

type GetChatBadgeParams struct {
	BroadcasterID string `query:"broadcaster_id"`
}

type GetChatBadgeResponse

type GetChatBadgeResponse struct {
	ResponseCommon
	Data ManyChatBadge
}

type GetChatChattersParams added in v2.8.0

type GetChatChattersParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	ModeratorID   string `query:"moderator_id"`
	After         string `query:"after"`
	First         string `query:"first"`
}

type GetChatChattersResponse added in v2.8.0

type GetChatChattersResponse struct {
	ResponseCommon
	Data ManyChatChatters
}

type GetChatSettingsParams added in v2.14.0

type GetChatSettingsParams struct {
	// Required, the ID of the broadcaster whose chat settings you want to get
	BroadcasterID string `query:"broadcaster_id"`

	// Optional, can be specified if you want the `non_moderator_chat_delay` and `non_moderator_chat_delay_duration` fields in the response. The ID should be a user that has moderation privileges in the broadcaster's chat.
	// The ID must match the specified User Access Token & the User Access Token must have the `moderator:read:chat_settings` scope
	ModeratorID string `query:"moderator_id,omitempty"`
}

type GetChatSettingsResponse added in v2.14.0

type GetChatSettingsResponse struct {
	ResponseCommon
	Data ManyChatSettings
}

type GetCreatorGoalsParams added in v2.2.0

type GetCreatorGoalsParams struct {
	BroadcasterID string `query:"broadcaster_id"`
}

type GetCustomRewardsParams

type GetCustomRewardsParams struct {
	BroadcasterID         string `query:"broadcaster_id"`
	ID                    string `query:"id"`
	OnlyManageableRewards bool   `query:"only_manageable_rewards"`
}

type GetDropEntitlementsParams

type GetDropEntitlementsParams struct {
	ID                string `query:"id"`
	UserID            string `query:"user_id"`
	GameID            string `query:"game_id"`
	FulfillmentStatus string `query:"fulfillment_status"` // Valid values "CLAIMED", "FULFILLED"
	After             string `query:"after"`
	First             int    `query:"first,20"` // Limit 1000
}

type GetDropsEntitlementsResponse

type GetDropsEntitlementsResponse struct {
	ResponseCommon
	Data ManyEntitlementsWithPagination
}

type GetEmoteSetsParams

type GetEmoteSetsParams struct {
	EmoteSetIDs []string `query:"emote_set_id"` // Minimum: 1. Maximum: 25.
}

type GetEmoteSetsResponse

type GetEmoteSetsResponse struct {
	ResponseCommon
	Data ManyEmotesWithOwner
}

type GetExtensionSecretParams

type GetExtensionSecretParams struct {
	ExtensionID string `query:"extension_id"`
}

type GetExtensionSecretResponse

type GetExtensionSecretResponse struct {
	Data ManyExtensionSecrets
	ResponseCommon
}

GetExtensionSecretResponse response structure received when fetching secrets for an extension

type GetFollowedChannelParams added in v2.16.0

type GetFollowedChannelParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	UserID        string `query:"user_id"` // required
	First         int    `query:"first"`   // max 100
	After         string `query:"after"`
}

type GetFollowedChannelResponse added in v2.16.0

type GetFollowedChannelResponse struct {
	ResponseCommon
	Data ManyFollowedChannels
}

SearchChannelsResponse is the response from SearchChannels

type GetModeratorsParams added in v2.14.0

type GetModeratorsParams struct {
	// Required
	BroadcasterID string `query:"broadcaster_id"`

	// Optional
	UserIDs []string `query:"user_id"` // Limit 100
	After   string   `query:"after"`
	First   int      `query:"first"`
}

type GetPollsResponse

type GetPollsResponse struct {
	ResponseCommon
	Data ManyPolls
}

type GetPredictionsResponse

type GetPredictionsResponse struct {
	ResponseCommon
	Data ManyPredictions
}

type GetScheduleData added in v2.24.0

type GetScheduleData struct {
	Schedule   ScheduleData          `json:"data"`
	Pagination GetSchedulePagination `json:"pagination"`
}

type GetSchedulePagination added in v2.24.0

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

type GetScheduleParams added in v2.24.0

type GetScheduleParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	ID            string `query:"id"`
	StartTime     Time   `query:"start_time"`
	UTCOffset     string `query:"utc_offset"`
	First         int    `query:"first"`
	After         string `query:"after"`
}

GetScheduleParams are the parameters for GetSchedule

type GetScheduleResponse added in v2.24.0

type GetScheduleResponse struct {
	ResponseCommon

	Data GetScheduleData
}

GetScheduleResponse is the response data in GetSchedule

type GetScheduleSegment added in v2.24.0

type GetScheduleSegment struct {
	ID            string                     `json:"id"`
	StartTime     Time                       `json:"start_time"`
	EndTime       Time                       `json:"end_time"`
	Title         string                     `json:"title"`
	CanceledUntil string                     `json:"canceled_until"`
	Category      GetScheduleSegmentCategory `json:"category"`
	IsRecurring   bool                       `json:"is_recurring"`
}

type GetScheduleSegmentCategory added in v2.24.0

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

type GetScheduleVacation added in v2.24.0

type GetScheduleVacation struct {
	StartTime Time `json:"start_time"`
	EndTime   Time `json:"end_time"`
}

type GetUserChatColorParams added in v2.20.0

type GetUserChatColorParams struct {
	UserID string `json:"user_id"`
}

GetUserChatColorParams are the parameters for GetUserChatColor

type GetUserChatColorResponse added in v2.20.0

type GetUserChatColorResponse struct {
	Data []GetUserChatColorUser `json:"data"`
}

GetUserChatColorResponse is the response data in UserChatColorResponse

type GetUserChatColorUser added in v2.20.0

type GetUserChatColorUser struct {
	UserID    string `json:"user_id"`
	UserLogin string `json:"user_login"`
	UserName  string `json:"user_name"`
	Color     string `json:"color"`
}

GetUserChatColorUser describes the user and their color

type GlobalCooldownSettings

type GlobalCooldownSettings struct {
	IsEnabled             bool `json:"is_enabled"`
	GlobalCooldownSeconds int  `json:"global_cooldown_seconds"`
}

type Goal added in v2.2.0

type Goal struct {
	ID               string `json:"id"`
	BroadcasterID    string `json:"broadcaster_id"`
	BroadcasterName  string `json:"broadcaster_name"`
	BroadcasterLogin string `json:"broadcaster_login"`
	Type             string `json:"type"`
	Description      string `json:"description"`
	CurrentAmount    int    `json:"current_amount"`
	TargetAmount     int    `json:"target_amount"`
	CreatedAt        Time   `json:"created_at"`
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type HeldMessageModerationParams

type HeldMessageModerationParams struct {
	UserID string `query:"user_id"`
	MsgID  string `query:"msg_id"`
	Action string `query:"action"` // Must be "ALLOW" or "DENY".
}

type HeldMessageModerationResponse

type HeldMessageModerationResponse struct {
	ResponseCommon
}

type HypeTrainContribuition

type HypeTrainContribuition struct {
	Total int64  `json:"total"`
	Type  string `json:"type"`
	User  string `json:"user"`
}

type HypeTrainEvent

type HypeTrainEvent struct {
	ID             string             `json:"id"`
	EventType      string             `json:"event_type"`
	EventTimestamp Time               `json:"event_timestamp"`
	Version        string             `json:"version"`
	Event          HypeTrainEventData `json:"event_data"`
}

type HypeTrainEventData

type HypeTrainEventData struct {
	ID               string                   `json:"id"`
	BroadcasterID    string                   `json:"broadcaster_id"`
	CooldownEndTime  Time                     `json:"cooldown_end_time"`
	ExpiresAt        Time                     `json:"expires_at"`
	Goal             int64                    `json:"goal"`
	LastContribution HypeTrainContribuition   `json:"last_contribution"`
	Level            int64                    `json:"level"`
	StartedAt        Time                     `json:"started_at"`
	TopContributions []HypeTrainContribuition `json:"top_contributions"`
	Total            int64                    `json:"total"`
}

type HypeTrainEventsParams

type HypeTrainEventsParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	After         string `query:"after"`
	First         int    `query:"first,20"` // Limit 100
	ID            string `query:"id"`
}

type HypeTrainEventsResponse

type HypeTrainEventsResponse struct {
	ResponseCommon
	Data ManyHypeTrainEvents
}

type ManyAdDetails

type ManyAdDetails struct {
	AdDetails []AdDetails `json:"data"`
}

type ManyAddBlockedTerms added in v2.10.0

type ManyAddBlockedTerms struct {
	Terms []BlockedTerm `json:"data"`
}

type ManyBanUser added in v2.9.0

type ManyBanUser struct {
	Bans []BanUser `json:"data"`
}

type ManyBans

type ManyBans struct {
	Bans       []Ban      `json:"data"`
	Pagination Pagination `json:"pagination"`
}

type ManyBlockedTerms added in v2.10.0

type ManyBlockedTerms struct {
	Terms      []BlockedTerm `json:"data"`
	Pagination Pagination    `json:"pagination"`
}

type ManyChannelCustomRewards

type ManyChannelCustomRewards struct {
	ChannelCustomRewards []ChannelCustomReward `json:"data"`
}

type ManyChannelCustomRewardsRedemptions added in v2.21.0

type ManyChannelCustomRewardsRedemptions struct {
	Redemptions []ChannelCustomRewardsRedemption `json:"data"`
}

type ManyChannelEditors

type ManyChannelEditors struct {
	ChannelEditors []ChannelEditor `json:"data"`
}

type ManyChannelFollows added in v2.16.0

type ManyChannelFollows struct {
	Channels   []ChannelFollow `json:"data"`
	Pagination Pagination      `json:"pagination"`
	Total      int             `json:"total"`
}

ManySearchChannels is the response data from SearchChannels

type ManyChannelInformation

type ManyChannelInformation struct {
	Channels []ChannelInformation `json:"data"`
}

type ManyChannelVips added in v2.17.0

type ManyChannelVips struct {
	ChannelsVips []ChannelVips `json:"data"`
	Pagination   Pagination    `json:"pagination"`
}

type ManyCharityCampaigns added in v2.7.0

type ManyCharityCampaigns struct {
	Campaigns  []CharityCampaignData `json:"data"`
	Pagination Pagination            `json:"pagination"`
}

type ManyCharityDonations added in v2.12.0

type ManyCharityDonations struct {
	Donations  []CharityDonationData `json:"data"`
	Pagination Pagination            `json:"pagination"`
}

type ManyChatBadge

type ManyChatBadge struct {
	Badges []ChatBadge `json:"data"`
}

type ManyChatChatters added in v2.8.0

type ManyChatChatters struct {
	Chatters   []ChatChatter `json:"data"`
	Pagination Pagination    `json:"pagination"`
	Total      int           `json:"total"`
}

type ManyChatMessages added in v2.26.0

type ManyChatMessages struct {
	Messages []ChatMessage `json:"data"`
}

type ManyChatSettings added in v2.14.0

type ManyChatSettings struct {
	Settings []ChatSettings `json:"data"`
}

type ManyCheermotes

type ManyCheermotes struct {
	Cheermotes []Cheermotes `json:"data"`
}

type ManyClipEditURLs

type ManyClipEditURLs struct {
	ClipEditURLs []ClipEditURL `json:"data"`
}

type ManyClips

type ManyClips struct {
	Clips      []Clip     `json:"data"`
	Pagination Pagination `json:"pagination"`
}

type ManyCodes

type ManyCodes struct {
	Codes []CodeStatus `json:"data"`
}

type ManyCreateStreamMarkers

type ManyCreateStreamMarkers struct {
	CreateStreamMarkers []CreateStreamMarker `json:"data"`
}

type ManyDropReasons added in v2.26.0

type ManyDropReasons struct {
	Data DropReason
}

type ManyEmotes

type ManyEmotes struct {
	Emotes []Emote `json:"data"`
}

type ManyEmotesWithOwner

type ManyEmotesWithOwner struct {
	Emotes []EmoteWithOwner `json:"data"`
}

type ManyEntitlements

type ManyEntitlements struct {
	Entitlements []Entitlement `json:"data"`
}

type ManyEntitlementsUploadURLs

type ManyEntitlementsUploadURLs struct {
	URLs []EntitlementsUploadURL `json:"data"`
}

type ManyEntitlementsWithPagination

type ManyEntitlementsWithPagination struct {
	ManyEntitlements
	Pagination `json:"pagination"`
}

type ManyEventSubSubscriptions

type ManyEventSubSubscriptions struct {
	Total                 int                    `json:"total"`
	TotalCost             int                    `json:"total_cost"`
	MaxTotalCost          int                    `json:"max_total_cost"`
	EventSubSubscriptions []EventSubSubscription `json:"data"`
	Pagination            Pagination             `json:"pagination"`
}

Twitch Response for getting all current subscriptions

type ManyExtensionAnalytics

type ManyExtensionAnalytics struct {
	ExtensionAnalytics []ExtensionAnalytic `json:"data"`
	Pagination         Pagination          `json:"pagination"`
}

type ManyExtensionConfigurationSegments

type ManyExtensionConfigurationSegments struct {
	Segments []ExtensionConfigurationSegment `json:"data"`
}

type ManyExtensionLiveChannels added in v2.3.0

type ManyExtensionLiveChannels struct {
	LiveChannels []ExtensionLiveChannel `json:"data"`
	Pagination   string                 `json:"pagination"`
}

type ManyExtensionSecrets

type ManyExtensionSecrets struct {
	SecretInfo []SecretsInformation `json:"data"`
}

type ManyExtensionTransactions

type ManyExtensionTransactions struct {
	ExtensionTransactions []ExtensionTransaction `json:"data"`
	Pagination            Pagination             `json:"pagination"`
}

type ManyFollowedChannels added in v2.16.0

type ManyFollowedChannels struct {
	FollowedChannels []FollowedChannel `json:"data"`
	Pagination       Pagination        `json:"pagination"`
	Total            int64             `json:"total"`
}

ManySearchChannels is the response data from SearchChannels

type ManyFollows

type ManyFollows struct {
	Total      int          `json:"total"`
	Follows    []UserFollow `json:"data"`
	Pagination Pagination   `json:"pagination"`
}

type ManyGameAnalytics

type ManyGameAnalytics struct {
	GameAnalytics []GameAnalytic `json:"data"`
	Pagination    Pagination     `json:"pagination"`
}

type ManyGames

type ManyGames struct {
	Games []Game `json:"data"`
}

type ManyGamesWithPagination

type ManyGamesWithPagination struct {
	ManyGames
	Pagination Pagination `json:"pagination"`
}

type ManyGoals added in v2.2.0

type ManyGoals struct {
	Goals      []Goal     `json:"data"`
	Pagination Pagination `json:"pagination"`
}

type ManyHypeTrainEvents

type ManyHypeTrainEvents struct {
	Events     []HypeTrainEvent `json:"data"`
	Pagination Pagination       `json:"pagination"`
}

type ManyModerators added in v2.14.0

type ManyModerators struct {
	Moderators []Moderator `json:"data"`
	Pagination Pagination  `json:"pagination"`
}

type ManyPolls

type ManyPolls struct {
	Polls      []Poll     `json:"data"`
	Pagination Pagination `json:"pagination"`
}

type ManyPredictions

type ManyPredictions struct {
	Predictions []Prediction `json:"data"`
	Pagination  Pagination   `json:"pagination"`
}

type ManySearchCategories added in v2.18.0

type ManySearchCategories struct {
	Categories []Category `json:"data"`
	Pagination Pagination `json:"pagination"`
}

ManySearchCategories is the response data from SearchCategories

type ManySearchChannels

type ManySearchChannels struct {
	Channels   []Channel  `json:"data"`
	Pagination Pagination `json:"pagination"`
}

ManySearchChannels is the response data from SearchChannels

type ManyStreamKeys added in v2.4.0

type ManyStreamKeys struct {
	Data []struct {
		StreamKey string `json:"stream_key"`
	} `json:"data"`
}

type ManyStreamMarkers

type ManyStreamMarkers struct {
	StreamMarkers []StreamMarker `json:"data"`
	Pagination    Pagination     `json:"pagination"`
}

type ManyStreams

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

type ManySubscriptions

type ManySubscriptions struct {
	Subscriptions []Subscription `json:"data"`
	Pagination    Pagination     `json:"pagination"`
	Total         int            `json:"total"`
	Points        int            `json:"points"` // Each Tier 1 is worth 1, Tier 2 is worth 2, and Tier 3 is worth 6
}

type ManyUpdatedEntitlementSet added in v2.1.0

type ManyUpdatedEntitlementSet struct {
	EntitlementSets []UpdatedEntitlementSet `json:"data"`
}

type ManyUserBitTotals

type ManyUserBitTotals struct {
	Total         int            `json:"total"`
	DateRange     DateRange      `json:"date_range"`
	UserBitTotals []UserBitTotal `json:"data"`
}

type ManyUserExtensions

type ManyUserExtensions struct {
	UserExtensions []UserExtension `json:"data"`
}

type ManyUserSubscriptions

type ManyUserSubscriptions struct {
	UserSubscriptions []UserSubscription `json:"data"`
}

type ManyUsers

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

type ManyUsersBlocked

type ManyUsersBlocked struct {
	Users      []UserBlocked `json:"data"`
	Pagination Pagination    `json:"pagination"`
}

type ManyVideos

type ManyVideos struct {
	Videos     []Video    `json:"data"`
	Pagination Pagination `json:"pagination"`
}

type ManyWebhookSubscriptions

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

type Marker

type Marker struct {
	ID              string `json:"id"`
	CreatedAt       Time   `json:"created_at"`
	Description     string `json:"description"`
	PositionSeconds int    `json:"position_seconds"`
	URL             string `json:"URL"`
}

type MaxPerStreamSettings

type MaxPerStreamSettings struct {
	IsEnabled    bool `json:"is_enabled"`
	MaxPerStream int  `json:"max_per_stream"`
}

type MaxPerUserPerStreamSettings

type MaxPerUserPerStreamSettings struct {
	IsEnabled           bool `json:"is_enabled"`
	MaxPerUserPerStream int  `json:"max_per_user_per_stream"`
}

type Moderator added in v2.14.0

type Moderator struct {
	UserID    string `json:"user_id"`
	UserLogin string `json:"user_login"`
	UserName  string `json:"user_name"`
}

type ModeratorsResponse added in v2.14.0

type ModeratorsResponse struct {
	ResponseCommon
	Data ManyModerators
}

type Options

type Options struct {
	ClientID        string
	ClientSecret    string
	AppAccessToken  string
	UserAccessToken string
	RefreshToken    string
	UserAgent       string
	RedirectURI     string
	HTTPClient      HTTPClient
	RateLimitFunc   RateLimitFunc
	APIBaseURL      string
	ExtensionOpts   ExtensionOptions
}

type Outcomes

type Outcomes struct {
	ID            string         `json:"id"`
	Title         string         `json:"title"`
	Users         int            `json:"users"`
	ChannelPoints int            `json:"channel_points"`
	TopPredictors []TopPredictor `json:"top_predictors"`
	Color         string         `json:"color"`
}

type Pagination

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

type Poll

type Poll struct {
	ID                         string       `json:"id"`
	BroadcasterID              string       `json:"broadcaster_id"`
	BroadcasterLogin           string       `json:"broadcaster_login"`
	BroadcasterName            string       `json:"broadcaster_name"`
	Title                      string       `json:"title"`
	Choices                    []PollChoice `json:"choices"`
	BitsVotingEnabled          bool         `json:"bits_voting_enabled"`
	BitsPerVote                int          `json:"bits_per_vote"`
	ChannelPointsVotingEnabled bool         `json:"channel_points_voting_enabled"`
	ChannelPointsPerVote       int          `json:"channel_points_per_vote"`
	Status                     string       `json:"status"`
	Duration                   int          `json:"duration"`
	StartedAt                  Time         `json:"started_at"`
	EndedAt                    Time         `json:"ended_at"`
}

type PollChoice

type PollChoice struct {
	ID                 string `json:"id"`
	Title              string `json:"title"`
	BitsVotes          int    `json:"bits_votes"`
	ChannelPointsVotes int    `json:"channel_points_votes"`
	Votes              int    `json:"votes"`
}

type PollChoiceParam

type PollChoiceParam struct {
	Title string `json:"title"` // Maximum: 25 characters.
}

type PollsParams

type PollsParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	ID            string `query:"id"`
	After         string `query:"after"`
	First         string `query:"first"`
}

type PollsResponse

type PollsResponse struct {
	ResponseCommon
	Data ManyPolls
}

type Prediction

type Prediction struct {
	ID                   string     `json:"id"`
	BroadcasterUserID    string     `json:"broadcaster_id"`
	BroadcasterUserLogin string     `json:"broadcaster_login"`
	BroadcasterUserName  string     `json:"broadcaster_name"`
	Title                string     `json:"title"`
	WinningOutcomeID     string     `json:"winning_outcome_id"`
	Outcomes             []Outcomes `json:"outcomes"`
	PredictionWindow     int        `json:"prediction_window"`
	Status               string     `json:"status"`
	CreatedAt            Time       `json:"created_at"`
	EndedAt              Time       `json:"ended_at"`
	LockedAt             Time       `json:"locked_at"`
}

Prediction ... same struct as Poll

type PredictionChoiceParam

type PredictionChoiceParam struct {
	Title string `json:"title"` // Maximum: 25 characters.
}

type PredictionsParams

type PredictionsParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	ID            string `query:"id"`
	After         string `query:"after"`
	First         string `query:"first"`
}

type PredictionsResponse

type PredictionsResponse struct {
	ResponseCommon
	Data ManyPredictions
}

type PubSubPermissions

type PubSubPermissions struct {
	Send   []ExtensionPubSubPublishType `json:"send,omitempty"`
	Listen []ExtensionPubSubPublishType `json:"listen,omitempty"`
}

PubSubPermissions publish permissions used within JWT claims

type RaidDetails added in v2.19.0

type RaidDetails struct {
	CreatedAt Time `json:"created_at"`
	IsMature  bool `json:"is_mature"`
}

RaidDetails describes details of the ongoing raid

type RaidResponse added in v2.19.0

type RaidResponse struct {
	ResponseCommon
	Data StartRaidResponse
}

RaidResponse is the response from StartRaid

type RateLimitFunc

type RateLimitFunc func(*Response) error

type RefreshTokenResponse

type RefreshTokenResponse struct {
	ResponseCommon
	Data AccessCredentials
}

type RemoveBlockedTermParams added in v2.10.0

type RemoveBlockedTermParams struct {
	BroadcasterID string `json:"broadcaster_id"`
	ModeratorID   string `json:"moderator_id"`
	ID            string `json:"id"`
}

type RemoveBlockedTermResponse added in v2.10.0

type RemoveBlockedTermResponse struct {
	ResponseCommon
}

type RemoveChannelModeratorParams added in v2.22.0

type RemoveChannelModeratorParams struct {
	UserID        string `query:"user_id"`
	BroadcasterID string `query:"broadcaster_id"`
}

type RemoveChannelModeratorResponse added in v2.22.0

type RemoveChannelModeratorResponse struct {
	ResponseCommon
}

type RemoveChannelVipParams added in v2.17.0

type RemoveChannelVipParams struct {
	UserID        string `query:"user_id"`        // required
	BroadcasterID string `query:"broadcaster_id"` // required
}

type RemoveChannelVipResponse added in v2.17.0

type RemoveChannelVipResponse struct {
	ResponseCommon
}

type RemoveEventSubSubscriptionParams

type RemoveEventSubSubscriptionParams struct {
	ID string `query:"id"`
}

Parameter for removing a subscription.

type RemoveEventSubSubscriptionParamsResponse

type RemoveEventSubSubscriptionParamsResponse struct {
	ResponseCommon
}

Response for removing a subscription

type Response

type Response struct {
	ResponseCommon
	Data interface{}
}

func (*Response) HydrateResponseCommon

func (r *Response) HydrateResponseCommon(rc *ResponseCommon)

HydrateResponseCommon copies the content of the source response's ResponseCommon to the supplied ResponseCommon argument

type ResponseCommon

type ResponseCommon struct {
	StatusCode   int
	Header       http.Header
	Error        string `json:"error"`
	ErrorStatus  int    `json:"status"`
	ErrorMessage string `json:"message"`
}

func (*ResponseCommon) GetRateLimit

func (rc *ResponseCommon) GetRateLimit() int

GetRateLimit returns the "RateLimit-Limit" header as an int.

func (*ResponseCommon) GetRateLimitRemaining

func (rc *ResponseCommon) GetRateLimitRemaining() int

GetRateLimitRemaining returns the "RateLimit-Remaining" header as an int.

func (*ResponseCommon) GetRateLimitReset

func (rc *ResponseCommon) GetRateLimitReset() int

GetRateLimitReset returns the "RateLimit-Reset" header as an int.

type RevokeAccessTokenResponse

type RevokeAccessTokenResponse struct {
	ResponseCommon
}

type RewardImage

type RewardImage struct {
	Url1x string `json:"url_1x"`
	Url2x string `json:"url_2x"`
	Url4x string `json:"url_4x"`
}

type RoleType

type RoleType string

RoleType The user role type

const (
	BroadcasterRole RoleType = "broadcaster"
	ExternalRole    RoleType = "external"
	ModeratorRole   RoleType = "moderator"
	ViewerRole      RoleType = "viewer"
)

Types of user roles used within the JWT Claims

type ScheduleData added in v2.24.0

type ScheduleData struct {
	Segments         []GetScheduleSegment `json:"segments"`
	BroadcasterID    string               `json:"broadcaster_id"`
	BroadcasterName  string               `json:"broadcaster_name"`
	BroadcasterLogin string               `json:"broadcaster_login"`
	Vacation         GetScheduleVacation  `json:"vacation"`
}

type SearchCategoriesParams added in v2.18.0

type SearchCategoriesParams struct {
	Query string `query:"query"`
	After string `query:"after"`
	First int    `query:"first,20"` // Limit 100
}

SearchCategoriesParams is parameters for SearchCategories

type SearchCategoriesResponse added in v2.18.0

type SearchCategoriesResponse struct {
	ResponseCommon
	Data ManySearchCategories
}

SearchCategoriesResponse is the response from SearchCategories

type SearchChannelsParams

type SearchChannelsParams struct {
	Channel  string `query:"query"`
	After    string `query:"after"`
	First    int    `query:"first,20"` // Limit 100
	LiveOnly bool   `query:"live_only"`
}

SearchChannelsParams is parameters for SearchChannels

type SearchChannelsResponse

type SearchChannelsResponse struct {
	ResponseCommon
	Data ManySearchChannels
}

SearchChannelsResponse is the response from SearchChannels

type Secret

type Secret struct {
	ActiveAt Time   `json:"active_at"`
	Content  string `json:"content"`
	Expires  Time   `json:"expires_at"`
}

Secret information about a generated secret

type SecretsInformation

type SecretsInformation struct {
	Version int      `json:"format_version"`
	Secrets []Secret `json:"secrets"`
}

type SendChatAnnouncementParams added in v2.6.0

type SendChatAnnouncementParams struct {
	BroadcasterID string `query:"broadcaster_id"` // required
	ModeratorID   string `query:"moderator_id"`   // required
	Message       string `json:"message"`         // upto 500 chars, thereafter str is truncated
	// blue || green || orange || purple are valid, default 'primary' or empty str result in channel accent color.
	Color string `json:"color"`
}

type SendChatAnnouncementResponse added in v2.6.0

type SendChatAnnouncementResponse struct {
	ResponseCommon
}

type SendChatMessageParams added in v2.26.0

type SendChatMessageParams struct {
	// The ID of the broadcaster whose chat room the message will be sent to
	BroadcasterID string `json:"broadcaster_id"`

	// The ID of the user sending the message. This ID must match the user ID in the user access token
	SenderID string `json:"sender_id"`

	// The message to send. The message is limited to a maximum of 500 characters.
	// Chat messages can also include emoticons.
	// To include emoticons, use the name of the emote.
	// The names are case sensitive.
	// Don’t include colons around the name (e.g., :bleedPurple:).
	// If Twitch recognizes the name, Twitch converts the name to the emote before writing the chat message to the chat room
	Message string `json:"message"`

	// The ID of the chat message being replied to
	ReplyParentMessageID string `json:"reply_parent_message_id,omitempty"`
}

type SendShoutoutParams added in v2.15.0

type SendShoutoutParams struct {
	FromBroadcasterID string `query:"from_broadcaster_id"` // required
	ToBroadcasterID   string `query:"to_broadcaster_id"`   // required
	ModeratorID       string `query:"moderator_id"`        // required
}

type SendShoutoutResponse added in v2.15.0

type SendShoutoutResponse struct {
	ResponseCommon
}

type SendUserWhisperParams added in v2.13.0

type SendUserWhisperParams struct {
	FromUserID string `query:"from_user_id"`
	ToUserID   string `query:"to_user_id"`
	Message    string `json:"message"`
}

type SendUserWhisperResponse added in v2.13.0

type SendUserWhisperResponse struct {
	ResponseCommon
}

type StartCommercialParams

type StartCommercialParams struct {
	BroadcasterID string       `query:"broadcaster_id"`
	Length        AdLengthEnum `query:"length"`
}

type StartCommercialResponse

type StartCommercialResponse struct {
	ResponseCommon
	Data ManyAdDetails
}

type StartRaidParams added in v2.19.0

type StartRaidParams struct {
	FromBroadcasterID string `query:"from_broadcaster_id"`
	ToBroadcasterID   string `query:"to_broadcaster_id"`
}

StartRaidParams are the parameters for StartRaid

type StartRaidResponse added in v2.19.0

type StartRaidResponse struct {
	Data []RaidDetails `json:"data"`
}

StartRaidResponse is the response data in RaidResponse

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"`
	TagIDs       []string  `json:"tag_ids"`
	Tags         []string  `json:"tags"`
	IsMature     bool      `json:"is_mature"`
	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"`
}

type StreamKeyParams added in v2.4.0

type StreamKeyParams struct {
	BroadcasterID string `query:"broadcaster_id"`
}

type StreamKeysResponse added in v2.4.0

type StreamKeysResponse struct {
	ResponseCommon
	Data ManyStreamKeys
}

type StreamMarker

type StreamMarker struct {
	UserID    string        `json:"user_id"`
	UserName  string        `json:"user_name"`
	UserLogin string        `json:"user_login"`
	Videos    []VideoMarker `json:"videos"`
}

type StreamMarkersParams

type StreamMarkersParams struct {
	UserID  string `query:"user_id"`
	VideoID string `query:"video_id"`

	// Optional
	After  string `query:"after"`
	Before string `query:"before"`
	First  int    `query:"first,20"` // Limit 100
}

StreamMarkersParams requires _either_ UserID or VideoID set

UserID: fetches stream markers of the current livestream of the given user (VOD recording must be enabled). VideoID: fetches streams markers of the VOD.

type StreamMarkersResponse

type StreamMarkersResponse struct {
	ResponseCommon
	Data ManyStreamMarkers
}

type StreamsParams

type StreamsParams struct {
	After      string   `query:"after"`
	Before     string   `query:"before"`
	First      int      `query:"first,20"`   // Limit 100
	GameIDs    []string `query:"game_id"`    // Limit 100
	Language   []string `query:"language"`   // Limit 100
	Type       string   `query:"type,all"`   // "all" (default), "live" and "vodcast"
	UserIDs    []string `query:"user_id"`    // limit 100
	UserLogins []string `query:"user_login"` // limit 100
}

type StreamsResponse

type StreamsResponse struct {
	ResponseCommon
	Data ManyStreams
}

type Subscription

type Subscription struct {
	BroadcasterID    string `json:"broadcaster_id"`
	BroadcasterLogin string `json:"broadcaster_login"`
	BroadcasterName  string `json:"broadcaster_name"`
	IsGift           bool   `json:"is_gift"`
	GifterID         string `json:"gifter_id"`
	GifterLogin      string `json:"gifter_login"`
	GifterName       string `json:"gifter_name"`
	Tier             string `json:"tier"`
	PlanName         string `json:"plan_name"`
	UserID           string `json:"user_id"`
	UserName         string `json:"user_name"`
	UserLogin        string `json:"user_login"`
}

type SubscriptionsParams

type SubscriptionsParams struct {
	BroadcasterID string   `query:"broadcaster_id"` // Limit 1
	UserID        []string `query:"user_id"`        // Limit 100
	After         string   `query:"after"`
	Before        string   `query:"before"`
	First         int      `query:"first,20"` // Limit 100
}

type SubscriptionsResponse

type SubscriptionsResponse struct {
	ResponseCommon
	Data ManySubscriptions
}

type TierImageTypes

type TierImageTypes struct {
	Animated TierImages `json:"animated"`
	Static   TierImages `json:"static"`
}

type TierImages

type TierImages struct {
	Image1   string `json:"1"`
	Image1_5 string `json:"1.5"`
	Image2   string `json:"2"`
	Image3   string `json:"3"`
	Image4   string `json:"4"`
}

type Time

type Time struct {
	time.Time
}

Time is our custom time struct.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON is our custom datetime unmarshaller. Twitch sometimes returns datetimes as empty strings, which casuses issues with the native time UnmarshalJSON method when decoding the JSON string. Here we handle that scenario, by returning a zero time value for any JSON time field that is either an empty string or "null".

type TopGamesParams

type TopGamesParams struct {
	After  string `query:"after"`
	Before string `query:"before"`
	First  int    `query:"first,20"` // Limit 100
}

type TopGamesResponse

type TopGamesResponse struct {
	ResponseCommon
	Data ManyGamesWithPagination
}

type TopPredictor

type TopPredictor struct {
	UserID            string `json:"user_id"`
	UserName          string `json:"user_name"`
	UserLogin         string `json:"user_login"`
	ChannelPointsUsed int    `json:"channel_points_used"`
	ChannelPointsWon  int    `json:"channel_points_won"`
}

type TwitchJWTClaims

type TwitchJWTClaims struct {
	OpaqueUserID string             `json:"opaque_user_id,omitempty"`
	UserID       string             `json:"user_id"`
	ChannelID    string             `json:"channel_id,omitempty"`
	Role         RoleType           `json:"role"`
	Unlinked     bool               `json:"is_unlinked,omitempty"`
	Permissions  *PubSubPermissions `json:"pubsub_perms"`
	jwt.StandardClaims
}

TwitchJWTClaims contains information containing twitch specific JWT information.

type UnbanUserParams added in v2.9.0

type UnbanUserParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	ModeratorID   string `query:"moderator_id"`
	UserID        string `query:"user_id"`
}

type UnbanUserResponse added in v2.9.0

type UnbanUserResponse struct {
	ResponseCommon
}

type UnblockUserParams

type UnblockUserParams struct {
	TargetUserID string `query:"target_user_id"`
}

type UpdateChannelCustomRewardsParams added in v2.14.0

type UpdateChannelCustomRewardsParams struct {
	ID                                string `query:"id"`
	BroadcasterID                     string `query:"broadcaster_id"`
	Title                             string `json:"title"`
	Cost                              int    `json:"cost"`
	Prompt                            string `json:"prompt"`
	IsEnabled                         bool   `json:"is_enabled"`
	BackgroundColor                   string `json:"background_color,omitempty"`
	IsUserInputRequired               bool   `json:"is_user_input_required"`
	IsMaxPerStreamEnabled             bool   `json:"is_max_per_stream_enabled"`
	MaxPerStream                      int    `json:"max_per_stream"`
	IsMaxPerUserPerStreamEnabled      bool   `json:"is_max_per_user_per_stream_enabled"`
	MaxPerUserPerStream               int    `json:"max_per_user_per_stream"`
	IsGlobalCooldownEnabled           bool   `json:"is_global_cooldown_enabled"`
	GlobalCooldownSeconds             int    `json:"global_cooldown_seconds"`
	ShouldRedemptionsSkipRequestQueue bool   `json:"should_redemptions_skip_request_queue"`
}

type UpdateChannelCustomRewardsRedemptionStatusParams added in v2.21.0

type UpdateChannelCustomRewardsRedemptionStatusParams struct {
	ID            string `query:"id"`
	BroadcasterID string `query:"broadcaster_id"`
	RewardID      string `query:"reward_id"`
	Status        string `json:"status"`
}

type UpdateChatSettingsParams added in v2.17.0

type UpdateChatSettingsParams struct {
	// Required, the ID of the broadcaster whose chat settings you want to update
	BroadcasterID string `query:"broadcaster_id"`

	// Required, the ID of a user that has moderator privileges in the BroadcasterID's channel.
	// The ID must match the specified User Access Token
	ModeratorID string `query:"moderator_id"`

	// Optional, set to true if only emotes are allowed
	// If unset (i.e. nil), no change to this setting will be made
	EmoteMode *bool `json:"emote_mode,omitempty"`

	// Optional, set to true if only followers may chat
	// If unset (i.e. nil), no change to this setting will be made
	FollowerMode *bool `json:"follower_mode,omitempty"`

	// Optional, time in minutes a user must have been following to chat.
	// If unset (i.e. nil), no change to this setting will be made
	// If set, FollowerMode must be set to true.
	// Possible values are 0 (no time restriction) through 129600 (3 months)
	FollowerModeDuration *int `json:"follower_mode_duration,omitempty"`

	// Optional, set to true if there's a delay before chat messages appear for non-moderators
	// If unset (i.e. nil), no change to this setting will be made
	NonModeratorChatDelay *bool `json:"non_moderator_chat_delay,omitempty"`

	// Optional, time in seconds before messages appear for non-moderators
	// If unset (i.e. nil), no change to this setting will be made
	// If set, FollowerMode must be set to true.
	// Possible values are 2, 4, or 6
	NonModeratorChatDelayDuration *int `json:"non_moderator_chat_delay_duration,omitempty"`

	// Optional, set to true if chatters must wait some extra time between sending more messages
	// If unset (i.e. nil), no change to this setting will be made
	SlowMode *bool `json:"slow_mode,omitempty"`

	// Optional, time in seconds chatters must wait between sending messages
	// If unset (i.e. nil), no change to this setting will be made
	// If set, SlowMode must be set to true.
	// Possible values are 3 through 120 seconds
	SlowModeWaitTime *int `json:"slow_mode_wait_time,omitempty"`

	// Optional, set to true if only subscribers may chat
	// If unset (i.e. nil), no change to this setting will be made
	SubscriberMode *bool `json:"subscriber_mode,omitempty"`

	// Optional, set to true if users may only post "unique messages" in chat
	// If unset (i.e. nil), no change to this setting will be made
	UniqueChatMode *bool `json:"unique_chat_mode,omitempty"`
}

type UpdateChatSettingsResponse added in v2.17.0

type UpdateChatSettingsResponse struct {
	ResponseCommon
	Data ManyChatSettings
}

type UpdateDropsEntitlementsParams added in v2.1.0

type UpdateDropsEntitlementsParams struct {
	EntitlementIDs    []string `json:"entitlement_ids"`    // Limit 100
	FulfillmentStatus string   `json:"fulfillment_status"` // Valid values "CLAIMED", "FULFILLED"
}

type UpdateDropsEntitlementsResponse added in v2.1.0

type UpdateDropsEntitlementsResponse struct {
	ResponseCommon
	Data ManyUpdatedEntitlementSet
}

type UpdateScheduleParams added in v2.24.0

type UpdateScheduleParams struct {
	BroadcasterID     string `json:"broadcaster_id"`
	IsVacationEnabled bool   `json:"is_vacation_enabled"`
	VacationStartTime Time   `json:"vacation_start_time"`
	VacationEndTime   Time   `json:"vacation_end_time"`
	Timezone          string `json:"timezone"`
}

type UpdateScheduleResponse added in v2.24.0

type UpdateScheduleResponse struct {
	ResponseCommon
}

type UpdateScheduleSegmentData added in v2.24.0

type UpdateScheduleSegmentData struct {
	Schedule ScheduleData `json:"data"`
}

type UpdateScheduleSegmentParams added in v2.24.0

type UpdateScheduleSegmentParams struct {
	BroadcasterID string `json:"broadcaster_id"`
	ID            string `json:"id"`
	StartTime     Time   `json:"start_time"`
	Duration      string `json:"duration"`
	CategoryID    string `json:"category_id"`
	Title         string `json:"title"`
	IsCanceled    bool   `json:"is_canceled"`
	Timezone      string `json:"timezone"`
}

type UpdateScheduleSegmentResponse added in v2.24.0

type UpdateScheduleSegmentResponse struct {
	ResponseCommon

	Data UpdateScheduleSegmentData
}

type UpdateUserChatColorParams added in v2.20.0

type UpdateUserChatColorParams struct {
	UserID string `query:"user_id"`
	Color  string `query:"color"`
}

UpdateUserChatColorParams are the parameters for UpdateUserChatColor

type UpdateUserChatColorResponse added in v2.20.0

type UpdateUserChatColorResponse struct {
	ResponseCommon
}

UpdateUserChatColorResponse is the response for UpdateUserChatColor

type UpdateUserExtensionsPayload

type UpdateUserExtensionsPayload struct {
	Component map[string]UserActiveExtensionInfo `json:"component,omitempty"`
	Overlay   map[string]UserActiveExtensionInfo `json:"overlay,omitempty"`
	Panel     map[string]UserActiveExtensionInfo `json:"panel,omitempty"`
}

type UpdateUserParams

type UpdateUserParams struct {
	Description string `query:"description"`
}

type UpdatedEntitlementSet added in v2.1.0

type UpdatedEntitlementSet struct {
	Status string   `json:"status"` // Valid values "SUCCESS", "INVALID_ID", "NOT_FOUND", "UNAUTHORIZED", "UPDATE_FAILED"
	IDs    []string `json:"ids"`
}

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   `json:"created_at"`
}

type UserAccessTokenResponse

type UserAccessTokenResponse struct {
	ResponseCommon
	Data AccessCredentials
}

type UserActiveExtension

type UserActiveExtension struct {
	Component map[string]UserActiveExtensionInfo `json:"component"`
	Overlay   map[string]UserActiveExtensionInfo `json:"overlay"`
	Panel     map[string]UserActiveExtensionInfo `json:"panel"`
}

type UserActiveExtensionInfo

type UserActiveExtensionInfo struct {
	Active  bool   `json:"active"`
	ID      string `json:"id"`
	Name    string `json:"name"`
	Version string `json:"version"`
	X       int    `json:"x"`
	Y       int    `json:"y"`
}

type UserActiveExtensionSet

type UserActiveExtensionSet struct {
	UserActiveExtensions UserActiveExtension `json:"data"`
}

type UserActiveExtensionsParams

type UserActiveExtensionsParams struct {
	UserID string `query:"user_id"` // Optional, limit 1
}

type UserActiveExtensionsResponse

type UserActiveExtensionsResponse struct {
	ResponseCommon
	Data UserActiveExtensionSet
}

type UserBitTotal

type UserBitTotal struct {
	UserID    string `json:"user_id"`
	UserLogin string `json:"user_login"`
	UserName  string `json:"user_name"`
	Rank      int    `json:"rank"`
	Score     int    `json:"score"`
}

type UserBlocked

type UserBlocked struct {
	UserID      string `json:"user_id"`
	UserLogin   string `json:"user_login"`
	DisplayName string `json:"display_name"`
}

type UserChatColorResponse added in v2.20.0

type UserChatColorResponse struct {
	ResponseCommon
	Data GetUserChatColorResponse
}

UserChatColorResponse is the response from GetUserChatColor

type UserExtension

type UserExtension struct {
	CanActivate bool     `json:"can_activate"`
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Type        []string `json:"type"`
	Version     string   `json:"version"`
}

type UserExtensionsResponse

type UserExtensionsResponse struct {
	ResponseCommon
	Data ManyUserExtensions
}

type UserFollow

type UserFollow 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"`
}

type UserSubscription

type UserSubscription struct {
	BroadcasterID    string `json:"broadcaster_id"`
	BroadcasterLogin string `json:"broadcaster_login"`
	BroadcasterName  string `json:"broadcaster_name"`
	IsGift           bool   `json:"is_gift"`
	GifterLogin      string `json:"gifter_login"`
	GifterName       string `json:"gifter_name"`
	Tier             string `json:"tier"`
}

type UserSubscriptionResponse

type UserSubscriptionResponse struct {
	ResponseCommon
	Data ManyUserSubscriptions
}

type UserSubscriptionsParams

type UserSubscriptionsParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	UserID        string `query:"user_id"`
}

type UsersBlockedParams

type UsersBlockedParams struct {
	BroadcasterID string `query:"broadcaster_id"`
	After         string `query:"after"`
	First         int    `query:"first,20"` // Limit 100
}

type UsersBlockedResponse

type UsersBlockedResponse struct {
	ResponseCommon
	Data ManyUsersBlocked
}

type UsersFollowsParams

type UsersFollowsParams struct {
	After  string `query:"after"`
	First  int    `query:"first,20"` // Limit 100
	FromID string `query:"from_id"`
	ToID   string `query:"to_id"`
}

type UsersFollowsResponse

type UsersFollowsResponse struct {
	ResponseCommon
	Data ManyFollows
}

type UsersParams

type UsersParams struct {
	IDs    []string `query:"id"`    // Limit 100
	Logins []string `query:"login"` // Limit 100
}

type UsersResponse

type UsersResponse struct {
	ResponseCommon
	Data ManyUsers
}

type ValidateTokenResponse

type ValidateTokenResponse struct {
	ResponseCommon
	Data validateTokenDetails
}

type Video

type Video struct {
	ID            string              `json:"id"`
	UserID        string              `json:"user_id"`
	UserLogin     string              `json:"user_login"`
	UserName      string              `json:"user_name"`
	StreamID      string              `json:"stream_id"`
	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     int                 `json:"view_count"`
	Language      string              `json:"language"`
	Type          string              `json:"type"`
	Duration      string              `json:"duration"`
	MutedSegments []VideoMutedSegment `json:"muted_segments"`
}

type VideoMarker

type VideoMarker struct {
	VideoID string   `json:"video_id"`
	Markers []Marker `json:"markers"`
}

type VideoMutedSegment

type VideoMutedSegment struct {
	Duration int `json:"duration"`
	Offest   int `json:"offset"`
}

type VideosParams

type VideosParams struct {
	IDs    []string `query:"id"`      // Limit 100
	UserID string   `query:"user_id"` // Limit 1
	GameID string   `query:"game_id"` // Limit 1

	// Optional
	After    string `query:"after"`
	Before   string `query:"before"`
	First    int    `query:"first,20"`   // Limit 100
	Language string `query:"language"`   // Limit 1
	Period   string `query:"period,all"` // "all" (default), "day", "month", and "week"
	Sort     string `query:"sort,time"`  // "time" (default), "trending", and "views"
	Type     string `query:"type,all"`   // "all" (default), "upload", "archive", and "highlight"
}

type VideosResponse

type VideosResponse struct {
	ResponseCommon
	Data ManyVideos
}

type WebhookSubscription

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

type WebhookSubscriptionPayload

type WebhookSubscriptionPayload struct {
	Mode         string `json:"hub.mode"`
	Topic        string `json:"hub.topic"`
	Callback     string `json:"hub.callback"`
	LeaseSeconds int    `json:"hub.lease_seconds,omitempty"`
	Secret       string `json:"hub.secret,omitempty"`
}

type WebhookSubscriptionResponse

type WebhookSubscriptionResponse struct {
	ResponseCommon
}

type WebhookSubscriptionsParams

type WebhookSubscriptionsParams struct {
	After string `query:"after"`
	First int    `query:"first,20"` // Limit 100
}

type WebhookSubscriptionsResponse

type WebhookSubscriptionsResponse struct {
	ResponseCommon
	Data ManyWebhookSubscriptions
}

type WebhookTopic

type WebhookTopic int

WebhookTopic is a topic that relates to a specific webhook event.

const (
	UserFollowsTopic WebhookTopic = iota
	StreamChangedTopic
	UserChangedTopic
	GameAnalyticsTopic
	ExtensionAnalyticsTopic
)

Enumerated webhook topics

func GetWebhookTopicFromRequest

func GetWebhookTopicFromRequest(req *http.Request) WebhookTopic

GetWebhookTopicFromRequest inspects the "Link" request header to determine if it matches against any recognised webhooks topics. The matched topic is returned. Otherwise -1 is returned.

Jump to

Keyboard shortcuts

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