[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 <f0x@cthu.lu>
This commit is contained in:
tobi
2022-11-24 19:12:07 +01:00
committed by GitHub
parent 3e82196d5e
commit b6dbe21026
10 changed files with 1139 additions and 4 deletions

View File

@@ -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
)