mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2024-11-30 02:43:00 +00:00
Implement exclusion params for notifications API call
This commit is contained in:
parent
a4a1ce9677
commit
71c5da7b3b
@ -23,9 +23,13 @@ type Notification struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetNotifications return notifications.
|
// 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
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user