Replace deprecated /api/v1/notifications/dismiss with new API

pull/138/head
Hanage999 2021-05-03 10:16:04 +09:00 committed by mattn
parent 6abe72ddb0
commit 8c434b5282
3 changed files with 3 additions and 9 deletions

View File

@ -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

View File

@ -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.

View File

@ -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
} }