feat: add uploadLimit endpoint

This commit is contained in:
Derrick Hammer 2024-03-17 11:18:03 -04:00
parent b2b4d7b8ea
commit ffe01db460
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 13 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import {
postApiAuthPasswordResetRequest, postApiAuthPasswordResetRequest,
postApiAuthPing, postApiAuthPing,
RegisterRequest, RegisterRequest,
UploadLimitResponse,
VerifyEmailRequest, VerifyEmailRequest,
} from "./account/generated/index.js"; } from "./account/generated/index.js";
@ -26,6 +27,7 @@ import {
PasswordResetRequest, PasswordResetRequest,
postApiAuthPasswordResetConfirm, postApiAuthPasswordResetConfirm,
postApiAuthLogout, postApiAuthLogout,
getApiUploadLimit,
} from "./account/generated/index.js"; } from "./account/generated/index.js";
import { AxiosResponse } from "axios"; import { AxiosResponse } from "axios";
@ -207,6 +209,17 @@ export class AccountApi {
return true; return true;
} }
public async uploadLimit(): Promise<number> {
let ret: AxiosResponse<UploadLimitResponse>;
try {
ret = await getApiUploadLimit(this.buildOptions());
} catch (e) {
return 0;
}
return this.checkSuccessVal<UploadLimitResponse>(ret) ? ret.data.limit : 0;
}
private checkSuccessBool(ret: AxiosResponse<void>): boolean { private checkSuccessBool(ret: AxiosResponse<void>): boolean {
return ret.status === 200; return ret.status === 200;
} }