go-twitch/api/polls/models.go

88 lines
2.6 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 broadcasters display name.
BroadcasterName string `json:"broadcaster_name"`
// The broadcasters 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 polls 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 choices 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"
)