Bonfire.API.MastoCompat.Mappers.Poll (Bonfire v1.0.1-social-alpha.28)
View SourceMaps Bonfire Poll.Question objects to Mastodon Poll format.
Per the Mastodon API spec, a Poll represents a poll attached to a status. See: https://docs.joinmastodon.org/entities/Poll/
Required Fields
id(string) - The poll's database IDoptions(array) - Poll options with title and votes_count
Optional Fields
expires_at(string, datetime) - When the poll endsexpired(boolean) - Whether the poll has endedmultiple(boolean) - Whether multiple choices are allowedvotes_count(integer) - Total votes across all optionsvoters_count(integer) - Unique voters countvoted(boolean) - Whether the current user has votedown_votes(array of integers) - Indices of user's choicesemojis(array) - Custom emojis in options
Summary
Functions
Transform a Bonfire Poll.Question to a Mastodon Poll.
Check if a given object is a Poll Question type. Uses module name check to avoid compile-time struct dependency.
Functions
Transform a Bonfire Poll.Question to a Mastodon Poll.
Options
:current_user- The current user (for voted/own_votes):votes_count- Pre-computed votes count (optional):voters_count- Pre-computed voters count (optional):user_votes- Pre-loaded user votes list (optional)
Check if a given object is a Poll Question type. Uses module name check to avoid compile-time struct dependency.