Skip to content

Commit

Permalink
adds device token endpoint
Browse files Browse the repository at this point in the history
This endpoint is for pushing a device token that can be used later to send
push notifications to the device.

BACK-2506
  • Loading branch information
ewollesen committed Jan 29, 2024
1 parent 31103a5 commit c3759be
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
30 changes: 30 additions & 0 deletions reference/auth.v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,28 @@ paths:
security:
- serverToken: []

'/auth/v1/users/{userId}/device_tokens':
parameters:
- $ref: './common/parameters/tidepooluserid.yaml'
post:
operationId: CreateDeviceTokenForUser
summary: Post Device Token
description: >-
Stores a token used to send notifications to a device such as a mobile phone.
requestBody:
$ref: '#/components/requestBodies/DeviceToken'
responses:
'200':
description: 200 OK
'400':
$ref: './common/responses/badrequest.v1.yaml'
'403':
$ref: './common/responses/forbidden.v1.yaml'
security:
- sessionToken: []
tags:
- Internal

components:
securitySchemes:
basicAuth:
Expand Down Expand Up @@ -785,6 +807,14 @@ components:
schema:
$ref: './auth/models/providers/updatesession.v1.yaml'

DeviceToken:
description: 'Device token used for sending push notifications to a mobile device.'
content:
'application/json':
schema:
oneOf:
- $ref: './auth/models/devicetoken-apple.v1.yaml'

responses:
User:
description: 'Tidepool User Account'
Expand Down
20 changes: 20 additions & 0 deletions reference/auth/models/devicetoken-apple.v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
title: Apple Device Token
description: >-
An opaque token used to send push notifications to an Apple-branded device.
type: object
required:
- token
- environment
properties:
token:
description: >-
Base64-encoded opaque blob of data, as received from Apple.
type: string
maxLength: 8192
environment:
description: >-
The Apple-defined environment determines which server URLs to communicate with.
type: string
enum:
- production
- sandbox
17 changes: 17 additions & 0 deletions reference/auth/models/devicetoken.v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
title: Device Token
description: >-
An opaque device token used to identify a mobile device for push notifications.
type: object
properties:
- type: object
properties:
apple:
type: object
properties:
token:
type: string
environments:
type: string
enum:
- production
- sandbox

0 comments on commit c3759be

Please sign in to comment.