v1

package
v0.17.0-rc3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// BasePath is the base path for serving the filters API, minus the 'api' prefix
	BasePath = "/v1/filters"
	// BasePathWithID is the base path with the ID key in it, for operations on an existing filter.
	BasePathWithID = BasePath + "/:" + apiutil.IDKey
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

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

Module implements APIs for client-side aka "v1" filtering.

func New

func New(processor *processing.Processor) *Module

func (*Module) FilterDELETEHandler

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

FilterDELETEHandler swagger:operation DELETE /api/v1/filters/{id} filterV1Delete

Delete a single filter with the given ID.

---
tags:
- filters

produces:
- application/json

parameters:
-
	name: id
	type: string
	description: ID of the filter
	in: path
	required: true

security:
- OAuth2 Bearer:
	- write:filters

responses:
	'200':
		description: filter deleted
	'400':
		description: bad request
	'401':
		description: unauthorized
	'404':
		description: not found
	'406':
		description: not acceptable
	'500':
		description: internal server error

func (*Module) FilterGETHandler

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

FilterGETHandler swagger:operation GET /api/v1/filters/{id} filterV1Get

Get a single filter with the given ID.

---
tags:
- filters

produces:
- application/json

parameters:
-
	name: id
	type: string
	description: ID of the filter
	in: path
	required: true

security:
- OAuth2 Bearer:
	- read:filters

responses:
	'200':
		name: filter
		description: Requested filter.
		schema:
			"$ref": "#/definitions/filterV1"
	'400':
		description: bad request
	'401':
		description: unauthorized
	'404':
		description: not found
	'406':
		description: not acceptable
	'500':
		description: internal server error

func (*Module) FilterPOSTHandler

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

FilterPOSTHandler swagger:operation POST /api/v1/filters filterV1Post

Create a single filter.

---
tags:
- filters

consumes:
- application/json
- application/xml
- application/x-www-form-urlencoded

produces:
- application/json

parameters:
-
	name: phrase
	in: formData
	required: true
	description: |-
		The text to be filtered.

		Sample: fnord
	minLength: 1
	maxLength: 40
	type: string
-
	name: context[]
	in: formData
	required: true
	description: |-
		The contexts in which the filter should be applied.

		Sample: home, public
	enum:
		- home
		- notifications
		- public
		- thread
		- account
	type: array
	items:
		type:
			string
	collectionFormat: multi
	minItems: 1
	uniqueItems: true
-
	name: expires_in
	in: formData
	description: |-
		Number of seconds from now that the filter should expire. If omitted, filter never expires.

		Sample: 86400
	type: number
-
	name: irreversible
	in: formData
	description: |-
		Should matching entities be removed from the user's timelines/views, instead of hidden? Not supported yet.

		Sample: false
	type: boolean
	default: false
-
	name: whole_word
	in: formData
	description: |-
		Should the filter consider word boundaries?

		Sample: true
	type: boolean
	default: false

security:
- OAuth2 Bearer:
	- write:filters

responses:
	'200':
		name: filter
		description: New filter.
		schema:
			"$ref": "#/definitions/filterV1"
	'400':
		description: bad request
	'401':
		description: unauthorized
	'403':
		description: forbidden to moved accounts
	'404':
		description: not found
	'406':
		description: not acceptable
	'409':
		description: conflict (duplicate keyword)
	'422':
		description: unprocessable content
	'500':
		description: internal server error

func (*Module) FilterPUTHandler

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

FilterPUTHandler swagger:operation PUT /api/v1/filters/{id} filterV1Put

Update a single filter with the given ID.

---
tags:
- filters

consumes:
- application/json
- application/xml
- application/x-www-form-urlencoded

produces:
- application/json

parameters:
-
	name: id
	in: path
	type: string
	required: true
	description: ID of the filter.
-
	name: phrase
	in: formData
	required: true
	description: |-
		The text to be filtered.

		Sample: fnord
	minLength: 1
	maxLength: 40
	type: string
-
	name: context[]
	in: formData
	required: true
	description: |-
		The contexts in which the filter should be applied.

		Sample: home, public
	enum:
		- home
		- notifications
		- public
		- thread
		- account
	type: array
	items:
		type:
			string
	collectionFormat: multi
	minItems: 1
	uniqueItems: true
-
	name: expires_in
	in: formData
	description: |-
		Number of seconds from now that the filter should expire. If omitted, filter never expires.

		Sample: 86400
	type: number
-
	name: irreversible
	in: formData
	description: |-
		Should matching entities be removed from the user's timelines/views, instead of hidden? Not supported yet.

		Sample: false
	type: boolean
	default: false
-
	name: whole_word
	in: formData
	description: |-
		Should the filter consider word boundaries?

		Sample: true
	type: boolean
	default: false

security:
- OAuth2 Bearer:
	- write:filters

responses:
	'200':
		name: filter
		description: Updated filter.
		schema:
			"$ref": "#/definitions/filterV1"
	'400':
		description: bad request
	'401':
		description: unauthorized
	'403':
		description: forbidden to moved accounts
	'404':
		description: not found
	'406':
		description: not acceptable
	'409':
		description: conflict (duplicate keyword)
	'422':
		description: unprocessable content
	'500':
		description: internal server error

func (*Module) FiltersGETHandler

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

FiltersGETHandler swagger:operation GET /api/v1/filters filtersV1Get

Get all filters for the authenticated account.

---
tags:
- filters

produces:
- application/json

security:
- OAuth2 Bearer:
	- read:filters

responses:
	'200':
		name: filters
		description: Requested filters.
		schema:
			type: array
			items:
				"$ref": "#/definitions/filterV1"
	'400':
		description: bad request
	'401':
		description: unauthorized
	'404':
		description: not found
	'406':
		description: not acceptable
	'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