1
+ import {
2
+ CharacterGetParams ,
3
+ CharacterGetResult ,
4
+ CharacterSearchParams ,
5
+ CharacterSearchResult ,
6
+ FreeCompanyGetParams ,
7
+ FreeCompanyGetResult ,
8
+ FreeCompanySearchParams ,
9
+ FreeCompanySearchResult ,
10
+ LinkshellGetResult ,
11
+ LinkshellSearchParams ,
12
+ LinkshellSearchResult ,
13
+ PvPTeamGetResult ,
14
+ PvPTeamSearchParams ,
15
+ PvPTeamSearchResult ,
16
+ SearchResult ,
17
+ } from "./utils" ;
18
+ export * from "./utils" ;
19
+
1
20
declare module "@xivapi/js" {
2
21
type StringAlgo =
3
22
| "custom"
@@ -12,117 +31,6 @@ declare module "@xivapi/js" {
12
31
| "multi_match"
13
32
| "query_string" ;
14
33
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" ;
125
-
126
34
interface XIVAPIOptions {
127
35
private_key ?: string ;
128
36
language ?: "en" | "de" | "fr" | "ja" | "cn" | "ko" ;
@@ -131,37 +39,6 @@ declare module "@xivapi/js" {
131
39
verbose ?: boolean ;
132
40
}
133
41
134
- interface SearchResponse {
135
- Pagination : {
136
- Page : number ;
137
- PageNext : number ;
138
- PagePrev : number | null ;
139
- PageTotal : number ;
140
- Results : number ;
141
- ResultsPerPage : number ;
142
- ResultsTotal : number ;
143
- } ;
144
- Results : unknown [ ] ;
145
- }
146
-
147
- interface SearchParams {
148
- /**
149
- * The name to search for, you can use `+` for spaces or let the API handle it for you.
150
- */
151
- name ?: string ;
152
-
153
- /**
154
- * The server to search against, this is case sensitive.
155
- * @see https://xivapi.com/servers
156
- */
157
- server ?: Servers ;
158
-
159
- /**
160
- * Search or move to a specific page.
161
- */
162
- page ?: number ;
163
- }
164
-
165
42
interface DataSearchParams {
166
43
/**
167
44
* Search a specific series of indexes separated by commas.
@@ -227,11 +104,12 @@ declare module "@xivapi/js" {
227
104
limit ?: number ;
228
105
}
229
106
230
- export default class XIVAPI < T = { [ key : string ] : any } > {
107
+ export default class XIVAPI {
231
108
public readonly options : XIVAPIOptions ;
232
109
public readonly endpoint : string ;
233
110
public readonly globalParams : { [ key : string ] : string | number } ;
234
111
112
+ constructor ( options : string | XIVAPIOptions ) ;
235
113
constructor ( options : string | XIVAPIOptions , legacyOptions ?: XIVAPIOptions ) ;
236
114
237
115
/**
@@ -247,7 +125,7 @@ declare module "@xivapi/js" {
247
125
* await xiv.search("aiming", { indexes: ["Item", "Recipe"] }); // with params
248
126
* ```
249
127
*/
250
- public search ( input : string , params ?: DataSearchParams ) : Promise < SearchResponse > ;
128
+ public search ( input : string , params ?: DataSearchParams ) : Promise < SearchResult > ;
251
129
252
130
/**
253
131
* Obtain game content data of Final Fantasy XIV.
@@ -265,7 +143,7 @@ declare module "@xivapi/js" {
265
143
* await xiv.data.get("Item", 1673);
266
144
* ```
267
145
*/
268
- get : ( name : string , id : number ) => Promise < T > ;
146
+ get : ( name : string , id : string | number ) => Promise < { [ key : string ] : any } > ;
269
147
270
148
/**
271
149
* Obtain game content data of Final Fantasy XIV.
@@ -293,7 +171,7 @@ declare module "@xivapi/js" {
293
171
*/
294
172
ids ?: number [ ] ;
295
173
}
296
- ) => Promise < SearchResponse > ;
174
+ ) => Promise < SearchResult > ;
297
175
298
176
/**
299
177
* Returns information about a specific object including extended information.
@@ -316,22 +194,8 @@ declare module "@xivapi/js" {
316
194
* @see https://xivapi.com/docs/Character
317
195
*/
318
196
public character : {
319
- search : ( name : string , params ?: SearchParams ) => Promise < SearchResponse > ;
320
- get : (
321
- id : number ,
322
- params ?: {
323
- /**
324
- * If set to 1, the API will return more data in the response by extending out the data IDs to useful objects.
325
- */
326
- extended ?: 1 ;
327
-
328
- /**
329
- * By default the `Character`, `ClassJobs`, `Minion` and `Mount` data will return, you can request more data using the `data` query.
330
- * @see https://xivapi.com/docs/Character#character
331
- */
332
- data ?: ( "AC" | "FR" | "FC" | "FC" | "FCM" | "MIMO" | "PVP" ) [ ] ;
333
- }
334
- ) => Promise < T > ;
197
+ search : ( name : string , params ?: CharacterSearchParams ) => Promise < CharacterSearchResult > ;
198
+ get : ( id : string | number , params ?: CharacterGetParams ) => Promise < CharacterGetResult > ;
335
199
} ;
336
200
337
201
/**
@@ -340,22 +204,8 @@ declare module "@xivapi/js" {
340
204
* @see https://xivapi.com/docs/Free-Company
341
205
*/
342
206
public freecompany : {
343
- search : ( name : string , params ?: SearchParams ) => Promise < SearchResponse > ;
344
- get : (
345
- id : number ,
346
- params ?: {
347
- /**
348
- * If set to 1, the API will return more data in the response by extending out the data IDs to useful objects.
349
- */
350
- extended ?: 1 ;
351
-
352
- /**
353
- * By default only the `FreeCompany` data will return, you can request more data using the `data` query.
354
- * @see https://xivapi.com/docs/Free-Company#free-company
355
- */
356
- data ?: [ "FCM" ] ;
357
- }
358
- ) => Promise < T > ;
207
+ search : ( name : string , params ?: FreeCompanySearchParams ) => Promise < FreeCompanySearchResult > ;
208
+ get : ( id : string | number , params ?: FreeCompanyGetParams ) => Promise < FreeCompanyGetResult > ;
359
209
} ;
360
210
361
211
/**
@@ -364,8 +214,8 @@ declare module "@xivapi/js" {
364
214
* @see https://xivapi.com/docs/Linkshell
365
215
*/
366
216
public linkshell : {
367
- search : ( name : string , params ?: SearchParams ) => Promise < SearchResponse > ;
368
- get : ( id : number ) => Promise < T > ;
217
+ search : ( name : string , params ?: LinkshellSearchParams ) => Promise < LinkshellSearchResult > ;
218
+ get : ( id : string | number ) => Promise < LinkshellGetResult > ;
369
219
} ;
370
220
371
221
/**
@@ -374,8 +224,8 @@ declare module "@xivapi/js" {
374
224
* @see https://xivapi.com/docs/PvP-Team
375
225
*/
376
226
public pvpteam : {
377
- search : ( name : string , params ?: SearchParams ) => Promise < SearchResponse > ;
378
- get : ( id : number ) => Promise < T > ;
227
+ search : ( name : string , params ?: PvPTeamSearchParams ) => Promise < PvPTeamSearchResult > ;
228
+ get : ( id : string | number ) => Promise < PvPTeamGetResult > ;
379
229
} ;
380
230
}
381
231
}
0 commit comments