Skip to content

Commit be685cc

Browse files
author
c0reme
committed
fix: invalid response data
1 parent 28c1fe6 commit be685cc

File tree

1 file changed

+126
-132
lines changed

1 file changed

+126
-132
lines changed

typings/index.d.ts

Lines changed: 126 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -12,149 +12,143 @@ declare module "@xivapi/js" {
1212
| "multi_match"
1313
| "query_string";
1414

15-
export enum Servers {
16-
"Adamantine",
17-
"Aegis",
18-
"Alexander",
19-
"Anima",
20-
"Asura",
21-
"Atomos",
22-
"Bahamut",
23-
"Balmung",
24-
"Behemoth",
25-
"Belias",
26-
"Brynhildr",
27-
"Cactuar",
28-
"Carbuncle",
29-
"Cerberus",
30-
"Chocobo",
31-
"Coeurl",
32-
"Diabolos",
33-
"Durandal",
34-
"Excalibur",
35-
"Exodus",
36-
"Faerie",
37-
"Famfrit",
38-
"Fenrir",
39-
"Garuda",
40-
"Gilgamesh",
41-
"Goblin",
42-
"Gungnir",
43-
"Hades",
44-
"Hyperion",
45-
"Ifrit",
46-
"Ixion",
47-
"Jenova",
48-
"Kujata",
49-
"Lamia",
50-
"Leviathan",
51-
"Lich",
52-
"Louisoix",
53-
"Malboro",
54-
"Mandragora",
55-
"Masamune",
56-
"Mateus",
57-
"Midgardsormr",
58-
"Moogle",
59-
"Odin",
60-
"Omega",
61-
"Pandaemonium",
62-
"Phoenix",
63-
"Ragnarok",
64-
"Ramuh",
65-
"Ridill",
66-
"Sargatanas",
67-
"Shinryu",
68-
"Shiva",
69-
"Siren",
70-
"Tiamat",
71-
"Titan",
72-
"Tonberry",
73-
"Typhon",
74-
"Ultima",
75-
"Ultros",
76-
"Unicorn",
77-
"Valefor",
78-
"Yojimbo",
79-
"Zalera",
80-
"Zeromus",
81-
"Zodiark",
82-
"Spriggan",
83-
"Twintania",
84-
"Bismarck",
85-
"Ravana",
86-
"Sephirot",
87-
"Sophia",
88-
"Zurvan",
89-
"Halicarnassus",
90-
"Maduin",
91-
"Marilith",
92-
"Seraph",
93-
"HongYuHai",
94-
"ShenYiZhiDi",
95-
"LaNuoXiYa",
96-
"HuanYingQunDao",
97-
"MengYaChi",
98-
"YuZhouHeYin",
99-
"WoXianXiRan",
100-
"ChenXiWangZuo",
101-
"BaiYinXiang",
102-
"BaiJinHuanXiang",
103-
"ShenQuanHen",
104-
"ChaoFengTing",
105-
"LvRenZhanQiao",
106-
"FuXiaoZhiJian",
107-
"Longchaoshendian",
108-
"MengYuBaoJing",
109-
"ZiShuiZhanQiao",
110-
"YanXia",
111-
"JingYuZhuangYuan",
112-
"MoDuNa",
113-
"HaiMaoChaWu",
114-
"RouFengHaiWan",
115-
"HuPoYuan",
116-
"ShuiJingTa2",
117-
"YinLeiHu2",
118-
"TaiYangHaiAn2",
119-
"YiXiuJiaDe2",
120-
"HongChaChuan2",
121-
"Alpha",
122-
"Phantom",
123-
"Raiden",
124-
"Sagittarius",
125-
}
15+
type Servers =
16+
| "Adamantine"
17+
| "Aegis"
18+
| "Alexander"
19+
| "Anima"
20+
| "Asura"
21+
| "Atomos"
22+
| "Bahamut"
23+
| "Balmung"
24+
| "Behemoth"
25+
| "Belias"
26+
| "Brynhildr"
27+
| "Cactuar"
28+
| "Carbuncle"
29+
| "Cerberus"
30+
| "Chocobo"
31+
| "Coeurl"
32+
| "Diabolos"
33+
| "Durandal"
34+
| "Excalibur"
35+
| "Exodus"
36+
| "Faerie"
37+
| "Famfrit"
38+
| "Fenrir"
39+
| "Garuda"
40+
| "Gilgamesh"
41+
| "Goblin"
42+
| "Gungnir"
43+
| "Hades"
44+
| "Hyperion"
45+
| "Ifrit"
46+
| "Ixion"
47+
| "Jenova"
48+
| "Kujata"
49+
| "Lamia"
50+
| "Leviathan"
51+
| "Lich"
52+
| "Louisoix"
53+
| "Malboro"
54+
| "Mandragora"
55+
| "Masamune"
56+
| "Mateus"
57+
| "Midgardsormr"
58+
| "Moogle"
59+
| "Odin"
60+
| "Omega"
61+
| "Pandaemonium"
62+
| "Phoenix"
63+
| "Ragnarok"
64+
| "Ramuh"
65+
| "Ridill"
66+
| "Sargatanas"
67+
| "Shinryu"
68+
| "Shiva"
69+
| "Siren"
70+
| "Tiamat"
71+
| "Titan"
72+
| "Tonberry"
73+
| "Typhon"
74+
| "Ultima"
75+
| "Ultros"
76+
| "Unicorn"
77+
| "Valefor"
78+
| "Yojimbo"
79+
| "Zalera"
80+
| "Zeromus"
81+
| "Zodiark"
82+
| "Spriggan"
83+
| "Twintania"
84+
| "Bismarck"
85+
| "Ravana"
86+
| "Sephirot"
87+
| "Sophia"
88+
| "Zurvan"
89+
| "Halicarnassus"
90+
| "Maduin"
91+
| "Marilith"
92+
| "Seraph"
93+
| "HongYuHai"
94+
| "ShenYiZhiDi"
95+
| "LaNuoXiYa"
96+
| "HuanYingQunDao"
97+
| "MengYaChi"
98+
| "YuZhouHeYin"
99+
| "WoXianXiRan"
100+
| "ChenXiWangZuo"
101+
| "BaiYinXiang"
102+
| "BaiJinHuanXiang"
103+
| "ShenQuanHen"
104+
| "ChaoFengTing"
105+
| "LvRenZhanQiao"
106+
| "FuXiaoZhiJian"
107+
| "Longchaoshendian"
108+
| "MengYuBaoJing"
109+
| "ZiShuiZhanQiao"
110+
| "YanXia"
111+
| "JingYuZhuangYuan"
112+
| "MoDuNa"
113+
| "HaiMaoChaWu"
114+
| "RouFengHaiWan"
115+
| "HuPoYuan"
116+
| "ShuiJingTa2"
117+
| "YinLeiHu2"
118+
| "TaiYangHaiAn2"
119+
| "YiXiuJiaDe2"
120+
| "HongChaChuan2"
121+
| "Alpha"
122+
| "Phantom"
123+
| "Raiden"
124+
| "Sagittarius";
126125

127-
export interface XIVAPIOptions {
126+
interface XIVAPIOptions {
128127
private_key?: string;
129128
language?: "en" | "de" | "fr" | "ja" | "cn" | "ko";
130129
snake_case?: boolean;
131130
staging?: boolean;
132131
verbose?: boolean;
133132
}
134133

135-
export interface ItemResponse {
134+
interface SearchResponse {
136135
Pagination: {
137136
Page: number;
138137
PageNext: number;
139-
PagePrev: number;
138+
PagePrev: number | null;
140139
PageTotal: number;
141140
Results: number;
142141
ResultsPerPage: number;
143142
ResultsTotal: number;
144143
};
145-
Results: {
146-
ID: number;
147-
Icon: string;
148-
Name: string;
149-
Url: string;
150-
}[];
144+
Results: unknown[];
151145
}
152146

153-
export interface SearchParams {
147+
interface SearchParams {
154148
/**
155149
* The name to search for, you can use `+` for spaces or let the API handle it for you.
156150
*/
157-
name: string;
151+
name?: string;
158152

159153
/**
160154
* The server to search against, this is case sensitive.
@@ -168,7 +162,7 @@ declare module "@xivapi/js" {
168162
page?: number;
169163
}
170164

171-
export interface DataSearchParams {
165+
interface DataSearchParams {
172166
/**
173167
* Search a specific series of indexes separated by commas.
174168
*/
@@ -253,7 +247,7 @@ declare module "@xivapi/js" {
253247
* await xiv.search("aiming", { indexes: ["Item", "Recipe"] }); // with params
254248
* ```
255249
*/
256-
public search(input: string, params?: DataSearchParams): Promise<T>;
250+
public search(input: string, params?: DataSearchParams): Promise<SearchResponse>;
257251

258252
/**
259253
* Obtain game content data of Final Fantasy XIV.
@@ -299,21 +293,21 @@ declare module "@xivapi/js" {
299293
*/
300294
ids?: number[];
301295
}
302-
) => Promise<ItemResponse>;
296+
) => Promise<SearchResponse>;
303297

304298
/**
305299
* Returns information about a specific object including extended information.
306300
* @since 0.4.2
307301
* @see https://xivapi.com/docs/Game-Data#servers
308302
*/
309-
servers: () => Promise<T>;
303+
servers: () => Promise<string[]>;
310304

311305
/**
312306
* Another list of servers grouped by their data center.
313307
* @since 0.4.2
314308
* @see https://xivapi.com/docs/Game-Data#data-center
315309
*/
316-
datacenters: () => Promise<T>;
310+
datacenters: () => Promise<{ [key: string]: string[] }>;
317311
};
318312

319313
/**
@@ -322,7 +316,7 @@ declare module "@xivapi/js" {
322316
* @see https://xivapi.com/docs/Character
323317
*/
324318
public character: {
325-
search: (name: string, params?: SearchParams) => Promise<T>;
319+
search: (name: string, params?: SearchParams) => Promise<SearchResponse>;
326320
get: (
327321
id: number,
328322
params?: {
@@ -335,7 +329,7 @@ declare module "@xivapi/js" {
335329
* By default the `Character`, `ClassJobs`, `Minion` and `Mount` data will return, you can request more data using the `data` query.
336330
* @see https://xivapi.com/docs/Character#character
337331
*/
338-
data?: ["AC" | "FR" | "FC" | "FC" | "FCM" | "MIMO" | "PVP"];
332+
data?: ("AC" | "FR" | "FC" | "FC" | "FCM" | "MIMO" | "PVP")[];
339333
}
340334
) => Promise<T>;
341335
};
@@ -346,7 +340,7 @@ declare module "@xivapi/js" {
346340
* @see https://xivapi.com/docs/Free-Company
347341
*/
348342
public freecompany: {
349-
search: (name: string, params?: SearchParams) => Promise<T>;
343+
search: (name: string, params?: SearchParams) => Promise<SearchResponse>;
350344
get: (
351345
id: number,
352346
params?: {
@@ -370,7 +364,7 @@ declare module "@xivapi/js" {
370364
* @see https://xivapi.com/docs/Linkshell
371365
*/
372366
public linkshell: {
373-
search: (name: string, params?: SearchParams) => Promise<T>;
367+
search: (name: string, params?: SearchParams) => Promise<SearchResponse>;
374368
get: (id: number) => Promise<T>;
375369
};
376370

@@ -380,7 +374,7 @@ declare module "@xivapi/js" {
380374
* @see https://xivapi.com/docs/PvP-Team
381375
*/
382376
public pvpteam: {
383-
search: (name: string, params?: SearchParams) => Promise<T>;
377+
search: (name: string, params?: SearchParams) => Promise<SearchResponse>;
384378
get: (id: number) => Promise<T>;
385379
};
386380
}

0 commit comments

Comments
 (0)