diff options
author | Hyphen <hyphen@tfwno.gf> | 2020-08-29 00:27:36 +0200 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2020-09-03 04:49:09 +0000 |
commit | 71c5da7b3b9e816caa52dbf9e332c5b10112c93d (patch) | |
tree | 6a43d68921338f25cef1c7a6dd5e88443df6f365 | |
parent | a4a1ce9677e95a5f0503386e972f1f65c6037e2e (diff) | |
download | bloat-71c5da7b3b9e816caa52dbf9e332c5b10112c93d.tar.gz bloat-71c5da7b3b9e816caa52dbf9e332c5b10112c93d.zip |
Implement exclusion params for notifications API call
-rw-r--r-- | mastodon/notification.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mastodon/notification.go b/mastodon/notification.go index d793905..5983396 100644 --- a/mastodon/notification.go +++ b/mastodon/notification.go @@ -23,9 +23,13 @@ type Notification struct { } // GetNotifications return notifications. -func (c *Client) GetNotifications(ctx context.Context, pg *Pagination) ([]*Notification, error) { +func (c *Client) GetNotifications(ctx context.Context, pg *Pagination, excludes ...string) ([]*Notification, error) { var notifications []*Notification - err := c.doAPI(ctx, http.MethodGet, "/api/v1/notifications", nil, ¬ifications, pg) + params := url.Values{} + for _, exclude := range excludes { + params.Add("exclude_types[]", exclude) + } + err := c.doAPI(ctx, http.MethodGet, "/api/v1/notifications", params, ¬ifications, pg) if err != nil { return nil, err } |