media

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BasePathV1 = "/api/v1/media"

BasePathV1 is the base API path for making media requests through v1 of the api (for mastodon API compatibility)

View Source
const BasePathV2 = "/api/v2/media"

BasePathV2 is the base API path for making media requests through v2 of the api (for mastodon API compatibility)

View Source
const BasePathWithIDV1 = BasePathV1 + "/:" + IDKey

BasePathWithIDV1 corresponds to a media attachment with the given ID

View Source
const BasePathWithIDV2 = BasePathV2 + "/:" + IDKey

BasePathWithIDV2 corresponds to a media attachment with the given ID

View Source
const IDKey = "id"

IDKey is the key for media attachment IDs

Variables

This section is empty.

Functions

func New

func New(processor processing.Processor) api.ClientModule

New returns a new auth module

Types

type Module

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

Module implements the ClientAPIModule interface for media

func (*Module) MediaCreatePOSTHandler

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

MediaCreatePOSTHandler swagger:operation POST /api/v1/media mediaCreate

Upload a new media attachment.

--- tags: - media

consumes: - multipart/form-data

produces: - application/json

parameters:

  • 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
  • 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
'403':
   description: forbidden
'422':
   description: unprocessable

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
'403':
   description: forbidden
'422':
   description: unprocessable

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

security: - OAuth2 Bearer:

  • write:media

responses:

'200':
  description: The newly-updated media attachment.
  schema:
    "$ref": "#/definitions/attachment"
'400':
   description: bad request
'401':
   description: unauthorized
'403':
   description: forbidden
'422':
   description: unprocessable

func (*Module) Route

func (m *Module) Route(s router.Router) error

Route satisfies the RESTAPIModule interface

Jump to

Keyboard shortcuts

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