From 3e91c76504df99d2066afada755594ee8b554d1d Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Mon, 13 May 2019 01:46:11 +0200 Subject: [PATCH] Added polls entity, available since API 2.8.0 --- polls.go | 20 ++++++++++++++++++++ status.go | 1 + 2 files changed, 21 insertions(+) create mode 100644 polls.go diff --git a/polls.go b/polls.go new file mode 100644 index 0000000..841d209 --- /dev/null +++ b/polls.go @@ -0,0 +1,20 @@ +package mastodon + +import "time" + +// Poll hold information for mastodon polls. +type Poll struct { + ID ID `json:"id"` + ExpiresAt time.Time `json:"expires_at"` + Expired bool `json:"expired"` + Multiple bool `json:"multiple"` + VotesCount int64 `json:"votes_count"` + Options []PollOption `json:"options"` + Voted bool `json:"voted"` +} + +// Poll hold information for a mastodon poll option. +type PollOption struct { + Title string `json:"title"` + VotesCount int64 `json:"votes_count"` +} diff --git a/status.go b/status.go index 2f6bdd7..e0d955f 100644 --- a/status.go +++ b/status.go @@ -34,6 +34,7 @@ type Status struct { Mentions []Mention `json:"mentions"` Tags []Tag `json:"tags"` Card *Card `json:"card"` + Poll *Poll `json:"poll"` Application Application `json:"application"` Language string `json:"language"` Pinned interface{} `json:"pinned"`