diff --git a/src/exporters/stat.ink.ts b/src/exporters/stat.ink.ts index 4c2f316..9a0c1c4 100644 --- a/src/exporters/stat.ink.ts +++ b/src/exporters/stat.ink.ts @@ -23,6 +23,7 @@ import { StatInkPostBody, StatInkPostResponse, StatInkStage, + StatInkUuidList, StatInkWeapon, VsHistoryDetail, VsInfo, @@ -66,12 +67,23 @@ class StatInkAPI { async uuidList(type: Game["type"]): Promise { const fetch = this.env.newFetcher(); - return await (await fetch.get({ + const response = await fetch.get({ url: type === "VsInfo" ? `${this.statInk}/api/v3/s3s/uuid-list` : `${this.statInk}/api/v3/salmon/uuid-list`, headers: this.requestHeaders(), - })).json(); + }); + const uuidResult: StatInkUuidList = await response.json(); + + if (!Array.isArray(uuidResult)) { + throw new APIError({ + response, + json: uuidResult, + message: uuidResult.message, + }); + } + + return uuidResult; } async postBattle(body: StatInkPostBody) { diff --git a/src/types.ts b/src/types.ts index 4c6393c..ba682c6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -552,6 +552,13 @@ export enum BattleListType { Coop, } +export type StatInkUuidList = { + status: number; + code: number; + name: string; + message: string; +} | string[]; + export type StatInkAbility = { key: string; name: Record;