polls

package
v0.17.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDKey           = "id"                                 // IDKey is the key for poll IDs
	BasePath        = "/:" + util.APIVersionKey + "/polls" // BasePath is the base API path for making poll requests through v1 or v2 of the api (for mastodon API compatibility)
	PollWithID      = BasePath + "/:" + IDKey              //
	PollVotesWithID = BasePath + "/:" + IDKey + "/votes"   //
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

func New

func New(processor *processing.Processor) *Module

func (*Module) PollGETHandler

func (m *Module) PollGETHandler(c *gin.Context)

PollGETHandler swagger:operation GET /api/v1/polls/{id} poll

View poll with given ID.

---
tags:
- polls

produces:
- application/json

parameters:
-
	name: id
	type: string
	description: Target poll ID.
	in: path
	required: true

security:
- OAuth2 Bearer:
	- read:statuses

responses:
	'200':
		description: "The requested poll."
		schema:
			"$ref": "#/definitions/poll"
	'400':
		description: bad request
	'401':
		description: unauthorized
	'403':
		description: forbidden
	'404':
		description: not found
	'406':
		description: not acceptable
	'500':
		description: internal server error

func (*Module) PollVotePOSTHandler

func (m *Module) PollVotePOSTHandler(c *gin.Context)

PollVotePOSTHandler swagger:operation POST /api/v1/polls/{id}/votes pollVote

Vote with choices in the given poll.

---
tags:
- polls

produces:
- application/json

parameters:
-
	name: id
	type: string
	description: Target poll ID.
	in: path
	required: true
-
	name: choices
	type: array
	items:
		type: integer
	description: Poll choice indices on which to vote.
	in: formData
	required: true

security:
- OAuth2 Bearer:
	- write:statuses

responses:
	'200':
		description: "The updated poll with user vote choices."
		schema:
			"$ref": "#/definitions/poll"
	'400':
		description: bad request
	'401':
		description: unauthorized
	'403':
		description: forbidden
	'404':
		description: not found
	'406':
		description: not acceptable
	'422':
		description: unprocessable entity
	'500':
		description: internal server error

func (*Module) Route

func (m *Module) Route(attachHandler func(method string, path string, f ...gin.HandlerFunc) gin.IRoutes)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL