From ffe01db4608ed442b6f0dc7e4e93f0b11adee0f9 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 17 Mar 2024 11:18:03 -0400 Subject: [PATCH] feat: add uploadLimit endpoint --- src/account.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/account.ts b/src/account.ts index 0c84035..5d09647 100644 --- a/src/account.ts +++ b/src/account.ts @@ -12,6 +12,7 @@ import { postApiAuthPasswordResetRequest, postApiAuthPing, RegisterRequest, + UploadLimitResponse, VerifyEmailRequest, } from "./account/generated/index.js"; @@ -26,6 +27,7 @@ import { PasswordResetRequest, postApiAuthPasswordResetConfirm, postApiAuthLogout, + getApiUploadLimit, } from "./account/generated/index.js"; import { AxiosResponse } from "axios"; @@ -207,6 +209,17 @@ export class AccountApi { return true; } + public async uploadLimit(): Promise { + let ret: AxiosResponse; + try { + ret = await getApiUploadLimit(this.buildOptions()); + } catch (e) { + return 0; + } + + return this.checkSuccessVal(ret) ? ret.data.limit : 0; + } + private checkSuccessBool(ret: AxiosResponse): boolean { return ret.status === 200; }