MCPcopy Index your code
hub / github.com/coder/coder / PostTestWebpushMessage

Method PostTestWebpushMessage

codersdk/notifications.go:271–285  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

269}
270
271func (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
287type CustomNotificationContent struct {
288 Title string `json:"title"`

Callers 1

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 1