Documentation
¶
Index ¶
- Constants
- func DoNothingOnSuccess(auth *util.AuthConfig, userStore db.UserStore, ...) error
- func IsRevocationRequest(r *http.Request) bool
- func IsValidReward(e *helix.EventSubChannelPointsCustomRewardRedemptionEvent, ...) bool
- func IsVerificationRequest(r *http.Request) bool
- func UpdateRedemptionStatus(auth *util.AuthConfig, userStore db.UserStore, ...) error
- type EventSubHandler
- type EventSubNotification
- type PreferenceHandler
- type RewardHandler
- type RewardHandlerConfig
- type SpotifyAuthZHandler
- type StatsHandler
- type SubscribeRequest
- type SvgData
- type TwitchAuthZHandler
- type UserHandler
Constants ¶
const ( PrefFormExplicitKey = "explicit" PrefFormSongLengthKey = "song-length" )
const (
SongRequestsTitle = "TwitchSongRequests"
)
Variables ¶
This section is empty.
Functions ¶
func DoNothingOnSuccess ¶
func DoNothingOnSuccess(auth *util.AuthConfig, userStore db.UserStore, event *helix.EventSubChannelPointsCustomRewardRedemptionEvent, success bool) error
DoNothingOnSuccess is a no-op to satisfy the function interface. See https://github.com/SaxyPandaBear/TwitchSongRequests/issues/133
func IsRevocationRequest ¶
func IsValidReward ¶
func IsValidReward(e *helix.EventSubChannelPointsCustomRewardRedemptionEvent, p *preferences.Preference) bool
IsValidReward ensures that the redemption event is a valid event that we want to consume. Original implementation relies on the existence of a key word in the reward title. New implementation verifies with the stored CustomRewardID for a user's preference.
func IsVerificationRequest ¶
func UpdateRedemptionStatus ¶
func UpdateRedemptionStatus(auth *util.AuthConfig, userStore db.UserStore, event *helix.EventSubChannelPointsCustomRewardRedemptionEvent, success bool) error
UpdateRedemptionStatus attempts to update the status for the channel point redemption. This is helpful so failed submissions should get refunded.
Types ¶
type EventSubHandler ¶
type EventSubHandler struct {
// contains filtered or unexported fields
}
func NewEventSubHandler ¶
func NewEventSubHandler(u db.UserStore, p db.PreferenceStore, auth *util.AuthConfig, callbackURL, secret string) *EventSubHandler
func (*EventSubHandler) SubscribeToTopic ¶
func (e *EventSubHandler) SubscribeToTopic(w http.ResponseWriter, r *http.Request)
SubscribeToTopic
type EventSubNotification ¶
type EventSubNotification struct { Subscription helix.EventSubSubscription `json:"subscription"` Challenge string `json:"challenge"` Event json.RawMessage `json:"event"` }
type PreferenceHandler ¶
type PreferenceHandler struct {
// contains filtered or unexported fields
}
func NewPreferenceHandler ¶
func NewPreferenceHandler(d db.PreferenceStore, redirectURL string) *PreferenceHandler
func (*PreferenceHandler) SavePreferences ¶
func (h *PreferenceHandler) SavePreferences(w http.ResponseWriter, r *http.Request)
type RewardHandler ¶
type RewardHandler struct { // OnSuccess is a callback function that executes after successfully // publishing to the queue OnSuccess func(*util.AuthConfig, db.UserStore, *helix.EventSubChannelPointsCustomRewardRedemptionEvent, bool) error // contains filtered or unexported fields }
func NewRewardHandler ¶
func NewRewardHandler(config *RewardHandlerConfig) *RewardHandler
func (*RewardHandler) ChannelPointRedeem ¶
func (h *RewardHandler) ChannelPointRedeem(w http.ResponseWriter, r *http.Request)
type RewardHandlerConfig ¶
type RewardHandlerConfig struct { Secret string Publisher queue.Publisher UserStore db.UserStore PrefStore db.PreferenceStore MsgCount db.MessageCounter Twitch *util.AuthConfig Spotify *util.AuthConfig }
type SpotifyAuthZHandler ¶
type SpotifyAuthZHandler struct {
// contains filtered or unexported fields
}
func NewSpotifyAuthZHandler ¶
func NewSpotifyAuthZHandler(url string, auth *util.AuthConfig, userStore db.UserStore) *SpotifyAuthZHandler
func (*SpotifyAuthZHandler) Authorize ¶
func (h *SpotifyAuthZHandler) Authorize(w http.ResponseWriter, r *http.Request)
https://developer.spotify.com/documentation/general/guides/authorization/code-flow/
type StatsHandler ¶
type StatsHandler struct { NumOnboarded uint NumAllowed uint // contains filtered or unexported fields }
func NewStatsHandler ¶
func NewStatsHandler(counter db.MessageCounter, onboarded, allowed uint) *StatsHandler
func (*StatsHandler) Onboarded ¶ added in v1.3.1
func (h *StatsHandler) Onboarded(w http.ResponseWriter, r *http.Request)
func (*StatsHandler) RunningCount ¶
func (h *StatsHandler) RunningCount(w http.ResponseWriter, r *http.Request)
func (*StatsHandler) TotalMessages ¶
func (h *StatsHandler) TotalMessages(w http.ResponseWriter, r *http.Request)
type SubscribeRequest ¶
type SubscribeRequest struct {
UserID string `json:"user_id"`
}
type SvgData ¶
type SvgData struct { SchemaVersion int `json:"schemaVersion"` Label string `json:"label"` Message string `json:"message"` Color string `json:"color"` Style string `json:"style"` CacheSeconds int `json:"cacheSeconds"` }
https://shields.io/endpoint schema
type TwitchAuthZHandler ¶
type TwitchAuthZHandler struct {
// contains filtered or unexported fields
}
func NewTwitchAuthZHandler ¶
func NewTwitchAuthZHandler(url string, auth *util.AuthConfig, userStore db.UserStore, prefStore db.PreferenceStore) *TwitchAuthZHandler
func (*TwitchAuthZHandler) Authorize ¶
func (h *TwitchAuthZHandler) Authorize(w http.ResponseWriter, r *http.Request)
Authorize handles the callback from the OAuth authorization
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
func NewUserHandler ¶
func NewUserHandler(d db.UserStore, p db.PreferenceStore, redirectURL string, twitch, spotify *util.AuthConfig) *UserHandler
func (*UserHandler) RevokeUserAccesses ¶
func (h *UserHandler) RevokeUserAccesses(w http.ResponseWriter, r *http.Request)