summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-04-17 16:07:28 +0200
committerHarrison Healey <harrisonmhealey@gmail.com>2017-04-17 10:07:28 -0400
commit80684ad69f641bb759095beff0e1a15db0aa33b1 (patch)
treeaecc0fd9fe73bc10f28467aa1f3d7194bb043e41 /model
parent62974f19cd0025a3a5098741210f1b61b08765a9 (diff)
downloadchat-80684ad69f641bb759095beff0e1a15db0aa33b1.tar.gz
chat-80684ad69f641bb759095beff0e1a15db0aa33b1.tar.bz2
chat-80684ad69f641bb759095beff0e1a15db0aa33b1.zip
implement DELETE /emoji/{emoji_id} fro apiV4 (#6021)
implement GET /emoji/{emoji_id} for apiv4
Diffstat (limited to 'model')
-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.