From f8beb9df6a501d407ae00faffbad5e5213686037 Mon Sep 17 00:00:00 2001 From: lostlevels Date: Wed, 14 Aug 2024 06:43:17 -0700 Subject: [PATCH 1/8] [BACK-2780] Add new and legacy user profile endpoint documentation. --- .gitignore | 1 + reference/auth.v1.yaml | 182 ++++++++++++++++++ .../auth/models/profile/legacyprofile.v1.yaml | 44 +++++ reference/auth/models/profile/profile.v1.yaml | 41 ++++ 4 files changed, 268 insertions(+) create mode 100644 reference/auth/models/profile/legacyprofile.v1.yaml create mode 100644 reference/auth/models/profile/profile.v1.yaml diff --git a/.gitignore b/.gitignore index 6cd4ef26..8cea200a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build .idea/ /node_modules/ /tools/ +.DS_Store diff --git a/reference/auth.v1.yaml b/reference/auth.v1.yaml index f7f05061..a91fd2e8 100644 --- a/reference/auth.v1.yaml +++ b/reference/auth.v1.yaml @@ -680,6 +680,164 @@ paths: - sessionToken: [] tags: - Internal + '/v1/users/{userId}/profile': + parameters: + - $ref: ./common/parameters/tidepooluserid.yaml + get: + operationId: GetUserProfile + summary: Get a user's profile + description: Returns the user's profile specified by the `userId`. + responses: + '200': + $ref: '#/components/responses/UserProfile' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + tags: + - Profile + - Internal + security: + - serverToken: [] + post: + operationId: UpdateUserProfile + summary: Creates or updates a user's profile + description: Upserts or updates the user profile specified by the `userId`. Due to legacy reasons, this operates as POST request if the profile does not exist or a PUT request if it does. + requestBody: + $ref: '#/components/requestBodies/UpdateUserProfile' + responses: + '200': + $ref: '#/components/responses/UserProfile' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + tags: + - Profile + - Internal + security: + - serverToken: [] + put: + operationId: UpdateUserProfile + summary: Creates or updates a user's profile + description: Upserts or updates the user profile specified by the `userId`. Due to legacy reasons, this operates as POST request if the profile does not exist or a PUT request if it does. + requestBody: + $ref: '#/components/requestBodies/UpdateUserProfile' + responses: + '200': + $ref: '#/components/responses/UserProfile' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + tags: + - Profile + - Internal + security: + - serverToken: [] + delete: + operationId: DeleteUserProfile + summary: Delete a user's profile + description: Delete the user profile specified by `userId`. + responses: + '200': + description: Success + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + tags: + - Profile + - Internal + security: + - serverToken: [] + '/v1/users/legacy/{userId}/profile': + parameters: + - $ref: ./common/parameters/tidepooluserid.yaml + get: + operationId: GetLegacyUserProfile + summary: Get a user's legacy profile. + description: Returns the user's profile in the legacy seagull format specified by the `userId`. + responses: + '200': + $ref: '#/components/responses/UserProfile' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + tags: + - Profile + - Internal + security: + - serverToken: [] + post: + operationId: UpdateLegacyUserProfile + summary: Creates or updates a user's profile. + description: Upserts or updates the user profile specified by the `userId`. Due to legacy reasons, this operates as POST request if the profile does not exist or a PUT request if it does. + requestBody: + $ref: '#/components/requestBodies/UpdateLegacyUserProfile' + responses: + '200': + $ref: '#/components/responses/LegacyUserProfile' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + tags: + - Profile + - Internal + security: + - serverToken: [] + put: + operationId: UpdateUserProfile + summary: Creates or updates a user's profile + description: Upserts or updates the user profile specified by the `userId`. Due to legacy reasons, this operates as POST request if the profile does not exist or a PUT request if it does. + requestBody: + $ref: '#/components/requestBodies/UpdateUserProfile' + responses: + '200': + $ref: '#/components/LegacyUserProfile' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + tags: + - Profile + - Internal + security: + - serverToken: [] + delete: + operationId: DeleteUserProfile + summary: Delete a user's profile + description: Delete the user profile specified by `userId`. + responses: + '200': + description: Success + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + tags: + - Profile + - Internal + security: + - serverToken: [] components: securitySchemes: basicAuth: @@ -740,6 +898,18 @@ components: schema: oneOf: - $ref: ./auth/models/devicetoken-apple.v1.yaml + UpdateUserProfile: + description: Updated user profile + content: + application/json: + schema: + $ref: ./auth/models/profile/profile.v1.yaml + UpdateLegacyUserProfile: + description: Updated legacy user profile + content: + application/json: + schema: + $ref: ./auth/models/profile/legacyprofile.v1.yaml responses: User: description: Tidepool User Account @@ -811,6 +981,18 @@ components: application/json: schema: $ref: ./auth/models/providers/sessions.v1.yaml + UserProfile: + description: User profile + content: + application/json: + schema: + $ref: ./auth/models/profile/profile.v1.yaml + LegacyUserProfile: + description: Legacy user profile compatible with seagull + content: + application/json: + schema: + $ref: ./auth/models/profile/legacyprofile.v1.yaml Unauthorized: description: Unauthorized content: diff --git a/reference/auth/models/profile/legacyprofile.v1.yaml b/reference/auth/models/profile/legacyprofile.v1.yaml new file mode 100644 index 00000000..6e8d4c44 --- /dev/null +++ b/reference/auth/models/profile/legacyprofile.v1.yaml @@ -0,0 +1,44 @@ +title: Legacy User Profile +description: >- + Legacy user profile compatible with seagull returned by platform. +type: object +properties: + fullName: + $ref: '../../../fullname.v1.yaml' + email: + $ref: '../../../common/models/emailaddress.v1.yaml' + emails: + $ref: '../emailaddressess.v1.yaml' + patient: + type: object + description: 'Embedded legacy patient profile' + properties: + birthday: + $ref: '../../../common/models/birthday.v1.yaml' + diagnosisType: + $ref: '../../../diagnosistype.v1.yaml' + diagnosisDate: + $ref: '../../../common/models/diagnosisdate.v1.yaml' + biologicalSex: + $ref: '../../../metadata/models/biologicalsex.v1.yaml' + targetDevices: + $ref: '../../../metadata/models/targetdevices.v1.yaml' + targetTimezone: + $ref: '../../../metadata/models/targettimezone.v1.yaml' + about: + $ref: '../../../metadata/models/about.v1.yaml' + isOtherPerson: + type: boolean + clinic: + type: object + properties: + name: + type: string + description: 'Name of the clinic' + role: + $ref: '../role.v1.yaml' + telephone: + type: string + npi: + type: string + diff --git a/reference/auth/models/profile/profile.v1.yaml b/reference/auth/models/profile/profile.v1.yaml new file mode 100644 index 00000000..acbf2f5f --- /dev/null +++ b/reference/auth/models/profile/profile.v1.yaml @@ -0,0 +1,41 @@ +title: User Profile +description: >- + User profile returned by platform. +type: object +properties: + fullName: + $ref: '../../../fullname.v1.yaml' + birthday: + $ref: '../../../common/models/birthday.v1.yaml' + diagnosisType: + $ref: '../../../diagnosistype.v1.yaml' + diagnosisDate: + $ref: '../../../common/models/diagnosisdate.v1.yaml' + biologicalSex: + $ref: '../../../metadata/models/biologicalsex.v1.yaml' + targetDevices: + $ref: '../../../metadata/models/targetdevices.v1.yaml' + targetTimezone: + $ref: '../../../metadata/models/targettimezone.v1.yaml' + about: + $ref: '../../../metadata/models/about.v1.yaml' + mrn: + $ref: '../../../metadata/models/mrn.v1.yaml' + custodian: + type: object + properties: + fullName: + $ref: '../../../fullname.v1.yaml' + clinic: + type: object + properties: + name: + type: string + description: 'Name of the clinic' + role: + $ref: '../role.v1.yaml' + telephone: + type: string + npi: + type: string + From 43cda4e4af106e4caeac7d98807f2c692f5f9237 Mon Sep 17 00:00:00 2001 From: lostlevels Date: Wed, 14 Aug 2024 09:25:42 -0700 Subject: [PATCH 2/8] Fix path typos. --- reference/auth/models/profile/legacyprofile.v1.yaml | 6 +++--- reference/auth/models/profile/profile.v1.yaml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/reference/auth/models/profile/legacyprofile.v1.yaml b/reference/auth/models/profile/legacyprofile.v1.yaml index 6e8d4c44..99931089 100644 --- a/reference/auth/models/profile/legacyprofile.v1.yaml +++ b/reference/auth/models/profile/legacyprofile.v1.yaml @@ -4,11 +4,11 @@ description: >- type: object properties: fullName: - $ref: '../../../fullname.v1.yaml' + $ref: '../../../metadata/models/fullname.v1.yaml' email: $ref: '../../../common/models/emailaddress.v1.yaml' emails: - $ref: '../emailaddressess.v1.yaml' + $ref: '../emailaddresses.v1.yaml' patient: type: object description: 'Embedded legacy patient profile' @@ -16,7 +16,7 @@ properties: birthday: $ref: '../../../common/models/birthday.v1.yaml' diagnosisType: - $ref: '../../../diagnosistype.v1.yaml' + $ref: '../../../metadata/models/diagnosistype.v1.yaml' diagnosisDate: $ref: '../../../common/models/diagnosisdate.v1.yaml' biologicalSex: diff --git a/reference/auth/models/profile/profile.v1.yaml b/reference/auth/models/profile/profile.v1.yaml index acbf2f5f..cd4964e7 100644 --- a/reference/auth/models/profile/profile.v1.yaml +++ b/reference/auth/models/profile/profile.v1.yaml @@ -4,11 +4,11 @@ description: >- type: object properties: fullName: - $ref: '../../../fullname.v1.yaml' + $ref: '../../../metadata/models/fullname.v1.yaml' birthday: $ref: '../../../common/models/birthday.v1.yaml' diagnosisType: - $ref: '../../../diagnosistype.v1.yaml' + $ref: '../../../metadata/models/diagnosistype.v1.yaml' diagnosisDate: $ref: '../../../common/models/diagnosisdate.v1.yaml' biologicalSex: @@ -25,7 +25,7 @@ properties: type: object properties: fullName: - $ref: '../../../fullname.v1.yaml' + $ref: '../../../metadata/models/fullname.v1.yaml' clinic: type: object properties: From ff824e5ed8ef92950f420d8cd0aac7ef5599ee91 Mon Sep 17 00:00:00 2001 From: lostlevels Date: Wed, 14 Aug 2024 09:41:18 -0700 Subject: [PATCH 3/8] Fix path. --- reference/auth.v1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/auth.v1.yaml b/reference/auth.v1.yaml index a91fd2e8..c1c2f9d4 100644 --- a/reference/auth.v1.yaml +++ b/reference/auth.v1.yaml @@ -808,7 +808,7 @@ paths: $ref: '#/components/requestBodies/UpdateUserProfile' responses: '200': - $ref: '#/components/LegacyUserProfile' + $ref: '#/components/responses/LegacyUserProfile' '400': $ref: '#/components/responses/BadRequest' '401': From 4863ee16d0f9e92427737a70effe252618ea09ec Mon Sep 17 00:00:00 2001 From: lostlevels Date: Wed, 14 Aug 2024 09:56:25 -0700 Subject: [PATCH 4/8] Rename Profiles tag to plural to be consistent w/ other tags. --- reference/auth.v1.yaml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/reference/auth.v1.yaml b/reference/auth.v1.yaml index c1c2f9d4..3901e21c 100644 --- a/reference/auth.v1.yaml +++ b/reference/auth.v1.yaml @@ -31,6 +31,9 @@ tags: description: APIs intended for internal use by Tidepool. - name: Users description: List and manage users. + - name: Profiles + description: |- + Create and update user profiles. paths: /auth/login: post: @@ -697,8 +700,7 @@ paths: '404': $ref: '#/components/responses/NotFound' tags: - - Profile - - Internal + - Profiles security: - serverToken: [] post: @@ -717,8 +719,7 @@ paths: '404': $ref: '#/components/responses/NotFound' tags: - - Profile - - Internal + - Profiles security: - serverToken: [] put: @@ -737,7 +738,7 @@ paths: '404': $ref: '#/components/responses/NotFound' tags: - - Profile + - Profiles - Internal security: - serverToken: [] @@ -755,8 +756,7 @@ paths: '404': $ref: '#/components/responses/NotFound' tags: - - Profile - - Internal + - Profiles security: - serverToken: [] '/v1/users/legacy/{userId}/profile': @@ -776,8 +776,7 @@ paths: '404': $ref: '#/components/responses/NotFound' tags: - - Profile - - Internal + - Profiles security: - serverToken: [] post: @@ -796,8 +795,7 @@ paths: '404': $ref: '#/components/responses/NotFound' tags: - - Profile - - Internal + - Profiles security: - serverToken: [] put: @@ -816,8 +814,7 @@ paths: '404': $ref: '#/components/responses/NotFound' tags: - - Profile - - Internal + - Profiles security: - serverToken: [] delete: @@ -834,8 +831,7 @@ paths: '404': $ref: '#/components/responses/NotFound' tags: - - Profile - - Internal + - Profiles security: - serverToken: [] components: From 6dc7c2d84165d99a8a8d2c424bb9562c82e5edbb Mon Sep 17 00:00:00 2001 From: lostlevels Date: Wed, 14 Aug 2024 09:58:48 -0700 Subject: [PATCH 5/8] Remove Internal tag --- reference/auth.v1.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/reference/auth.v1.yaml b/reference/auth.v1.yaml index 3901e21c..c39c8ce0 100644 --- a/reference/auth.v1.yaml +++ b/reference/auth.v1.yaml @@ -739,7 +739,6 @@ paths: $ref: '#/components/responses/NotFound' tags: - Profiles - - Internal security: - serverToken: [] delete: From f001e609d40c148fe0458b9424d68ea4e27ef973 Mon Sep 17 00:00:00 2001 From: lostlevels Date: Tue, 20 Aug 2024 12:20:10 -0700 Subject: [PATCH 6/8] Update to use sessionToken. --- reference/auth.v1.yaml | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/reference/auth.v1.yaml b/reference/auth.v1.yaml index c39c8ce0..8b84ad80 100644 --- a/reference/auth.v1.yaml +++ b/reference/auth.v1.yaml @@ -702,7 +702,7 @@ paths: tags: - Profiles security: - - serverToken: [] + - sessionToken: [] post: operationId: UpdateUserProfile summary: Creates or updates a user's profile @@ -721,7 +721,7 @@ paths: tags: - Profiles security: - - serverToken: [] + - sessionToken: [] put: operationId: UpdateUserProfile summary: Creates or updates a user's profile @@ -740,7 +740,7 @@ paths: tags: - Profiles security: - - serverToken: [] + - sessionToken: [] delete: operationId: DeleteUserProfile summary: Delete a user's profile @@ -757,7 +757,7 @@ paths: tags: - Profiles security: - - serverToken: [] + - sessionToken: [] '/v1/users/legacy/{userId}/profile': parameters: - $ref: ./common/parameters/tidepooluserid.yaml @@ -777,7 +777,7 @@ paths: tags: - Profiles security: - - serverToken: [] + - sessionToken: [] post: operationId: UpdateLegacyUserProfile summary: Creates or updates a user's profile. @@ -796,7 +796,7 @@ paths: tags: - Profiles security: - - serverToken: [] + - sessionToken: [] put: operationId: UpdateUserProfile summary: Creates or updates a user's profile @@ -815,7 +815,7 @@ paths: tags: - Profiles security: - - serverToken: [] + - sessionToken: [] delete: operationId: DeleteUserProfile summary: Delete a user's profile @@ -832,7 +832,26 @@ paths: tags: - Profiles security: - - serverToken: [] + - sessionToken: [] + '/v1/users/{userId}/users': + parameters: + - $ref: './common/parameters/tidepooluserid.yaml' + get: + operationId: ListUsers + summary: List Users + description: >- + List all users who have trustee or trustor access to the user account identified by `userId`. + responses: + '200': + $ref: '#/components/responses/TrustUsers' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + tags: + - Profiles + security: + - sessionToken: [] components: securitySchemes: basicAuth: @@ -988,6 +1007,12 @@ components: application/json: schema: $ref: ./auth/models/profile/legacyprofile.v1.yaml + TrustUsers: + description: 'Success' + content: + application/json: + schema: + $ref: './metadata/models/trustusers.v1.yaml' Unauthorized: description: Unauthorized content: From 86e31a6dbf8e6c4f2a33644d232951b27c6dc3f4 Mon Sep 17 00:00:00 2001 From: lostlevels Date: Tue, 20 Aug 2024 12:28:29 -0700 Subject: [PATCH 7/8] Note legacy format. --- reference/auth.v1.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/auth.v1.yaml b/reference/auth.v1.yaml index 8b84ad80..907f2bfc 100644 --- a/reference/auth.v1.yaml +++ b/reference/auth.v1.yaml @@ -763,7 +763,7 @@ paths: - $ref: ./common/parameters/tidepooluserid.yaml get: operationId: GetLegacyUserProfile - summary: Get a user's legacy profile. + summary: Get a user's profile in the legacy format. description: Returns the user's profile in the legacy seagull format specified by the `userId`. responses: '200': @@ -780,7 +780,7 @@ paths: - sessionToken: [] post: operationId: UpdateLegacyUserProfile - summary: Creates or updates a user's profile. + summary: Create or updates a user's profile in the legacy format. description: Upserts or updates the user profile specified by the `userId`. Due to legacy reasons, this operates as POST request if the profile does not exist or a PUT request if it does. requestBody: $ref: '#/components/requestBodies/UpdateLegacyUserProfile' @@ -799,7 +799,7 @@ paths: - sessionToken: [] put: operationId: UpdateUserProfile - summary: Creates or updates a user's profile + summary: Create or updates a user's profile in the legacy format. description: Upserts or updates the user profile specified by the `userId`. Due to legacy reasons, this operates as POST request if the profile does not exist or a PUT request if it does. requestBody: $ref: '#/components/requestBodies/UpdateUserProfile' From d19ac3cc700a24f7a8b8bcc0787d9b5e4e8361fe Mon Sep 17 00:00:00 2001 From: lostlevels Date: Tue, 20 Aug 2024 13:13:32 -0700 Subject: [PATCH 8/8] UpdateLegacyUserProfile typo. --- reference/auth.v1.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/auth.v1.yaml b/reference/auth.v1.yaml index 907f2bfc..7b4f1bf6 100644 --- a/reference/auth.v1.yaml +++ b/reference/auth.v1.yaml @@ -798,11 +798,11 @@ paths: security: - sessionToken: [] put: - operationId: UpdateUserProfile + operationId: UpdateLegacyUserProfile summary: Create or updates a user's profile in the legacy format. description: Upserts or updates the user profile specified by the `userId`. Due to legacy reasons, this operates as POST request if the profile does not exist or a PUT request if it does. requestBody: - $ref: '#/components/requestBodies/UpdateUserProfile' + $ref: '#/components/requestBodies/UpdateLegacyUserProfile' responses: '200': $ref: '#/components/responses/LegacyUserProfile'