EditedAt commit and for feature reactions pleroma func

This commit is contained in:
localhost_frssoft 2022-10-16 17:00:53 +03:00
parent 7d54da6380
commit bdf1574d40

View File

@ -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