Compare commits
No commits in common. "c0345dec11a0940f25dbd278b530f7480082a989" and "845c47fef99cd8b2be7a49258545edda678d5493" have entirely different histories.
c0345dec11
...
845c47fef9
|
@ -19,18 +19,17 @@ import {
|
||||||
import {
|
import {
|
||||||
postApiAuthLogin,
|
postApiAuthLogin,
|
||||||
postApiAuthRegister,
|
postApiAuthRegister,
|
||||||
postApiAccountVerifyEmail,
|
postApiAuthVerifyEmail,
|
||||||
getApiAuthOtpGenerate,
|
getApiAuthOtpGenerate,
|
||||||
postApiAccountOtpVerify,
|
postApiAuthOtpVerify,
|
||||||
postApiAccountOtpValidate,
|
postApiAuthOtpValidate,
|
||||||
postApiAuthOtpDisable,
|
postApiAuthOtpDisable,
|
||||||
PasswordResetRequest,
|
PasswordResetRequest,
|
||||||
postApiAccountPasswordResetConfirm,
|
postApiAuthPasswordResetConfirm,
|
||||||
postApiAuthLogout,
|
postApiAuthLogout,
|
||||||
getApiUploadLimit,
|
getApiUploadLimit,
|
||||||
postApiAccountUpdateEmail,
|
|
||||||
} from "./account/generated/index.js";
|
} from "./account/generated/index.js";
|
||||||
import { AxiosError, AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
|
|
||||||
export class AccountApi {
|
export class AccountApi {
|
||||||
private apiUrl: string;
|
private apiUrl: string;
|
||||||
|
@ -89,7 +88,7 @@ export class AccountApi {
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
let ret: AxiosResponse<void>;
|
let ret: AxiosResponse<void>;
|
||||||
try {
|
try {
|
||||||
ret = await postApiAccountVerifyEmail(
|
ret = await postApiAuthVerifyEmail(
|
||||||
verifyEmailRequest,
|
verifyEmailRequest,
|
||||||
this.buildOptions(),
|
this.buildOptions(),
|
||||||
);
|
);
|
||||||
|
@ -112,10 +111,7 @@ export class AccountApi {
|
||||||
public async verifyOtp(otpVerifyRequest: OTPVerifyRequest): Promise<boolean> {
|
public async verifyOtp(otpVerifyRequest: OTPVerifyRequest): Promise<boolean> {
|
||||||
let ret: AxiosResponse<void>;
|
let ret: AxiosResponse<void>;
|
||||||
try {
|
try {
|
||||||
ret = await postApiAccountOtpVerify(
|
ret = await postApiAuthOtpVerify(otpVerifyRequest, this.buildOptions());
|
||||||
otpVerifyRequest,
|
|
||||||
this.buildOptions(),
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +123,7 @@ export class AccountApi {
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
let ret: AxiosResponse<void>;
|
let ret: AxiosResponse<void>;
|
||||||
try {
|
try {
|
||||||
ret = await postApiAccountOtpValidate(
|
ret = await postApiAuthOtpValidate(
|
||||||
otpValidateRequest,
|
otpValidateRequest,
|
||||||
this.buildOptions(),
|
this.buildOptions(),
|
||||||
);
|
);
|
||||||
|
@ -169,7 +165,7 @@ export class AccountApi {
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
let ret: AxiosResponse<void>;
|
let ret: AxiosResponse<void>;
|
||||||
try {
|
try {
|
||||||
ret = await postApiAccountPasswordResetConfirm(
|
ret = await postApiAuthPasswordResetConfirm(
|
||||||
passwordResetVerifyRequest,
|
passwordResetVerifyRequest,
|
||||||
this.buildOptions(),
|
this.buildOptions(),
|
||||||
);
|
);
|
||||||
|
@ -230,23 +226,6 @@ export class AccountApi {
|
||||||
return this.checkSuccessVal<UploadLimitResponse>(ret) ? ret.data.limit : 0;
|
return this.checkSuccessVal<UploadLimitResponse>(ret) ? ret.data.limit : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async updateEmail(
|
|
||||||
email: string,
|
|
||||||
password: string,
|
|
||||||
): Promise<boolean | Error> {
|
|
||||||
let ret: AxiosResponse<void>;
|
|
||||||
try {
|
|
||||||
ret = await postApiAccountUpdateEmail(
|
|
||||||
{ email, password },
|
|
||||||
this.buildOptions(),
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
return new Error((e as AxiosError).response.data as string);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.checkSuccessBool(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
private checkSuccessBool(ret: AxiosResponse<void>): boolean {
|
private checkSuccessBool(ret: AxiosResponse<void>): boolean {
|
||||||
return ret.status === 200;
|
return ret.status === 200;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ paths:
|
||||||
description: Successfully registered
|
description: Successfully registered
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
/api/account/verify-email:
|
/api/auth/verify-email:
|
||||||
post:
|
post:
|
||||||
summary: Verify email address
|
summary: Verify email address
|
||||||
requestBody:
|
requestBody:
|
||||||
|
@ -64,7 +64,7 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/OTPGenerateResponse"
|
$ref: "#/components/schemas/OTPGenerateResponse"
|
||||||
/api/account/otp/verify:
|
/api/auth/otp/verify:
|
||||||
post:
|
post:
|
||||||
summary: Verify OTP for enabling two-factor authentication
|
summary: Verify OTP for enabling two-factor authentication
|
||||||
requestBody:
|
requestBody:
|
||||||
|
@ -76,7 +76,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OTP verified successfully
|
description: OTP verified successfully
|
||||||
/api/account/otp/validate:
|
/api/auth/otp/validate:
|
||||||
post:
|
post:
|
||||||
summary: Validate OTP for two-factor authentication login
|
summary: Validate OTP for two-factor authentication login
|
||||||
requestBody:
|
requestBody:
|
||||||
|
@ -100,7 +100,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OTP disabled successfully
|
description: OTP disabled successfully
|
||||||
/api/account/password-reset/request:
|
/api/auth/password-reset/request:
|
||||||
post:
|
post:
|
||||||
summary: Request a password reset
|
summary: Request a password reset
|
||||||
requestBody:
|
requestBody:
|
||||||
|
@ -112,7 +112,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Password reset requested successfully
|
description: Password reset requested successfully
|
||||||
/api/account/password-reset/confirm:
|
/api/auth/password-reset/confirm:
|
||||||
post:
|
post:
|
||||||
summary: Confirm a password reset
|
summary: Confirm a password reset
|
||||||
requestBody:
|
requestBody:
|
||||||
|
@ -148,18 +148,6 @@ paths:
|
||||||
$ref: "#/components/schemas/AccountInfoResponse"
|
$ref: "#/components/schemas/AccountInfoResponse"
|
||||||
"401":
|
"401":
|
||||||
description: Unauthorized
|
description: Unauthorized
|
||||||
/api/account/update-email:
|
|
||||||
post:
|
|
||||||
summary: Update email address
|
|
||||||
requestBody:
|
|
||||||
required: true
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/UpdateEmailRequest"
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: Email 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
|
||||||
|
@ -260,16 +248,6 @@ components:
|
||||||
type: string
|
type: string
|
||||||
password:
|
password:
|
||||||
type: string
|
type: string
|
||||||
UpdateEmailRequest:
|
|
||||||
type: object
|
|
||||||
required:
|
|
||||||
- email
|
|
||||||
- password
|
|
||||||
properties:
|
|
||||||
email:
|
|
||||||
type: string
|
|
||||||
password:
|
|
||||||
type: string
|
|
||||||
PingResponse:
|
PingResponse:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
|
Loading…
Reference in New Issue