| 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{ |
| 273 | Title: "It's working!", |
| 274 | Body: "You've subscribed to push notifications.", |
| 275 | }) |
| 276 | if err != nil { |
| 277 | return err |
| 278 | } |
| 279 | defer res.Body.Close() |
| 280 | |
| 281 | if res.StatusCode != http.StatusNoContent { |
| 282 | return ReadBodyAsError(res) |
| 283 | } |
| 284 | return nil |
| 285 | } |
| 286 | |
| 287 | type CustomNotificationContent struct { |
| 288 | Title string `json:"title"` |