summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/model/client4.go b/model/client4.go
index 151b5a491..0694ecbdf 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -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 {