eventsub

package
v0.0.0-...-9648343 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const EventSubVersion = "1"

Variables

View Source
var (
	MethodWebhook   = "webhook"
	MethodWebsocket = "websocket"
)
View Source
var ErrInvalidMAC = fmt.Errorf("Invalid signature")

Functions

This section is empty.

Types

type ESM

type ESM struct {
	ClientID string
	OAuth    string
	BaseURL  string
	Secret   string
}

func New

func New(cid, csec, oauth string) *ESM

func (*ESM) Register

func (esm *ESM) Register(vtype, uid string) error

func (*ESM) Unregister

func (esm *ESM) Unregister(id string) error

func (*ESM) WebHook

func (esm *ESM) WebHook(wr http.ResponseWriter, r *http.Request) *Event

func (*ESM) WebSocket

func (esm *ESM) WebSocket() (*WebSocket, error)

type Event

type Event struct {
	Subscription struct {
		Type string `json:"type"`
	} `json:"subscription"`
	Event json.RawMessage `json:"event"`
}

type EventChannelUpdate

type EventChannelUpdate struct {
	//broadcaster_user_id: "22484632",
	//broadcaster_user_login: "forsen",
	//broadcaster_user_name: "forsen",
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`

	//category_id: "509658",
	//category_name: "Just Chatting",
	CategoryID   string `json:"category_id"`
	CategoryName string `json:"category_name"`

	//is_mature: true,
	//language: "en",
	//title: "Games and shit!"
	IsMature bool   `json:"is_mature"`
	Language string `json:"language"`
	Title    string `json:"title"`
}

EventChannelUpdate is sent on `channel.update` events.

type EventStreamOffline

type EventStreamOffline struct {
	ID                   string `json:"id"`
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
}

type EventStreamOnline

type EventStreamOnline struct {
	ID                   string `json:"id"`   // "39716786411"
	Type                 string `json:"type"` // "live"
	BroadcasterUserID    string `json:"broadcaster_user_id"`
	BroadcasterUserLogin string `json:"broadcaster_user_login"`
	BroadcasterUserName  string `json:"broadcaster_user_name"`
	StartedAt            string `json:"started_at"`
}

type EventSubCondition

type EventSubCondition struct {
	BroadcasterUserID string `json:"broadcaster_user_id,omitempty"`
}

type EventSubTransport

type EventSubTransport struct {
	Method   string `json:"method"`
	ID       string `json:"id,omitempty"`
	Callback string `json:"callback,omitempty"`
	Secret   string `json:"secret,omitempty"`
}

type WebSocket

type WebSocket struct {
	ID string
	// contains filtered or unexported fields
}

func (*WebSocket) Close

func (ws *WebSocket) Close() error

func (*WebSocket) Receive

func (ws *WebSocket) Receive(msghandle func(transport string, e *Event)) error

func (*WebSocket) Register

func (ws *WebSocket) Register(vtype, uid string) error

type WebsocketWelcome

type WebsocketWelcome struct {
	Metadata struct {
		// "message_id":"ca351034-c602-49f7-b0c8-e31fbef90ec1",
		//"message_type":"websocket_welcome",
		//"message_timestamp":"2021-07-15T19:03:59Z",
		MessageID        string `json:"message_id"`
		MessageType      string `json:"message_type"`
		MessageTimestamp string `json:"message_timestamp"`
	} `json:"metadata"`
	Payload struct {
		WebSocket struct {
			ID     string `json:"id"`
			Status string `json:"status"`
		} `json:"websocket"`
	} `json:"payload"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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