Documentation ¶
Index ¶
Constants ¶
const ( IDKey = "id" // IDKey is the key for media attachment IDs APIVersionKey = "api_version" // APIVersionKey is the key for which version of the API to use (v1 or v2) BasePathWithAPIVersion = "/api/:" + APIVersionKey + "/media" // BasePathWithAPIVersion is the base API path for making media requests through v1 or v2 of the api (for mastodon API compatibility) BasePathWithIDV1 = "/api/v1/media/:" + IDKey // BasePathWithID corresponds to a media attachment with the given ID )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module implements the ClientAPIModule interface for media
func (*Module) MediaCreatePOSTHandler ¶
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 one of 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
- 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 ¶
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 ¶
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 '404': description: not found '406': description: not acceptable '500': description: internal server error