Documentation ¶
Index ¶
- func GetAuthToken(username, password, hostname string, port int, hasSSL bool) (string, error)
- type CheerCallback
- type CheerMsg
- type Client
- func (c *Client) Reconnect() error
- func (c *Client) SendMessage(msg interface{}) error
- func (c *Client) SetCheerCallback(callback CheerCallback)
- func (c *Client) SetErrorCallback(callback ErrorCallback)
- func (c *Client) SetFollowCallback(callback FollowCallback)
- func (c *Client) SetHypeTrainBeginCallback(callback HypeTrainBeginCallback)
- func (c *Client) SetHypeTrainEndedCallback(callback HypeTrainEndCallback)
- func (c *Client) SetHypeTrainProgressCallback(callback HypeTrainProgressCallback)
- func (c *Client) SetParallelProcessing(parallel bool)
- func (c *Client) SetPointsRedemptionCallback(callback PointsRedemptionCallback)
- func (c *Client) SetRaidCallback(callback RaidCallback)
- func (c *Client) SetRawCallback(callback RawCallback)
- func (c *Client) SetStreamOfflineCallback(callback StreamOfflineCallback)
- func (c *Client) SetStreamOnlineCallback(callback StreamOnlineCallback)
- func (c *Client) SetStreamUpdateCallback(callback StreamUpdateCallback)
- func (c *Client) SetSubscriptionCallback(callback SubscriptionCallback)
- type ErrorCallback
- type Event
- type FollowCallback
- type FollowMsg
- type HypeTrainBeginCallback
- type HypeTrainBeginMsg
- type HypeTrainEndCallback
- type HypeTrainEndedMsg
- type HypeTrainProgressCallback
- type HypeTrainProgressMsg
- type PointsRedemptionCallback
- type PointsRedemptionMsg
- type RaidCallback
- type RaidMsg
- type RawCallback
- type StreamOfflineCallback
- type StreamOfflineMsg
- type StreamOnlineCallback
- type StreamOnlineMsg
- type StreamUpdateCallback
- type StreamUpdateMsg
- type SubscriptionCallback
- type SubscriptionMsg
- type Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAuthToken ¶ added in v0.0.2
GetAuthToken is used to get the auth token for a user to interact with TAU given a username and password. Ideally this would be gathered from the UI and potentially stored in a config of some sort, but this option exists in case that is not an option.
Types ¶
type CheerCallback ¶
type CheerCallback func(msg *CheerMsg)
CheerCallback is a callback to handle cheer events
type CheerMsg ¶
type CheerMsg struct { *Event EventData struct { IsAnonymous bool `json:"is_anonymous"` UserID string `json:"user_id"` UserName string `json:"user_name"` UserLogin string `json:"user_login"` BroadcasterID string `json:"broadcaster_user_id"` BroadcasterName string `json:"broadcaster_user_name"` BroadcasterLogin string `json:"broadcaster_user_login"` Bits int `json:"bits"` Message string `json:"message"` } `json:"event_data"` }
CheerMsg is a message that represents a cheer event that TAU sends
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client connected to TAU
func (*Client) Reconnect ¶ added in v0.0.3
Reconnect can be used to reconnect if a connection error comes in via the ErrorCallback.
func (*Client) SendMessage ¶
SendMessage Allows you to send json message to the server.
func (*Client) SetCheerCallback ¶
func (c *Client) SetCheerCallback(callback CheerCallback)
SetCheerCallback sets a callback to be called when a cheer event is received.
func (*Client) SetErrorCallback ¶
func (c *Client) SetErrorCallback(callback ErrorCallback)
SetErrorCallback sets a callback for the user to handle errors that might arise (like connection closed)
func (*Client) SetFollowCallback ¶
func (c *Client) SetFollowCallback(callback FollowCallback)
SetFollowCallback sets a callback to be called on a follow event received.
func (*Client) SetHypeTrainBeginCallback ¶
func (c *Client) SetHypeTrainBeginCallback(callback HypeTrainBeginCallback)
SetHypeTrainBeginCallback sets a callback to be called when a hype train begin event is received.
func (*Client) SetHypeTrainEndedCallback ¶
func (c *Client) SetHypeTrainEndedCallback(callback HypeTrainEndCallback)
SetHypeTrainEndedCallback sets a callback to be called when a hype train ended event is received.
func (*Client) SetHypeTrainProgressCallback ¶
func (c *Client) SetHypeTrainProgressCallback(callback HypeTrainProgressCallback)
SetHypeTrainProgressCallback sets a callback to be called when a hype train progress event is received.
func (*Client) SetParallelProcessing ¶ added in v0.0.3
SetParallelProcessing Allows you to enable processing events in parallel. By default this is false, and most people probably would want it to be false, but there could be cases where processing in parallel would be useful/desirable.
func (*Client) SetPointsRedemptionCallback ¶
func (c *Client) SetPointsRedemptionCallback(callback PointsRedemptionCallback)
SetPointsRedemptionCallback sets a callback to be called when a points redemption event is received.
func (*Client) SetRaidCallback ¶
func (c *Client) SetRaidCallback(callback RaidCallback)
SetRaidCallback sets a callback to be called when a raid event is received.
func (*Client) SetRawCallback ¶
func (c *Client) SetRawCallback(callback RawCallback)
SetRawCallback sets a callback to be called on all received messages.
func (*Client) SetStreamOfflineCallback ¶
func (c *Client) SetStreamOfflineCallback(callback StreamOfflineCallback)
SetStreamOfflineCallback sets a callback to be called when a stream offline event is received.
func (*Client) SetStreamOnlineCallback ¶
func (c *Client) SetStreamOnlineCallback(callback StreamOnlineCallback)
SetStreamOnlineCallback sets a callback to be called when a stream online event is received.
func (*Client) SetStreamUpdateCallback ¶
func (c *Client) SetStreamUpdateCallback(callback StreamUpdateCallback)
SetStreamUpdateCallback sets a callback to be called on stream update events received
func (*Client) SetSubscriptionCallback ¶
func (c *Client) SetSubscriptionCallback(callback SubscriptionCallback)
SetSubscriptionCallback sets a callback to be called when a subscription event is received.
type ErrorCallback ¶
type ErrorCallback func(err error)
ErrorCallback is a callback to handle websocket specific errors where the websocket likely needs to be re-established and a new client is needed.
type Event ¶
type Event struct { ID string `json:"id"` EventID string `json:"event_id"` EventType string `json:"event_type"` EventSource string `json:"event_source"` Created Time `json:"created"` Origin string `json:"origin"` }
Event is the common parts of every event coming from TAU
type FollowCallback ¶
type FollowCallback func(msg *FollowMsg)
FollowCallback is a callback to handle follow events
type FollowMsg ¶
type FollowMsg struct { *Event EventData struct { UserName string `json:"user_name"` UserID string `json:"user_id"` UserLogin string `json:"user_login"` BroadcasterID string `json:"broadcaster_user_id"` BroadcasterName string `json:"broadcaster_user_name"` BroadcasterLogin string `json:"broadcaster_user_login"` } `json:"event_data"` }
FollowMsg is a message representing a follow event that TAU sends
type HypeTrainBeginCallback ¶
type HypeTrainBeginCallback func(msg *HypeTrainBeginMsg)
HypeTrainBeginCallback is a callback to handle hype train begin events
type HypeTrainBeginMsg ¶
type HypeTrainBeginMsg struct { *Event EventData struct { BroadcasterID string `json:"broadcaster_user_id"` BroadcasterName string `json:"broadcaster_user_name"` BroadcasterLogin string `json:"broadcaster_user_login"` Total int `json:"total"` Progress int `json:"progress"` Goal int `json:"goal"` StartedAt time.Time `json:"started_at"` ExpiresAt time.Time `json:"expires_at"` TopContributions []struct { UserID string `json:"user_id"` UserLogin string `json:"user_login"` UserName string `json:"user_name"` Type string `json:"type"` Total int `json:"total"` } `json:"top_contributions"` LastContribution struct { UserID string `json:"user_id"` UserLogin string `json:"user_login"` UserName string `json:"user_name"` Type string `json:"type"` Total int `json:"total"` } `json:"last_contribution"` } `json:"event_data"` }
HypeTrainBeginMsg is a message that represents a hype train begin event that TAU sends
type HypeTrainEndCallback ¶
type HypeTrainEndCallback func(msg *HypeTrainEndedMsg)
HypeTrainEndCallback is a callback to handle hype train end events
type HypeTrainEndedMsg ¶
type HypeTrainEndedMsg struct { *Event EventData struct { BroadcasterID string `json:"broadcaster_user_id"` BroadcasterName string `json:"broadcaster_user_name"` BroadcasterLogin string `json:"broadcaster_user_login"` Level int `json:"level"` Total int `json:"total"` Progress int `json:"progress"` StartedAt time.Time `json:"started_at"` EndedAt time.Time `json:"ended_at"` CooldownEndsAt time.Time `json:"cooldown_ends_at"` TopContributions []struct { UserID string `json:"user_id"` UserLogin string `json:"user_login"` UserName string `json:"user_name"` Type string `json:"type"` Total int `json:"total"` } `json:"top_contributions"` } `json:"event_data"` }
HypeTrainEndedMsg is a message that represents a hype train end event that TAU sends
type HypeTrainProgressCallback ¶
type HypeTrainProgressCallback func(msg *HypeTrainProgressMsg)
HypeTrainProgressCallback is a callback to handle hype train progress events
type HypeTrainProgressMsg ¶
type HypeTrainProgressMsg struct { *Event EventData struct { BroadcasterID string `json:"broadcaster_user_id"` BroadcasterName string `json:"broadcaster_user_name"` BroadcasterLogin string `json:"broadcaster_user_login"` Level int `json:"level"` Total int `json:"total"` Progress int `json:"progress"` Goal int `json:"goal"` StartedAt time.Time `json:"started_at"` ExpiresAt time.Time `json:"expires_at"` TopContributions []struct { UserID string `json:"user_id"` UserLogin string `json:"user_login"` UserName string `json:"user_name"` Type string `json:"type"` Total int `json:"total"` } `json:"top_contributions"` LastContribution struct { UserID string `json:"user_id"` UserLogin string `json:"user_login"` UserName string `json:"user_name"` Type string `json:"type"` Total int `json:"total"` } `json:"last_contribution"` } `json:"event_data"` }
HypeTrainProgressMsg is a message that represents a hype train progress event that TAU sends
type PointsRedemptionCallback ¶
type PointsRedemptionCallback func(msg *PointsRedemptionMsg)
PointsRedemptionCallback is a callback to handle points redemption events
type PointsRedemptionMsg ¶
type PointsRedemptionMsg struct { *Event EventData struct { BroadcasterID string `json:"broadcaster_user_id"` BroadcasterName string `json:"broadcaster_user_name"` BroadcasterLogin string `json:"broadcaster_user_login"` ID string `json:"id"` UserID string `json:"user_id"` UserLogin string `json:"user_login"` UserName string `json:"user_name"` UserInput string `json:"user_input"` Status string `json:"status"` RedeemedAt time.Time `json:"redeemed_at"` Reward struct { ID string `json:"id"` Title string `json:"title"` Prompt string `json:"prompt"` Cost int `json:"cost"` } `json:"reward"` } `json:"event_data"` }
PointsRedemptionMsg is a message that represents a points redemption event that TAU sends
type RaidCallback ¶
type RaidCallback func(msg *RaidMsg)
RaidCallback is a callback to handle raid events
type RaidMsg ¶
type RaidMsg struct { *Event EventData struct { FromBroadcasterName string `json:"from_broadcaster_user_name"` FromBroadcasterID string `json:"from_broadcaster_user_id"` FromBroadcasterLogin string `json:"from_broadcaster_user_login"` ToBroadcasterName string `json:"to_broadcaster_user_name"` ToBroadcasterID string `json:"to_broadcaster_user_id"` ToBroadcasterLogin string `json:"to_broadcaster_user_login"` Viewers int `json:"viewers"` } `json:"event_data"` }
RaidMsg is a message that represents a raid event that TAU sends
type RawCallback ¶
type RawCallback func(msg []byte)
RawCallback is a callback that will be called for every message that is received. Setting this callback does not prevent other callbacks from being called, though this one will be called first.
type StreamOfflineCallback ¶
type StreamOfflineCallback func(msg *StreamOfflineMsg)
StreamOfflineCallback is a callback to handle the stream going offline event
type StreamOfflineMsg ¶
type StreamOfflineMsg struct { *Event EventData struct { BroadcasterID string `json:"broadcaster_user_id"` BroadcasterName string `json:"broadcaster_user_name"` BroadcasterLogin string `json:"broadcaster_user_login"` } `json:"event_data"` }
StreamOfflineMsg is a message that represents a stream offline event that TAU sends
type StreamOnlineCallback ¶
type StreamOnlineCallback func(msg *StreamOnlineMsg)
StreamOnlineCallback is a callback to handle the stream coming online event
type StreamOnlineMsg ¶
type StreamOnlineMsg struct { *Event EventData struct { ID string `json:"id"` BroadcasterID string `json:"broadcaster_user_id"` BroadcasterName string `json:"broadcaster_user_name"` BroadcasterLogin string `json:"broadcaster_user_login"` Type string `json:"type"` StartedAt time.Time `json:"started_at"` } `json:"event_data"` }
StreamOnlineMsg is a message that represents a stream online event that TAU sends
type StreamUpdateCallback ¶
type StreamUpdateCallback func(msg *StreamUpdateMsg)
StreamUpdateCallback is a callback to handle updates to the stream information (like title)
type StreamUpdateMsg ¶
type StreamUpdateMsg struct { *Event EventData struct { Title string `json:"title"` Language string `json:"language"` IsMature bool `json:"is_mature"` CategoryID int `json:"category_id"` CategoryName string `json:"category_name"` BroadcasterID string `json:"broadcaster_user_id"` BroadcasterName string `json:"broadcaster_user_name"` BroadcasterLogin string `json:"broadcaster_user_login"` } `json:"event_data"` }
StreamUpdateMsg is a message that represents a stream update event that TAU sends
type SubscriptionCallback ¶
type SubscriptionCallback func(msg *SubscriptionMsg)
SubscriptionCallback is a callback to handle subscription events
type SubscriptionMsg ¶
type SubscriptionMsg struct { *Event EventData struct { Type string `json:"type"` Data struct { Topic string `json:"topic"` Message struct { BenefitEndMonth int `json:"benefit_end_month"` UserName string `json:"user_name"` DisplayName string `json:"display_name"` ChannelName string `json:"channel_name"` UserID string `json:"user_id"` ChannelID string `json:"channel_id"` Time time.Time `json:"time"` SubPlan string `json:"sub_plan"` SubPlanName string `json:"sub_plan_name"` Months int `json:"months"` CumulativeMonths int `json:"cumulative_months"` Context string `json:"context"` IsGift bool `json:"is_gift"` MultiMonthDuration int `json:"multi_month_duration"` StreakMonths int `json:"streak_months"` SubMessage struct { Message string `json:"message"` Emotes []struct { Start int `json:"start"` End int `json:"end"` ID int `json:"id"` } `json:"emotes"` } `json:"sub_message"` } `json:"message"` } `json:"data"` } `json:"event_data"` }
SubscriptionMsg is a message that represents a subscription event that TAU sends
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
Package helix handles interactions with twitch via the TAU pass through.
|
Package helix handles interactions with twitch via the TAU pass through. |