APIv4 POST /reactions (#6092)
* APIv4 POST /reactions * update corresponding V3 endpoint
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
8aab290d10
Коммит
d2b86f1b8d
@@ -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 {
|
||||
|
||||
Ссылка в новой задаче
Block a user