summaryrefslogtreecommitdiff
path: root/internal/api/client/media
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api/client/media')
-rw-r--r--internal/api/client/media/mediacreate.go101
-rw-r--r--internal/api/client/media/mediaget.go59
-rw-r--r--internal/api/client/media/mediaupdate.go102
3 files changed, 136 insertions, 126 deletions
diff --git a/internal/api/client/media/mediacreate.go b/internal/api/client/media/mediacreate.go
index 5a040b26c..62f4a0d4e 100644
--- a/internal/api/client/media/mediacreate.go
+++ b/internal/api/client/media/mediacreate.go
@@ -35,59 +35,64 @@ import (
//
// Upload a new media attachment.
//
-// ---
-// tags:
-// - media
+// ---
+// tags:
+// - media
//
-// consumes:
-// - multipart/form-data
+// consumes:
+// - multipart/form-data
//
-// produces:
-// - application/json
+// 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
+// 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
+// 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
+// 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 (m *Module) MediaCreatePOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/media/mediaget.go b/internal/api/client/media/mediaget.go
index c2a0ab7a0..fd232c4c7 100644
--- a/internal/api/client/media/mediaget.go
+++ b/internal/api/client/media/mediaget.go
@@ -32,39 +32,40 @@ import (
//
// Get a media attachment that you own.
//
-// ---
-// tags:
-// - media
+// ---
+// tags:
+// - media
//
-// produces:
-// - application/json
+// produces:
+// - application/json
//
-// parameters:
-// - name: id
-// description: id of the attachment
-// type: string
-// in: path
-// required: true
+// parameters:
+// -
+// name: id
+// description: id of the attachment
+// type: string
+// in: path
+// required: true
//
-// security:
-// - OAuth2 Bearer:
-// - read:media
+// 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
+// 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 (m *Module) MediaGETHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {
diff --git a/internal/api/client/media/mediaupdate.go b/internal/api/client/media/mediaupdate.go
index 32aef9cff..fb0e67ddc 100644
--- a/internal/api/client/media/mediaupdate.go
+++ b/internal/api/client/media/mediaupdate.go
@@ -40,60 +40,64 @@ import (
// 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
+// ---
+// tags:
+// - media
//
-// consumes:
-// - application/json
-// - application/xml
-// - application/x-www-form-urlencoded
+// consumes:
+// - application/json
+// - application/xml
+// - application/x-www-form-urlencoded
//
-// produces:
-// - application/json
+// 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
+// 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
+// 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
+// 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 (m *Module) MediaPUTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true)
if err != nil {