Add GET /emojis/name/{emoji_name} API endpoint (#8142)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f2415b98f6
Коммит
3918ed6c58
@@ -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 {
|
||||
|
||||
Ссылка в новой задаче
Block a user