Add unreact and reaction count; added mark self reactions as "*"

This commit is contained in:
localhost_frssoft 2022-10-19 15:47:31 +03:00
parent 4e79142c93
commit 927bd6127c
4 changed files with 43 additions and 4 deletions

View file

@ -11,8 +11,8 @@ import (
)
type StatusPleroma struct {
InReplyToAccountAcct string `json:"in_reply_to_account_acct"`
Reactions []*ReactionsPleroma `json:"emoji_reactions"`
InReplyToAccountAcct string `json:"in_reply_to_account_acct"`
Reactions []*ReactionsPleroma `json:"emoji_reactions"`
}
type ReactionsPleroma struct {
@ -186,6 +186,15 @@ func (c *Client) PutReaction(ctx context.Context, id string, emoji string) (*Sta
return &status, nil
}
// UnReaction is unreaction on status with unicode emoji (Pleroma)
func (c *Client) UnReaction(ctx context.Context, id string, emoji string) (*Status, error) {
var status Status
err := c.doAPI(ctx, http.MethodDelete, fmt.Sprintf("/api/v1/pleroma/statuses/%s/reactions/%s", id, emoji), nil, &status, nil)
if err != nil {
return nil, err
}
return &status, nil
}
// Reblog is reblog the toot of id and return status of reblog.
func (c *Client) Reblog(ctx context.Context, id string) (*Status, error) {