* APIv4 POST /reactions

* update corresponding V3 endpoint
Этот коммит содержится в:
Saturnino Abril
2017-04-19 05:15:15 +09:00
коммит произвёл Joram Wilander
родитель 8aab290d10
Коммит d2b86f1b8d
7 изменённых файлов: 202 добавлений и 8 удалений

Просмотреть файл

@@ -238,6 +238,10 @@ func (c *Client4) GetEmojiRoute(emojiId string) string {
return fmt.Sprintf(c.GetEmojisRoute()+"/%v", emojiId)
}
func (c *Client4) GetReactionsRoute() string {
return fmt.Sprintf("/reactions")
}
func (c *Client4) DoApiGet(url string, etag string) (*http.Response, *AppError) {
return c.DoApiRequest(http.MethodGet, url, "", etag)
}
@@ -2374,6 +2378,16 @@ func (c *Client4) GetEmoji(emojiId string) (*Emoji, *Response) {
// Reaction Section
// SaveReaction saves an emoji reaction for a post. Returns the saved reaction if successful, otherwise an error will be returned.
func (c *Client4) SaveReaction(reaction *Reaction) (*Reaction, *Response) {
if r, err := c.DoApiPost(c.GetReactionsRoute(), reaction.ToJson()); err != nil {
return nil, &Response{StatusCode: r.StatusCode, Error: err}
} else {
defer closeBody(r)
return ReactionFromJson(r.Body), BuildResponse(r)
}
}
// GetReactions returns a list of reactions to a post.
func (c *Client4) GetReactions(postId string) ([]*Reaction, *Response) {
if r, err := c.DoApiGet(c.GetPostRoute(postId)+"/reactions", ""); err != nil {