
Add a new document that precisely describes the string representation of datetime and date types. The previous description of them as "ISO 8601 Datetime" was very imprecise, as ISO 8601 describes many different ways of representing a datetime and date. Specify the datetime format precisely as the ISO 8601 profile described in RFC 3339, and the date format precisely as the "Complete date" format from the W3C note on date and time formats. Adjust all the references to ISO 8601 datetimes or dates to link back to the definition. Fixes #1420
3.1 KiB
title | description | menu | aliases | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Poll | Represents a poll attached to a status. |
|
|
Example
{
"id": "34830",
"expires_at": "2019-12-05T04:05:08.302Z",
"expired": true,
"multiple": false,
"votes_count": 10,
"voters_count": null,
"voted": true,
"own_votes": [
1
],
"options": [
{
"title": "accept",
"votes_count": 6
},
{
"title": "deny",
"votes_count": 4
}
],
"emojis": []
}
Attributes
id
Description: The ID of the poll in the database.
Type: String (cast from an integer, but not guaranteed to be a number)
Version history:
2.8.0 - added
expires_at
Description: When the poll ends.
Type: {{}} String (Datetime), or null if the poll does not end
Version history:
2.8.0 - added
expired
Description: Is the poll currently expired?
Type: Boolean
Version history:
2.8.0 - added
multiple
Description: Does the poll allow multiple-choice answers?
Type: Boolean
Version history:
2.8.0 - added
votes_count
Description: How many votes have been received.
Type: Integer
Version history:
2.8.0 - added
voters_count
Description: How many unique accounts have voted on a multiple-choice poll.
Type: {{}} Integer, or null if multiple
is false.
Version history:
2.8.0 - added
options
Description: Possible answers for the poll.
Type: Array of Poll::Option
Version history:
2.8.0 - added
emojis
Description: Custom emoji to be used for rendering poll options.
Type: Array of [CustomEmoji]({{< relref "entities/CustomEmoji" >}})
Version history:
2.8.0 - added
voted
{{%optional%}}
Description: When called with a user token, has the authorized user voted?
Type: Boolean
Version history:
2.8.0 - added
own_votes
{{%optional%}}
Description: When called with a user token, which options has the authorized user chosen? Contains an array of index values for options
.
Type: Array of Integer
Version history:
2.8.0 - added
Poll::Option attributes
title
Description: The text value of the poll option.
Type: String
Version history:
2.8.0 - added
votes_count
Description: The total number of received votes for this option.
Type: {{}} Integer, or null if results are not published yet.
Version history:
2.8.0 - added
See also
{{< page-relref ref="entities/Status#poll" caption="Status (poll
attribute)" >}}
{{< page-relref ref="methods/polls" caption="polls API methods" >}}
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/serializers/rest/poll_serializer.rb" caption="app/serializers/rest/poll_serializer.rb" >}}