summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-04-22 21:52:03 +0900
committerHarrison Healey <harrisonmhealey@gmail.com>2017-04-22 08:52:03 -0400
commitecb10ed62fdff179e34f82b0ff2569da8390f4ad (patch)
treee2405ed87a31cca42275b98a76e1312c0a1867eb /model/client4.go
parente62afeace04e2abd23fa78a0a54e0a5d2e17e0b7 (diff)
downloadchat-ecb10ed62fdff179e34f82b0ff2569da8390f4ad.tar.gz
chat-ecb10ed62fdff179e34f82b0ff2569da8390f4ad.tar.bz2
chat-ecb10ed62fdff179e34f82b0ff2569da8390f4ad.zip
APIv4 DELETE /users/{user_id}/posts/{post_id}/reactions/name (#6117)
* APIv4 DELETE /users/{user_id}/posts/{post_id}/reactions/name * updated v3 deleteReaction endpoint * update parameter of app.DeleteReactionForPost() * update utils.IsValidAlphaNum, add utils.IsValidAlphaNumHyphenUnderscore, and add related tests
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index ac5ebf03e..1a2ce523b 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -2533,3 +2533,13 @@ func (c *Client4) GetReactions(postId string) ([]*Reaction, *Response) {
return ReactionsFromJson(r.Body), BuildResponse(r)
}
}
+
+// DeleteReaction deletes reaction of a user in a post.
+func (c *Client4) DeleteReaction(reaction *Reaction) (bool, *Response) {
+ if r, err := c.DoApiDelete(c.GetUserRoute(reaction.UserId) + c.GetPostRoute(reaction.PostId) + fmt.Sprintf("/reactions/%v", reaction.EmojiName)); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}