diff options
author | r <r@freesoftwareextremist.com> | 2020-09-27 09:29:17 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2020-09-27 09:37:15 +0000 |
commit | da22d19fb45b5504f4191ad06d4e7637bfbc3916 (patch) | |
tree | 73a44f90ec525caddfe3d01caf688a1b4afdc4af /mastodon | |
parent | 0b8c41ca7c99f6ab31a3769b16c760fd028f7c2b (diff) | |
download | bloat-da22d19fb45b5504f4191ad06d4e7637bfbc3916.tar.gz bloat-da22d19fb45b5504f4191ad06d4e7637bfbc3916.zip |
Add bookmarks
- Add bookmark/unbookmark link on mouse hover
- Add bookmarks section on user profile page
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/accounts.go | 10 | ||||
-rw-r--r-- | mastodon/status.go | 23 |
2 files changed, 33 insertions, 0 deletions
diff --git a/mastodon/accounts.go b/mastodon/accounts.go index 7a44e2b..c5eb227 100644 --- a/mastodon/accounts.go +++ b/mastodon/accounts.go @@ -353,3 +353,13 @@ func (c *Client) UnSubscribe(ctx context.Context, id string) (*Relationship, err } return relationship, nil } + +// GetBookmarks returns the list of bookmarked statuses +func (c *Client) GetBookmarks(ctx context.Context, pg *Pagination) ([]*Status, error) { + var statuses []*Status + err := c.doAPI(ctx, http.MethodGet, "/api/v1/bookmarks", nil, &statuses, pg) + if err != nil { + return nil, err + } + return statuses, nil +} diff --git a/mastodon/status.go b/mastodon/status.go index 7a29b99..c8555d6 100644 --- a/mastodon/status.go +++ b/mastodon/status.go @@ -47,6 +47,7 @@ type Status struct { Application Application `json:"application"` Language string `json:"language"` Pinned interface{} `json:"pinned"` + Bookmarked bool `json:"bookmarked"` Poll *Poll `json:"poll"` // Custom fields @@ -366,3 +367,25 @@ func (c *Client) UnmuteConversation(ctx context.Context, id string) (*Status, er } return &status, nil } + +// Bookmark bookmarks status specified by id. +func (c *Client) Bookmark(ctx context.Context, id string) (*Status, error) { + var status Status + + err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/bookmark", id), nil, &status, nil) + if err != nil { + return nil, err + } + return &status, nil +} + +// Unbookmark bookmarks status specified by id. +func (c *Client) Unbookmark(ctx context.Context, id string) (*Status, error) { + var status Status + + err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/unbookmark", id), nil, &status, nil) + if err != nil { + return nil, err + } + return &status, nil +} |