Compare commits

..

3 Commits

Author SHA1 Message Date
Derrick Hammer 1f69c9c1cc
style: prettier 2024-03-26 15:18:48 -04:00
Derrick Hammer db2212ab70
feat: add requestEmailVerification 2024-03-26 15:18:29 -04:00
Derrick Hammer dcd1fdc705
chore: update swagger.yaml 2024-03-26 15:17:59 -04:00
3 changed files with 355 additions and 342 deletions

View File

@ -10,6 +10,7 @@ import {
PasswordResetVerifyRequest, PasswordResetVerifyRequest,
PingResponse, PingResponse,
postApiAccountPasswordResetRequest, postApiAccountPasswordResetRequest,
postApiAccountVerifyEmailResend,
postApiAuthPing, postApiAuthPing,
RegisterRequest, RegisterRequest,
UploadLimitResponse, UploadLimitResponse,
@ -124,6 +125,19 @@ export class AccountApi {
return this.checkSuccessBool(ret); return this.checkSuccessBool(ret);
} }
public async requestEmailVerification(): Promise<boolean | AccountError> {
let ret: AxiosResponse<void>;
try {
ret = await postApiAccountVerifyEmailResend(this.buildOptions());
} catch (e) {
return new AccountError(
(e as AxiosError).response?.data as string,
(e as AxiosError).response?.status as number,
);
}
return this.checkSuccessBool(ret);
}
public async generateOtp(): Promise< public async generateOtp(): Promise<
boolean | OTPGenerateResponse | AccountError boolean | OTPGenerateResponse | AccountError
> { > {

View File

@ -1,343 +1,342 @@
openapi: 3.0.0 openapi: 3.0.0
info: info:
title: Account Management API title: Account Management API
version: "1.0" version: "1.0"
description: API for managing user accounts, including login, registration, OTP operations, and password resets. description: API for managing user accounts, including login, registration, OTP operations, and password resets.
paths: paths:
/api/auth/login: /api/auth/login:
post: post:
summary: Login to the system summary: Login to the system
requestBody: requestBody:
required: true required: true
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/LoginRequest' $ref: "#/components/schemas/LoginRequest"
responses: responses:
'200': "200":
description: Successfully logged in description: Successfully logged in
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/LoginResponse' $ref: "#/components/schemas/LoginResponse"
'401': "401":
description: Unauthorized description: Unauthorized
/api/auth/logout: /api/auth/logout:
post: post:
summary: Logout of account service summary: Logout of account service
responses: responses:
'200': "200":
description: Successfully logged out description: Successfully logged out
/api/auth/register: /api/auth/register:
post: post:
summary: Register a new account summary: Register a new account
requestBody: requestBody:
required: true required: true
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/RegisterRequest' $ref: "#/components/schemas/RegisterRequest"
responses: responses:
'200': "200":
description: Successfully registered description: Successfully registered
'400': "400":
description: Bad Request description: Bad Request
/api/account/verify-email: /api/account/verify-email:
post: post:
summary: Verify email address summary: Verify email address
requestBody: requestBody:
required: true required: true
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/VerifyEmailRequest' $ref: "#/components/schemas/VerifyEmailRequest"
responses: responses:
'200': "200":
description: Email verified successfully description: Email verified successfully
/api/account/verify-email/resend: /api/account/verify-email/resend:
post: post:
summary: Resend email verification summary: Resend email verification
responses: responses:
'200': "200":
description: Email verification resent successfully description: Email verification resent successfully
/api/auth/otp/generate: /api/auth/otp/generate:
get: get:
summary: Generate OTP for two-factor authentication summary: Generate OTP for two-factor authentication
responses: responses:
'200': "200":
description: OTP generated successfully description: OTP generated successfully
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/OTPGenerateResponse' $ref: "#/components/schemas/OTPGenerateResponse"
/api/account/otp/verify: /api/account/otp/verify:
post: post:
summary: Verify OTP for enabling two-factor authentication summary: Verify OTP for enabling two-factor authentication
requestBody: requestBody:
required: true required: true
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/OTPVerifyRequest' $ref: "#/components/schemas/OTPVerifyRequest"
responses: responses:
'200': "200":
description: OTP verified successfully description: OTP verified successfully
/api/account/otp/validate: /api/account/otp/validate:
post: post:
summary: Validate OTP for two-factor authentication login summary: Validate OTP for two-factor authentication login
requestBody: requestBody:
required: true required: true
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/OTPValidateRequest' $ref: "#/components/schemas/OTPValidateRequest"
responses: responses:
'200': "200":
description: OTP validated successfully description: OTP validated successfully
/api/auth/otp/disable: /api/auth/otp/disable:
post: post:
summary: Disable OTP for two-factor authentication summary: Disable OTP for two-factor authentication
requestBody: requestBody:
required: true required: true
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/OTPDisableRequest' $ref: "#/components/schemas/OTPDisableRequest"
responses: responses:
'200': "200":
description: OTP disabled successfully description: OTP disabled successfully
/api/account/password-reset/request: /api/account/password-reset/request:
post: post:
summary: Request a password reset summary: Request a password reset
requestBody: requestBody:
required: true required: true
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/PasswordResetRequest' $ref: "#/components/schemas/PasswordResetRequest"
responses: responses:
'200': "200":
description: Password reset requested successfully description: Password reset requested successfully
/api/account/password-reset/confirm: /api/account/password-reset/confirm:
post: post:
summary: Confirm a password reset summary: Confirm a password reset
requestBody: requestBody:
required: true required: true
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/PasswordResetVerifyRequest' $ref: "#/components/schemas/PasswordResetVerifyRequest"
responses: responses:
'200': "200":
description: Password reset successfully description: Password reset successfully
/api/auth/ping: /api/auth/ping:
post: post:
summary: Auth check endpoint summary: Auth check endpoint
responses: responses:
'200': "200":
description: Pong description: Pong
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/PingResponse' $ref: "#/components/schemas/PingResponse"
'401': "401":
description: Unauthorized description: Unauthorized
/api/account: /api/account:
get: get:
summary: Get account information summary: Get account information
responses: responses:
'200': "200":
description: Account information retrieved successfully description: Account information retrieved successfully
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/AccountInfoResponse' $ref: "#/components/schemas/AccountInfoResponse"
'401': "401":
description: Unauthorized description: Unauthorized
/api/account/update-email: /api/account/update-email:
post: post:
summary: Update email address summary: Update email address
requestBody: requestBody:
required: true required: true
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/UpdateEmailRequest' $ref: "#/components/schemas/UpdateEmailRequest"
responses: responses:
'200': "200":
description: Email updated successfully description: Email updated successfully
/api/account/update-password: /api/account/update-password:
post: post:
summary: Update password summary: Update password
requestBody: requestBody:
required: true required: true
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/UpdatePasswordRequest' $ref: "#/components/schemas/UpdatePasswordRequest"
responses: responses:
'200': "200":
description: Password updated successfully description: Password updated successfully
/api/upload-limit: /api/upload-limit:
get: get:
summary: Get the basic file upload (POST) upload limit set by the portal summary: Get the basic file upload (POST) upload limit set by the portal
responses: responses:
'200': "200":
description: Upload limit retrieved successfully description: Upload limit retrieved successfully
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/UploadLimitResponse' $ref: "#/components/schemas/UploadLimitResponse"
/api/meta: /api/meta:
get: get:
summary: Get metadata about the portal summary: Get metadata about the portal
responses: responses:
'200': "200":
description: Metadata retrieved successfully description: Metadata retrieved successfully
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/MetaResponse' $ref: "#/components/schemas/MetaResponse"
components: components:
schemas: schemas:
LoginRequest: LoginRequest:
type: object type: object
required: required:
- email - email
- password - password
properties: properties:
email: email:
type: string type: string
password: password:
type: string type: string
LoginResponse: LoginResponse:
type: object type: object
properties: properties:
token: token:
type: string type: string
RegisterRequest: RegisterRequest:
type: object type: object
required: required:
- first_name - first_name
- last_name - last_name
- email - email
- password - password
properties: properties:
first_name: first_name:
type: string type: string
last_name: last_name:
type: string type: string
email: email:
type: string type: string
password: password:
type: string type: string
VerifyEmailRequest: VerifyEmailRequest:
type: object type: object
required: required:
- email - email
- token - token
properties: properties:
email: email:
type: string type: string
token: token:
type: string type: string
OTPGenerateResponse: OTPGenerateResponse:
type: object type: object
properties: properties:
OTP: OTP:
type: string type: string
OTPVerifyRequest: OTPVerifyRequest:
type: object type: object
required: required:
- OTP - OTP
properties: properties:
OTP: OTP:
type: string type: string
OTPValidateRequest: OTPValidateRequest:
type: object type: object
required: required:
- OTP - OTP
properties: properties:
OTP: OTP:
type: string type: string
OTPDisableRequest: OTPDisableRequest:
type: object type: object
required: required:
- password - password
properties: properties:
password: password:
type: string type: string
PasswordResetRequest: PasswordResetRequest:
type: object type: object
required: required:
- email - email
properties: properties:
email: email:
type: string type: string
PasswordResetVerifyRequest: PasswordResetVerifyRequest:
type: object type: object
required: required:
- email - email
- token - token
- password - password
properties: properties:
email: email:
type: string type: string
token: token:
type: string type: string
password: password:
type: string type: string
UpdateEmailRequest: UpdateEmailRequest:
type: object type: object
required: required:
- email - email
- password - password
properties: properties:
email: email:
type: string type: string
password: password:
type: string type: string
UpdatePasswordRequest: UpdatePasswordRequest:
type: object type: object
required: required:
- current_password - current_password
- new_password - new_password
properties: properties:
current_password: current_password:
type: string type: string
new_password: new_password:
type: string type: string
PingResponse: PingResponse:
type: object type: object
properties: properties:
ping: ping:
type: string type: string
token: token:
type: string type: string
AccountInfoResponse: AccountInfoResponse:
type: object type: object
properties: properties:
id: id:
type: number type: number
first_name: first_name:
type: string type: string
last_name: last_name:
type: string type: string
email: email:
type: string type: string
UploadLimitResponse: UploadLimitResponse:
type: object type: object
properties: properties:
limit: limit:
type: number type: number
required: required:
- limit - limit
MetaResponse: MetaResponse:
type: object type: object
required: required:
- domain - domain
properties: properties:
domain: domain:
type: string type: string

View File

@ -1,4 +1,4 @@
export * from './sdk.js'; export * from "./sdk.js";
export * from './account/generated/openapi.schemas.js'; export * from "./account/generated/openapi.schemas.js";
export * from './protocol/index.js'; export * from "./protocol/index.js";
export { AccountError } from './account.js'; export { AccountError } from "./account.js";