mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-06 03:48:45 +00:00
Add account {,un}subscribe
This commit is contained in:
parent
ccdb5ef051
commit
04af1b93dc
6 changed files with 127 additions and 8 deletions
|
@ -191,6 +191,7 @@ type Relationship struct {
|
|||
Blocking bool `json:"blocking"`
|
||||
Muting bool `json:"muting"`
|
||||
MutingNotifications bool `json:"muting_notifications"`
|
||||
Subscribing bool `json:"subscribing"`
|
||||
Requested bool `json:"requested"`
|
||||
DomainBlocking bool `json:"domain_blocking"`
|
||||
ShowingReblogs bool `json:"showing_reblogs"`
|
||||
|
@ -328,3 +329,23 @@ func (c *Client) GetMutes(ctx context.Context, pg *Pagination) ([]*Account, erro
|
|||
}
|
||||
return accounts, nil
|
||||
}
|
||||
|
||||
// Subscribe to receive notifications for all statuses posted by a user
|
||||
func (c *Client) Subscribe(ctx context.Context, id string) (*Relationship, error) {
|
||||
var relationship *Relationship
|
||||
err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/pleroma/accounts/%s/subscribe", url.PathEscape(id)), nil, &relationship, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return relationship, nil
|
||||
}
|
||||
|
||||
// UnSubscribe to stop receiving notifications from user statuses
|
||||
func (c *Client) UnSubscribe(ctx context.Context, id string) (*Relationship, error) {
|
||||
var relationship *Relationship
|
||||
err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/pleroma/accounts/%s/unsubscribe", url.PathEscape(id)), nil, &relationship, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return relationship, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue