88 lines
2.6 KiB
Go
88 lines
2.6 KiB
Go
package polls
|
||
|
||
import "time"
|
||
|
||
type Poll struct {
|
||
// An ID that identifies the poll.
|
||
ID string `json:"id"`
|
||
|
||
// An ID that identifies the broadcaster that created the poll.
|
||
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 viewers are voting on. For example, What game should I play next? The title may contain a maximum of 60 characters.
|
||
Title string `json:"title"`
|
||
|
||
// A list of choices that viewers can choose from. The list will contain a minimum of two choices and up to a maximum of five choices.
|
||
Choices []Choice `json:"choices"`
|
||
|
||
// Not used; will be set to false.
|
||
BitsVotingEnabled bool `json:"bits_voting_enabled"`
|
||
|
||
// Not used; will be set to 0.
|
||
BitsPerVote int `json:"bits_per_vote"`
|
||
|
||
// A Boolean value that indicates whether viewers may cast additional votes using Channel Points.
|
||
// For information about Channel Points, see Channel Points Guide: https://help.twitch.tv/s/article/channel-points-guide
|
||
ChannelPointsVotingEnabled bool `json:"channel_points_voting_enabled"`
|
||
|
||
// The number of points the viewer must spend to cast one additional vote.
|
||
ChannelPointsPerVote int `json:"channel_points_per_vote"`
|
||
|
||
// The poll’s status.
|
||
Status Status `json:"status"`
|
||
|
||
// The length of time (in seconds) that the poll will run for.
|
||
Duration int `json:"duration"`
|
||
|
||
// The UTC date and time (in RFC3339 format) of when the poll began.
|
||
StartedAt time.Time `json:"started_at"`
|
||
|
||
// The UTC date and time (in RFC3339 format) of when the poll ended. If status is ACTIVE, this field is set to null.
|
||
EndedAt time.Time `json:"ended_at"`
|
||
}
|
||
|
||
type Choice struct {
|
||
// An ID that identifies this choice.
|
||
ID string `json:"id"`
|
||
|
||
// The choice’s title. The title may contain a maximum of 25 characters.
|
||
Title string `json:"title"`
|
||
|
||
// The total number of votes cast for this choice.
|
||
Votes int `json:"votes"`
|
||
|
||
// The number of votes cast using Channel Points.
|
||
ChannelPointsVotes int `json:"channel_points_votes"`
|
||
|
||
// Not used; will be set to 0.
|
||
BitsVotes int `json:"bits_votes"`
|
||
}
|
||
|
||
type Status string
|
||
|
||
const (
|
||
// The poll is running.
|
||
Active Status = "ACTIVE"
|
||
|
||
// The poll ended on schedule (see the duration field).
|
||
Completed Status = "COMPLETED"
|
||
|
||
// The poll was terminated before its scheduled end.
|
||
Terminated Status = "TERMINATED"
|
||
|
||
// The poll has been archived and is no longer visible on the channel.
|
||
Archived Status = "ARCHIVED"
|
||
|
||
// The poll was deleted.
|
||
Moderated Status = "MODERATED"
|
||
|
||
// Something went wrong while determining the state.
|
||
Invalid Status = "INVALID"
|
||
)
|