go-twitch/eventsub/events/predictions.go

160 lines
4.8 KiB
Go
Raw Normal View History

2024-03-05 12:14:18 -05:00
package events
import "time"
// An array of up to 10 objects that describe users who participated in a Channel Points Prediction.
type TopPredictors struct {
// The ID of the user.
UserId string `json:"user_id"`
// The login of the user.
UserLogin string `json:"user_login"`
// The display name of the user.
UserName string `json:"user_name"`
// The number of Channel Points won.
// This value is always null in the event payload for Prediction progress and Prediction lock.
// This value is 0 if the outcome did not win or if the Prediction was canceled and Channel Points were refunded.
ChannelPointsWon int `json:"channel_points_won"`
// The number of Channel Points used.
ChannelPointsUsed int `json:"channel_points_used"`
}
// An array of the outcomes for a particular Channel Points Prediction. Each Predictions event payload includes an outcomes array.
// The outcomes array contains an object that describes each outcome and, if applicable, the number of users who selected that outcome,
// the number of Channel Points for that outcome, and an array of top_predictors.
type Outcome struct {
// The outcome ID.
Id string `json:"id"`
// The outcome title.
Title string `json:"title"`
// The color for the outcome. Valid values are pink and blue.
Color string `json:"color"`
// The number of users who used Channel Points on this outcome.
Users int `json:"users"`
// The total number of Channel Points used on this outcome.
ChannelPoints int `json:"channel_points"`
// An array of users who used the most Channel Points on this outcome.
TopPredictors []TopPredictors `json:"top_predictors"`
}
type ChannelPredictionBeginEvent struct {
// The Channel Points Prediction ID.
Id string `json:"id"`
// The requested broadcaster ID.
BroadcasterUserId string `json:"broadcaster_user_id"`
// The requested broadcaster login.
BroadcasterUserLogin string `json:"broadcaster_user_login"`
// The requested broadcaster display name.
BroadcasterUserName string `json:"broadcaster_user_name"`
// Title for the Channel Points Prediction.
Title string `json:"title"`
// An array of outcomes for the Channel Points Prediction.
Outcomes []Outcome `json:"outcomes"`
// The time the Channel Points Prediction started.
StartedAt time.Time `json:"started_at"`
// The time the Channel Points Prediction will automatically lock.
LocksAt time.Time `json:"locks_at"`
}
type ChannelPredictionProgressEvent struct {
// The Channel Points Prediction ID.
Id string `json:"id"`
// The requested broadcaster ID.
BroadcasterUserId string `json:"broadcaster_user_id"`
// The requested broadcaster login.
BroadcasterUserLogin string `json:"broadcaster_user_login"`
// The requested broadcaster display name.
BroadcasterUserName string `json:"broadcaster_user_name"`
// Title for the Channel Points Prediction.
Title string `json:"title"`
// An array of outcomes for the Channel Points Prediction.
Outcomes []Outcome `json:"outcomes"`
// The time the Channel Points Prediction started.
StartedAt time.Time `json:"started_at"`
// The time the Channel Points Prediction will automatically lock.
LocksAt time.Time `json:"locks_at"`
}
type ChannelPredictionLockEvent struct {
// The Channel Points Prediction ID.
Id string `json:"id"`
// The requested broadcaster ID.
BroadcasterUserId string `json:"broadcaster_user_id"`
// The requested broadcaster login.
BroadcasterUserLogin string `json:"broadcaster_user_login"`
// The requested broadcaster display name.
BroadcasterUserName string `json:"broadcaster_user_name"`
// Title for the Channel Points Prediction.
Title string `json:"title"`
// An array of outcomes for the Channel Points Prediction.
Outcomes []Outcome `json:"outcomes"`
// The time the Channel Points Prediction started.
StartedAt time.Time `json:"started_at"`
// The time the Channel Points Prediction was locked.
LockedAt time.Time `json:"locked_at"`
}
type ChannelPredictionEndEvent struct {
// The Channel Points Prediction ID.
Id string `json:"id"`
// The requested broadcaster ID.
BroadcasterUserId string `json:"broadcaster_user_id"`
// The requested broadcaster login.
BroadcasterUserLogin string `json:"broadcaster_user_login"`
// The requested broadcaster display name.
BroadcasterUserName string `json:"broadcaster_user_name"`
// Title for the Channel Points Prediction.
Title string `json:"title"`
// The ID of the winning outcome.
WinningOutcomeId string `json:"winning_outcome_id"`
// An array of outcomes for the Channel Points Prediction.
Outcomes []Outcome `json:"outcomes"`
// The status of the Channel Points Prediction. Valid values are resolved and canceled.
Status string `json:"status"`
// The time the Channel Points Prediction started.
StartedAt time.Time `json:"started_at"`
// The time the Channel Points Prediction ended.
EndedAt time.Time `json:"ended_at"`
}