DeleteWebpushSubscription deletes a push notification subscription for a given user. Think of this as an unsubscribe, but for a specific push notification subscription.
(ctx context.Context, user string, req DeleteWebpushSubscription)
| 256 | // DeleteWebpushSubscription deletes a push notification subscription for a given user. |
| 257 | // Think of this as an unsubscribe, but for a specific push notification subscription. |
| 258 | func (c *Client) DeleteWebpushSubscription(ctx context.Context, user string, req DeleteWebpushSubscription) error { |
| 259 | res, err := c.Request(ctx, http.MethodDelete, fmt.Sprintf("/api/v2/users/%s/webpush/subscription", user), req) |
| 260 | if err != nil { |
| 261 | return err |
| 262 | } |
| 263 | defer res.Body.Close() |
| 264 | |
| 265 | if res.StatusCode != http.StatusNoContent { |
| 266 | return ReadBodyAsError(res) |
| 267 | } |
| 268 | return nil |
| 269 | } |
| 270 | |
| 271 | func (c *Client) PostTestWebpushMessage(ctx context.Context) error { |
| 272 | res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/users/%s/webpush/test", Me), WebpushMessage{ |