media

package
v0.17.0-rc2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	IDKey            = "id"                                    // IDKey is the key for media attachment IDs
	BasePath         = "/:" + apiutil.APIVersionKey + "/media" // BasePath is the base API path for making media requests through v1 or v2 of the api (for mastodon API compatibility)
	AttachmentWithID = BasePath + "/:" + IDKey                 // BasePathWithID corresponds to a media attachment with the given ID
)

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) MediaCreatePOSTHandler

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

MediaCreatePOSTHandler swagger:operation POST /api/{api_version}/media mediaCreate

Upload a new media attachment.

---
tags:
- media

consumes:
- multipart/form-data

produces:
- application/json

parameters:
-
	name: api_version
	type: string
	in: path
	description: Version of the API to use. Must be either `v1` or `v2`.
	required: true
-
	name: description
	in: formData
	description: >-
		Image or media description to use as alt-text on the attachment.
		This is very useful for users of screenreaders!
		May or may not be required, depending on your instance settings.
	type: string
-
	name: focus
	in: formData
	description: >-
		Focus of the media file.
		If present, it should be in the form of two comma-separated floats between -1 and 1.
		For example: `-0.5,0.25`.
	type: string
	default: "0,0"
-
	name: file
	in: formData
	description: The media attachment to upload.
	type: file
	required: true

security:
- OAuth2 Bearer:
	- write:media

responses:
	'200':
		description: The newly-created media attachment.
		schema:
			"$ref": "#/definitions/attachment"
	'400':
		description: bad request
	'401':
		description: unauthorized
	'422':
		description: unprocessable
	'500':
		description: internal server error

func (*Module) MediaGETHandler

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

MediaGETHandler swagger:operation GET /api/v1/media/{id} mediaGet

Get a media attachment that you own.

---
tags:
- media

produces:
- application/json

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

security:
- OAuth2 Bearer:
	- read:media

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

func (*Module) MediaPUTHandler

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

MediaPUTHandler swagger:operation PUT /api/v1/media/{id} mediaUpdate

Update a media attachment.

You must own the media attachment, and the attachment must not yet be attached to a status.

The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'.

---
tags:
- media

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

produces:
- application/json

parameters:
-
	name: id
	description: id of the attachment to update
	type: string
	in: path
	required: true
-
	name: description
	in: formData
	description: >-
		Image or media description to use as alt-text on the attachment.
		This is very useful for users of screenreaders!
		May or may not be required, depending on your instance settings.
	type: string
	allowEmptyValue: true
-
	name: focus
	in: formData
	description: >-
		Focus of the media file.
		If present, it should be in the form of two comma-separated floats between -1 and 1.
		For example: `-0.5,0.25`.
	type: string
	allowEmptyValue: true
	default: "0,0"

security:
- OAuth2 Bearer:
	- write:media

responses:
	'200':
		description: The newly-updated media attachment.
		schema:
			"$ref": "#/definitions/attachment"
	'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