mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-06 03:48:45 +00:00
Add bookmarks
- Add bookmark/unbookmark link on mouse hover - Add bookmarks section on user profile page
This commit is contained in:
parent
0b8c41ca7c
commit
da22d19fb4
8 changed files with 181 additions and 13 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue