102 lines
2.9 KiB
Go
102 lines
2.9 KiB
Go
package predictions
|
||
|
||
import "time"
|
||
|
||
type Prediction struct {
|
||
// An ID that identifies this prediction.
|
||
ID string `json:"id"`
|
||
|
||
// An ID that identifies the broadcaster that created the prediction.
|
||
BroadcasterID string `json:"broadcaster_id"`
|
||
|
||
// The broadcaster’s display name.
|
||
BroadcasterName string `json:"broadcaster_name"`
|
||
|
||
// The broadcaster’s login name.
|
||
BroadcasterLogin string `json:"broadcaster_login"`
|
||
|
||
// The question that the prediction asks. For example, Will I finish this entire pizza?
|
||
Title string `json:"title"`
|
||
|
||
// The ID of the winning outcome. Is null unless status is RESOLVED.
|
||
WinningOutcomeID string `json:"winning_outcome_id"`
|
||
|
||
// The list of possible outcomes for the prediction.
|
||
Outcomes []Outcome `json:"outcomes"`
|
||
|
||
// The length of time (in seconds) that the prediction will run for.
|
||
PredictionWindow int `json:"prediction_window"`
|
||
|
||
// The prediction’s status.
|
||
Status Status `json:"status"`
|
||
|
||
// The UTC date and time of when the Prediction began.
|
||
CreatedAt time.Time `json:"created_at"`
|
||
|
||
// The UTC date and time of when the Prediction ended. If status is ACTIVE, this is set to null.
|
||
EndedAt *time.Time `json:"ended_at"`
|
||
|
||
// The UTC date and time of when the Prediction was locked. If status is not LOCKED, this is set to null.
|
||
LockedAt *time.Time `json:"locked_at"`
|
||
}
|
||
|
||
type Outcome struct {
|
||
// An ID that identifies this outcome.
|
||
ID string `json:"id"`
|
||
|
||
// The outcome’s text.
|
||
Title string `json:"title"`
|
||
|
||
// The number of unique viewers that chose this outcome.
|
||
Users int `json:"users"`
|
||
|
||
// The number of Channel Points spent by viewers on this outcome.
|
||
ChannelPoints int `json:"channel_points"`
|
||
|
||
// A list of viewers who were the top predictors; otherwise, null if none.
|
||
TopPredictors []TopPredictor `json:"top_predictors"`
|
||
|
||
// The color that visually identifies this outcome in the UX.
|
||
Color Color `json:"color"`
|
||
}
|
||
|
||
type TopPredictor struct {
|
||
// An ID that identifies the viewer.
|
||
UserID string `json:"user_id"`
|
||
|
||
// The viewer’s display name.
|
||
UserName string `json:"user_name"`
|
||
|
||
// The viewer’s login name.
|
||
UserLogin string `json:"user_login"`
|
||
|
||
// The number of Channel Points the viewer spent.
|
||
ChannelPointsUsed int `json:"channel_points_used"`
|
||
|
||
// The number of Channel Points distributed to the viewer.
|
||
ChannelPointsWon int `json:"channel_points_won"`
|
||
}
|
||
|
||
type Color string
|
||
|
||
const (
|
||
ColorBlue Color = "BLUE"
|
||
ColorPink Color = "PINK"
|
||
)
|
||
|
||
type Status string
|
||
|
||
const (
|
||
// The Prediction is running and viewers can make predictions.
|
||
StatusActive Status = "ACTIVE"
|
||
|
||
// The broadcaster canceled the Prediction and refunded the Channel Points to the participants.
|
||
StatusCanceled Status = "CANCELED"
|
||
|
||
// The broadcaster locked the Prediction, which means viewers can no longer make predictions.
|
||
StatusLocked Status = "LOCKED"
|
||
|
||
// The winning outcome was determined and the Channel Points were distributed to the viewers who predicted the correct outcome.
|
||
StatusResolved Status = "RESOLVED"
|
||
)
|