summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index 6281b3df4..9fda40aca 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -234,6 +234,10 @@ func (c *Client4) GetEmojisRoute() string {
return fmt.Sprintf("/emoji")
}
+func (c *Client4) GetEmojiRoute(emojiId string) string {
+ return fmt.Sprintf(c.GetEmojisRoute()+"/%v", emojiId)
+}
+
func (c *Client4) DoApiGet(url string, etag string) (*http.Response, *AppError) {
return c.DoApiRequest(http.MethodGet, url, "", etag)
}
@@ -2335,6 +2339,26 @@ func (c *Client4) GetEmojiList() ([]*Emoji, *Response) {
}
}
+// DeleteEmoji delete an custom emoji on the provided emoji id string.
+func (c *Client4) DeleteEmoji(emojiId string) (bool, *Response) {
+ if r, err := c.DoApiDelete(c.GetEmojiRoute(emojiId)); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
+// GetEmoji returns a custom emoji in the system on the provided emoji id string.
+func (c *Client4) GetEmoji(emojiId string) (*Emoji, *Response) {
+ if r, err := c.DoApiGet(c.GetEmojiRoute(emojiId), ""); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return EmojiFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// Reaction Section
// GetReactions returns a list of reactions to a post.