Add web push notifications for new inbox items
This commit is contained in:
+75
-1
@@ -27,6 +27,54 @@ paths:
|
||||
schema: { $ref: "#/components/schemas/User" }
|
||||
"400": { $ref: "#/components/responses/Error" }
|
||||
|
||||
/api/me/notifications:
|
||||
put:
|
||||
operationId: updateNotificationPrefs
|
||||
description: Sets which inbox items the calling user is sent push notifications for.
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/NotificationPrefs" }
|
||||
responses:
|
||||
"200":
|
||||
description: The updated user.
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/User" }
|
||||
"400": { $ref: "#/components/responses/Error" }
|
||||
|
||||
/api/me/push-subscriptions:
|
||||
post:
|
||||
operationId: addPushSubscription
|
||||
description: Registers a browser's push subscription for the calling user. Registering an endpoint again replaces it.
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/PushSubscription" }
|
||||
responses:
|
||||
"204":
|
||||
description: Registered.
|
||||
"400": { $ref: "#/components/responses/Error" }
|
||||
delete:
|
||||
operationId: removePushSubscription
|
||||
parameters:
|
||||
- { name: endpoint, in: query, required: true, schema: { type: string } }
|
||||
responses:
|
||||
"204":
|
||||
description: Removed, or was not registered.
|
||||
|
||||
/api/push/key:
|
||||
get:
|
||||
operationId: getPushKey
|
||||
responses:
|
||||
"200":
|
||||
description: The server's VAPID public key, the applicationServerKey for PushManager.subscribe.
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/PushKey" }
|
||||
|
||||
/api/projects:
|
||||
get:
|
||||
operationId: listProjects
|
||||
@@ -474,12 +522,38 @@ components:
|
||||
|
||||
User:
|
||||
type: object
|
||||
required: [login, display_name, git_name, git_email]
|
||||
required: [login, display_name, git_name, git_email, notification_prefs]
|
||||
properties:
|
||||
login: { type: string }
|
||||
display_name: { type: string }
|
||||
git_name: { type: string }
|
||||
git_email: { type: string }
|
||||
notification_prefs: { $ref: "#/components/schemas/NotificationPrefs" }
|
||||
|
||||
NotificationPrefs:
|
||||
type: object
|
||||
description: Which new inbox items send this user a push notification.
|
||||
required: [blocking_questions, questions, reports, errors, rate_limits]
|
||||
properties:
|
||||
blocking_questions: { type: boolean, description: "Questions asked with blocking: true. On by default." }
|
||||
questions: { type: boolean, description: Non-blocking questions. }
|
||||
reports: { type: boolean, description: Turn summaries. }
|
||||
errors: { type: boolean, description: session_error items. }
|
||||
rate_limits: { type: boolean, description: rate_limited items. }
|
||||
|
||||
PushSubscription:
|
||||
type: object
|
||||
required: [endpoint, p256dh, auth]
|
||||
properties:
|
||||
endpoint: { type: string }
|
||||
p256dh: { type: string, description: The subscription's p256dh key, base64url. }
|
||||
auth: { type: string, description: The subscription's auth secret, base64url. }
|
||||
|
||||
PushKey:
|
||||
type: object
|
||||
required: [public_key]
|
||||
properties:
|
||||
public_key: { type: string, description: Base64url, uncompressed P-256 point. }
|
||||
|
||||
UserUpdate:
|
||||
type: object
|
||||
|
||||
Reference in New Issue
Block a user