diff --git a/reference/alerts.v1.yaml b/reference/alerts.v1.yaml new file mode 100644 index 00000000..41d9766a --- /dev/null +++ b/reference/alerts.v1.yaml @@ -0,0 +1,170 @@ +openapi: 3.0.0 +info: + title: Alerts API + version: '1.0' + description: |- + The Tidepool API is an HTTP REST API used by Tidepool clients to communicate with the Tidepool Platform. + + For more information, see the [Getting Started](../docs/quick-start.md) section. + termsOfService: https://developer.tidepool.org/terms-of-use/ + contact: + name: API Support + url: https://support.tidepool.org/ + email: support@tidepool.org + license: + name: BSD-2-Clause + url: https://github.com/tidepool-org/hydrophone/blob/master/LICENSE + x-tidepool-service: https://github.com/tidepool-org/hydrophone + +servers: + - url: 'https://external.integration.tidepool.org' + description: integration + - url: 'https://api.tidepool.org' + description: production + - url: 'https://dev1.dev.tidepool.org' + description: dev1 + - url: 'https://qa1.development.tidepool.org' + description: qa1 + - url: 'https://qa2.development.tidepool.org' + description: qa2 + +security: + - sessionToken: [] + +tags: + - name: Alerts + description: >- + Endpoints related to alert configuration and management. + +paths: + /v1/users/{userId}/followers/{followerUserId}/alerts: + parameters: + - $ref: '#/components/parameters/userId' + - $ref: '#/components/parameters/followerUserId' + + delete: + summary: Delete an alerts configuration + description: >- + Delete an existing alerts configuration. + operationId: DeleteAlertsConfiguration + responses: + '200': + $ref: '#/components/responses/OK' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + tags: + - Alerts + + get: + summary: Get an alerts configuration + description: >- + Retrieve an existing alerts configuration. + operationId: GetAlertsConfiguration + responses: + '200': + $ref: '#/components/responses/AlertsConfig' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + tags: + - Alerts + + post: + summary: Create or update an alerts configuration + description: >- + Create or update an alerts configuration. + + If no alerts configuration exists, it will be created. + operationId: UpsertAlertsConfiguration + requestBody: + required: true + content: + application/json: + schema: + $ref: './common/models/alertsconfig.v1.yaml' + responses: + '200': + $ref: '#/components/responses/OK' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + '500': + $ref: '#/components/responses/ServerError' + tags: + - Alerts + + +components: + securitySchemes: + sessionToken: + $ref: ./common/security/tidepoolsessiontoken.v1.yaml + + responses: + OK: + description: 'OK' + + BadRequest: + description: 'Bad Request' + + Unauthorized: + description: 'Unauthorized' + + Forbidden: + description: 'Forbidden' + + NotFound: + description: 'Not Found' + + ServerError: + description: 'Server Error' + + AlertsConfig: + description: Alerts Config + content: + 'application/json': + schema: + $ref: './common/models/alertsconfig.v1.yaml' + + parameters: + userId: + name: userId + description: >- + Tidepool User ID of the user who granted follow access. + in: path + required: true + schema: + $ref: '#/components/schemas/tidepoolUserId' + + + followerUserId: + name: followerUserId + description: >- + Tidepool User ID of the care partner to receive alerts. + in: path + required: true + schema: + $ref: '#/components/schemas/tidepoolUserId' + + schemas: + tidepoolUserId: + $ref: './common/models/tidepooluserid.yaml' diff --git a/reference/common/models/alerts/base.v1.yaml b/reference/common/models/alerts/base.v1.yaml new file mode 100644 index 00000000..22e07a7a --- /dev/null +++ b/reference/common/models/alerts/base.v1.yaml @@ -0,0 +1,17 @@ +# intended as a mix-in to build complete alert specs +type: object +properties: + enabled: + type: boolean + default: false + description: >- + A toggle for disabling the alert. + repeat: + type: integer + default: 0 + minimum: 0 + maximum: 240 + description: >- + Duration in minutes, after which an alert will be repeated. + + A value of 0 disables the repeat functionality. diff --git a/reference/common/models/alerts/delay.v1.yaml b/reference/common/models/alerts/delay.v1.yaml new file mode 100644 index 00000000..66d20ff0 --- /dev/null +++ b/reference/common/models/alerts/delay.v1.yaml @@ -0,0 +1,10 @@ +# intended as a mix-in to build complete alert specs +type: object +properties: + delay: + type: integer + default: 0 + minimum: 0 + maximum: 120 + description: >- + Duration in minutes to wait before alerting. diff --git a/reference/common/models/alerts/glucosethreshold.v1.yaml b/reference/common/models/alerts/glucosethreshold.v1.yaml new file mode 100644 index 00000000..93429f6d --- /dev/null +++ b/reference/common/models/alerts/glucosethreshold.v1.yaml @@ -0,0 +1,7 @@ +# intended as a mix-in to build complete alert specs +type: object +properties: + threshold: + $ref: '../../../data/models/blood/glucose/glucose.v1.yaml' +required: + - threshold diff --git a/reference/common/models/alertsconfig.v1.yaml b/reference/common/models/alertsconfig.v1.yaml new file mode 100644 index 00000000..2518eadf --- /dev/null +++ b/reference/common/models/alertsconfig.v1.yaml @@ -0,0 +1,43 @@ +type: object +properties: + urgentLow: + allOf: + - $ref: './alerts/base.v1.yaml' + - $ref: './alerts/glucosethreshold.v1.yaml' + - type: object + description: >- + Blood glucose measurements at or below this value will trigger an immediate and urgent alert. + low: + allOf: + - $ref: './alerts/base.v1.yaml' + - $ref: './alerts/delay.v1.yaml' + - $ref: './alerts/glucosethreshold.v1.yaml' + - type: object + description: >- + Blood glucose measurements at or below this value will trigger an alert. + high: + allOf: + - $ref: './alerts/base.v1.yaml' + - $ref: './alerts/delay.v1.yaml' + - $ref: './alerts/glucosethreshold.v1.yaml' + - type: object + description: >- + Blood glucose measurements at or above this value will trigger an alert. + noCommunication: + allOf: + - $ref: './alerts/base.v1.yaml' + - $ref: './alerts/delay.v1.yaml' + - type: object + description: >- + An alert sent when issues prevent the display of CGM data. + notLooping: + allOf: + - $ref: './alerts/base.v1.yaml' + - $ref: './alerts/delay.v1.yaml' + - type: object + description: >- + An alert sent when the Tidepool Loop app is unable to loop. +minProperties: 1 +description: >- + Configuration for alerts triggered in response to the status of a user's + device and data. diff --git a/reference/confirm/models/invitation.v1.yaml b/reference/confirm/models/invitation.v1.yaml index 6d8a9ac8..5d92f82d 100644 --- a/reference/confirm/models/invitation.v1.yaml +++ b/reference/confirm/models/invitation.v1.yaml @@ -16,6 +16,13 @@ properties: note: { } upload: { } view: { } + nickname: + description: A user-friendly name for the recipient of the invitation. + type: string + example: "Julia" + alertsConfig: + $ref: '../../common/models/alertsconfig.v1.yaml' + required: - email - permissions