From 31505980c9637073df1c5722e3e4f32f79a78921 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 14 Mar 2024 06:57:49 -0400 Subject: [PATCH] feat: add account info endpoint --- src/account.ts | 13 +++++++++++++ src/account/swagger.yaml | 23 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) 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