twitch

package module
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 10 Imported by: 0

README

Twitch Eventsub

Go Report Card Software License GoDoc tests

Implements a Twitch EventSub Websocket connection

If a websocket connection has no subscriptions, then it will close automatically on twitch's end so call client.OnWelcome and subscribe there after getting the subscription ID.

Major Version Changes

v2 changes OnRawEvent from passing EventSubscription to PayloadSubscription. This allows extra information to be passed in the event instead of just the type.

Authorization

For authorization, a user access token must be used. An app access token will cause an error. See the Authorization section in the Twitch Docs

When subscribing to events using WebSockets, you must use a user access token only. The request fails if you use an app access token.

...

When subscribing to events using webhooks, you must use an app access token. The request fails if you use a user access token.

If the error below occurs, it's likely an app access token is being used instead of a user app token.

ERROR: could not subscribe to event: 400 Bad Request: {"error":"Bad Request","status":400,"message":"invalid transport and auth combination"}

Example

package main

import (
	"fmt"

	"github.com/joeyak/go-twitch-eventsub/v2"
)

var (
	userID = "<USERID>"
	accessToken = "<ACCESSTOKEN>"
	clientID = "<CLIENTID>"
)

func main() {
	client := twitch.NewClient()

	client.OnError(func(err error) {
		fmt.Printf("ERROR: %v\n", err)
	})
	client.OnWelcome(func(message twitch.WelcomeMessage) {
		fmt.Printf("WELCOME: %v\n", message)

		events := []twitch.EventSubscription{
			twitch.SubStreamOnline,
			twitch.SubStreamOffline,
		}

		for _, event := range events {
			fmt.Printf("subscribing to %s\n", event)
			_, err := twitch.SubscribeEvent(twitch.SubscribeRequest{
				SessionID:   message.Payload.Session.ID,
				ClientID:    clientID,
				AccessToken: accessToken,
				Event:       event,
				Condition: map[string]string{
					"broadcaster_user_id": userID,
				},
			})
			if err != nil {
				fmt.Printf("ERROR: %v\n", err)
				return
			}
		}
	})
	client.OnNotification(func(message twitch.NotificationMessage) {
		fmt.Printf("NOTIFICATION: %s: %#v\n", message.Payload.Subscription.Type, message.Payload.Event)
	})
	client.OnKeepAlive(func(message twitch.KeepAliveMessage) {
		fmt.Printf("KEEPALIVE: %v\n", message)
	})
	client.OnRevoke(func(message twitch.RevokeMessage) {
		fmt.Printf("REVOKE: %v\n", message)
	})
	client.OnRawEvent(func(event string, metadata twitch.MessageMetadata, subscription twitch.PayloadSubscription) {
		fmt.Printf("EVENT[%s]: %s: %s\n", subscription.Type, metadata, event)
	})

	err := client.Connect()
	if err != nil {
		fmt.Printf("Could not connect client: %v\n", err)
	}
}

Events that won't be handled

Events that are in beta will not be handled since it could change, thus possibly breaking code.

The goals event will not be handled because there is no subscription type to request it.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnClosed   = fmt.Errorf("connection closed")
	ErrNilOnWelcome = fmt.Errorf("OnWelcome function was not set")
)

Functions

This section is empty.

Types

type AutomaticChannelPointReward added in v2.0.2

type AutomaticChannelPointReward struct {
	Type          string                                   `json:"type"`
	Cost          int                                      `json:"cost"`
	UnlockedEmote AutomaticChannelPointRewardUnlockedEmote `json:"unlocked_emote"`
}

type AutomaticChannelPointRewardUnlockedEmote added in v2.0.2

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

type AutomodTerms added in v2.0.2

type AutomodTerms struct {
	Action      string   `json:"action"`
	List        string   `json:"list"`
	Terms       []string `json:"terms"`
	FromAutomod bool     `json:"from_automod"`
}

type Ban added in v2.0.2

type Ban struct {
	User
	Reason string `json:"reason"`
}

type BaseCharity

type BaseCharity struct {
	Broadcaster
	User

	CharityName        string `json:"charity_name"`
	CharityDescription string `json:"charity_description"`
	CharityWebsite     string `json:"charity_website"`
}

type Broadcaster

type Broadcaster struct {
	BroadcasterUserId    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
}

type ChatMessage added in v2.0.2

type ChatMessage struct {
	Text      string                `json:"text"`
	Fragments []ChatMessageFragment `json:"fragments"`
}

type ChatMessageCheer added in v2.0.2

type ChatMessageCheer struct {
	Bits int `json:"bits"`
}

type ChatMessageFragment added in v2.0.2

type ChatMessageFragment struct {
	Type      string                       `json:"type"`
	Text      string                       `json:"text"`
	Cheermote ChatMessageFragmentCheermote `json:"cheermote"`
	Emote     ChatMessageFragmentEmote     `json:"emote"`
	Mention   ChatMessageFragmentMention   `json:"mention"`
}

type ChatMessageFragmentCheermote added in v2.0.2

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

type ChatMessageFragmentEmote added in v2.0.2

type ChatMessageFragmentEmote struct {
	Id         string   `json:"id"`
	EmoteSetId string   `json:"emote_set_id"`
	OwnerId    string   `json:"owner_id"`
	Format     []string `json:"format"`
}

type ChatMessageFragmentMention added in v2.0.2

type ChatMessageFragmentMention User

type ChatMessageReply added in v2.0.2

type ChatMessageReply 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 ChatMessageUserBadge added in v2.0.2

type ChatMessageUserBadge struct {
	SetId string `json:"set_id"`
	Id    string `json:"id"`
	Info  string `json:"info"`
}

type ChatNotificationAnnouncement added in v2.0.2

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

type ChatNotificationBitsBadgeTier added in v2.0.2

type ChatNotificationBitsBadgeTier struct {
	Tier int `json:"tier"`
}

type ChatNotificationCharityDonation added in v2.0.2

type ChatNotificationCharityDonation struct {
	CharityName string                                `json:"charity_name"`
	Amount      ChatNotificationCharityDonationAmount `json:"amount"`
}

type ChatNotificationCharityDonationAmount added in v2.0.2

type ChatNotificationCharityDonationAmount struct {
	Value        int    `json:"value"`
	DecimalPlace int    `json:"decimal_place"`
	Currency     string `json:"currency"`
}

type ChatNotificationCommunitySubGift added in v2.0.2

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

type ChatNotificationGiftPaidUpgrade added in v2.0.2

type ChatNotificationGiftPaidUpgrade struct {
	GifterIsAnonymous bool   `json:"gifter_is_anonymous"`
	GifterUserId      string `json:"gifter_user_id"`
	GifterUserName    string `json:"gifter_user_name"`
}

type ChatNotificationPayItForward added in v2.0.2

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

type ChatNotificationPrimePaidUpgrade added in v2.0.2

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

type ChatNotificationRaid added in v2.0.2

type ChatNotificationRaid struct {
	User

	ViewerCount     string `json:"viewer_count"`
	ProfileImageUrl string `json:"profile_image_url"`
}

type ChatNotificationResub added in v2.0.2

type ChatNotificationResub 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"`
	GifterUserName    string `json:"gifter_user_name"`
	GifterUserLogin   string `json:"gifter_user_login"`
}

type ChatNotificationSub added in v2.0.2

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

type ChatNotificationSubGift added in v2.0.2

type ChatNotificationSubGift struct {
	DurationMonths     int    `json:"duration_months"`
	CumulativeTotal    int    `json:"cumulative_total"`
	RecipientUserId    string `json:"recipient_user_id"`
	RecipientUserName  string `json:"recipient_user_name"`
	RecipientUserLogin string `json:"recipient_user_login"`
	SubTier            string `json:"sub_tier"`
	CommunityGiftId    string `json:"community_gift_id"`
}

type ChatNotificationUnraid added in v2.0.2

type ChatNotificationUnraid struct{}

type Chatter added in v2.0.2

type Chatter struct {
	ChatterUserId    string `json:"chatter_user_id"`
	ChatterUserLogin string `json:"chatter_user_login"`
	ChatterUserName  string `json:"chatter_user_name"`
}

type Client

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

func NewClient

func NewClient() *Client

func NewClientWithUrl

func NewClientWithUrl(url string) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) ConnectWithContext

func (c *Client) ConnectWithContext(ctx context.Context) error

func (*Client) OnError

func (c *Client) OnError(callback func(err error))

func (*Client) OnEventAutomodMessageHold added in v2.0.2

func (c *Client) OnEventAutomodMessageHold(callback func(event EventAutomodMessageHold))

func (*Client) OnEventAutomodMessageUpdate added in v2.0.2

func (c *Client) OnEventAutomodMessageUpdate(callback func(event EventAutomodMessageUpdate))

func (*Client) OnEventAutomodSettingsUpdate added in v2.0.2

func (c *Client) OnEventAutomodSettingsUpdate(callback func(event EventAutomodSettingsUpdate))

func (*Client) OnEventAutomodTermsUpdate added in v2.0.2

func (c *Client) OnEventAutomodTermsUpdate(callback func(event EventAutomodTermsUpdate))

func (*Client) OnEventChannelAdBreakBegin added in v2.0.2

func (c *Client) OnEventChannelAdBreakBegin(callback func(event EventChannelAdBreakBegin))

func (*Client) OnEventChannelBan

func (c *Client) OnEventChannelBan(callback func(event EventChannelBan))

func (*Client) OnEventChannelChannelPointsAutomaticRewardRedemptionAdd added in v2.0.2

func (c *Client) OnEventChannelChannelPointsAutomaticRewardRedemptionAdd(callback func(event EventChannelChannelPointsAutomaticRewardRedemptionAdd))

func (*Client) OnEventChannelChannelPointsCustomRewardAdd

func (c *Client) OnEventChannelChannelPointsCustomRewardAdd(callback func(event EventChannelChannelPointsCustomRewardAdd))

func (*Client) OnEventChannelChannelPointsCustomRewardRedemptionAdd

func (c *Client) OnEventChannelChannelPointsCustomRewardRedemptionAdd(callback func(event EventChannelChannelPointsCustomRewardRedemptionAdd))

func (*Client) OnEventChannelChannelPointsCustomRewardRedemptionUpdate

func (c *Client) OnEventChannelChannelPointsCustomRewardRedemptionUpdate(callback func(event EventChannelChannelPointsCustomRewardRedemptionUpdate))

func (*Client) OnEventChannelChannelPointsCustomRewardRemove

func (c *Client) OnEventChannelChannelPointsCustomRewardRemove(callback func(event EventChannelChannelPointsCustomRewardRemove))

func (*Client) OnEventChannelChannelPointsCustomRewardUpdate

func (c *Client) OnEventChannelChannelPointsCustomRewardUpdate(callback func(event EventChannelChannelPointsCustomRewardUpdate))

func (*Client) OnEventChannelCharityCampaignDonate

func (c *Client) OnEventChannelCharityCampaignDonate(callback func(event EventChannelCharityCampaignDonate))

func (*Client) OnEventChannelCharityCampaignProgress

func (c *Client) OnEventChannelCharityCampaignProgress(callback func(event EventChannelCharityCampaignProgress))

func (*Client) OnEventChannelCharityCampaignStart

func (c *Client) OnEventChannelCharityCampaignStart(callback func(event EventChannelCharityCampaignStart))

func (*Client) OnEventChannelCharityCampaignStop

func (c *Client) OnEventChannelCharityCampaignStop(callback func(event EventChannelCharityCampaignStop))

func (*Client) OnEventChannelChatClear added in v2.0.2

func (c *Client) OnEventChannelChatClear(callback func(event EventChannelChatClear))

func (*Client) OnEventChannelChatClearUserMessages added in v2.0.2

func (c *Client) OnEventChannelChatClearUserMessages(callback func(event EventChannelChatClearUserMessages))

func (*Client) OnEventChannelChatMessage added in v2.0.2

func (c *Client) OnEventChannelChatMessage(callback func(event EventChannelChatMessage))

func (*Client) OnEventChannelChatMessageDelete added in v2.0.2

func (c *Client) OnEventChannelChatMessageDelete(callback func(event EventChannelChatMessageDelete))

func (*Client) OnEventChannelChatNotification added in v2.0.2

func (c *Client) OnEventChannelChatNotification(callback func(event EventChannelChatNotification))

func (*Client) OnEventChannelChatSettingsUpdate added in v2.0.2

func (c *Client) OnEventChannelChatSettingsUpdate(callback func(event EventChannelChatSettingsUpdate))

func (*Client) OnEventChannelChatUserMessageHold added in v2.0.2

func (c *Client) OnEventChannelChatUserMessageHold(callback func(event EventChannelChatUserMessageHold))

func (*Client) OnEventChannelChatUserMessageUpdate added in v2.0.2

func (c *Client) OnEventChannelChatUserMessageUpdate(callback func(event EventChannelChatUserMessageUpdate))

func (*Client) OnEventChannelCheer

func (c *Client) OnEventChannelCheer(callback func(event EventChannelCheer))

func (*Client) OnEventChannelFollow

func (c *Client) OnEventChannelFollow(callback func(event EventChannelFollow))

func (*Client) OnEventChannelGoalBegin

func (c *Client) OnEventChannelGoalBegin(callback func(event EventChannelGoalBegin))

func (*Client) OnEventChannelGoalEnd

func (c *Client) OnEventChannelGoalEnd(callback func(event EventChannelGoalEnd))

func (*Client) OnEventChannelGoalProgress

func (c *Client) OnEventChannelGoalProgress(callback func(event EventChannelGoalProgress))

func (*Client) OnEventChannelHypeTrainBegin

func (c *Client) OnEventChannelHypeTrainBegin(callback func(event EventChannelHypeTrainBegin))

func (*Client) OnEventChannelHypeTrainEnd

func (c *Client) OnEventChannelHypeTrainEnd(callback func(event EventChannelHypeTrainEnd))

func (*Client) OnEventChannelHypeTrainProgress

func (c *Client) OnEventChannelHypeTrainProgress(callback func(event EventChannelHypeTrainProgress))

func (*Client) OnEventChannelModerate added in v2.0.2

func (c *Client) OnEventChannelModerate(callback func(event EventChannelModerate))

func (*Client) OnEventChannelModeratorAdd

func (c *Client) OnEventChannelModeratorAdd(callback func(event EventChannelModeratorAdd))

func (*Client) OnEventChannelModeratorRemove

func (c *Client) OnEventChannelModeratorRemove(callback func(event EventChannelModeratorRemove))

func (*Client) OnEventChannelPollBegin

func (c *Client) OnEventChannelPollBegin(callback func(event EventChannelPollBegin))

func (*Client) OnEventChannelPollEnd

func (c *Client) OnEventChannelPollEnd(callback func(event EventChannelPollEnd))

func (*Client) OnEventChannelPollProgress

func (c *Client) OnEventChannelPollProgress(callback func(event EventChannelPollProgress))

func (*Client) OnEventChannelPredictionBegin

func (c *Client) OnEventChannelPredictionBegin(callback func(event EventChannelPredictionBegin))

func (*Client) OnEventChannelPredictionEnd

func (c *Client) OnEventChannelPredictionEnd(callback func(event EventChannelPredictionEnd))

func (*Client) OnEventChannelPredictionLock

func (c *Client) OnEventChannelPredictionLock(callback func(event EventChannelPredictionLock))

func (*Client) OnEventChannelPredictionProgress

func (c *Client) OnEventChannelPredictionProgress(callback func(event EventChannelPredictionProgress))

func (*Client) OnEventChannelRaid

func (c *Client) OnEventChannelRaid(callback func(event EventChannelRaid))

func (*Client) OnEventChannelSharedChatBegin added in v2.0.2

func (c *Client) OnEventChannelSharedChatBegin(callback func(event EventChannelSharedChatBegin))

func (*Client) OnEventChannelSharedChatEnd added in v2.0.2

func (c *Client) OnEventChannelSharedChatEnd(callback func(event EventChannelSharedChatEnd))

func (*Client) OnEventChannelSharedChatUpdate added in v2.0.2

func (c *Client) OnEventChannelSharedChatUpdate(callback func(event EventChannelSharedChatUpdate))

func (*Client) OnEventChannelShieldModeBegin

func (c *Client) OnEventChannelShieldModeBegin(callback func(event EventChannelShieldModeBegin))

func (*Client) OnEventChannelShieldModeEnd

func (c *Client) OnEventChannelShieldModeEnd(callback func(event EventChannelShieldModeEnd))

func (*Client) OnEventChannelShoutoutCreate added in v2.0.1

func (c *Client) OnEventChannelShoutoutCreate(callback func(event EventChannelShoutoutCreate))

func (*Client) OnEventChannelShoutoutReceive added in v2.0.1

func (c *Client) OnEventChannelShoutoutReceive(callback func(event EventChannelShoutoutReceive))

func (*Client) OnEventChannelSubscribe

func (c *Client) OnEventChannelSubscribe(callback func(event EventChannelSubscribe))

func (*Client) OnEventChannelSubscriptionEnd

func (c *Client) OnEventChannelSubscriptionEnd(callback func(event EventChannelSubscriptionEnd))

func (*Client) OnEventChannelSubscriptionGift

func (c *Client) OnEventChannelSubscriptionGift(callback func(event EventChannelSubscriptionGift))

func (*Client) OnEventChannelSubscriptionMessage

func (c *Client) OnEventChannelSubscriptionMessage(callback func(event EventChannelSubscriptionMessage))

func (*Client) OnEventChannelSuspiciousUserMessage added in v2.0.2

func (c *Client) OnEventChannelSuspiciousUserMessage(callback func(event EventChannelSuspiciousUserMessage))

func (*Client) OnEventChannelSuspiciousUserUpdate added in v2.0.2

func (c *Client) OnEventChannelSuspiciousUserUpdate(callback func(event EventChannelSuspiciousUserUpdate))

func (*Client) OnEventChannelUnban

func (c *Client) OnEventChannelUnban(callback func(event EventChannelUnban))

func (*Client) OnEventChannelUnbanRequestCreate added in v2.0.2

func (c *Client) OnEventChannelUnbanRequestCreate(callback func(event EventChannelUnbanRequestCreate))

func (*Client) OnEventChannelUnbanRequestResolve added in v2.0.2

func (c *Client) OnEventChannelUnbanRequestResolve(callback func(event EventChannelUnbanRequestResolve))

func (*Client) OnEventChannelUpdate

func (c *Client) OnEventChannelUpdate(callback func(event EventChannelUpdate))

func (*Client) OnEventChannelVIPAdd added in v2.0.2

func (c *Client) OnEventChannelVIPAdd(callback func(event EventChannelVIPAdd))

func (*Client) OnEventChannelVIPRemove added in v2.0.2

func (c *Client) OnEventChannelVIPRemove(callback func(event EventChannelVIPRemove))

func (*Client) OnEventChannelWarningAcknowledge added in v2.0.2

func (c *Client) OnEventChannelWarningAcknowledge(callback func(event EventChannelWarningAcknowledge))

func (*Client) OnEventChannelWarningSend added in v2.0.2

func (c *Client) OnEventChannelWarningSend(callback func(event EventChannelWarningSend))

func (*Client) OnEventConduitShardDisabled added in v2.0.3

func (c *Client) OnEventConduitShardDisabled(callback func(event EventConduitShardDisabled))

func (*Client) OnEventDropEntitlementGrant

func (c *Client) OnEventDropEntitlementGrant(callback func(event []EventDropEntitlementGrant))

func (*Client) OnEventExtensionBitsTransactionCreate

func (c *Client) OnEventExtensionBitsTransactionCreate(callback func(event EventExtensionBitsTransactionCreate))

func (*Client) OnEventStreamOffline

func (c *Client) OnEventStreamOffline(callback func(event EventStreamOffline))

func (*Client) OnEventStreamOnline

func (c *Client) OnEventStreamOnline(callback func(event EventStreamOnline))

func (*Client) OnEventUserAuthorizationGrant

func (c *Client) OnEventUserAuthorizationGrant(callback func(event EventUserAuthorizationGrant))

func (*Client) OnEventUserAuthorizationRevoke

func (c *Client) OnEventUserAuthorizationRevoke(callback func(event EventUserAuthorizationRevoke))

func (*Client) OnEventUserUpdate

func (c *Client) OnEventUserUpdate(callback func(event EventUserUpdate))

func (*Client) OnEventUserWhisperMessage added in v2.0.2

func (c *Client) OnEventUserWhisperMessage(callback func(event EventUserWhisperMessage))

func (*Client) OnKeepAlive

func (c *Client) OnKeepAlive(callback func(message KeepAliveMessage))

func (*Client) OnNotification

func (c *Client) OnNotification(callback func(message NotificationMessage))

func (*Client) OnRawEvent

func (c *Client) OnRawEvent(callback func(event string, metadata MessageMetadata, subscription PayloadSubscription))

func (*Client) OnReconnect

func (c *Client) OnReconnect(callback func(message ReconnectMessage))

func (*Client) OnRevoke

func (c *Client) OnRevoke(callback func(message RevokeMessage))

func (*Client) OnWelcome

func (c *Client) OnWelcome(callback func(message WelcomeMessage))

type ConduitTransport added in v2.0.3

type ConduitTransport struct {
	Method         string    `json:"method"`
	SessionId      string    `json:"session_id"`
	ConnectedAt    time.Time `json:"connected_at"`
	DisconnectedAt time.Time `json:"disconnected_at"`
}

type CustomChannelPointReward added in v2.0.2

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

type DeletedMessage added in v2.0.2

type DeletedMessage struct {
	User
	MessageId   string `json:"message_id"`
	MessageBody string `json:"message_body"`
}

type DropEntitlement

type DropEntitlement struct {
	User

	OrganizationId string    `json:"organization_id"`
	CategoryId     string    `json:"category_id"`
	CategoryName   string    `json:"category_name"`
	CampaignId     string    `json:"campaign_id"`
	EntitlementId  string    `json:"entitlement_id"`
	BenefitId      string    `json:"benefit_id"`
	CreatedAt      time.Time `json:"created_at"`
}

type Emote

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

type EventAutomodMessageHold added in v2.0.2

type EventAutomodMessageHold struct {
	Broadcaster
	User

	MessageId string      `json:"message_id"`
	Message   ChatMessage `json:"message"`
	Level     int         `json:"level"`
	Category  string      `json:"category"`
	HeldAt    time.Time   `json:"held_at"`
}

type EventAutomodMessageUpdate added in v2.0.2

type EventAutomodMessageUpdate struct {
	Broadcaster
	User
	Moderator

	MessageId string      `json:"message_id"`
	Message   ChatMessage `json:"message"`
	Level     int         `json:"level"`
	Category  string      `json:"category"`
	Status    string      `json:"status"`
	HeldAt    time.Time   `json:"held_at"`
}

type EventAutomodSettingsUpdate added in v2.0.2

type EventAutomodSettingsUpdate struct {
	Broadcaster
	Moderator

	OverallLevel            int `json:"overall_level"`
	Disability              int `json:"disability"`
	Aggression              int `json:"aggression"`
	SexualitySexOrGender    int `json:"sexuality_sex_or_gender"`
	Misogyny                int `json:"misogyny"`
	Bullying                int `json:"bullying"`
	Swearing                int `json:"swearing"`
	RaceEthnicityOrReligion int `json:"race_ethnicity_or_religion"`
	SexBasedTerms           int `json:"sex_based_terms"`
}

type EventAutomodTermsUpdate added in v2.0.2

type EventAutomodTermsUpdate struct {
	Broadcaster
	Moderator

	Action      string   `json:"action"`
	FromAutomod bool     `json:"from_automod"`
	Terms       []string `json:"terms"`
}

type EventChannelAdBreakBegin added in v2.0.2

type EventChannelAdBreakBegin struct {
	Broadcaster

	DurationSeconds    int       `json:"duration_seconds"`
	StartedAt          time.Time `json:"started_at"`
	IsAutomatic        bool      `json:"is_automatic"`
	RequesterUserId    string    `json:"requester_user_id"`
	RequesterUserLogin string    `json:"requester_user_login"`
	RequesterUserName  string    `json:"requester_user_name"`
}

type EventChannelBan

type EventChannelBan struct {
	User
	Broadcaster
	Moderator

	Reason      string `json:"reason"`
	BannedAt    string `json:"banned_at"`
	EndsAt      string `json:"ends_at"`
	IsPermanent bool   `json:"is_permanent"`
}

type EventChannelChannelPointsAutomaticRewardRedemptionAdd added in v2.0.2

type EventChannelChannelPointsAutomaticRewardRedemptionAdd struct {
	Broadcaster
	User

	ID         string                      `json:"id"`
	Reward     AutomaticChannelPointReward `json:"reward"`
	Message    Message                     `json:"message"`
	UserInput  string                      `json:"user_input"`
	RedeemedAt time.Time                   `json:"redeemed_at"`
}

type EventChannelChannelPointsCustomRewardAdd

type EventChannelChannelPointsCustomRewardAdd struct {
	Broadcaster

	ID                                string                    `json:"id"`
	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                      MaxChannelPointsPerStream `json:"max_per_stream"`
	MaxPerUserPerStream               MaxChannelPointsPerStream `json:"max_per_user_per_stream"`
	BackgroundColor                   string                    `json:"background_color"`
	Image                             Image                     `json:"image"`
	DefaultImage                      Image                     `json:"default_image"`
	GlobalCooldown                    GlobalCooldown            `json:"global_cooldown"`
	CooldownExpiresAt                 time.Time                 `json:"cooldown_expires_at"`
	RedemptionsRedeemedCurrentStream  int                       `json:"redemptions_redeemed_current_stream"`
}

type EventChannelChannelPointsCustomRewardRedemptionAdd

type EventChannelChannelPointsCustomRewardRedemptionAdd struct {
	Broadcaster
	User

	ID         string                   `json:"id"`
	UserInput  string                   `json:"user_input"`
	Status     string                   `json:"status"`
	Reward     CustomChannelPointReward `json:"reward"`
	RedeemedAt time.Time                `json:"redeemed_at"`
}

type EventChannelChannelPointsCustomRewardRemove

type EventChannelChannelPointsCustomRewardRemove EventChannelChannelPointsCustomRewardAdd

type EventChannelChannelPointsCustomRewardUpdate

type EventChannelChannelPointsCustomRewardUpdate EventChannelChannelPointsCustomRewardAdd

type EventChannelCharityCampaignDonate

type EventChannelCharityCampaignDonate struct {
	BaseCharity

	Amount GoalAmount `json:"amount"`
}

type EventChannelCharityCampaignProgress

type EventChannelCharityCampaignProgress struct {
	BaseCharity

	CurrentAmount GoalAmount `json:"current_amount"`
	TargetAmount  GoalAmount `json:"target_amount"`
}

type EventChannelCharityCampaignStart

type EventChannelCharityCampaignStart struct {
	EventChannelCharityCampaignProgress

	StartedAt time.Time `json:"started_at"`
}

type EventChannelCharityCampaignStop

type EventChannelCharityCampaignStop struct {
	EventChannelCharityCampaignProgress

	StoppedAt time.Time `json:"stopped_at"`
}

type EventChannelChatClear added in v2.0.2

type EventChannelChatClear Broadcaster

type EventChannelChatClearUserMessages added in v2.0.2

type EventChannelChatClearUserMessages struct {
	Broadcaster
	Target
}

type EventChannelChatMessage added in v2.0.2

type EventChannelChatMessage struct {
	Broadcaster
	SourceBroadcaster
	Chatter

	MessageId                   string                 `json:"message_id"`
	SourceMessageId             string                 `json:"source_message_id"`
	Message                     ChatMessage            `json:"message"`
	Color                       string                 `json:"color"`
	Badges                      []ChatMessageUserBadge `json:"badges"`
	SourceBadges                []ChatMessageUserBadge `json:"source_badges"`
	MessageType                 string                 `json:"message_type"`
	Cheer                       ChatMessageCheer       `json:"cheer"`
	Reply                       ChatMessageReply       `json:"reply"`
	ChannelPointsCustomRewardId string                 `json:"channel_points_custom_reward_id"`
}

type EventChannelChatMessageDelete added in v2.0.2

type EventChannelChatMessageDelete struct {
	Broadcaster
	Target

	MessageId string `json:"message_id"`
}

type EventChannelChatNotification added in v2.0.2

type EventChannelChatNotification struct {
	Broadcaster
	SourceBroadcaster
	Chatter

	ChatterIsAnonymous bool                   `json:"chatter_is_anonymous"`
	Color              string                 `json:"color"`
	Badges             []ChatMessageUserBadge `json:"badges"`
	SourceBadges       []ChatMessageUserBadge `json:"source_badges"`
	SystemMessage      string                 `json:"system_message"`
	MessageId          string                 `json:"message_id"`
	SourceMessageId    string                 `json:"source_message_id"`
	Message            ChatMessage            `json:"message"`

	NoticeType       string                           `json:"notice_type"`
	Sub              ChatNotificationSub              `json:"sub"`
	Resub            ChatNotificationResub            `json:"resub"`
	SubGift          ChatNotificationSubGift          `json:"sub_gift"`
	CommunitySubGift ChatNotificationCommunitySubGift `json:"community_sub_gift"`
	GiftPaidUpgrade  ChatNotificationGiftPaidUpgrade  `json:"gift_paid_upgrade"`
	PrimePaidUpgrade ChatNotificationPrimePaidUpgrade `json:"prime_paid_upgrade"`
	PayItForward     ChatNotificationPayItForward     `json:"pay_it_forward"`
	Raid             ChatNotificationRaid             `json:"raid"`
	Unraid           ChatNotificationUnraid           `json:"unraid"`
	Announcement     ChatNotificationAnnouncement     `json:"announcement"`
	BitsBadgeTier    ChatNotificationBitsBadgeTier    `json:"bits_badge_tier"`
	CharityDonation  ChatNotificationCharityDonation  `json:"charity_donation"`

	SharedChatSub              ChatNotificationSub              `json:"shared_chat_sub"`
	SharedChatResub            ChatNotificationResub            `json:"shared_chat_resub"`
	SharedChatSubGift          ChatNotificationSubGift          `json:"shared_chat_sub_gift"`
	SharedChatCommunitySubGift ChatNotificationCommunitySubGift `json:"shared_chat_community_sub_gift"`
	SharedChatGiftPaidUpgrade  ChatNotificationGiftPaidUpgrade  `json:"shared_chat_gift_paid_upgrade"`
	SharedChatPrimePaidUpgrade ChatNotificationPrimePaidUpgrade `json:"shared_chat_prime_paid_upgrade"`
	SharedChatPayItForward     ChatNotificationPayItForward     `json:"shared_chat_pay_it_forward"`
	SharedChatRaid             ChatNotificationRaid             `json:"shared_chat_raid"`
	SharedChatAnnouncement     ChatNotificationAnnouncement     `json:"shared_chat_announcement"`
}

type EventChannelChatSettingsUpdate added in v2.0.2

type EventChannelChatSettingsUpdate struct {
	Broadcaster

	EmoteMode                   bool `json:"emote_mode"`
	FollowerMode                bool `json:"follower_mode"`
	FollowerModeDurationMinutes int  `json:"follower_mode_duration_minutes"`
	SlowMode                    bool `json:"slow_mode"`
	SlowModeWaitTimeSeconds     int  `json:"slow_mode_wait_time_seconds"`
	SubscriberMode              bool `json:"subscriber_mode"`
	UniqueChatMode              bool `json:"unique_chat_mode"`
}

type EventChannelChatUserMessageHold added in v2.0.2

type EventChannelChatUserMessageHold struct {
	Broadcaster
	User

	MessageId string      `json:"message_id"`
	Message   ChatMessage `json:"message"`
}

type EventChannelChatUserMessageUpdate added in v2.0.2

type EventChannelChatUserMessageUpdate struct {
	Broadcaster
	User

	Status    string      `json:"status"`
	MessageId string      `json:"message_id"`
	Message   ChatMessage `json:"message"`
}

type EventChannelCheer

type EventChannelCheer struct {
	User
	Broadcaster

	Message     string `json:"message"`
	Bits        int    `json:"bits"`
	IsAnonymous bool   `json:"is_anonymous"`
}

type EventChannelFollow

type EventChannelFollow struct {
	User
	Broadcaster

	FollowedAt time.Time `json:"followed_at"`
}

type EventChannelGoalBegin

type EventChannelGoalBegin struct {
	Broadcaster

	ID                 string    `json:"id"`
	CharityName        string    `json:"charity_name"`
	CharityDescription string    `json:"charity_description"`
	CharityWebsite     string    `json:"charity_website"`
	CurrentAmount      int       `json:"current_amount"`
	TargetAmount       int       `json:"target_amount"`
	StoppedAt          time.Time `json:"stopped_at"`
}

type EventChannelGoalEnd

type EventChannelGoalEnd EventChannelGoalBegin

type EventChannelGoalProgress

type EventChannelGoalProgress EventChannelGoalBegin

type EventChannelHypeTrainBegin

type EventChannelHypeTrainBegin struct {
	Broadcaster

	Id               string                  `json:"id"`
	Total            int                     `json:"total"`
	Progress         int                     `json:"progress"`
	Goal             int                     `json:"goal"`
	TopContributions []HypeTrainContribution `json:"top_contributions"`
	LastContribution HypeTrainContribution   `json:"last_contribution"`
	Level            int                     `json:"level"`
	StartedAt        time.Time               `json:"started_at"`
	ExpiresAt        time.Time               `json:"expires_at"`
}

type EventChannelHypeTrainEnd

type EventChannelHypeTrainEnd struct {
	Broadcaster

	Id               string                  `json:"id"`
	Level            int                     `json:"level"`
	Total            int                     `json:"total"`
	TopContributions []HypeTrainContribution `json:"top_contributions"`
	StartedAt        time.Time               `json:"started_at"`
	ExpiresAt        time.Time               `json:"expires_at"`
	CooldownEndsAt   time.Time               `json:"cooldown_ends_at"`
}

type EventChannelHypeTrainProgress

type EventChannelHypeTrainProgress struct {
	EventChannelHypeTrainBegin

	Level int `json:"level"`
}

type EventChannelModerate added in v2.0.2

type EventChannelModerate struct {
	Broadcaster
	SourceBroadcaster
	Moderator

	Action              string         `json:"action"`
	Followers           Followers      `json:"followers"`
	Slow                SlowMode       `json:"slow"`
	Vip                 User           `json:"vip"`
	Unvip               User           `json:"unvip"`
	Mod                 User           `json:"mod"`
	Unmod               User           `json:"unmod"`
	Ban                 Ban            `json:"ban"`
	Unban               User           `json:"unban"`
	Timeout             Timeout        `json:"timeout"`
	Untimeout           User           `json:"untimeout"`
	Raid                Raid           `json:"raid"`
	Unraid              User           `json:"unraid"`
	Delete              DeletedMessage `json:"delete"`
	AutomodTerms        AutomodTerms   `json:"automod_terms"`
	UnbanRequest        UnbanRequest   `json:"unban_request"`
	Warn                Warning        `json:"warn"`
	SharedChatBan       Ban            `json:"shared_chat_ban"`
	SharedChatUnban     User           `json:"shared_chat_unban"`
	SharedChatTimeout   Timeout        `json:"shared_chat_timeout"`
	SharedChatuntimeout User           `json:"shared_chat_untimeout"`
	SharedChatDelete    DeletedMessage `json:"shared_chat_delete"`
}

type EventChannelModeratorAdd

type EventChannelModeratorAdd struct {
	Broadcaster
	User
}

type EventChannelModeratorRemove

type EventChannelModeratorRemove struct {
	Broadcaster
	User
}

type EventChannelPollBegin

type EventChannelPollBegin struct {
	Broadcaster

	ID                  string       `json:"id"`
	Title               string       `json:"title"`
	Choices             []PollChoice `json:"choices"`
	BitsVoting          PollVoting   `json:"bits_voting"`
	ChannelPointsVoting PollVoting   `json:"channel_points_voting"`
	StartedAt           time.Time    `json:"started_at"`
	EndsAt              time.Time    `json:"ends_at"`
}

type EventChannelPollEnd

type EventChannelPollEnd struct {
	EventChannelPollBegin

	Status string `json:"status"`
}

type EventChannelPollProgress

type EventChannelPollProgress EventChannelPollBegin

type EventChannelPredictionBegin

type EventChannelPredictionBegin struct {
	Broadcaster

	ID        string              `json:"id"`
	Title     string              `json:"title"`
	Outcomes  []PredictionOutcome `json:"outcomes"`
	StartedAt time.Time           `json:"started_at"`
	LocksAt   time.Time           `json:"locks_at"`
}

type EventChannelPredictionEnd

type EventChannelPredictionEnd struct {
	Broadcaster

	ID               string              `json:"id"`
	Title            string              `json:"title"`
	WinningOutcomeID string              `json:"winning_outcome_id"`
	Outcomes         []PredictionOutcome `json:"outcomes"`
	Status           string              `json:"status"`
	StartedAt        time.Time           `json:"started_at"`
	EndedAt          time.Time           `json:"ended_at"`
}

type EventChannelPredictionLock

type EventChannelPredictionLock EventChannelPredictionBegin

type EventChannelPredictionProgress

type EventChannelPredictionProgress EventChannelPredictionBegin

type EventChannelRaid

type EventChannelRaid struct {
	FromBroadcaster
	ToBroadcaster

	Viewers int `json:"viewers"`
}

type EventChannelSharedChatBegin added in v2.0.2

type EventChannelSharedChatBegin struct {
	Broadcaster
	HostBroadcaster

	SessionId    string        `json:"session_id"`
	Participants []Broadcaster `json:"participants"`
}

type EventChannelSharedChatEnd added in v2.0.2

type EventChannelSharedChatEnd struct {
	Broadcaster
	HostBroadcaster

	SessionId string `json:"session_id"`
}

type EventChannelSharedChatUpdate added in v2.0.2

type EventChannelSharedChatUpdate EventChannelSharedChatBegin

type EventChannelShieldModeBegin

type EventChannelShieldModeBegin struct {
	Broadcaster
	Moderator

	StartedAt time.Time `json:"started_at"`
	StoppedAt time.Time `json:"stopped_at"`
}

type EventChannelShieldModeEnd

type EventChannelShieldModeEnd EventChannelShieldModeBegin

type EventChannelShoutoutCreate added in v2.0.1

type EventChannelShoutoutCreate struct {
	Broadcaster
	Moderator
	ToBroadcaster

	StartedAt            time.Time `json:"started_at"`
	ViewerCount          int       `json:"viewer_count"`
	CooldownEndsAt       time.Time `json:"cooldown_ends_at"`
	TargetCooldownEndsAt time.Time `json:"target_cooldown_ends_at"`
}

type EventChannelShoutoutReceive added in v2.0.1

type EventChannelShoutoutReceive struct {
	Broadcaster
	FromBroadcaster

	ViewerCount int       `json:"viewer_count"`
	StartedAt   time.Time `json:"started_at"`
}

type EventChannelSubscribe

type EventChannelSubscribe struct {
	User
	Broadcaster

	Tier   string `json:"tier"`
	IsGift bool   `json:"is_gift"`
}

type EventChannelSubscriptionEnd

type EventChannelSubscriptionEnd struct {
	User
	Broadcaster

	Tier   string `json:"tier"`
	IsGift bool   `json:"is_gift"`
}

type EventChannelSubscriptionGift

type EventChannelSubscriptionGift struct {
	User
	Broadcaster

	Total           int    `json:"total"`
	Tier            string `json:"tier"`
	CumulativeTotal int    `json:"cumulative_total"`
	IsAnonymous     bool   `json:"is_anonymous"`
}

type EventChannelSubscriptionMessage

type EventChannelSubscriptionMessage struct {
	User
	Broadcaster

	Tier             string  `json:"tier"`
	Message          Message `json:"message"`
	CumulativeMonths int     `json:"cumulative_months"`
	StreakMonths     int     `json:"streak_months"`
	DurationMonths   int     `json:"duration_months"`
}

type EventChannelSuspiciousUserMessage added in v2.0.2

type EventChannelSuspiciousUserMessage struct {
	Broadcaster
	User

	LowTrustStatus       string                    `json:"low_trust_status"`
	SharedBanChannelIds  []string                  `json:"shared_ban_channel_ids"`
	Types                []string                  `json:"types"`
	BanEvasionEvaluation string                    `json:"ban_evasion_evaluation"`
	Message              SuspiciousUserChatMessage `json:"message"`
}

type EventChannelSuspiciousUserUpdate added in v2.0.2

type EventChannelSuspiciousUserUpdate struct {
	Broadcaster
	User
	Moderator

	LowTrustStatus string `json:"low_trust_status"`
}

type EventChannelUnban

type EventChannelUnban struct {
	User
	Broadcaster
	Moderator
}

type EventChannelUnbanRequestCreate added in v2.0.2

type EventChannelUnbanRequestCreate struct {
	Broadcaster
	User

	Id        string    `json:"id"`
	Text      string    `json:"text"`
	CreatedAt time.Time `json:"created_at"`
}

type EventChannelUnbanRequestResolve added in v2.0.2

type EventChannelUnbanRequestResolve struct {
	Broadcaster
	Moderator
	User

	Id             string `json:"id"`
	ResolutionText string `json:"resolution_text"`
	Status         string `json:"status"`
}

type EventChannelUpdate

type EventChannelUpdate struct {
	Broadcaster

	Title                       string   `json:"title"`
	Language                    string   `json:"language"`
	CategoryID                  string   `json:"category_id"`
	CategoryName                string   `json:"category_name"`
	ContentClassificationLabels []string `json:"content_classification_labels"`
}

type EventChannelVIPAdd added in v2.0.2

type EventChannelVIPAdd struct {
	Broadcaster
	User
}

type EventChannelVIPRemove added in v2.0.2

type EventChannelVIPRemove struct {
	Broadcaster
	User
}

type EventChannelWarningAcknowledge added in v2.0.2

type EventChannelWarningAcknowledge struct {
	Broadcaster
	User
}

type EventChannelWarningSend added in v2.0.2

type EventChannelWarningSend struct {
	Broadcaster
	Moderator
	User

	Reason         string   `json:"reason"`
	ChatRulesCited []string `json:"chat_rules_cited"`
}

type EventConduitShardDisabled added in v2.0.3

type EventConduitShardDisabled struct {
	ConduitId string           `json:"conduit_id"`
	ShardId   string           `json:"shard_id"`
	Status    string           `json:"status"`
	Transport ConduitTransport `json:"transport"`
}

type EventDropEntitlementGrant

type EventDropEntitlementGrant struct {
	ID   string          `json:"id"`
	Data DropEntitlement `json:"data"`
}

type EventExtensionBitsTransactionCreate

type EventExtensionBitsTransactionCreate struct {
	Broadcaster
	User

	ID                string           `json:"id"`
	ExtensionClientID string           `json:"extension_client_id"`
	Product           ExtensionProduct `json:"product"`
}

type EventStreamOffline

type EventStreamOffline Broadcaster

type EventStreamOnline

type EventStreamOnline struct {
	Broadcaster

	Id        string    `json:"id"`
	Type      string    `json:"type"`
	StartedAt time.Time `json:"started_at"`
}

type EventSubscription

type EventSubscription string
var (
	SubChannelUpdate EventSubscription = "channel.update"
	SubChannelFollow EventSubscription = "channel.follow"

	SubChannelSubscribe           EventSubscription = "channel.subscribe"
	SubChannelSubscriptionEnd     EventSubscription = "channel.subscription.end"
	SubChannelSubscriptionGift    EventSubscription = "channel.subscription.gift"
	SubChannelSubscriptionMessage EventSubscription = "channel.subscription.message"

	SubChannelCheer EventSubscription = "channel.cheer"
	SubChannelRaid  EventSubscription = "channel.raid"
	SubChannelBan   EventSubscription = "channel.ban"
	SubChannelUnban EventSubscription = "channel.unban"

	SubChannelModeratorAdd    EventSubscription = "channel.moderator.add"
	SubChannelModeratorRemove EventSubscription = "channel.moderator.remove"
	SubChannelVIPAdd          EventSubscription = "channel.vip.add"
	SubChannelVIPRemove       EventSubscription = "channel.vip.remove"

	SubChannelChannelPointsCustomRewardAdd              EventSubscription = "channel.channel_points_custom_reward.add"
	SubChannelChannelPointsCustomRewardUpdate           EventSubscription = "channel.channel_points_custom_reward.update"
	SubChannelChannelPointsCustomRewardRemove           EventSubscription = "channel.channel_points_custom_reward.remove"
	SubChannelChannelPointsCustomRewardRedemptionAdd    EventSubscription = "channel.channel_points_custom_reward_redemption.add"
	SubChannelChannelPointsCustomRewardRedemptionUpdate EventSubscription = "channel.channel_points_custom_reward_redemption.update"
	SubChannelChannelPointsAutomaticRewardRedemptionAdd EventSubscription = "channel.channel_points_automatic_reward_redemption.add"

	SubChannelPollBegin    EventSubscription = "channel.poll.begin"
	SubChannelPollProgress EventSubscription = "channel.poll.progress"
	SubChannelPollEnd      EventSubscription = "channel.poll.end"

	SubChannelPredictionBegin    EventSubscription = "channel.prediction.begin"
	SubChannelPredictionProgress EventSubscription = "channel.prediction.progress"
	SubChannelPredictionLock     EventSubscription = "channel.prediction.lock"
	SubChannelPredictionEnd      EventSubscription = "channel.prediction.end"

	SubDropEntitlementGrant           EventSubscription = "drop.entitlement.grant"
	SubExtensionBitsTransactionCreate EventSubscription = "extension.bits_transaction.create"

	SubChannelGoalBegin    EventSubscription = "channel.goal.begin"
	SubChannelGoalProgress EventSubscription = "channel.goal.progress"
	SubChannelGoalEnd      EventSubscription = "channel.goal.end"

	SubChannelHypeTrainBegin    EventSubscription = "channel.hype_train.begin"
	SubChannelHypeTrainProgress EventSubscription = "channel.hype_train.progress"
	SubChannelHypeTrainEnd      EventSubscription = "channel.hype_train.end"

	SubStreamOnline  EventSubscription = "stream.online"
	SubStreamOffline EventSubscription = "stream.offline"

	SubUserAuthorizationGrant  EventSubscription = "user.authorization.grant"
	SubUserAuthorizationRevoke EventSubscription = "user.authorization.revoke"
	SubUserUpdate              EventSubscription = "user.update"

	SubChannelCharityCampaignDonate   EventSubscription = "channel.charity_campaign.donate"
	SubChannelCharityCampaignStart    EventSubscription = "channel.charity_campaign.start"
	SubChannelCharityCampaignProgress EventSubscription = "channel.charity_campaign.progress"
	SubChannelCharityCampaignStop     EventSubscription = "channel.charity_campaign.stop"

	SubChannelShieldModeBegin EventSubscription = "channel.shield_mode.begin"
	SubChannelShieldModeEnd   EventSubscription = "channel.shield_mode.end"

	SubChannelShoutoutCreate  EventSubscription = "channel.shoutout.create"
	SubChannelShoutoutReceive EventSubscription = "channel.shoutout.receive"

	SubChannelModerate EventSubscription = "channel.moderate"

	SubAutomodMessageHold           EventSubscription = "automod.message.hold"
	SubAutomodMessageUpdate         EventSubscription = "automod.message.update"
	SubAutomodSettingsUpdate        EventSubscription = "automod.settings.update"
	SubAutomodTermsUpdate           EventSubscription = "automod.terms.update"
	SubChannelChatUserMessageHold   EventSubscription = "channel.chat.user_message_hold"
	SubChannelChatUserMessageUpdate EventSubscription = "channel.chat.user_message_update"

	SubChannelChatClear             EventSubscription = "channel.chat.clear"
	SubChannelChatClearUserMessages EventSubscription = "channel.chat.clear_user_messages"
	SubChannelChatMessage           EventSubscription = "channel.chat.message"
	SubChannelChatMessageDelete     EventSubscription = "channel.chat.message_delete"
	SubChannelChatNotification      EventSubscription = "channel.chat.notification"
	SubChannelChatSettingsUpdate    EventSubscription = "channel.chat_settings.update"
	SubChannelSuspiciousUserMessage EventSubscription = "channel.suspicious_user.message"
	SubChannelSuspiciousUserUpdate  EventSubscription = "channel.suspicious_user.update"

	SubChannelSharedChatBegin  EventSubscription = "channel.shared_chat.begin"
	SubChannelSharedChatUpdate EventSubscription = "channel.shared_chat.update"
	SubChannelSharedChatEnd    EventSubscription = "channel.shared_chat.end"

	SubUserWhisperMessage EventSubscription = "user.whisper.message"

	SubChannelAdBreakBegin EventSubscription = "channel.ad_break.begin"

	SubChannelWarningAcknowledge EventSubscription = "channel.warning.acknowledge"
	SubChannelWarningSend        EventSubscription = "channel.warning.send"

	SubChannelUnbanRequestCreate  EventSubscription = "channel.unban_request.create"
	SubChannelUnbanRequestResolve EventSubscription = "channel.unban_request.resolve"

	SubConduitShardDisabled EventSubscription = "conduit.shard.disabled"
)

type EventUserAuthorizationGrant

type EventUserAuthorizationGrant struct {
	User

	ClientID string `json:"client_id"`
}

type EventUserAuthorizationRevoke

type EventUserAuthorizationRevoke EventUserAuthorizationGrant

type EventUserUpdate

type EventUserUpdate struct {
	User

	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Description   string `json:"description"`
}

type EventUserWhisperMessage added in v2.0.2

type EventUserWhisperMessage struct {
	FromUserId    string      `json:"from_user_id"`
	FromUserLogin string      `json:"from_user_login"`
	FromUserName  string      `json:"from_user_name"`
	ToUserId      string      `json:"to_user_id"`
	ToUserLogin   string      `json:"to_user_login"`
	ToUserName    string      `json:"to_user_name"`
	WhisperId     string      `json:"whisper_id"`
	Whisper       UserWhisper `json:"whisper"`
}

type ExtensionProduct

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

type Followers added in v2.0.2

type Followers struct {
	FollowDurationMinutes int `json:"follow_duration_minutes"`
}

type FromBroadcaster added in v2.0.2

type FromBroadcaster struct {
	FromBroadcasterUserId    string `json:"from_broadcaster_user_id"`
	FromBroadcasterUserLogin string `json:"from_broadcaster_user_login"`
	FromBroadcasterUserName  string `json:"from_broadcaster_user_name"`
}

type GlobalCooldown

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

type GoalAmount

type GoalAmount struct {
	Value         int    `json:"value"`
	DecimalPlaces int    `json:"decimal_places"`
	Currency      string `json:"currency"`
}

func (GoalAmount) Amount

func (a GoalAmount) Amount() float64

type HostBroadcaster added in v2.0.2

type HostBroadcaster struct {
	HostBroadcasterUserId    string `json:"host_broadcaster_user_id"`
	HostBroadcasterUserLogin string `json:"host_broadcaster_user_login"`
	HostBroadcasterUserName  string `json:"host_broadcaster_user_name"`
}

type HypeTrainContribution

type HypeTrainContribution struct {
	User

	Type  string `json:"type"`
	Total int    `json:"total"`
}

type Image

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

type KeepAliveMessage

type KeepAliveMessage struct {
	Metadata MessageMetadata `json:"metadata"`
	Payload  struct{}        `json:"payload"`
}

type MaxChannelPointsPerStream

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

type Message

type Message struct {
	Text   string  `json:"text"`
	Emotes []Emote `json:"emotes"`
}

type MessageMetadata

type MessageMetadata struct {
	MessageID        string    `json:"message_id"`
	MessageType      string    `json:"message_type"`
	MessageTimestamp time.Time `json:"message_timestamp"`
}

type Moderator

type Moderator struct {
	ModeratorUserId    string `json:"moderator_user_id"`
	ModeratorUserLogin string `json:"moderator_user_login"`
	ModeratorUserName  string `json:"moderator_user_name"`
}

type NotificationMessage

type NotificationMessage struct {
	Metadata MessageMetadata `json:"metadata"`
	Payload  struct {
		Subscription PayloadSubscription `json:"subscription"`
		Event        *json.RawMessage    `json:"event"`
	} `json:"payload"`
}

type PayloadSession

type PayloadSession struct {
	ID                      string    `json:"id"`
	Status                  string    `json:"status"`
	ConnectedAt             time.Time `json:"connected_at"`
	KeepaliveTimeoutSeconds int       `json:"keepalive_timeout_seconds"`
	ReconnectUrl            string    `json:"reconnect_url"`
}

type PayloadSubscription

type PayloadSubscription struct {
	SubscriptionRequest

	ID       string    `json:"id"`
	Status   string    `json:"status"`
	Cost     int       `json:"cost"`
	CreateAt time.Time `json:"created_at"`
}

type PollChoice

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

type PollVoting

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

type PredictionOutcome

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

type Raid added in v2.0.2

type Raid struct {
	User
	ViewerCount int `json:"viewer_count"`
}

type ReconnectMessage

type ReconnectMessage struct {
	Metadata MessageMetadata `json:"metadata"`
	Payload  struct {
		Session PayloadSession `json:"session"`
	} `json:"payload"`
}

type RevokeMessage

type RevokeMessage struct {
	Metadata MessageMetadata `json:"metadata"`
	Payload  struct {
		Subscription PayloadSubscription `json:"subscription"`
	} `json:"payload"`
}

type SlowMode added in v2.0.2

type SlowMode struct {
	WaitTimeSeconds int `json:"wait_time_seconds"`
}

type SourceBroadcaster added in v2.0.2

type SourceBroadcaster struct {
	SourceBroadcasterUserId    string `json:"source_broadcaster_user_id"`
	SourceBroadcasterUserLogin string `json:"source_broadcaster_user_login"`
	SourceBroadcasterUserName  string `json:"source_broadcaster_user_name"`
}

type SubscribeRequest

type SubscribeRequest struct {
	SessionID       string
	ClientID        string
	AccessToken     string
	VersionOverride string

	Event     EventSubscription
	Condition map[string]string
}

type SubscribeResponse

type SubscribeResponse struct {
	Data         []PayloadSubscription `json:"data"`
	Total        int                   `json:"total"`
	TotalCost    int                   `json:"total_cost"`
	MaxTotalCost int                   `json:"max_total_cost"`
}

func SubscribeEvent

func SubscribeEvent(request SubscribeRequest) (SubscribeResponse, error)

func SubscribeEventUrl

func SubscribeEventUrl(request SubscribeRequest, url string) (SubscribeResponse, error)

func SubscribeEventUrlWithContext

func SubscribeEventUrlWithContext(ctx context.Context, request SubscribeRequest, url string) (SubscribeResponse, error)

func SubscribeEventWithContext

func SubscribeEventWithContext(ctx context.Context, request SubscribeRequest) (SubscribeResponse, error)

type SubscriptionRequest

type SubscriptionRequest struct {
	Type      EventSubscription     `json:"type"`
	Version   string                `json:"version"`
	Condition map[string]string     `json:"condition"`
	Transport SubscriptionTransport `json:"transport"`
}

type SubscriptionTransport

type SubscriptionTransport struct {
	Method    string `json:"method"`
	SessionID string `json:"session_id"`
}

type SuspiciousUserChatMessage added in v2.0.2

type SuspiciousUserChatMessage struct {
	ChatMessage

	MessageId string `json:"message_id"`
}

type Target added in v2.0.2

type Target struct {
	TargetUserId    string `json:"target_user_id"`
	TargetUserLogin string `json:"target_user_login"`
	TargetUserName  string `json:"target_user_name"`
}

type Timeout added in v2.0.2

type Timeout struct {
	Ban
	ExpiresAt time.Time `json:"expires_at"`
}

type ToBroadcaster added in v2.0.2

type ToBroadcaster struct {
	ToBroadcasterUserId    string `json:"to_broadcaster_user_id"`
	ToBroadcasterUserLogin string `json:"to_broadcaster_user_login"`
	ToBroadcasterUserName  string `json:"to_broadcaster_user_name"`
}

type TopPredictor

type TopPredictor struct {
	User

	ChannelPointsWon  int `json:"channel_points_won"`
	ChannelPointsUsed int `json:"channel_points_used"`
}

type UnbanRequest added in v2.0.2

type UnbanRequest struct {
	User
	IsApproved       bool   `json:"is_approved"`
	ModeratorMessage string `json:"moderator_message"`
}

type User

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

type UserWhisper added in v2.0.2

type UserWhisper struct {
	Text string `json:"text"`
}

type Warning added in v2.0.2

type Warning struct {
	User
	Reason         string   `json:"reason"`
	ChatRulesCited []string `json:"chat_rules_cited"`
}

type WelcomeMessage

type WelcomeMessage struct {
	Metadata MessageMetadata `json:"metadata"`
	Payload  struct {
		Session PayloadSession `json:"session"`
	} `json:"payload"`
}

Jump to

Keyboard shortcuts

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