Replace deprecated /api/v1/notifications/dismiss with new API
This commit is contained in:
parent
6abe72ddb0
commit
8c434b5282
|
@ -110,7 +110,7 @@ func main() {
|
||||||
* [x] GET /api/v1/mutes
|
* [x] GET /api/v1/mutes
|
||||||
* [x] GET /api/v1/notifications
|
* [x] GET /api/v1/notifications
|
||||||
* [x] GET /api/v1/notifications/:id
|
* [x] GET /api/v1/notifications/:id
|
||||||
* [x] POST /api/v1/notifications/dismiss
|
* [x] POST /api/v1/notifications/:id/dismiss
|
||||||
* [x] POST /api/v1/notifications/clear
|
* [x] POST /api/v1/notifications/clear
|
||||||
* [x] POST /api/v1/push/subscription
|
* [x] POST /api/v1/push/subscription
|
||||||
* [x] GET /api/v1/push/subscription
|
* [x] GET /api/v1/push/subscription
|
||||||
|
|
|
@ -57,13 +57,7 @@ func (c *Client) GetNotification(ctx context.Context, id ID) (*Notification, err
|
||||||
|
|
||||||
// DismissNotification deletes a single notification.
|
// DismissNotification deletes a single notification.
|
||||||
func (c *Client) DismissNotification(ctx context.Context, id ID) error {
|
func (c *Client) DismissNotification(ctx context.Context, id ID) error {
|
||||||
params := url.Values{}
|
return c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/notifications/%v/dismiss", id), nil, nil, nil)
|
||||||
params.Add("id", string(id))
|
|
||||||
err := c.doAPI(ctx, http.MethodPost, "/api/v1/notifications/dismiss", params, nil, nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearNotifications clear notifications.
|
// ClearNotifications clear notifications.
|
||||||
|
|
|
@ -23,7 +23,7 @@ func TestGetNotifications(t *testing.T) {
|
||||||
case "/api/v1/notifications/clear":
|
case "/api/v1/notifications/clear":
|
||||||
fmt.Fprintln(w, `{}`)
|
fmt.Fprintln(w, `{}`)
|
||||||
return
|
return
|
||||||
case "/api/v1/notifications/dismiss":
|
case "/api/v1/notifications/123/dismiss":
|
||||||
fmt.Fprintln(w, `{}`)
|
fmt.Fprintln(w, `{}`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user