From b6dbe21026615ef3fbaacff98c7cc860cef39d16 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Thu, 24 Nov 2022 19:12:07 +0100 Subject: [feature] `PATCH /api/v1/admin/custom_emojis/{id}` endpoint (#1061) * start adding admin emoji PATCH stuff * updating works OK, now how about copying * allow emojis to be copied * update swagger docs * update admin processer to use non-interface storage driver * remove shortcode updating for local emojis * go fmt Co-authored-by: f0x52 --- internal/api/model/emoji.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'internal/api/model/emoji.go') diff --git a/internal/api/model/emoji.go b/internal/api/model/emoji.go index eb636f63c..2c75ceadd 100644 --- a/internal/api/model/emoji.go +++ b/internal/api/model/emoji.go @@ -54,3 +54,28 @@ type EmojiCreateRequest struct { // CategoryName length should not exceed 64 characters. CategoryName string `form:"category"` } + +// EmojiUpdateRequest represents a request to update a custom emoji, made through the admin API. +// +// swagger:model emojiUpdateRequest +type EmojiUpdateRequest struct { + // Type of action. One of disable, modify, copy. + Type EmojiUpdateType `form:"type" json:"type" xml:"type"` + // Desired shortcode for the emoji, without surrounding colons. This must be unique for the domain. + // example: blobcat_uwu + Shortcode *string `form:"shortcode"` + // Image file to use for the emoji. + // Must be png or gif and no larger than 50kb. + Image *multipart.FileHeader `form:"image"` + // Category in which to place the emoji. + CategoryName *string `form:"category"` +} + +// EmojiUpdateType models an admin update action to take on a custom emoji. +type EmojiUpdateType string + +const ( + EmojiUpdateModify EmojiUpdateType = "modify" // modify local emoji + EmojiUpdateDisable EmojiUpdateType = "disable" // disable remote emoji + EmojiUpdateCopy EmojiUpdateType = "copy" // copy remote emoji -> local +) -- cgit v1.2.3