forked from g8rswimmer/go-twitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
poll_obj.go
41 lines (36 loc) · 1.44 KB
/
poll_obj.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package twitter
// PollField defines the fields of the expanded tweet
type PollField string
const (
// PollFieldDurationMinutes specifies the total duration of this poll.
PollFieldDurationMinutes PollField = "duration_minutes"
// PollFieldEndDateTime specifies the end date and time for this poll.
PollFieldEndDateTime PollField = "end_datetime"
// PollFieldID is unique identifier of the expanded poll.
PollFieldID PollField = "id"
// PollFieldOptions contains objects describing each choice in the referenced poll.
PollFieldOptions PollField = "options"
// PollFieldVotingStatus indicates if this poll is still active and can receive votes, or if the voting is now closed.
PollFieldVotingStatus PollField = "voting_status"
)
func pollFieldStringArray(arr []PollField) []string {
strs := make([]string, len(arr))
for i, field := range arr {
strs[i] = string(field)
}
return strs
}
// PollObj included in a Tweet is not a primary object on any endpoint
type PollObj struct {
ID string `json:"id"`
Options []PollOptionObj `json:"options"`
DurationMinutes int `json:"duration_minutes"`
EndDateTime string `json:"end_datetime"`
VotingStatus string `json:"voting_status"`
}
// PollOptionObj contains objects describing each choice in the referenced poll.
type PollOptionObj struct {
Position int `json:"position"`
Label string `json:"label"`
Votes int `json:"votes"`
}