diff --git a/src/account.ts b/src/account.ts index 7c02ab7..1652609 100644 --- a/src/account.ts +++ b/src/account.ts @@ -1,4 +1,6 @@ import { + AccountInfoResponse, + getApiAccount, LoginRequest, LoginResponse, OTPDisableRequest, @@ -185,6 +187,17 @@ export class AccountApi { return this.checkSuccessVal(ret) && ret.data.ping == "pong"; } + public async info(): Promise { + let ret: AxiosResponse; + try { + ret = await getApiAccount(this.buildOptions()); + } catch (e) { + return false; + } + + return this.checkSuccessVal(ret); + } + private checkSuccessBool(ret: AxiosResponse): boolean { return ret.status === 200; } diff --git a/src/account/swagger.yaml b/src/account/swagger.yaml index 94dc919..95f9af0 100644 --- a/src/account/swagger.yaml +++ b/src/account/swagger.yaml @@ -130,6 +130,18 @@ paths: $ref: "#/components/schemas/PingResponse" "401": description: Unauthorized + /api/account: + get: + summary: Get account information + responses: + "200": + description: Account information retrieved successfully + content: + application/json: + schema: + $ref: "#/components/schemas/AccountInfoResponse" + "401": + description: Unauthorized components: schemas: @@ -225,3 +237,14 @@ components: properties: ping: type: string + AccountInfoResponse: + type: object + properties: + id: + type: number + first_name: + type: string + last_name: + type: string + email: + type: string