summaryrefslogtreecommitdiff
path: root/internal/api/client/media/mediacreate.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-08-02 19:06:44 +0200
committerLibravatar GitHub <noreply@github.com>2021-08-02 19:06:44 +0200
commit0386a28b5a3c4212320e8a96ddd14c54b65a2090 (patch)
tree3bfdf198934215ac64acac9d66d952baf65c2752 /internal/api/client/media/mediacreate.go
parentfix breaky linky (diff)
downloadgotosocial-0386a28b5a3c4212320e8a96ddd14c54b65a2090.tar.xz
Frodo swaggins (#126)
* more swagger fun * document a whole bunch more stuff * more swagger yayyyyyyy * progress + go fmt
Diffstat (limited to 'internal/api/client/media/mediacreate.go')
-rw-r--r--internal/api/client/media/mediacreate.go53
1 files changed, 52 insertions, 1 deletions
diff --git a/internal/api/client/media/mediacreate.go b/internal/api/client/media/mediacreate.go
index 9f4702b6b..f41d4568f 100644
--- a/internal/api/client/media/mediacreate.go
+++ b/internal/api/client/media/mediacreate.go
@@ -29,7 +29,58 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/oauth"
)
-// MediaCreatePOSTHandler handles requests to create/upload media attachments
+// 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 (m *Module) MediaCreatePOSTHandler(c *gin.Context) {
l := m.log.WithField("func", "statusCreatePOSTHandler")
authed, err := oauth.Authed(c, true, true, true, true) // posting new media is serious business so we want *everything*