Documentation ¶
Index ¶
Constants ¶
View Source
const (
EventSubSubscriptionsEndpoint = "https://api.twitch.tv/helix/eventsub/subscriptions"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Credentials ¶
type MapTracker ¶
type MapTracker struct {
// contains filtered or unexported fields
}
MapTracker uses an in-memory map to check if a notification ID is a duplicate.
func NewMapTracker ¶
func NewMapTracker() *MapTracker
NewMapTracker creates a new MapTracker instance which uses an in-memory map to check if a notification ID is a duplicate.
func (*MapTracker) AddAndCheckIfDuplicate ¶
type Status ¶
type Status string
const ( StatusAny Status = "" StatusEnabled Status = "enabled" StatusVerificationPending Status = "webhook_callback_verification_pending" StatusVerificationFailed Status = "webhook_callback_verification_failed" StatusFailuresExceeded Status = "notification_failures_exceeded" StatusAuthorizationRevoked Status = "authorization_revoked" StatusModeratorRemoved Status = "moderator_removed" StatusUserRemoved Status = "user_removed" StatusVersionRemoved Status = "version_removed" )
type SubClient ¶
type SubClient struct {
// contains filtered or unexported fields
}
func NewSubClient ¶
func NewSubClient(credentials Credentials) *SubClient
NewSubClient creates a new SubClient with the given Credentials provider.
func NewSubClientHTTP ¶ added in v1.0.2
func NewSubClientHTTP(credentials Credentials, client *http.Client) *SubClient
NewSubClientHTTP creates a new SubClient with the given Credentials provider and http.Client instance.
func (*SubClient) GetSubscriptions ¶
func (s *SubClient) GetSubscriptions(ctx context.Context, statusFilter Status) (*esb.RequestStatus, error)
GetSubscriptions returns all EventSub subscriptions. If statusFilter != StatusAny, it will apply the filter to the query.
func (*SubClient) Subscribe ¶
func (s *SubClient) Subscribe(ctx context.Context, srq *SubRequest) (*esb.RequestStatus, error)
Subscribe creates a new Webhook subscription.
type SubHandler ¶
type SubHandler struct { // Challenge handler function. // Returns whether the subscription should be accepted. VerifyChallenge func(h *esb.ResponseHeaders, chal *esb.SubscriptionChallenge) bool // IDTracker used to deduplicate notifications IDTracker IDTracker OnDuplicateNotification func(h *esb.ResponseHeaders) HandleChannelUpdate func(h *esb.ResponseHeaders, event *esb.EventChannelUpdate) HandleChannelFollow func(h *esb.ResponseHeaders, event *esb.EventChannelFollow) HandleUserUpdate func(h *esb.ResponseHeaders, event *esb.EventUserUpdate) HandleChannelSubscribe func(h *esb.ResponseHeaders, event *esb.EventChannelSubscribe) HandleChannelSubscriptionEnd func(h *esb.ResponseHeaders, event *esb.EventChannelSubscriptionEnd) HandleChannelSubscriptionGift func(h *esb.ResponseHeaders, event *esb.EventChannelSubscriptionGift) HandleChannelSubscriptionMessage func(h *esb.ResponseHeaders, event *esb.EventChannelSubscriptionMessage) HandleChannelCheer func(h *esb.ResponseHeaders, event *esb.EventChannelCheer) HandleChannelRaid func(h *esb.ResponseHeaders, event *esb.EventChannelRaid) HandleChannelBan func(h *esb.ResponseHeaders, event *esb.EventChannelBan) HandleChannelUnban func(h *esb.ResponseHeaders, event *esb.EventChannelUnban) HandleChannelModeratorAdd func(h *esb.ResponseHeaders, event *esb.EventChannelModeratorAdd) HandleChannelModeratorRemove func(h *esb.ResponseHeaders, event *esb.EventChannelModeratorRemove) HandleChannelPointsRewardAdd func(h *esb.ResponseHeaders, event *esb.EventChannelPointsRewardAdd) HandleChannelPointsRewardUpdate func(h *esb.ResponseHeaders, event *esb.EventChannelPointsRewardUpdate) HandleChannelPointsRewardRemove func(h *esb.ResponseHeaders, event *esb.EventChannelPointsRewardRemove) HandleChannelPointsRewardRedemptionAdd func(h *esb.ResponseHeaders, event *esb.EventChannelPointsRewardRedemptionAdd) HandleChannelPointsRewardRedemptionUpdate func(h *esb.ResponseHeaders, event *esb.EventChannelPointsRewardRedemptionUpdate) HandleChannelPollBegin func(h *esb.ResponseHeaders, event *esb.EventChannelPollBegin) HandleChannelPollProgress func(h *esb.ResponseHeaders, event *esb.EventChannelPollProgress) HandleChannelPollEnd func(h *esb.ResponseHeaders, event *esb.EventChannelPollEnd) HandleChannelPredictionBegin func(h *esb.ResponseHeaders, event *esb.EventChannelPredictionBegin) HandleChannelPredictionProgress func(h *esb.ResponseHeaders, event *esb.EventChannelPredictionProgress) HandleChannelPredictionLock func(h *esb.ResponseHeaders, event *esb.EventChannelPredictionLock) HandleChannelPredictionEnd func(h *esb.ResponseHeaders, event *esb.EventChannelPredictionEnd) HandleDropEntitlementGrant func(h *esb.ResponseHeaders, event *esb.EventDropEntitlementGrant) HandleExtensionBitsTransactionCreate func(h *esb.ResponseHeaders, event *esb.EventBitsTransactionCreate) HandleGoalBegin func(h *esb.ResponseHeaders, event *esb.EventGoals) HandleGoalProgress func(h *esb.ResponseHeaders, event *esb.EventGoals) HandleGoalEnd func(h *esb.ResponseHeaders, event *esb.EventGoals) HandleHypeTrainBegin func(h *esb.ResponseHeaders, event *esb.EventHypeTrainBegin) HandleHypeTrainProgress func(h *esb.ResponseHeaders, event *esb.EventHypeTrainProgress) HandleHypeTrainEnd func(h *esb.ResponseHeaders, event *esb.EventHypeTrainEnd) HandleStreamOnline func(h *esb.ResponseHeaders, event *esb.EventStreamOnline) HandleStreamOffline func(h *esb.ResponseHeaders, event *esb.EventStreamOffline) HandleUserAuthorizationGrant func(h *esb.ResponseHeaders, event *esb.EventUserAuthorizationGrant) HandleUserAuthorizationRevoke func(h *esb.ResponseHeaders, event *esb.EventUserAuthorizationRevoke) // contains filtered or unexported fields }
func NewSubHandler ¶
func NewSubHandler(doSignatureVerification bool, secret []byte) *SubHandler
func (*SubHandler) ServeHTTP ¶
func (s *SubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type SubRequest ¶
type TwitchError ¶
type TwitchError struct { ErrorText string `json:"error"` Status int `json:"status"` Message string `json:"message"` }
TwitchError describes an error from the Twitch API.
For example:
{ "error": "Unauthorized", "status": 401, "message": "Invalid OAuth token" }
func (*TwitchError) Error ¶
func (t *TwitchError) Error() string
Click to show internal directories.
Click to hide internal directories.