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