From 71c5da7b3b9e816caa52dbf9e332c5b10112c93d Mon Sep 17 00:00:00 2001 From: Hyphen Date: Sat, 29 Aug 2020 00:27:36 +0200 Subject: Implement exclusion params for notifications API call --- mastodon/notification.go | 8 ++++++-- 1 file 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 } -- cgit v1.2.3