From bdf1574d402c6743aa1a0ac973eed60afee457a9 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sun, 16 Oct 2022 17:00:53 +0300 Subject: [PATCH] EditedAt commit and for feature reactions pleroma func --- mastodon/status.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mastodon/status.go b/mastodon/status.go index 2fae6ee..48180c4 100644 --- a/mastodon/status.go +++ b/mastodon/status.go @@ -23,6 +23,10 @@ type CreatedAt struct { time.Time } +type EditedAt struct{ + time.Time +} + func (t *CreatedAt) UnmarshalJSON(d []byte) error { // Special case to handle retweets from GNU Social // which returns empty string ("") in created_at @@ -43,6 +47,7 @@ type Status struct { Reblog *Status `json:"reblog"` Content string `json:"content"` CreatedAt CreatedAt `json:"created_at"` + EditedAt *EditedAt `json:"edited_at"` Emojis []Emoji `json:"emojis"` RepliesCount int64 `json:"replies_count"` ReblogsCount int64 `json:"reblogs_count"` @@ -153,6 +158,17 @@ func (c *Client) GetFavouritedBy(ctx context.Context, id string, pg *Pagination) return accounts, nil } +// GetReactionBy returns the account list of the user who reacted the toot of id. (Pleroma) +func (c *Client) GetReactedBy(ctx context.Context, id string, pg *Pagination) ([]*Account, error) { + var accounts []*Account + err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/pleroma/statuses/%s/reactions", id), nil, &accounts, pg) + if err != nil { + return nil, err + } + return accounts, nil +} + + // Reblog is reblog the toot of id and return status of reblog. func (c *Client) Reblog(ctx context.Context, id string) (*Status, error) { var status Status