diff options
author | r <r@freesoftwareextremist.com> | 2020-04-17 17:19:11 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2020-04-17 17:31:32 +0000 |
commit | 04af1b93dc95d761b4e05a448c9d86ac67623ff6 (patch) | |
tree | 75da80bfb467874b4fd94617f9c7c4cbd3cdbb85 /mastodon | |
parent | ccdb5ef051bfcc9e96f4b0ce98a32735eb48d1c4 (diff) | |
download | bloat-04af1b93dc95d761b4e05a448c9d86ac67623ff6.tar.gz bloat-04af1b93dc95d761b4e05a448c9d86ac67623ff6.zip |
Add account {,un}subscribe
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/accounts.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mastodon/accounts.go b/mastodon/accounts.go index c02f0bd..995741c 100644 --- a/mastodon/accounts.go +++ b/mastodon/accounts.go @@ -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 +} |