add GetNotificationsExclude
This commit is contained in:
parent
ad3aa348dd
commit
fe547bf14f
2 changed files with 27 additions and 2 deletions
|
@ -37,8 +37,19 @@ type PushAlerts struct {
|
|||
|
||||
// GetNotifications returns notifications.
|
||||
func (c *Client) GetNotifications(ctx context.Context, pg *Pagination) ([]*Notification, error) {
|
||||
return c.GetNotificationsExclude(ctx, nil, pg)
|
||||
}
|
||||
|
||||
// GetNotificationsExclude returns notifications with excluded notifications
|
||||
func (c *Client) GetNotificationsExclude(ctx context.Context, exclude *[]string, pg *Pagination) ([]*Notification, error) {
|
||||
var notifications []*Notification
|
||||
err := c.doAPI(ctx, http.MethodGet, "/api/v1/notifications", nil, ¬ifications, pg)
|
||||
params := url.Values{}
|
||||
if exclude != nil {
|
||||
for _, ex := range *exclude {
|
||||
params.Add("exclude_types[]", ex)
|
||||
}
|
||||
}
|
||||
err := c.doAPI(ctx, http.MethodGet, "/api/v1/notifications", params, ¬ifications, pg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue