feat: add uploadLimit endpoint
This commit is contained in:
parent
b2b4d7b8ea
commit
ffe01db460
|
@ -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<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 {
|
||||
return ret.status === 200;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue