mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Add GET /emojis/name/{emoji_name} API endpoint (#8142)
This commit is contained in:
@@ -282,6 +282,10 @@ func (c *Client4) GetEmojiRoute(emojiId string) string {
|
||||
return fmt.Sprintf(c.GetEmojisRoute()+"/%v", emojiId)
|
||||
}
|
||||
|
||||
func (c *Client4) GetEmojiByNameRoute(name string) string {
|
||||
return fmt.Sprintf(c.GetEmojisRoute()+"/name/%v", name)
|
||||
}
|
||||
|
||||
func (c *Client4) GetReactionsRoute() string {
|
||||
return fmt.Sprintf("/reactions")
|
||||
}
|
||||
@@ -3045,7 +3049,7 @@ func (c *Client4) DeleteEmoji(emojiId string) (bool, *Response) {
|
||||
}
|
||||
}
|
||||
|
||||
// GetEmoji returns a custom emoji in the system on the provided emoji id string.
|
||||
// GetEmoji returns a custom emoji based on the emojiId string.
|
||||
func (c *Client4) GetEmoji(emojiId string) (*Emoji, *Response) {
|
||||
if r, err := c.DoApiGet(c.GetEmojiRoute(emojiId), ""); err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
@@ -3055,6 +3059,16 @@ func (c *Client4) GetEmoji(emojiId string) (*Emoji, *Response) {
|
||||
}
|
||||
}
|
||||
|
||||
// GetEmojiByName returns a custom emoji based on the name string.
|
||||
func (c *Client4) GetEmojiByName(name string) (*Emoji, *Response) {
|
||||
if r, err := c.DoApiGet(c.GetEmojiByNameRoute(name), ""); err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return EmojiFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
// GetEmojiImage returns the emoji image.
|
||||
func (c *Client4) GetEmojiImage(emojiId string) ([]byte, *Response) {
|
||||
if r, err := c.DoApiGet(c.GetEmojiRoute(emojiId)+"/image", ""); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user