From 68ed887194f360e40ab86ac26c61b8d05927f686 Mon Sep 17 00:00:00 2001 From: Chakravarthi Medicharla Date: Thu, 7 Dec 2023 16:33:06 +0530 Subject: [PATCH 1/4] feat: API spec for user creation on user dashboard --- api_spec.yaml | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) diff --git a/api_spec.yaml b/api_spec.yaml index 8515bba8..dcbf9853 100644 --- a/api_spec.yaml +++ b/api_spec.yaml @@ -1664,6 +1664,224 @@ paths: enum: - Method not supported + //dashboard/api/user/create/emailpassword: + post: + tags: + - User Creation + summary: Creates a new emailpassword user. + requestBody: + content: + application/json: + schema: + type: object + properties: + email: + type: string + password: + type: string + responses: + 200: + description: signup response + content: + application/json: + schema: + oneOf: + - type: object + properties: + status: + type: string + default: "OK" + user: + $ref: "#/components/schemas/authRecipeUser" + recipeUserId: + $ref: "#/components/schemas/userId" + - type: object + properties: + status: + type: string + default: "EMAIL_ALREADY_EXISTS_ERROR" + - type: object + properties: + status: + type: string + default: "FEATURE_NOT_ENABLED_ERROR" + + //dashboard/api/user/create/thirdparty: + post: + tags: + - User Creation + summary: Creates a new thirdparty user. + requestBody: + content: + application/json: + schema: + type: object + properties: + thirdPartyId: + type: string + thirdPartyUserId: + type: string + email: + type: string + isVerified: + type: boolean + responses: + 200: + description: signup response + content: + application/json: + schema: + oneOf: + - type: object + properties: + status: + type: string + default: "OK" + createdNewRecipeUser: + type: boolean + default: true + user: + $ref: "#/components/schemas/authRecipeUser" + recipeUserId: + $ref: "#/components/schemas/userId" + - type: object + properties: + status: + type: string + default: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" + reason: + type: string + - type: object + properties: + status: + type: string + default: "SIGN_IN_UP_NOT_ALLOWED" + reason: + type: string + - type: object + properties: + status: + type: string + default: "FEATURE_NOT_ENABLED_ERROR" + + //dashboard/api/user/create/passwordless: + post: + tags: + - User Creation + summary: Creates a new passwordless user + requestBody: + content: + application/json: + schema: + type: object + properties: + email: + type: string + password: + type: string + responses: + 200: + description: Success + content: + application/json: + schema: + type: object + properties: + tags: + type: array + items: + type: string + +components: + schemas: + authRecipeUser: + type: object + properties: + id: + $ref: "#/components/schemas/userId" + isPrimaryUser: + type: boolean + example: true + tenantIds: + type: array + items: + $ref: "#/components/schemas/tenantId" + timeJoined: + $ref: "#/components/schemas/timeJoined" + emails: + type: array + items: + $ref: "#/components/schemas/email" + phoneNumbers: + type: array + items: + $ref: "#/components/schemas/phoneNumber" + thirdParty: + type: array + items: + type: object + properties: + id: + $ref: "#/components/schemas/thirdPartyId" + userId: + $ref: "#/components/schemas/thirdPartyUserId" + loginMethods: + type: array + items: + type: object + properties: + tenantIds: + type: array + items: + $ref: "#/components/schemas/tenantId" + recipeUserId: + $ref: "#/components/schemas/userId" + verified: + type: boolean + example: true + timeJoined: + $ref: "#/components/schemas/timeJoined" + recipeId: + $ref: "#/components/schemas/recipeId" + email: + $ref: "#/components/schemas/email" + phoneNumber: + $ref: "#/components/schemas/phoneNumber" + thirdParty: + type: object + properties: + id: + $ref: "#/components/schemas/thirdPartyId" + userId: + $ref: "#/components/schemas/thirdPartyUserId" + recipeId: + type: string + enum: + - emailpassword + - passwordless + - thirdparty + thirdPartyId: + type: string + example: google + thirdPartyUserId: + type: string + example: 106347997792363865062 + email: + type: string + example: johndoe@gmail.com + userId: + type: string + example: fa7a0841-b533-4478-95533-0fde890c3483 + timeJoined: + type: number + example: 1623918032231 + phoneNumber: + type: string + example: "+14155552671" + tenantId: + type: string + example: "customer1" + servers: # Added by API Auto Mocking Plugin - description: SwaggerHub API Auto Mocking From 92fdcfa394f150649e139d0f6e5f20dc9df30153 Mon Sep 17 00:00:00 2001 From: Chakravarthi Medicharla Date: Thu, 7 Dec 2023 19:21:05 +0530 Subject: [PATCH 2/4] passwordless user creation api spec --- api_spec.yaml | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/api_spec.yaml b/api_spec.yaml index dcbf9853..676ec562 100644 --- a/api_spec.yaml +++ b/api_spec.yaml @@ -1773,24 +1773,45 @@ paths: content: application/json: schema: - type: object - properties: - email: - type: string - password: - type: string + oneOf: + - type: object + properties: + email: + $ref: "#/components/schemas/email" + example: + email: "test@example.com" + required: + - email + - type: object + properties: + phoneNumber: + $ref: "#/components/schemas/phoneNumber" + required: + - phoneNumber responses: 200: - description: Success + description: signup response content: application/json: schema: - type: object - properties: - tags: - type: array - items: - type: string + oneOf: + - type: object + properties: + status: + type: string + default: "OK" + createdNewRecipeUser: + type: boolean + default: true + user: + $ref: "#/components/schemas/authRecipeUser" + recipeUserId: + $ref: "#/components/schemas/userId" + - type: object + properties: + status: + type: string + default: "FEATURE_NOT_ENABLED_ERROR" components: schemas: From 92d15ef62ddf54f8fa50915c6505a168b1016a5f Mon Sep 17 00:00:00 2001 From: Chakravarthi Medicharla Date: Fri, 8 Dec 2023 15:25:17 +0530 Subject: [PATCH 3/4] add login methods api spec --- api_spec.yaml | 91 +++++++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 58 deletions(-) diff --git a/api_spec.yaml b/api_spec.yaml index 676ec562..a0156e96 100644 --- a/api_spec.yaml +++ b/api_spec.yaml @@ -1706,64 +1706,6 @@ paths: type: string default: "FEATURE_NOT_ENABLED_ERROR" - //dashboard/api/user/create/thirdparty: - post: - tags: - - User Creation - summary: Creates a new thirdparty user. - requestBody: - content: - application/json: - schema: - type: object - properties: - thirdPartyId: - type: string - thirdPartyUserId: - type: string - email: - type: string - isVerified: - type: boolean - responses: - 200: - description: signup response - content: - application/json: - schema: - oneOf: - - type: object - properties: - status: - type: string - default: "OK" - createdNewRecipeUser: - type: boolean - default: true - user: - $ref: "#/components/schemas/authRecipeUser" - recipeUserId: - $ref: "#/components/schemas/userId" - - type: object - properties: - status: - type: string - default: "EMAIL_CHANGE_NOT_ALLOWED_ERROR" - reason: - type: string - - type: object - properties: - status: - type: string - default: "SIGN_IN_UP_NOT_ALLOWED" - reason: - type: string - - type: object - properties: - status: - type: string - default: "FEATURE_NOT_ENABLED_ERROR" - //dashboard/api/user/create/passwordless: post: tags: @@ -1812,6 +1754,39 @@ paths: status: type: string default: "FEATURE_NOT_ENABLED_ERROR" + //dashboard/api/login-methods: + get: + tags: + - Login Methods + summary: Gets all the available login methods for a tenant. + responses: + 200: + description: login methods response. + content: + application/json: + schema: + type: object + properties: + status: + type: string + default: "OK" + loginMethods: + type: array + items: + oneOf: + - type: object + properties: + methodType: + type: string + default: "passwordless" + contactMethod: + type: string + enum: [PHONE, EMAIL, EMAIL_OR_PHONE] + - type: object + properties: + methodType: + type: string + default: "emailPassword" components: schemas: From 7ab822d06e1d62a8a5078c73fe3170774e8bca35 Mon Sep 17 00:00:00 2001 From: Chakravarthi Medicharla Date: Mon, 11 Dec 2023 10:01:34 +0530 Subject: [PATCH 4/4] add thirdparty into the response --- api_spec.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api_spec.yaml b/api_spec.yaml index a0156e96..735d126c 100644 --- a/api_spec.yaml +++ b/api_spec.yaml @@ -1786,7 +1786,12 @@ paths: properties: methodType: type: string - default: "emailPassword" + default: "emailpassword" + - type: object + properties: + methodType: + type: string + default: "thirdparty" components: schemas: