gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

emoji.go (3199B)


      1 // GoToSocial
      2 // Copyright (C) GoToSocial Authors admin@gotosocial.org
      3 // SPDX-License-Identifier: AGPL-3.0-or-later
      4 //
      5 // This program is free software: you can redistribute it and/or modify
      6 // it under the terms of the GNU Affero General Public License as published by
      7 // the Free Software Foundation, either version 3 of the License, or
      8 // (at your option) any later version.
      9 //
     10 // This program is distributed in the hope that it will be useful,
     11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 // GNU Affero General Public License for more details.
     14 //
     15 // You should have received a copy of the GNU Affero General Public License
     16 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17 
     18 package model
     19 
     20 import "mime/multipart"
     21 
     22 // Emoji represents a custom emoji.
     23 //
     24 // swagger:model emoji
     25 type Emoji struct {
     26 	// The name of the custom emoji.
     27 	// example: blobcat_uwu
     28 	Shortcode string `json:"shortcode"`
     29 	// Web URL of the custom emoji.
     30 	// example: https://example.org/fileserver/emojis/blogcat_uwu.gif
     31 	URL string `json:"url"`
     32 	// A link to a static copy of the custom emoji.
     33 	// example: https://example.org/fileserver/emojis/blogcat_uwu.png
     34 	StaticURL string `json:"static_url"`
     35 	// Emoji is visible in the emoji picker of the instance.
     36 	// example: true
     37 	VisibleInPicker bool `json:"visible_in_picker"`
     38 	// Used for sorting custom emoji in the picker.
     39 	// example: blobcats
     40 	Category string `json:"category,omitempty"`
     41 }
     42 
     43 // EmojiCreateRequest represents a request to create a custom emoji made through the admin API.
     44 //
     45 // swagger:model emojiCreateRequest
     46 type EmojiCreateRequest struct {
     47 	// Desired shortcode for the emoji, without surrounding colons. This must be unique for the domain.
     48 	// example: blobcat_uwu
     49 	Shortcode string `form:"shortcode" validation:"required"`
     50 	// Image file to use for the emoji. Must be png or gif and no larger than 50kb.
     51 	Image *multipart.FileHeader `form:"image" validation:"required"`
     52 	// Category in which to place the new emoji. Will be uncategorized by default.
     53 	// CategoryName length should not exceed 64 characters.
     54 	CategoryName string `form:"category"`
     55 }
     56 
     57 // EmojiUpdateRequest represents a request to update a custom emoji, made through the admin API.
     58 //
     59 // swagger:model emojiUpdateRequest
     60 type EmojiUpdateRequest struct {
     61 	// Type of action. One of disable, modify, copy.
     62 	Type EmojiUpdateType `form:"type" json:"type" xml:"type"`
     63 	// Desired shortcode for the emoji, without surrounding colons. This must be unique for the domain.
     64 	// example: blobcat_uwu
     65 	Shortcode *string `form:"shortcode"`
     66 	// Image file to use for the emoji.
     67 	// Must be png or gif and no larger than 50kb.
     68 	Image *multipart.FileHeader `form:"image"`
     69 	// Category in which to place the emoji.
     70 	CategoryName *string `form:"category"`
     71 }
     72 
     73 // EmojiUpdateType models an admin update action to take on a custom emoji.
     74 type EmojiUpdateType string
     75 
     76 const (
     77 	EmojiUpdateModify  EmojiUpdateType = "modify"  // modify local emoji
     78 	EmojiUpdateDisable EmojiUpdateType = "disable" // disable remote emoji
     79 	EmojiUpdateCopy    EmojiUpdateType = "copy"    // copy remote emoji -> local
     80 )