Bonfire.Poll.API.GraphQLMasto.Adapter (Bonfire v1.0.1-social-alpha.28)

View Source

Mastodon-compatible Poll API endpoints.

Handles viewing polls and voting on them. Uses direct domain calls to the well-established context functions in Bonfire.Poll.

Summary

Functions

GET /api/v1/polls/:id

POST /api/v1/polls/:id/votes

Functions

show_poll(map, conn)

GET /api/v1/polls/:id

Returns a poll by ID. Public if parent status is public, requires authentication for private polls.

vote_on_poll(params, conn)

POST /api/v1/polls/:id/votes

Vote on a poll. Requires authentication. The choices[] parameter contains 0-based indices of the choices to vote for.

Returns 422 if:

  • Poll has expired
  • User has already voted
  • Invalid choice indices