diff --git a/reference/auth.v1.yaml b/reference/auth.v1.yaml index 463d79e8..b4e216a9 100644 --- a/reference/auth.v1.yaml +++ b/reference/auth.v1.yaml @@ -405,7 +405,7 @@ paths: get: operationId: VerifyDeviceToken summary: Verify Device Token - description: "Checks the validity of Apple's DeviceCheck token by calling Apple's server to verify it. For more details, see Apple's [developer documentation](https://developer.apple.com/documentation/devicecheck)." + description: 'Checks the validity of Apple''s DeviceCheck token by calling Apple''s server to verify it. For more details, see Apple''s [developer documentation](https://developer.apple.com/documentation/devicecheck).' requestBody: $ref: '#/components/requestBodies/VerifyDeviceToken' responses: @@ -680,6 +680,144 @@ paths: - sessionToken: [] tags: - Internal + /v1/consents: + get: + summary: List Consents + tags: + - Internal + - Consent + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: ./auth/models/consent/consents.v1.yaml + operationId: ListConsents + description: 'Retrieves the list of all different consent types and their content. ' + requestBody: + content: {} + parameters: [] + x-internal: true + parameters: [] + '/v1/consents/{consentType}': + parameters: + - $ref: '#/components/parameters/consentType' + get: + summary: Get Latest Consent By Type + tags: + - Consent + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: ./auth/models/consent/consent.v1.yaml + operationId: GetLatestConsentByType + description: Returns the latest consent version for the given type + '/v1/consents/{consentType}/versions': + parameters: + - $ref: '#/components/parameters/consentType' + get: + summary: Get Consent Versions + tags: + - Consent + - Internal + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: ./auth/models/consent/consents.v1.yaml + operationId: GetConsentVersions + description: Returns a list of all consent versions for a given type + x-internal: true + '/v1/users/{userId}/consents': + parameters: + - $ref: '#/components/parameters/userId' + get: + summary: Get User Consent Records + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: ./auth/models/consent/records.v1.yaml + operationId: GetUserConsentRecords + description: Returns a list of all user consent records. By default only the most recent consent record for a given consent type will be returned. This can be overriden by setting the `latest` query parameter to `false`. + parameters: + - schema: + type: boolean + enum: + - 'true' + - 'false' + default: 'true' + in: query + name: latest + description: Whether to return all versions or only the most recent one. + - schema: + type: string + in: query + name: type + post: + summary: Create User Consent Record + operationId: CreateUserConsentRecord + responses: + '200': + description: Created + content: + application/json: + schema: + $ref: ./auth/models/consent/record.v1.yaml + description: Creates a user consent record + requestBody: + content: + application/json: + schema: + $ref: ./auth/models/consent/recordcreate.v1.yaml + '/v1/users/{userId}/consents/{recordId}': + parameters: + - $ref: '#/components/parameters/userId' + - $ref: '#/components/parameters/recordId' + get: + summary: Get User Consent Record + tags: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: ./auth/models/consent/record.v1.yaml + operationId: GetUserConsentRecord + description: Retrieves a consent record by ID for a given user. + patch: + summary: Update User Consent Record + operationId: UpdateUserConsentRecord + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: ./auth/models/consent/record.v1.yaml + description: '' + requestBody: + content: + application/json: + schema: + $ref: ./auth/models/consent/recordupdate.v1.yaml + delete: + summary: 'Revoke User Consent Record' + operationId: RevokeConsent + responses: + '204': + description: OK + description: Revokes a consent record components: securitySchemes: basicAuth: @@ -941,3 +1079,22 @@ components: required: - code - reason + parameters: + consentType: + name: consentType + in: path + required: true + schema: + $ref: ./auth/models/consent/type.v1.yaml + userId: + name: userId + in: path + required: true + schema: + $ref: ./common/models/tidepooluserid.yaml + recordId: + name: recordId + in: path + required: true + schema: + $ref: ./auth/models/consent/recordId.v1.yaml diff --git a/reference/auth/models/consent/consent.v1.yaml b/reference/auth/models/consent/consent.v1.yaml new file mode 100644 index 00000000..48abb2af --- /dev/null +++ b/reference/auth/models/consent/consent.v1.yaml @@ -0,0 +1,29 @@ +title: Consent +description: Consent +type: object +properties: + type: + $ref: ./type.v1.yaml + version: + type: integer + example: 1 + x-stoplight: + id: 13aoxi0q1a5dq + minimum: 1 + readOnly: true + content: + type: string + contentType: + type: string + enum: + - markdown + createdTime: + type: string + format: date-time + readOnly: true +required: + - type + - version + - content + - contentType + - createdTime diff --git a/reference/auth/models/consent/consents.v1.yaml b/reference/auth/models/consent/consents.v1.yaml new file mode 100644 index 00000000..81238e9b --- /dev/null +++ b/reference/auth/models/consent/consents.v1.yaml @@ -0,0 +1,21 @@ +title: consents.v1 +x-stoplight: + id: o02joytb2fxay +type: object +properties: + data: + x-stoplight: + id: iepviv3jm8m9m + type: array + uniqueItems: true + items: + $ref: ./consent.v1.yaml + x-stoplight: + id: 22oi76x2nbqnp + count: + type: integer + x-stoplight: + id: jsfxo40v5vj0g +required: + - data + - count diff --git a/reference/auth/models/consent/metadata.tbddp.v1.yaml b/reference/auth/models/consent/metadata.tbddp.v1.yaml new file mode 100644 index 00000000..1df7ca06 --- /dev/null +++ b/reference/auth/models/consent/metadata.tbddp.v1.yaml @@ -0,0 +1,24 @@ +title: metadata.tbddp.v1 +x-stoplight: + id: 95q0hhj045suc +type: object +properties: + supportedOrganizations: + type: array + uniqueItems: true + description: >- + The list of supported organizations when the consent grant is for the + Tidepool Big Data Donation Project + items: + x-stoplight: + id: whfmccxwfj7zx + type: string + enum: + - ADCES Foundation + - Beyond Type 1 + - Children With Diabetes + - The Diabetes Link + - Diabetes Youth Families (DYF) + - DiabetesSisters + - The diaTribe Foundation + - Breakthrough T1D \ No newline at end of file diff --git a/reference/auth/models/consent/metadata.v1.yaml b/reference/auth/models/consent/metadata.v1.yaml new file mode 100644 index 00000000..c4661256 --- /dev/null +++ b/reference/auth/models/consent/metadata.v1.yaml @@ -0,0 +1,5 @@ +title: metadata.v1 +x-stoplight: + id: 8ctwq6xjg496g +oneOf: + - $ref: ./metadata.tbddp.v1.yaml diff --git a/reference/auth/models/consent/record.v1.yaml b/reference/auth/models/consent/record.v1.yaml new file mode 100644 index 00000000..b990649d --- /dev/null +++ b/reference/auth/models/consent/record.v1.yaml @@ -0,0 +1,87 @@ +title: record.v1 +x-stoplight: + id: nvtrxa89tps30 +type: object +properties: + id: + $ref: ./recordId.v1.yaml + status: + type: string + x-stoplight: + id: m5tc1errbouci + enum: + - active + - revoked + readOnly: true + ageGroup: + type: string + x-stoplight: + id: u5whtndrytunl + enum: + - <12 + - 13-17 + - 18+ + ownerName: + type: string + x-stoplight: + id: 2cw4335ateapa + description: The name of the account owner + parentGuardianName: + type: string + x-stoplight: + id: 94pqubqvzwigs + description: The name of the parent or legal guardian granting the consent. Required if ageGroup is '<12' or '13-17'. + grantorType: + type: string + x-stoplight: + id: zc8e4q8t37yig + enum: + - owner + - parent/guardian + type: + $ref: ./type.v1.yaml + x-stoplight: + id: jub0w6n4sx03g + version: + type: integer + x-stoplight: + id: s4pt6ptt7ez4n + metadata: + $ref: ./metadata.v1.yaml + x-stoplight: + id: u4fzjwa9iivzp + grantTime: + type: string + x-stoplight: + id: z984vbbyzt0n5 + format: date-time + readOnly: true + revocationTime: + type: string + x-stoplight: + id: 9hx9eo1oucsak + format: date-time + readOnly: true + createdTime: + type: string + x-stoplight: + id: r7ypd0pfkbhkv + format: date-time + readOnly: true + updatedTime: + type: string + x-stoplight: + id: ohlc8mndn74ov + format: date-time + readOnly: true +required: + - id + - status + - ageGroup + - ownerName + - grantorType + - type + - version + - grantTime + - createdTime + - updatedTime diff --git a/reference/auth/models/consent/recordId.v1.yaml b/reference/auth/models/consent/recordId.v1.yaml new file mode 100644 index 00000000..9ef9679d --- /dev/null +++ b/reference/auth/models/consent/recordId.v1.yaml @@ -0,0 +1,6 @@ +title: recordId.v1 +x-stoplight: + id: 5aevzr0n4qx6k +type: string +minLength: 1 +readOnly: true diff --git a/reference/auth/models/consent/recordcreate.v1.yaml b/reference/auth/models/consent/recordcreate.v1.yaml new file mode 100644 index 00000000..288b0aba --- /dev/null +++ b/reference/auth/models/consent/recordcreate.v1.yaml @@ -0,0 +1,9 @@ +$ref: ./record.v1.yaml +x-stoplight: + id: saa37zeaoirkr +examples: + - type: tbddp + version: 1 + metadata: + supportedOrganizations: + - ADCES Foundation diff --git a/reference/auth/models/consent/records.v1.yaml b/reference/auth/models/consent/records.v1.yaml new file mode 100644 index 00000000..4cb664a9 --- /dev/null +++ b/reference/auth/models/consent/records.v1.yaml @@ -0,0 +1,21 @@ +title: records.v1 +x-stoplight: + id: 0tuzybru8eee5 +type: object +properties: + data: + type: array + x-stoplight: + id: whbezmg3q7pxh + uniqueItems: true + items: + $ref: ./record.v1.yaml + x-stoplight: + id: u1b4u8fpl1ed6 + count: + type: integer + x-stoplight: + id: leqbw9m8u2lku +required: + - data + - count diff --git a/reference/auth/models/consent/recordupdate.v1.yaml b/reference/auth/models/consent/recordupdate.v1.yaml new file mode 100644 index 00000000..bbe0052b --- /dev/null +++ b/reference/auth/models/consent/recordupdate.v1.yaml @@ -0,0 +1,11 @@ +title: recordupdate.v1 +x-stoplight: + id: c8oq1dn4m4uak +type: object +properties: + metadata: + $ref: ./metadata.v1.yaml + x-stoplight: + id: 2hnhmpwbyck12 +required: + - metadata diff --git a/reference/auth/models/consent/type.v1.yaml b/reference/auth/models/consent/type.v1.yaml new file mode 100644 index 00000000..a7fb16f7 --- /dev/null +++ b/reference/auth/models/consent/type.v1.yaml @@ -0,0 +1,6 @@ +title: Consent Type +x-stoplight: + id: r396s741z1sca +type: string +pattern: '^[a-z0-9_-]{3,64}$' +example: big_data_donation_project