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