summaryrefslogtreecommitdiff
path: root/internal/api/model
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-05-10 16:29:05 +0200
committerLibravatar GitHub <noreply@github.com>2021-05-10 16:29:05 +0200
commit742f985d5b0620ad14015f9a2df9940edc254bf4 (patch)
tree5c8d469fd015efc6f8459f2d9df04132877285a3 /internal/api/model
parentWebfinger + Small fixes (#20) (diff)
downloadgotosocial-742f985d5b0620ad14015f9a2df9940edc254bf4.tar.xz
Mediahandler (#21)
Media GET and media PUT handlers
Diffstat (limited to 'internal/api/model')
-rw-r--r--internal/api/model/attachment.go16
-rw-r--r--internal/api/model/status.go2
2 files changed, 12 insertions, 6 deletions
diff --git a/internal/api/model/attachment.go b/internal/api/model/attachment.go
index d90247f83..c5dbb0cba 100644
--- a/internal/api/model/attachment.go
+++ b/internal/api/model/attachment.go
@@ -23,10 +23,16 @@ import "mime/multipart"
// AttachmentRequest represents the form data parameters submitted by a client during a media upload request.
// See: https://docs.joinmastodon.org/methods/statuses/media/
type AttachmentRequest struct {
- File *multipart.FileHeader `form:"file"`
- Thumbnail *multipart.FileHeader `form:"thumbnail"`
- Description string `form:"description"`
- Focus string `form:"focus"`
+ File *multipart.FileHeader `form:"file" binding:"required"`
+ Description string `form:"description" json:"description" xml:"description"`
+ Focus string `form:"focus" json:"focus" xml:"focus"`
+}
+
+// AttachmentRequest represents the form data parameters submitted by a client during a media update/PUT request.
+// See: https://docs.joinmastodon.org/methods/statuses/media/
+type AttachmentUpdateRequest struct {
+ Description *string `form:"description" json:"description" xml:"description"`
+ Focus *string `form:"focus" json:"focus" xml:"focus"`
}
// Attachment represents the object returned to a client after a successful media upload request.
@@ -57,7 +63,7 @@ type Attachment struct {
// See https://docs.joinmastodon.org/methods/statuses/media/#focal-points points for more.
Meta MediaMeta `json:"meta,omitempty"`
// Alternate text that describes what is in the media attachment, to be used for the visually impaired or when media attachments do not load.
- Description string `json:"description,omitempty"`
+ Description string `json:"description"`
// A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet.
// See https://github.com/woltapp/blurhash
Blurhash string `json:"blurhash,omitempty"`
diff --git a/internal/api/model/status.go b/internal/api/model/status.go
index faf88ae84..54d021e29 100644
--- a/internal/api/model/status.go
+++ b/internal/api/model/status.go
@@ -88,7 +88,7 @@ type StatusCreateRequest struct {
// Text content of the status. If media_ids is provided, this becomes optional. Attaching a poll is optional while status is provided.
Status string `form:"status"`
// Array of Attachment ids to be attached as media. If provided, status becomes optional, and poll cannot be used.
- MediaIDs []string `form:"media_ids"`
+ MediaIDs []string `form:"media_ids" json:"media_ids" xml:"media_ids"`
// Poll to include with this status.
Poll *PollRequest `form:"poll"`
// ID of the status being replied to, if status is a reply