guildwars2-ts 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,2745 @@
1
+ import axios, { AxiosHeaders, AxiosError } from 'axios';
2
+ import { Logger } from 'tslog';
3
+ import Queue from 'promise-queue';
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __async = (__this, __arguments, generator) => {
22
+ return new Promise((resolve, reject) => {
23
+ var fulfilled = (value) => {
24
+ try {
25
+ step(generator.next(value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ };
30
+ var rejected = (value) => {
31
+ try {
32
+ step(generator.throw(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
+ step((generator = generator.apply(__this, __arguments)).next());
39
+ });
40
+ };
41
+
42
+ // src/base/apiParams.ts
43
+ var ApiLanguage = /* @__PURE__ */ ((ApiLanguage2) => {
44
+ ApiLanguage2["English"] = "en";
45
+ ApiLanguage2["French"] = "fr";
46
+ ApiLanguage2["German"] = "de";
47
+ ApiLanguage2["Spanish"] = "es";
48
+ ApiLanguage2["Chinese"] = "zh";
49
+ return ApiLanguage2;
50
+ })(ApiLanguage || {});
51
+
52
+ // src/base/errors/apiNotFoundError.ts
53
+ var ApiNotFoundError = class _ApiNotFoundError extends Error {
54
+ constructor() {
55
+ super("The Api did not return any data with the provided arguments");
56
+ Object.setPrototypeOf(this, _ApiNotFoundError.prototype);
57
+ }
58
+ };
59
+
60
+ // src/base/errors/apiRetryFailedError.ts
61
+ var ApiRetryFailedError = class _ApiRetryFailedError extends Error {
62
+ constructor() {
63
+ super("The Api failed to return data after several attempts");
64
+ Object.setPrototypeOf(this, _ApiRetryFailedError.prototype);
65
+ }
66
+ };
67
+
68
+ // src/base/errors/apiTokenError.ts
69
+ var ApiTokenError = class _ApiTokenError extends Error {
70
+ constructor() {
71
+ super("Api token was required, but was either missing or incorrect");
72
+ Object.setPrototypeOf(this, _ApiTokenError.prototype);
73
+ }
74
+ };
75
+
76
+ // src/base/errors/apiGenericError.ts
77
+ var ApiGenericError = class _ApiGenericError extends Error {
78
+ constructor() {
79
+ super("The Api request failed with an unknown error");
80
+ Object.setPrototypeOf(this, _ApiGenericError.prototype);
81
+ }
82
+ };
83
+
84
+ // src/base/errors/apiPermissionsError.ts
85
+ var ApiPermissionsError = class _ApiPermissionsError extends Error {
86
+ constructor(scope) {
87
+ super(`The Api token does not have sufficient permissions for this request. ${scope}`);
88
+ Object.setPrototypeOf(this, _ApiPermissionsError.prototype);
89
+ }
90
+ };
91
+
92
+ // src/base/errors/apiTimeoutError.ts
93
+ var ApiTimeoutError = class _ApiTimeoutError extends Error {
94
+ constructor() {
95
+ super("The Api request timed out");
96
+ Object.setPrototypeOf(this, _ApiTimeoutError.prototype);
97
+ }
98
+ };
99
+ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
100
+ LogLevel2[LogLevel2["silly"] = 0] = "silly";
101
+ LogLevel2[LogLevel2["trace"] = 1] = "trace";
102
+ LogLevel2[LogLevel2["debug"] = 2] = "debug";
103
+ LogLevel2[LogLevel2["info"] = 3] = "info";
104
+ LogLevel2[LogLevel2["warn"] = 4] = "warn";
105
+ LogLevel2[LogLevel2["error"] = 5] = "error";
106
+ LogLevel2[LogLevel2["fatal"] = 6] = "fatal";
107
+ return LogLevel2;
108
+ })(LogLevel || {});
109
+ var logger = new Logger({
110
+ minLevel: 3 /* info */,
111
+ hideLogPositionForProduction: true
112
+ });
113
+ var setLogLevel = (minLevel) => {
114
+ logger.settings.minLevel = minLevel;
115
+ };
116
+ var setPathLogging = (displayFilePath) => {
117
+ logger.settings.hideLogPositionForProduction = !displayFilePath;
118
+ };
119
+ var queue = new Queue(Infinity, Infinity);
120
+ function sendRequest(options) {
121
+ return __async(this, null, function* () {
122
+ return yield new Promise((resolve, reject) => {
123
+ axios.get(options.url, __spreadValues({}, options)).then(resolve).catch(reject);
124
+ });
125
+ });
126
+ }
127
+ function enqueueRequest(options) {
128
+ return __async(this, null, function* () {
129
+ return yield queue.add(() => __async(this, null, function* () {
130
+ return yield sendRequest(options);
131
+ }));
132
+ });
133
+ }
134
+
135
+ // src/base/apiBase.ts
136
+ var ApiBase = class {
137
+ constructor(apiParams) {
138
+ this._baseUrl = "https://api.guildwars2.com";
139
+ var _a, _b, _c, _d;
140
+ this._apiToken = apiParams == null ? void 0 : apiParams.token;
141
+ this._language = (_a = apiParams == null ? void 0 : apiParams.language) != null ? _a : "en" /* English */;
142
+ this._rateLimitRetry = (_c = (_b = apiParams == null ? void 0 : apiParams.rateLimit) == null ? void 0 : _b.retry) != null ? _c : true;
143
+ this._rateLimitRetryAttempts = ((_d = apiParams == null ? void 0 : apiParams.rateLimit) == null ? void 0 : _d.retry) ? apiParams.rateLimit.attempts : 0;
144
+ }
145
+ /**
146
+ * Parameters for the api response, at top level
147
+ *
148
+ * @returns Api parameters
149
+ */
150
+ getParams() {
151
+ return {
152
+ token: this._apiToken,
153
+ language: this._language,
154
+ rateLimit: {
155
+ retry: this._rateLimitRetry,
156
+ attempts: this._rateLimitRetryAttempts
157
+ }
158
+ };
159
+ }
160
+ /**
161
+ * Generic request builder. Adds a finalized request to the concurrency queue
162
+ *
163
+ * @param endpoint - API Endpoint
164
+ * @param apiParams - Query string
165
+ * @param schemaVersion - Schema version
166
+ */
167
+ buildRequest(endpoint, apiParams, schemaVersion) {
168
+ return __async(this, null, function* () {
169
+ const { tokenRequired } = endpoint;
170
+ const url = this._getApiUrl(endpoint, apiParams != null ? apiParams : {});
171
+ const headers = new AxiosHeaders();
172
+ headers["Accept-Language"] = this._language;
173
+ if (tokenRequired) {
174
+ if (!this._apiToken)
175
+ throw new ApiTokenError();
176
+ headers.Authorization = `Bearer ${this._apiToken}`;
177
+ }
178
+ if (schemaVersion)
179
+ headers["X-Schema-Version"] = schemaVersion;
180
+ const options = {
181
+ url,
182
+ method: "GET",
183
+ headers
184
+ };
185
+ try {
186
+ logger.info(`Requesting ${options.url}`);
187
+ const response = yield enqueueRequest(options);
188
+ const { data } = response;
189
+ return data;
190
+ } catch (error) {
191
+ return yield this.retryRequest(endpoint, options, apiParams, error);
192
+ }
193
+ });
194
+ }
195
+ /**
196
+ * Retries failed requests
197
+ * TODO: Fix logic. Rate-limits are almost impossible hit, but other generic requests will fail and loop forever
198
+ *
199
+ * @param endpoint - Endpoint to which a request was originally made
200
+ * @param prevOptions - Axios request options
201
+ * @param apiParams - Query string
202
+ * @param prevError - Error that caused a retry
203
+ * @returns Successful request, or error
204
+ */
205
+ retryRequest(endpoint, prevOptions, apiParams, prevError) {
206
+ return __async(this, null, function* () {
207
+ if (prevError instanceof AxiosError) {
208
+ if (prevError.response) {
209
+ const { status } = prevError.response;
210
+ if (status === 401) {
211
+ logger.warn(`Request to ${prevOptions.url} failed.`);
212
+ throw new ApiTokenError();
213
+ }
214
+ if (status === 403) {
215
+ const requiredScope = (
216
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/restrict-plus-operands
217
+ prevError.response.data.text.slice(0, 1).toUpperCase() + prevError.response.data.text.slice(1)
218
+ );
219
+ logger.warn(`Request to ${prevOptions.url} failed. ${requiredScope}.`);
220
+ throw new ApiPermissionsError(requiredScope);
221
+ }
222
+ if (status === 404) {
223
+ logger.warn(`Request to ${prevOptions.url} returned no data.`);
224
+ throw new ApiNotFoundError();
225
+ }
226
+ if (status === 504) {
227
+ logger.warn(`Request to ${prevOptions.url} timed out.`);
228
+ throw new ApiTimeoutError();
229
+ }
230
+ }
231
+ logger.warn(`Request to ${prevOptions.url} failed. ${prevError.message}`);
232
+ } else if (this._rateLimitRetry) {
233
+ for (let attempt = 0; attempt < this._rateLimitRetryAttempts; attempt++) {
234
+ try {
235
+ return yield this.buildRequest(endpoint, apiParams);
236
+ } catch (error) {
237
+ if (error instanceof AxiosError && error.code === "ERR_TOO_MANY_REQUESTS") {
238
+ setTimeout(() => {
239
+ logger.warn("Request timed out. Waiting to retry...");
240
+ }, 1e3);
241
+ }
242
+ }
243
+ }
244
+ logger.info(`Rate-limit retries failed. Aborting request to ${prevOptions.url}`);
245
+ throw new ApiRetryFailedError();
246
+ }
247
+ throw new ApiGenericError();
248
+ });
249
+ }
250
+ /**
251
+ * Builds final Api url from the endpoint and provided parameters
252
+ *
253
+ * @param endpoint - Api endpoint
254
+ * @param urlParams - Parameters
255
+ * @returns Finalized endpoint Url
256
+ */
257
+ _getApiUrl(endpoint, urlParams) {
258
+ const { path } = endpoint;
259
+ const regex = /\$\(([^)]+)?\)/g;
260
+ let fullUrl = `${this._baseUrl}/${path}`;
261
+ let match;
262
+ while (match = regex.exec(fullUrl)) {
263
+ const [key, param] = match;
264
+ if (!param)
265
+ continue;
266
+ const value = encodeURI(String(urlParams[param]));
267
+ fullUrl = fullUrl.replace(key, value);
268
+ regex.lastIndex = 0;
269
+ }
270
+ return fullUrl;
271
+ }
272
+ };
273
+
274
+ // src/apis/endpoints.ts
275
+ var endpoints = {
276
+ account: {
277
+ base: {
278
+ path: "v2/account",
279
+ tokenRequired: true
280
+ },
281
+ achievements: {
282
+ path: "v2/account/achievements",
283
+ tokenRequired: true
284
+ },
285
+ bank: {
286
+ path: "v2/account/bank",
287
+ tokenRequired: true
288
+ },
289
+ buildStorage: {
290
+ path: "v2/account/buildstorage?ids=all",
291
+ tokenRequired: true
292
+ },
293
+ dailyCrafting: {
294
+ path: "v2/account/dailycrafting",
295
+ tokenRequired: true
296
+ },
297
+ dungeons: {
298
+ path: "v2/account/dungeons",
299
+ tokenRequired: true
300
+ },
301
+ dyes: {
302
+ path: "v2/account/dyes",
303
+ tokenRequired: true
304
+ },
305
+ emotes: {
306
+ path: "v2/account/emotes",
307
+ tokenRequired: true
308
+ },
309
+ finishers: {
310
+ path: "v2/account/finishers",
311
+ tokenRequired: true
312
+ },
313
+ gliders: {
314
+ path: "v2/account/gliders",
315
+ tokenRequired: true
316
+ },
317
+ homeCats: {
318
+ path: "v2/account/home/cats",
319
+ tokenRequired: true
320
+ },
321
+ homeNodes: {
322
+ path: "v2/account/home/nodes",
323
+ tokenRequired: true
324
+ },
325
+ sharedInventory: {
326
+ path: "v2/account/inventory",
327
+ tokenRequired: true
328
+ },
329
+ legendaryArmory: {
330
+ path: "v2/account/legendaryarmory",
331
+ tokenRequired: true
332
+ },
333
+ luck: {
334
+ path: "v2/account/luck",
335
+ tokenRequired: true
336
+ },
337
+ mailCarriers: {
338
+ path: "v2/account/mailcarriers",
339
+ tokenRequired: true
340
+ },
341
+ mapChests: {
342
+ path: "v2/account/mapchests",
343
+ tokenRequired: true
344
+ },
345
+ masteries: {
346
+ path: "v2/account/masteries",
347
+ tokenRequired: true
348
+ },
349
+ masteryPoints: {
350
+ path: "v2/account/mastery/points",
351
+ tokenRequired: true
352
+ },
353
+ materials: {
354
+ path: "v2/account/materials",
355
+ tokenRequired: true
356
+ },
357
+ minis: {
358
+ path: "v2/account/minis",
359
+ tokenRequired: true
360
+ },
361
+ mountsSkins: {
362
+ path: "v2/account/mounts/skins",
363
+ tokenRequired: true
364
+ },
365
+ mountsTypes: {
366
+ path: "v2/account/mounts/types",
367
+ tokenRequired: true
368
+ },
369
+ novelties: {
370
+ path: "v2/account/novelties",
371
+ tokenRequired: true
372
+ },
373
+ outfits: {
374
+ path: "v2/account/outfits",
375
+ tokenRequired: true
376
+ },
377
+ progression: {
378
+ path: "v2/account/progression",
379
+ tokenRequired: true
380
+ },
381
+ pvpHeroes: {
382
+ path: "v2/account/pvp/heroes",
383
+ tokenRequired: true
384
+ },
385
+ raids: {
386
+ path: "v2/account/raids",
387
+ tokenRequired: true
388
+ },
389
+ recipes: {
390
+ path: "v2/account/recipes",
391
+ tokenRequired: true
392
+ },
393
+ skins: {
394
+ path: "v2/account/skins",
395
+ tokenRequired: true
396
+ },
397
+ titles: {
398
+ path: "v2/account/titles",
399
+ tokenRequired: true
400
+ },
401
+ wallet: {
402
+ path: "v2/account/wallet",
403
+ tokenRequired: true
404
+ },
405
+ worldBosses: {
406
+ path: "v2/account/worldbosses",
407
+ tokenRequired: true
408
+ }
409
+ },
410
+ achievements: {
411
+ categoryIds: {
412
+ path: "v2/achievements/categories",
413
+ tokenRequired: false
414
+ },
415
+ categories: {
416
+ path: "v2/achievements/categories?ids=$(ids)",
417
+ tokenRequired: false
418
+ },
419
+ daily: {
420
+ path: "v2/achievements/daily",
421
+ tokenRequired: false
422
+ },
423
+ dailyTomorrow: {
424
+ path: "v2/achievements/daily/tomorrow",
425
+ tokenRequired: false
426
+ },
427
+ groups: {
428
+ path: "v2/achievements/groups/$(id)",
429
+ tokenRequired: false
430
+ }
431
+ },
432
+ characters: {
433
+ base: {
434
+ path: "v2/characters",
435
+ tokenRequired: true
436
+ },
437
+ backstory: {
438
+ path: "v2/characters/$(id)/backstory",
439
+ tokenRequired: true
440
+ },
441
+ buildTabs: {
442
+ path: "v2/characters/$(id)/buildtabs?tabs=$(tabs)",
443
+ tokenRequired: true
444
+ },
445
+ core: {
446
+ path: "v2/characters/$(id)/core",
447
+ tokenRequired: true
448
+ },
449
+ crafting: {
450
+ path: "v2/characters/$(id)/crafting",
451
+ tokenRequired: true
452
+ },
453
+ equipment: {
454
+ path: "v2/characters/$(id)/equipment",
455
+ tokenRequired: true
456
+ },
457
+ equipmentTabsById: {
458
+ path: "v2/characters/$(id)/equipmenttabs?tabs=$(tabs)",
459
+ tokenRequired: true
460
+ },
461
+ equipmentTabActive: {
462
+ path: "v2/characters/$(id)/equipmenttabs/active",
463
+ tokenRequired: true
464
+ },
465
+ heroPoints: {
466
+ path: "v2/characters/$(id)/heropoints",
467
+ tokenRequired: true
468
+ },
469
+ inventory: {
470
+ path: "v2/characters/$(id)/inventory",
471
+ tokenRequired: true
472
+ },
473
+ quests: {
474
+ path: "v2/characters/$(id)/quests",
475
+ tokenRequired: true
476
+ },
477
+ recipes: {
478
+ path: "v2/characters/$(id)/recipes",
479
+ tokenRequired: true
480
+ },
481
+ sab: {
482
+ path: "v2/characters/$(id)/sab",
483
+ tokenRequired: true
484
+ },
485
+ skills: {
486
+ path: "v2/characters/$(id)/skills",
487
+ tokenRequired: true
488
+ },
489
+ specializations: {
490
+ path: "v2/characters/$(id)/specializations",
491
+ tokenRequired: true
492
+ },
493
+ training: {
494
+ path: "v2/character/$(id)/training",
495
+ tokenRequired: true
496
+ }
497
+ },
498
+ colors: {
499
+ all: {
500
+ path: "v2/colors",
501
+ tokenRequired: false
502
+ },
503
+ byId: {
504
+ path: "v2/colors?ids=$(ids)",
505
+ tokenRequired: false
506
+ }
507
+ },
508
+ commerce: {
509
+ delivery: {
510
+ path: "v2/commerce/delivery",
511
+ tokenRequired: true
512
+ },
513
+ exchangeCoins: {
514
+ path: "v2/commerce/exchange/coins?quantity=$(quantity)",
515
+ tokenRequired: false
516
+ },
517
+ exchangeGems: {
518
+ path: "v2/commerce/exchange/gems?quantity=$(quantity)",
519
+ tokenRequired: false
520
+ },
521
+ listings: {
522
+ path: "v2/commerce/listings?ids=$(ids)",
523
+ tokenRequired: false
524
+ },
525
+ prices: {
526
+ path: "v2/commerce/prices?ids=$(ids)",
527
+ tokenRequired: false
528
+ },
529
+ transactionsCurrentBuys: {
530
+ path: "v2/commerce/transactions/current/buys",
531
+ tokenRequired: true
532
+ },
533
+ transactionsCurrentSells: {
534
+ path: "v2/commerce/transactions/current/sells",
535
+ tokenRequired: true
536
+ },
537
+ transactionsHistoryBuys: {
538
+ path: "v2/commerce/transactions/history/buys",
539
+ tokenRequired: true
540
+ },
541
+ transactionsHistorySells: {
542
+ path: "v2/commerce/transactions/history/sells",
543
+ tokenRequired: true
544
+ }
545
+ },
546
+ continents: {
547
+ core: {
548
+ path: "v2/continents",
549
+ tokenRequired: false
550
+ },
551
+ continents: {
552
+ path: "v2/continents?ids=$(continents)",
553
+ tokenRequired: false
554
+ },
555
+ floors: {
556
+ path: "v2/continents/$(continent)/floors?ids=$(floors)",
557
+ tokenRequired: false
558
+ },
559
+ regions: {
560
+ path: "v2/continents/$(continent)/floors/$(floor)/regions?ids=$(regions)",
561
+ tokenRequired: false
562
+ },
563
+ maps: {
564
+ path: "v2/continents/$(continent)/floors/$(floor)/regions/$(region)/maps?ids=$(maps)",
565
+ tokenRequired: false
566
+ }
567
+ },
568
+ createSubtoken: {
569
+ noUrl: {
570
+ path: "v2/createsubtoken?expire=$(expire)&permissions=$(permissions)",
571
+ tokenRequired: true
572
+ },
573
+ url: {
574
+ path: "v2/createsubtoken?expire=$(expire)&permissions=$(permissions)&urls=$(urls)",
575
+ tokenRequired: true
576
+ }
577
+ },
578
+ currencies: {
579
+ all: {
580
+ path: "v2/currencies",
581
+ tokenRequired: false
582
+ },
583
+ byId: {
584
+ path: "v2/currencies?ids=$(ids)",
585
+ tokenRequired: false
586
+ }
587
+ },
588
+ emblem: {
589
+ path: "v2/emblem/$(type)?ids=$(ids)",
590
+ tokenRequired: false
591
+ },
592
+ emotes: {
593
+ all: {
594
+ path: "v2/emotes",
595
+ tokenRequired: false
596
+ },
597
+ byId: {
598
+ path: "v2/emotes?ids=$(ids)",
599
+ tokenRequired: false
600
+ }
601
+ },
602
+ gliders: {
603
+ all: {
604
+ path: "v2/gliders",
605
+ tokenRequired: false
606
+ },
607
+ byId: {
608
+ path: "v2/gliders?ids=$(ids)",
609
+ tokenRequired: false
610
+ },
611
+ paginated: {
612
+ path: "v2/gliders?ids=$(ids)&page=$(page)&page_size=$(page_size)",
613
+ tokenRequired: false
614
+ }
615
+ },
616
+ guild: {
617
+ core: {
618
+ path: "v2/guild/$(id)",
619
+ tokenRequired: false
620
+ },
621
+ log: {
622
+ path: "v2/guild/$(id)/log?since=$(since)",
623
+ tokenRequired: true
624
+ },
625
+ members: {
626
+ path: "v2/guild/$(id)/members",
627
+ tokenRequired: true
628
+ },
629
+ ranks: {
630
+ path: "v2/guild/$(id)/ranks",
631
+ tokenRequired: true
632
+ },
633
+ stash: {
634
+ path: "v2/guild/$(id)/stash",
635
+ tokenRequired: true
636
+ },
637
+ storage: {
638
+ path: "v2/guild/$(id)/storage",
639
+ tokenRequired: true
640
+ },
641
+ teams: {
642
+ path: "v2/guild/$(id)/teams",
643
+ tokenRequired: true
644
+ },
645
+ treasury: {
646
+ path: "v2/guild/$(id)/treasury",
647
+ tokenRequired: true
648
+ },
649
+ upgrades: {
650
+ path: "v2/guild/$(id)/upgrades",
651
+ tokenRequired: true
652
+ },
653
+ upgradesInfo: {
654
+ path: "v2/guild/upgrades?ids=$(ids)",
655
+ tokenRequired: false
656
+ },
657
+ permissions: {
658
+ path: "v2/guild/permissions",
659
+ tokenRequired: false
660
+ },
661
+ search: {
662
+ path: "v2/guild/search?name=$(name)",
663
+ tokenRequired: false
664
+ }
665
+ },
666
+ home: {
667
+ cats: {
668
+ path: "v2/home/cats?ids=$(ids)",
669
+ tokenRequired: false
670
+ },
671
+ nodes: {
672
+ path: "v2/home/nodes?ids=$(ids)",
673
+ tokenRequired: false
674
+ }
675
+ },
676
+ items: {
677
+ all: {
678
+ path: "v2/items",
679
+ tokenRequired: false
680
+ },
681
+ byId: {
682
+ path: "v2/items?ids=$(ids)",
683
+ tokenRequired: false
684
+ }
685
+ },
686
+ itemstats: {
687
+ all: {
688
+ path: "v2/itemstats",
689
+ tokenRequired: false
690
+ },
691
+ byId: {
692
+ path: "v2/itemstats?ids=$(ids)",
693
+ tokenRequired: false
694
+ }
695
+ },
696
+ legendaryArmory: {
697
+ all: {
698
+ path: "v2/legendaryarmory",
699
+ tokenRequired: false
700
+ },
701
+ byId: {
702
+ path: "v2/legendaryarmory?ids=$(ids)",
703
+ tokenRequired: false
704
+ }
705
+ },
706
+ legends: {
707
+ all: {
708
+ path: "v2/legends",
709
+ tokenRequired: false
710
+ },
711
+ byId: {
712
+ path: "v2/legends?ids=$(ids)",
713
+ tokenRequired: false
714
+ }
715
+ },
716
+ mailCarriers: {
717
+ all: {
718
+ path: "v2/mailcarriers",
719
+ tokenRequired: false
720
+ },
721
+ byId: {
722
+ path: "v2/mailcarriers?ids=$(ids)",
723
+ tokenRequired: false
724
+ }
725
+ },
726
+ mapChests: {
727
+ path: "v2/mapchests",
728
+ tokenRequired: false
729
+ },
730
+ maps: {
731
+ all: {
732
+ path: "v2/maps",
733
+ tokenRequired: false
734
+ },
735
+ byId: {
736
+ path: "v2/maps?ids=$(ids)",
737
+ tokenRequired: false
738
+ }
739
+ },
740
+ masteries: {
741
+ all: {
742
+ path: "v2/masteries",
743
+ tokenRequired: false
744
+ },
745
+ byId: {
746
+ path: "v2/masteries?ids=$(ids)",
747
+ tokenRequired: false
748
+ }
749
+ },
750
+ materials: {
751
+ all: {
752
+ path: "v2/materials",
753
+ tokenRequired: false
754
+ },
755
+ byId: {
756
+ path: "v2/materials?ids=$(ids)",
757
+ tokenRequired: false
758
+ }
759
+ },
760
+ minis: {
761
+ all: {
762
+ path: "v2/minis",
763
+ tokenRequired: false
764
+ },
765
+ byId: {
766
+ path: "v2/minis?ids=$(ids)",
767
+ tokenRequired: false
768
+ }
769
+ },
770
+ mountsSkins: {
771
+ all: {
772
+ path: "v2/mounts/skins",
773
+ tokenRequired: false
774
+ },
775
+ byId: {
776
+ path: "v2/mounts/skins?ids=$(ids)",
777
+ tokenRequired: false
778
+ }
779
+ },
780
+ mountsTypes: {
781
+ all: {
782
+ path: "v2/mounts/types",
783
+ tokenRequired: false
784
+ },
785
+ byId: {
786
+ path: "v2/mounts/types?ids=$(ids)",
787
+ tokenRequired: false
788
+ }
789
+ },
790
+ novelties: {
791
+ all: {
792
+ path: "v2/novelties",
793
+ tokenRequired: false
794
+ },
795
+ byId: {
796
+ path: "v2/novelties?ids=$(ids)",
797
+ tokenRequired: false
798
+ }
799
+ },
800
+ outfits: {
801
+ all: {
802
+ path: "v2/outfits",
803
+ tokenRequired: false
804
+ },
805
+ byId: {
806
+ path: "v2/outfits?ids=$(ids)",
807
+ tokenRequired: false
808
+ }
809
+ },
810
+ pets: {
811
+ all: {
812
+ path: "v2/pets",
813
+ tokenRequired: false
814
+ },
815
+ byId: {
816
+ path: "v2/pets?ids=$(ids)",
817
+ tokenRequired: false
818
+ }
819
+ },
820
+ pvp: {
821
+ amuletsAll: {
822
+ path: "v2/pvp/amulets",
823
+ tokenRequired: false
824
+ },
825
+ amuletsById: {
826
+ path: `v2/pvp/amulets?ids=$(ids)`,
827
+ tokenRequired: false
828
+ },
829
+ gamesAll: {
830
+ path: `v2/pvp/games`,
831
+ tokenRequired: true
832
+ },
833
+ gamesById: {
834
+ path: `v2/pvp/games?ids=$(ids)`,
835
+ tokenRequired: true
836
+ },
837
+ heroesAll: {
838
+ path: `v2/pvp/heroes`,
839
+ tokenRequired: false
840
+ },
841
+ heroesById: {
842
+ path: `v2/pvp/heroes?ids=$(ids)`,
843
+ tokenRequired: false
844
+ },
845
+ ranksAll: {
846
+ path: `v2/pvp/ranks`,
847
+ tokenRequired: false
848
+ },
849
+ ranksById: {
850
+ path: `v2/pvp/ranks?ids=$(ids)`,
851
+ tokenRequired: false
852
+ },
853
+ seasonsAll: {
854
+ path: `v2/pvp/seasons`,
855
+ tokenRequired: false
856
+ },
857
+ seasonsById: {
858
+ path: `v2/pvp/seasons?ids=$(ids)`,
859
+ tokenRequired: false
860
+ },
861
+ leaderboards: {
862
+ path: `v2/pvp/seasons/$(id)/leaderboards/$(type)/$(region)`,
863
+ tokenRequired: false
864
+ },
865
+ standings: {
866
+ path: `v2/pvp/standings`,
867
+ tokenRequired: true
868
+ },
869
+ stats: {
870
+ path: `v2/pvp/stats`,
871
+ tokenRequired: true
872
+ }
873
+ },
874
+ quaggans: {
875
+ all: {
876
+ path: "v2/quaggans",
877
+ tokenRequired: false
878
+ },
879
+ byId: {
880
+ path: "v2/quaggans?ids=$(ids)",
881
+ tokenRequired: false
882
+ }
883
+ },
884
+ quests: {
885
+ all: {
886
+ path: "v2/quests",
887
+ tokenRequired: false
888
+ },
889
+ byId: {
890
+ path: "v2/quests?ids=$(ids)",
891
+ tokenRequired: false
892
+ }
893
+ },
894
+ races: {
895
+ all: {
896
+ path: "v2/races",
897
+ tokenRequired: false
898
+ },
899
+ byId: {
900
+ path: "v2/races?ids=$(ids)",
901
+ tokenRequired: false
902
+ }
903
+ },
904
+ raids: {
905
+ all: {
906
+ path: "v2/raids",
907
+ tokenRequired: false
908
+ },
909
+ byId: {
910
+ path: "v2/raids?ids=$(ids)",
911
+ tokenRequired: false
912
+ }
913
+ },
914
+ recipes: {
915
+ byId: {
916
+ path: "v2/recipes?ids=$(ids)",
917
+ tokenRequired: false
918
+ },
919
+ search: {
920
+ path: "v2/recipes/search?$(type)=$(ids)",
921
+ tokenRequired: false
922
+ }
923
+ },
924
+ skills: {
925
+ path: "v2/skills?ids=$(ids)",
926
+ tokenRequired: false
927
+ },
928
+ skins: {
929
+ all: {
930
+ path: "v2/skins",
931
+ tokenRequired: false
932
+ },
933
+ byId: {
934
+ path: "v2/skins?ids=$(ids)",
935
+ tokenRequired: false
936
+ }
937
+ },
938
+ specializations: {
939
+ all: {
940
+ path: "v2/specializations",
941
+ tokenRequired: false
942
+ },
943
+ byId: {
944
+ path: "v2/specializations?ids=$(ids)",
945
+ tokenRequired: false
946
+ }
947
+ },
948
+ stories: {
949
+ all: {
950
+ path: "v2/stories",
951
+ tokenRequired: false
952
+ },
953
+ byId: {
954
+ path: "v2/stories?ids=$(ids)",
955
+ tokenRequired: false
956
+ }
957
+ },
958
+ seasons: {
959
+ all: {
960
+ path: "v2/stories/seasons",
961
+ tokenRequired: false
962
+ },
963
+ byId: {
964
+ path: "v2/stories/seasons?ids=$(ids)",
965
+ tokenRequired: false
966
+ }
967
+ },
968
+ titles: {
969
+ all: {
970
+ path: "v2/titles",
971
+ tokenRequired: false
972
+ },
973
+ byId: {
974
+ path: "v2/titles?ids=$(ids)",
975
+ tokenRequired: false
976
+ }
977
+ },
978
+ tokenInfo: {
979
+ path: "v2/tokeninfo",
980
+ tokenRequired: true
981
+ },
982
+ traits: {
983
+ all: {
984
+ path: "v2/traits",
985
+ tokenRequired: false
986
+ },
987
+ byId: {
988
+ path: "v2/traits?ids=$(ids)",
989
+ tokenRequired: false
990
+ }
991
+ },
992
+ worldBosses: {
993
+ path: "v2/worldbosses",
994
+ tokenRequired: false
995
+ },
996
+ worlds: {
997
+ all: {
998
+ path: "v2/worlds",
999
+ tokenRequired: false
1000
+ },
1001
+ byId: {
1002
+ path: "v2/worlds?ids=$(ids)",
1003
+ tokenRequired: false
1004
+ }
1005
+ },
1006
+ wvw: {
1007
+ abilities: {
1008
+ path: "v2/wvw/abilities",
1009
+ tokenRequired: false
1010
+ },
1011
+ abilitiesById: {
1012
+ path: "v2/wvw/abilities?ids=$(ids)",
1013
+ tokenRequired: false
1014
+ },
1015
+ matches: {
1016
+ path: "v2/wvw/matches",
1017
+ tokenRequired: false
1018
+ },
1019
+ matchesById: {
1020
+ path: "v2/wvw/matches?ids=$(ids)",
1021
+ tokenRequired: false
1022
+ },
1023
+ matchesByWorld: {
1024
+ path: "v2/wvw/matches/$(type)?world=$(world)",
1025
+ tokenRequired: false
1026
+ },
1027
+ objectives: {
1028
+ path: "v2/wvw/objectives",
1029
+ tokenRequired: false
1030
+ },
1031
+ objectivesById: {
1032
+ path: "v2/wvw/objectives?ids=$(ids)",
1033
+ tokenRequired: false
1034
+ },
1035
+ ranks: {
1036
+ path: "v2/wvw/ranks",
1037
+ tokenRequired: false
1038
+ },
1039
+ ranksById: {
1040
+ path: "v2/wvw/ranks?ids=$(ids)",
1041
+ tokenRequired: false
1042
+ }
1043
+ }
1044
+ };
1045
+
1046
+ // src/apis/account/account.ts
1047
+ var AccountApi = class extends ApiBase {
1048
+ /**
1049
+ * Get all account information
1050
+ *
1051
+ * @returns Account information
1052
+ */
1053
+ get() {
1054
+ return __async(this, null, function* () {
1055
+ return yield this.buildRequest(endpoints.account.base, {});
1056
+ });
1057
+ }
1058
+ /**
1059
+ * Get account achievement information
1060
+ *
1061
+ * @returns Account achievements
1062
+ */
1063
+ getAchievements() {
1064
+ return __async(this, null, function* () {
1065
+ return yield this.buildRequest(endpoints.account.achievements, {});
1066
+ });
1067
+ }
1068
+ /**
1069
+ * Get the items stored in a player's vault (not including material storage)
1070
+ * If null, the slot is empty
1071
+ *
1072
+ * @returns Account bank contents
1073
+ */
1074
+ getBankContents() {
1075
+ return __async(this, null, function* () {
1076
+ return yield this.buildRequest(endpoints.account.bank, {});
1077
+ });
1078
+ }
1079
+ /**
1080
+ * Get templates stored in the account build storage
1081
+ *
1082
+ * @returns Account build storage
1083
+ */
1084
+ getBuildStorage() {
1085
+ return __async(this, null, function* () {
1086
+ return yield this.buildRequest(endpoints.account.buildStorage, {});
1087
+ });
1088
+ }
1089
+ /**
1090
+ * Get completed daily crafts
1091
+ *
1092
+ * @returns Crafts completed since last daily reset
1093
+ */
1094
+ getDailyCrafts() {
1095
+ return __async(this, null, function* () {
1096
+ return yield this.buildRequest(endpoints.account.dailyCrafting, {});
1097
+ });
1098
+ }
1099
+ /**
1100
+ * Get completed dungeons
1101
+ *
1102
+ * @returns Dungeons completed since last daily reset
1103
+ */
1104
+ getDungeons() {
1105
+ return __async(this, null, function* () {
1106
+ return yield this.buildRequest(endpoints.account.dungeons, {});
1107
+ });
1108
+ }
1109
+ /**
1110
+ * Get dyes unlocked on the account
1111
+ *
1112
+ * @returns Dyes unlocked on the account
1113
+ */
1114
+ getDyes() {
1115
+ return __async(this, null, function* () {
1116
+ return yield this.buildRequest(endpoints.account.dyes, {});
1117
+ });
1118
+ }
1119
+ /**
1120
+ * Get emotes unlocked on the account
1121
+ *
1122
+ * @returns Emotes unlocked on the account
1123
+ */
1124
+ getEmotes() {
1125
+ return __async(this, null, function* () {
1126
+ return yield this.buildRequest(endpoints.account.emotes, {});
1127
+ });
1128
+ }
1129
+ /**
1130
+ * Get finishers unlocked on the account
1131
+ *
1132
+ * @returns Finishers unlocked on the account
1133
+ */
1134
+ getFinishers() {
1135
+ return __async(this, null, function* () {
1136
+ return yield this.buildRequest(endpoints.account.finishers, {});
1137
+ });
1138
+ }
1139
+ /**
1140
+ * Get gliders unlocked on the account
1141
+ *
1142
+ * @returns Gliders unlocked on the account
1143
+ */
1144
+ getGliders() {
1145
+ return __async(this, null, function* () {
1146
+ return yield this.buildRequest(endpoints.account.gliders, {});
1147
+ });
1148
+ }
1149
+ /**
1150
+ * Get nodes unlocked on the account home instance
1151
+ *
1152
+ * @returns Nodes unlocked on the account
1153
+ */
1154
+ getHomeNodes() {
1155
+ return __async(this, null, function* () {
1156
+ return yield this.buildRequest(endpoints.account.homeNodes, {});
1157
+ });
1158
+ }
1159
+ /**
1160
+ * Get cats unlocked on the account home instance
1161
+ *
1162
+ * @returns Gliders unlocked on the account
1163
+ */
1164
+ getHomeCats() {
1165
+ return __async(this, null, function* () {
1166
+ return yield this.buildRequest(endpoints.account.homeCats, {});
1167
+ });
1168
+ }
1169
+ /**
1170
+ * Get the items stored in the account shared inventory
1171
+ * If null, the slot is empty
1172
+ *
1173
+ * @returns Account shared inventory contents
1174
+ */
1175
+ getSharedInventory() {
1176
+ return __async(this, null, function* () {
1177
+ return yield this.buildRequest(endpoints.account.sharedInventory, {});
1178
+ });
1179
+ }
1180
+ /**
1181
+ * Get legendary items stored in the account armory
1182
+ *
1183
+ * @returns Legendary armory
1184
+ */
1185
+ getLegendaryArmory() {
1186
+ return __async(this, null, function* () {
1187
+ return yield this.buildRequest(endpoints.account.legendaryArmory, {});
1188
+ });
1189
+ }
1190
+ /**
1191
+ * Get account luck
1192
+ *
1193
+ * @returns Account luck
1194
+ */
1195
+ getLuck() {
1196
+ return __async(this, null, function* () {
1197
+ return yield this.buildRequest(endpoints.account.luck, {});
1198
+ });
1199
+ }
1200
+ /**
1201
+ * Get mail carriers unlocked on the account
1202
+ *
1203
+ * @returns Account mail carriers
1204
+ */
1205
+ getMailCarriers() {
1206
+ return __async(this, null, function* () {
1207
+ return yield this.buildRequest(endpoints.account.mailCarriers, {});
1208
+ });
1209
+ }
1210
+ /**
1211
+ * Get map chests opened on this account today
1212
+ *
1213
+ * @returns Unlocked map chests
1214
+ */
1215
+ getMapChests() {
1216
+ return __async(this, null, function* () {
1217
+ return yield this.buildRequest(endpoints.account.mapChests, {});
1218
+ });
1219
+ }
1220
+ /**
1221
+ * Get masteries unlocked on the account
1222
+ *
1223
+ * @returns Account masteries
1224
+ */
1225
+ getMasteries() {
1226
+ return __async(this, null, function* () {
1227
+ return yield this.buildRequest(endpoints.account.masteries, {});
1228
+ });
1229
+ }
1230
+ /**
1231
+ * Get account mastery points
1232
+ *
1233
+ * @returns account mastery points
1234
+ */
1235
+ getMasteryPoints() {
1236
+ return __async(this, null, function* () {
1237
+ return yield this.buildRequest(endpoints.account.masteryPoints, {});
1238
+ });
1239
+ }
1240
+ /**
1241
+ * Get materials in the account vault
1242
+ *
1243
+ * @returns Account materials
1244
+ */
1245
+ getMaterials() {
1246
+ return __async(this, null, function* () {
1247
+ return yield this.buildRequest(endpoints.account.materials, {});
1248
+ });
1249
+ }
1250
+ /**
1251
+ * Get minis unlocked on the account
1252
+ *
1253
+ * @returns Account minis
1254
+ */
1255
+ getAccountMinis() {
1256
+ return __async(this, null, function* () {
1257
+ return yield this.buildRequest(endpoints.account.minis, {});
1258
+ });
1259
+ }
1260
+ /**
1261
+ * Get account mount skins
1262
+ *
1263
+ * @returns Account mount skins
1264
+ */
1265
+ getMountSkins() {
1266
+ return __async(this, null, function* () {
1267
+ return yield this.buildRequest(endpoints.account.mountsSkins, {});
1268
+ });
1269
+ }
1270
+ /**
1271
+ * Get account mount skins
1272
+ *
1273
+ * @returns Account mount types
1274
+ */
1275
+ getMountTypes() {
1276
+ return __async(this, null, function* () {
1277
+ return yield this.buildRequest(endpoints.account.mountsTypes, {});
1278
+ });
1279
+ }
1280
+ /**
1281
+ * Get novelties unlocked on the account
1282
+ *
1283
+ * @returns Account novelties
1284
+ */
1285
+ getNovelties() {
1286
+ return __async(this, null, function* () {
1287
+ return yield this.buildRequest(endpoints.account.novelties, {});
1288
+ });
1289
+ }
1290
+ /**
1291
+ * Get outfits unlocked on the account
1292
+ *
1293
+ * @returns Account outfits
1294
+ */
1295
+ getOutfits() {
1296
+ return __async(this, null, function* () {
1297
+ return yield this.buildRequest(endpoints.account.outfits, {});
1298
+ });
1299
+ }
1300
+ /**
1301
+ * Get account progression
1302
+ *
1303
+ * @returns Account progression
1304
+ */
1305
+ getProgression() {
1306
+ return __async(this, null, function* () {
1307
+ return yield this.buildRequest(endpoints.account.progression, {});
1308
+ });
1309
+ }
1310
+ /**
1311
+ * Get pvp heroes unlocked on the account
1312
+ *
1313
+ * @returns Account Pvp heroes
1314
+ */
1315
+ getPvpHeroes() {
1316
+ return __async(this, null, function* () {
1317
+ return yield this.buildRequest(endpoints.account.pvpHeroes, {});
1318
+ });
1319
+ }
1320
+ /**
1321
+ * Get weekly raid boss progression
1322
+ *
1323
+ * @returns Account raid boss progression
1324
+ */
1325
+ getRaids() {
1326
+ return __async(this, null, function* () {
1327
+ return yield this.buildRequest(endpoints.account.raids, {});
1328
+ });
1329
+ }
1330
+ /**
1331
+ * Get recipes unlocked on the account
1332
+ *
1333
+ * @returns Account recipes
1334
+ */
1335
+ getRecipes() {
1336
+ return __async(this, null, function* () {
1337
+ return yield this.buildRequest(endpoints.account.recipes, {});
1338
+ });
1339
+ }
1340
+ /**
1341
+ * Get skins unlocked on the account
1342
+ *
1343
+ * @returns Account skins
1344
+ */
1345
+ getSkins() {
1346
+ return __async(this, null, function* () {
1347
+ return yield this.buildRequest(endpoints.account.skins, {});
1348
+ });
1349
+ }
1350
+ /**
1351
+ * Get titles unlocked on the account
1352
+ *
1353
+ * @returns Account titles
1354
+ */
1355
+ getTitles() {
1356
+ return __async(this, null, function* () {
1357
+ return yield this.buildRequest(endpoints.account.titles, {});
1358
+ });
1359
+ }
1360
+ /**
1361
+ * Get world bosses killed today
1362
+ */
1363
+ getWorldBosses() {
1364
+ return __async(this, null, function* () {
1365
+ return yield this.buildRequest(endpoints.account.worldBosses, {});
1366
+ });
1367
+ }
1368
+ };
1369
+
1370
+ // src/apis/achievements/achievements.ts
1371
+ var AchievementsApi = class extends ApiBase {
1372
+ /**
1373
+ * Get all achievement categories
1374
+ */
1375
+ getCategoryIds() {
1376
+ return __async(this, null, function* () {
1377
+ return yield this.buildRequest(endpoints.achievements.categoryIds, {});
1378
+ });
1379
+ }
1380
+ /**
1381
+ * Get achievement category details.
1382
+ *
1383
+ * @param ids - (optional) List of category ids
1384
+ * @param schemaVersion - Schema version
1385
+ */
1386
+ getCategories(ids, schemaVersion) {
1387
+ return __async(this, null, function* () {
1388
+ return yield this.buildRequest(
1389
+ endpoints.achievements.categories,
1390
+ { ids: ids != null ? ids : "all" },
1391
+ schemaVersion
1392
+ );
1393
+ });
1394
+ }
1395
+ /**
1396
+ * Get daily achievements.
1397
+ */
1398
+ getDailyAchievements() {
1399
+ return __async(this, null, function* () {
1400
+ return yield this.buildRequest(endpoints.achievements.daily, {});
1401
+ });
1402
+ }
1403
+ /**
1404
+ * Get daily achievements for tomorrow.
1405
+ */
1406
+ getDailyAchievementsTomorrow() {
1407
+ return __async(this, null, function* () {
1408
+ return yield this.buildRequest(endpoints.achievements.dailyTomorrow, {});
1409
+ });
1410
+ }
1411
+ /**
1412
+ * Get achievement groups.
1413
+ */
1414
+ getGroups() {
1415
+ return __async(this, null, function* () {
1416
+ return yield this.buildRequest(endpoints.achievements.groups, { id: "" });
1417
+ });
1418
+ }
1419
+ /**
1420
+ * Get achievement group by id.
1421
+ *
1422
+ * @param id - Group id
1423
+ */
1424
+ getGroupById(id) {
1425
+ return __async(this, null, function* () {
1426
+ return yield this.buildRequest(endpoints.achievements.groups, { id });
1427
+ });
1428
+ }
1429
+ };
1430
+
1431
+ // src/apis/characters/characters.ts
1432
+ var CharactersApi = class extends ApiBase {
1433
+ /**
1434
+ * Get names of all characters on the account
1435
+ *
1436
+ * @returns Character names
1437
+ */
1438
+ get() {
1439
+ return __async(this, null, function* () {
1440
+ return yield this.buildRequest(endpoints.characters.base, {});
1441
+ });
1442
+ }
1443
+ /**
1444
+ * Get backstory of a selected character
1445
+ *
1446
+ * @param id - Character name
1447
+ * @returns Character backstory
1448
+ */
1449
+ getBackstory(id) {
1450
+ return __async(this, null, function* () {
1451
+ return yield this.buildRequest(endpoints.characters.backstory, { id });
1452
+ });
1453
+ }
1454
+ /**
1455
+ * Get build tabs of a selected character
1456
+ *
1457
+ * @param id - Character name
1458
+ * @param tabs - Optional tab index. If the index is invalid, all tabs will be returned
1459
+ * @returns Character build tabs
1460
+ */
1461
+ getBuildTabs(id, tabs) {
1462
+ return __async(this, null, function* () {
1463
+ if (tabs) {
1464
+ tabs.forEach((tab) => {
1465
+ if (tab < 1 || tab > 8) {
1466
+ logger.warn("Build tab ids must be between 1 and 8");
1467
+ throw new ApiGenericError();
1468
+ }
1469
+ });
1470
+ }
1471
+ return yield this.buildRequest(endpoints.characters.buildTabs, {
1472
+ id,
1473
+ tabs: tabs != null ? tabs : "all"
1474
+ });
1475
+ });
1476
+ }
1477
+ /**
1478
+ * Returns core information about a character attached to a specific account.
1479
+ *
1480
+ * @param id - Character name
1481
+ * @returns Core character information
1482
+ */
1483
+ getCore(id) {
1484
+ return __async(this, null, function* () {
1485
+ return yield this.buildRequest(endpoints.characters.core, { id });
1486
+ });
1487
+ }
1488
+ /**
1489
+ * Returns crafting disciplines available to a character attached to a specific account.
1490
+ *
1491
+ * @param id - Character name
1492
+ * @returns Character crafting disciplines
1493
+ */
1494
+ getCrafting(id) {
1495
+ return __async(this, null, function* () {
1496
+ return yield this.buildRequest(endpoints.characters.crafting, { id });
1497
+ });
1498
+ }
1499
+ /**
1500
+ * Returns equipment of a character attached to a specific account.
1501
+ *
1502
+ * @param id - Character name
1503
+ * @param schemaVersion - Schema version
1504
+ * @returns Character equipment
1505
+ */
1506
+ getEquipment(id, schemaVersion) {
1507
+ return __async(this, null, function* () {
1508
+ return yield this.buildRequest(endpoints.characters.equipment, { id }, schemaVersion);
1509
+ });
1510
+ }
1511
+ /**
1512
+ * Returns equipment tabs of a character attached to a specific account.
1513
+ *
1514
+ * @param id - Character name
1515
+ * @param tabs - Optional equipment tab number.
1516
+ */
1517
+ getEquipmentTabs(id, tabs) {
1518
+ return __async(this, null, function* () {
1519
+ if (tabs) {
1520
+ tabs.forEach((tab) => {
1521
+ if (tab < 1 || tab > 8) {
1522
+ logger.warn("Equipment tab ids must be between 1 and 8");
1523
+ throw new ApiGenericError();
1524
+ }
1525
+ });
1526
+ }
1527
+ return yield this.buildRequest(endpoints.characters.equipmentTabsById, {
1528
+ id,
1529
+ tabs: tabs != null ? tabs : "all"
1530
+ });
1531
+ });
1532
+ }
1533
+ /**
1534
+ * Returns the active equipment tab of a character attached to a specific account.
1535
+ *
1536
+ * @param id - Character name
1537
+ */
1538
+ getActiveEquipmentTab(id) {
1539
+ return __async(this, null, function* () {
1540
+ return yield this.buildRequest(endpoints.characters.equipmentTabActive, { id });
1541
+ });
1542
+ }
1543
+ /**
1544
+ * Returns hero points obtained by a character attached to a specific account.
1545
+ * NOTE: This api does not currently return a lot of hero point values.
1546
+ * Check the list here for details https://wiki.guildwars2.com/wiki/API:2/characters/:id/heropoints#Notes
1547
+ *
1548
+ * @param id - Character name
1549
+ * @returns Character hero points
1550
+ */
1551
+ getHeroPoints(id) {
1552
+ return __async(this, null, function* () {
1553
+ return yield this.buildRequest(endpoints.characters.heroPoints, { id });
1554
+ });
1555
+ }
1556
+ /**
1557
+ * Returns inventory of a character attached to a specific account.
1558
+ *
1559
+ * @param id - Character name
1560
+ * @returns Character inventory
1561
+ */
1562
+ getInventory(id) {
1563
+ return __async(this, null, function* () {
1564
+ return yield this.buildRequest(endpoints.characters.inventory, { id });
1565
+ });
1566
+ }
1567
+ /**
1568
+ * Returns quests that are selected by a character attached to a specific account.
1569
+ *
1570
+ * @param id - Character name
1571
+ * @returns Character quest selections
1572
+ */
1573
+ getQuests(id) {
1574
+ return __async(this, null, function* () {
1575
+ return yield this.buildRequest(endpoints.characters.quests, { id });
1576
+ });
1577
+ }
1578
+ /**
1579
+ * Returns recipes that the given character can use.
1580
+ *
1581
+ * @param id - Character name
1582
+ * @returns Character recipes
1583
+ */
1584
+ getRecipes(id) {
1585
+ return __async(this, null, function* () {
1586
+ return yield this.buildRequest(endpoints.characters.recipes, { id });
1587
+ });
1588
+ }
1589
+ /**
1590
+ * Returns information about Super Adventure Box on a character attached to a specific account.
1591
+ *
1592
+ * @param id - Character name
1593
+ * @returns Character SAB
1594
+ */
1595
+ getSAB(id) {
1596
+ return __async(this, null, function* () {
1597
+ return yield this.buildRequest(endpoints.characters.sab, { id });
1598
+ });
1599
+ }
1600
+ /**
1601
+ * Returns skill information of a character attached to a specific account.
1602
+ *
1603
+ * @param id - Character name
1604
+ * @returns Character skills
1605
+ */
1606
+ getSkills(id) {
1607
+ return __async(this, null, function* () {
1608
+ return yield this.buildRequest(endpoints.characters.skills, { id });
1609
+ });
1610
+ }
1611
+ /**
1612
+ * Returns specialization information of a character attached to a specific account.
1613
+ *
1614
+ * @param id - Character name
1615
+ * @returns Character specialization information
1616
+ */
1617
+ getSpecializations(id) {
1618
+ return __async(this, null, function* () {
1619
+ return yield this.buildRequest(endpoints.characters.specializations, {
1620
+ id
1621
+ });
1622
+ });
1623
+ }
1624
+ /**
1625
+ * Returns training details of a character attached to a specific account
1626
+ *
1627
+ * @param id - Character name
1628
+ * @returns Character training information
1629
+ */
1630
+ getTraining(id) {
1631
+ return __async(this, null, function* () {
1632
+ return yield this.buildRequest(endpoints.characters.training, { id });
1633
+ });
1634
+ }
1635
+ };
1636
+
1637
+ // src/apis/commerce/commerce.ts
1638
+ var CommerceApi = class extends ApiBase {
1639
+ /**
1640
+ * Get deliveries from Black Lion Trading Company
1641
+ *
1642
+ * @returns Deliveries awaiting pickup
1643
+ */
1644
+ getDeliveries() {
1645
+ return __async(this, null, function* () {
1646
+ return yield this.buildRequest(endpoints.commerce.delivery, {});
1647
+ });
1648
+ }
1649
+ /**
1650
+ * Get the current coins to gems exchange rate.
1651
+ *
1652
+ * @param quantity - Quantity of coins to be exchanged (in copper coins)
1653
+ * @returns Coins to gems exchange rate
1654
+ */
1655
+ getExchangeCoins(quantity) {
1656
+ return __async(this, null, function* () {
1657
+ return yield this.buildRequest(endpoints.commerce.exchangeCoins, {
1658
+ quantity
1659
+ });
1660
+ });
1661
+ }
1662
+ /**
1663
+ * Get the current gem to coin exchange rate.
1664
+ *
1665
+ * @param quantity - Quantity of gems to be exhanged
1666
+ * @returns Gems to coins exchnage rate
1667
+ */
1668
+ getExchangeGems(quantity) {
1669
+ return __async(this, null, function* () {
1670
+ return yield this.buildRequest(endpoints.commerce.exchangeGems, { quantity });
1671
+ });
1672
+ }
1673
+ /**
1674
+ * Get current buy and sell listings from the trading post.
1675
+ *
1676
+ * TODO: Functionality to return a complete list of every listing is currently unsupported
1677
+ *
1678
+ * @param ids - Listing ids
1679
+ * @returns Buy and sell listings from the trading post
1680
+ */
1681
+ getListings(ids) {
1682
+ return __async(this, null, function* () {
1683
+ return yield this.buildRequest(endpoints.commerce.listings, { ids });
1684
+ });
1685
+ }
1686
+ /**
1687
+ * Get current aggregated buy and sell listing information from the trading post.
1688
+ *
1689
+ * TODO: Functionality to return a complete list of every listing is currently unsupported
1690
+ *
1691
+ * @param ids - Item ids
1692
+ * @returns Buy and sell details from the trading point
1693
+ */
1694
+ getPrices(ids) {
1695
+ return __async(this, null, function* () {
1696
+ return yield this.buildRequest(endpoints.commerce.prices, { ids });
1697
+ });
1698
+ }
1699
+ /**
1700
+ * Get current or past transactions of the account.
1701
+ *
1702
+ * Results are cached for 5 minutes.
1703
+ *
1704
+ * @param status - Current or historical transactions
1705
+ * @param type - Buy or sell transactions
1706
+ * @returns Transactions
1707
+ */
1708
+ getTransactions(status, type) {
1709
+ return __async(this, null, function* () {
1710
+ if (status === "current") {
1711
+ if (type === "buys") {
1712
+ return yield this.buildRequest(
1713
+ endpoints.commerce.transactionsCurrentBuys,
1714
+ {}
1715
+ );
1716
+ }
1717
+ return yield this.buildRequest(endpoints.commerce.transactionsCurrentSells, {});
1718
+ }
1719
+ if (type === "buys") {
1720
+ return yield this.buildRequest(endpoints.commerce.transactionsHistoryBuys, {});
1721
+ }
1722
+ return yield this.buildRequest(endpoints.commerce.transactionsHistorySells, {});
1723
+ });
1724
+ }
1725
+ };
1726
+
1727
+ // src/apis/emblem/emblem.ts
1728
+ var EmblemApi = class extends ApiBase {
1729
+ /**
1730
+ * Get Emblem by type and id
1731
+ *
1732
+ * @param type - Background or foreground
1733
+ * @param ids - Ids of the requested emblem foregrounds
1734
+ * @returns Emblem foreground information
1735
+ */
1736
+ getEmblem(type, ids) {
1737
+ return __async(this, null, function* () {
1738
+ return yield this.buildRequest(endpoints.emblem, {
1739
+ type,
1740
+ ids: ids != null ? ids : "all"
1741
+ });
1742
+ });
1743
+ }
1744
+ };
1745
+
1746
+ // src/apis/guild/guild.ts
1747
+ var GuildApi = class extends ApiBase {
1748
+ /**
1749
+ * Returns core details about a given guild.
1750
+ * The end point will include more or less fields depend on whether
1751
+ * an API Key of a Leader or Member of the Guild with the guilds scope
1752
+ * is included in the Request.
1753
+ *
1754
+ * @param id - Unique guild id
1755
+ */
1756
+ get(id) {
1757
+ return __async(this, null, function* () {
1758
+ return yield this.buildRequest(endpoints.guild.core, { id });
1759
+ });
1760
+ }
1761
+ /**
1762
+ * Returns information about certain events in a guild's log.
1763
+ * The endpoint requires the scope guilds, and will only work if
1764
+ * the API key is from the guild leader's account.
1765
+ *
1766
+ * @param id - Unique guild id
1767
+ * @param since - Starting point for the log, by log id
1768
+ */
1769
+ getLog(id, since) {
1770
+ return __async(this, null, function* () {
1771
+ return yield this.buildRequest(endpoints.guild.log, { id, since: since != null ? since : 0 });
1772
+ });
1773
+ }
1774
+ /**
1775
+ * Returns information about the members of a specified guild.
1776
+ * The endpoint requires the scope guilds, and will only work
1777
+ * if the API key is from the guild leader's account.
1778
+ *
1779
+ * @param id - Unique guild id
1780
+ */
1781
+ getMembers(id) {
1782
+ return __async(this, null, function* () {
1783
+ return yield this.buildRequest(endpoints.guild.members, { id });
1784
+ });
1785
+ }
1786
+ /**
1787
+ * Returns information about the ranks of a specified guild.
1788
+ * The endpoint requires the scope guilds, and will only work
1789
+ * if the API key is from the guild leader's account.
1790
+ *
1791
+ * @param id - Unique guild id
1792
+ */
1793
+ getRanks(id) {
1794
+ return __async(this, null, function* () {
1795
+ return yield this.buildRequest(endpoints.guild.ranks, { id });
1796
+ });
1797
+ }
1798
+ /**
1799
+ * Returns information about the items in a guild's vault.
1800
+ * The endpoint requires the scope guilds, and will only work
1801
+ * if the API key is from the guild leader's account.
1802
+ *
1803
+ * @param id - Unique guild id
1804
+ */
1805
+ getStash(id) {
1806
+ return __async(this, null, function* () {
1807
+ return yield this.buildRequest(endpoints.guild.stash, { id });
1808
+ });
1809
+ }
1810
+ /**
1811
+ * Returns information about the items in a guild's storage.
1812
+ * The endpoint requires the scope guilds, and will only work
1813
+ * if the API key is from the guild leader's account.
1814
+ *
1815
+ * @param id - Unique guild id
1816
+ */
1817
+ getStorage(id) {
1818
+ return __async(this, null, function* () {
1819
+ return yield this.buildRequest(endpoints.guild.storage, { id });
1820
+ });
1821
+ }
1822
+ /**
1823
+ * Returns information about the teams in a guild.
1824
+ * The endpoint requires the scope guilds, and will only work
1825
+ * if the API key is from the guild leader's account.
1826
+ *
1827
+ * @param id - Unique guild id
1828
+ */
1829
+ getTeams(id) {
1830
+ return __async(this, null, function* () {
1831
+ return yield this.buildRequest(endpoints.guild.teams, { id });
1832
+ });
1833
+ }
1834
+ /**
1835
+ * Returns information about the items in a guild's treasury.
1836
+ * The endpoint requires the scope guilds, and will only work
1837
+ * if the API key is from the guild leader's account.
1838
+ *
1839
+ * @param id - Unique guild id
1840
+ */
1841
+ getTreasury(id) {
1842
+ return __async(this, null, function* () {
1843
+ return yield this.buildRequest(endpoints.guild.treasury, { id });
1844
+ });
1845
+ }
1846
+ /**
1847
+ * Returns information about the guild's upgrades.
1848
+ * The endpoint requires the scope guilds, and will only work
1849
+ * if the API key is from the guild leader's account.
1850
+ *
1851
+ * @param id - Unique guild id
1852
+ */
1853
+ getUpgrades(id) {
1854
+ return __async(this, null, function* () {
1855
+ return yield this.buildRequest(endpoints.guild.upgrades, { id });
1856
+ });
1857
+ }
1858
+ /**
1859
+ * Returns information about all guild permissions.
1860
+ */
1861
+ getPermissions() {
1862
+ return __async(this, null, function* () {
1863
+ return yield this.buildRequest(endpoints.guild.permissions, {});
1864
+ });
1865
+ }
1866
+ /**
1867
+ * Returns information on guild ids to be used for other API queries.
1868
+ *
1869
+ * @param name - Guild name
1870
+ */
1871
+ find(name) {
1872
+ return __async(this, null, function* () {
1873
+ return yield this.buildRequest(endpoints.guild.search, { name });
1874
+ });
1875
+ }
1876
+ /**
1877
+ * Returns information about all available Guild Hall upgrades, including scribe decorations.
1878
+ *
1879
+ * @param ids - Guild upgrade ids
1880
+ */
1881
+ upgrades(ids) {
1882
+ return __async(this, null, function* () {
1883
+ return yield this.buildRequest(endpoints.guild.upgradesInfo, { ids });
1884
+ });
1885
+ }
1886
+ };
1887
+
1888
+ // src/apis/home/home.ts
1889
+ var HomeApi = class extends ApiBase {
1890
+ /**
1891
+ * Returns information about cats.
1892
+ * Identical to /v2/cats
1893
+ *
1894
+ * @param ids - Cat ids
1895
+ */
1896
+ getCats(ids) {
1897
+ return __async(this, null, function* () {
1898
+ return yield this.buildRequest(endpoints.home.cats, { ids: ids != null ? ids : "all" });
1899
+ });
1900
+ }
1901
+ /**
1902
+ * Returns a list of all currently available home instance nodes.
1903
+ * Can be resolved against /v2/account/home/nodes to identify an account's unlocked nodes.
1904
+ *
1905
+ * @param ids - Node ids
1906
+ */
1907
+ getNodes(ids) {
1908
+ return __async(this, null, function* () {
1909
+ return yield this.buildRequest(endpoints.home.nodes, { ids: ids != null ? ids : "all" });
1910
+ });
1911
+ }
1912
+ };
1913
+
1914
+ // src/apis/misc/colors.ts
1915
+ var ColorsApi = class extends ApiBase {
1916
+ get(ids) {
1917
+ return __async(this, null, function* () {
1918
+ if (ids)
1919
+ return yield this.buildRequest(endpoints.colors.byId, { ids });
1920
+ return yield this.buildRequest(endpoints.colors.all, {});
1921
+ });
1922
+ }
1923
+ };
1924
+
1925
+ // src/apis/misc/continents.ts
1926
+ var ContinentsApi = class extends ApiBase {
1927
+ /**
1928
+ * Get all continent ids
1929
+ *
1930
+ * @returns Continent ids
1931
+ */
1932
+ getAllContinents() {
1933
+ return __async(this, null, function* () {
1934
+ return yield this.buildRequest(endpoints.continents.core, {});
1935
+ });
1936
+ }
1937
+ /**
1938
+ * Get continents by id
1939
+ *
1940
+ * @param continents Continent ids. If not present, returns all continents
1941
+ * @returns Continent details
1942
+ */
1943
+ getContinents(continents) {
1944
+ return __async(this, null, function* () {
1945
+ return yield this.buildRequest(endpoints.continents.continents, {
1946
+ continents: continents != null ? continents : "all"
1947
+ });
1948
+ });
1949
+ }
1950
+ /**
1951
+ * Get continent floors
1952
+ *
1953
+ * @param continent Continent id
1954
+ * @param floors Floor id
1955
+ * @returns Continent floor details
1956
+ */
1957
+ getContinentFloors(continent, floors) {
1958
+ return __async(this, null, function* () {
1959
+ return yield this.buildRequest(endpoints.continents.floors, {
1960
+ continent,
1961
+ floors: floors != null ? floors : "all"
1962
+ });
1963
+ });
1964
+ }
1965
+ /**
1966
+ * Get regions in a continent floor
1967
+ *
1968
+ * @param continent Continent id
1969
+ * @param floor Floor id
1970
+ * @param regions Region ids
1971
+ * @returns Regions in a continent floor
1972
+ */
1973
+ getContinentFloorRegions(continent, floor, regions) {
1974
+ return __async(this, null, function* () {
1975
+ return yield this.buildRequest(endpoints.continents.regions, {
1976
+ continent,
1977
+ floor,
1978
+ regions: regions != null ? regions : "all"
1979
+ });
1980
+ });
1981
+ }
1982
+ /**
1983
+ * Get maps in a continent region
1984
+ *
1985
+ * @param continent Continent id
1986
+ * @param floor Floor id
1987
+ * @param region Region id
1988
+ * @param maps Map ids
1989
+ * @returns Maps in a continent region
1990
+ */
1991
+ getContinentFloorRegionMaps(continent, floor, region, maps) {
1992
+ return __async(this, null, function* () {
1993
+ return yield this.buildRequest(endpoints.continents.maps, {
1994
+ continent,
1995
+ floor,
1996
+ region,
1997
+ maps: maps != null ? maps : "all"
1998
+ });
1999
+ });
2000
+ }
2001
+ };
2002
+
2003
+ // src/apis/misc/currencies.ts
2004
+ var CurrenciesApi = class extends ApiBase {
2005
+ get(ids) {
2006
+ return __async(this, null, function* () {
2007
+ if (ids)
2008
+ return yield this.buildRequest(endpoints.currencies.byId, { ids });
2009
+ return yield this.buildRequest(endpoints.currencies.all, {});
2010
+ });
2011
+ }
2012
+ };
2013
+
2014
+ // src/apis/misc/emotes.ts
2015
+ var EmotesApi = class extends ApiBase {
2016
+ get(ids) {
2017
+ return __async(this, null, function* () {
2018
+ if (ids && Array.isArray(ids)) {
2019
+ ids = ids.map((id) => {
2020
+ if (["shiverplus", "stretch"].includes(id.toLocaleLowerCase()))
2021
+ return id[0].toLocaleUpperCase() + id.substring(1);
2022
+ return id.toLocaleLowerCase();
2023
+ });
2024
+ return yield this.buildRequest(endpoints.emotes.byId, { ids });
2025
+ }
2026
+ return yield this.buildRequest(endpoints.emotes.all, {});
2027
+ });
2028
+ }
2029
+ };
2030
+
2031
+ // src/apis/misc/gliders.ts
2032
+ var GlidersApi = class extends ApiBase {
2033
+ get(ids) {
2034
+ return __async(this, null, function* () {
2035
+ if (ids)
2036
+ return yield this.buildRequest(endpoints.gliders.byId, { ids });
2037
+ return yield this.buildRequest(endpoints.gliders.all, {});
2038
+ });
2039
+ }
2040
+ };
2041
+
2042
+ // src/apis/misc/items.ts
2043
+ var ItemsApi = class extends ApiBase {
2044
+ get(ids) {
2045
+ return __async(this, null, function* () {
2046
+ if (ids)
2047
+ return yield this.buildRequest(endpoints.items.byId, { ids });
2048
+ return yield this.buildRequest(endpoints.items.all, {});
2049
+ });
2050
+ }
2051
+ };
2052
+
2053
+ // src/apis/misc/itemstats.ts
2054
+ var ItemStatsApi = class extends ApiBase {
2055
+ get(ids) {
2056
+ return __async(this, null, function* () {
2057
+ if (ids)
2058
+ return yield this.buildRequest(endpoints.itemstats.byId, { ids });
2059
+ return yield this.buildRequest(endpoints.itemstats.all, {});
2060
+ });
2061
+ }
2062
+ };
2063
+
2064
+ // src/apis/misc/legendaryarmory.ts
2065
+ var LegendaryArmoryApi = class extends ApiBase {
2066
+ get(ids) {
2067
+ return __async(this, null, function* () {
2068
+ if (ids)
2069
+ return yield this.buildRequest(endpoints.legendaryArmory.byId, { ids });
2070
+ return yield this.buildRequest(endpoints.legendaryArmory.all, {});
2071
+ });
2072
+ }
2073
+ };
2074
+
2075
+ // src/apis/misc/legends.ts
2076
+ var LegendsApi = class extends ApiBase {
2077
+ get(ids) {
2078
+ return __async(this, null, function* () {
2079
+ if (ids)
2080
+ return yield this.buildRequest(endpoints.legends.byId, { ids });
2081
+ return yield this.buildRequest(endpoints.legends.all, {});
2082
+ });
2083
+ }
2084
+ };
2085
+
2086
+ // src/apis/misc/mailCarriers.ts
2087
+ var MailCarriersApi = class extends ApiBase {
2088
+ get(ids) {
2089
+ return __async(this, null, function* () {
2090
+ if (ids)
2091
+ return yield this.buildRequest(endpoints.mailCarriers.byId, { ids });
2092
+ return yield this.buildRequest(endpoints.mailCarriers.all, {});
2093
+ });
2094
+ }
2095
+ };
2096
+
2097
+ // src/apis/misc/mapChests.ts
2098
+ var MapChestsApi = class extends ApiBase {
2099
+ get() {
2100
+ return __async(this, null, function* () {
2101
+ return yield this.buildRequest(endpoints.mapChests, {});
2102
+ });
2103
+ }
2104
+ };
2105
+
2106
+ // src/apis/misc/maps.ts
2107
+ var MapsApi = class extends ApiBase {
2108
+ get(ids) {
2109
+ return __async(this, null, function* () {
2110
+ if (ids)
2111
+ return yield this.buildRequest(endpoints.maps.byId, { ids });
2112
+ return yield this.buildRequest(endpoints.maps.all, {});
2113
+ });
2114
+ }
2115
+ };
2116
+
2117
+ // src/apis/misc/masteries.ts
2118
+ var MasteriesApi = class extends ApiBase {
2119
+ get(ids) {
2120
+ return __async(this, null, function* () {
2121
+ if (ids)
2122
+ return yield this.buildRequest(endpoints.masteries.byId, { ids });
2123
+ return yield this.buildRequest(endpoints.masteries.all, {});
2124
+ });
2125
+ }
2126
+ };
2127
+
2128
+ // src/apis/misc/materials.ts
2129
+ var MaterialsApi = class extends ApiBase {
2130
+ get(ids) {
2131
+ return __async(this, null, function* () {
2132
+ if (ids)
2133
+ return yield this.buildRequest(endpoints.materials.byId, { ids });
2134
+ return yield this.buildRequest(endpoints.materials.all, {});
2135
+ });
2136
+ }
2137
+ };
2138
+
2139
+ // src/apis/misc/minis.ts
2140
+ var MinisApi = class extends ApiBase {
2141
+ get(ids) {
2142
+ return __async(this, null, function* () {
2143
+ if (ids)
2144
+ return yield this.buildRequest(endpoints.minis.byId, { ids });
2145
+ return yield this.buildRequest(endpoints.minis.all, {});
2146
+ });
2147
+ }
2148
+ };
2149
+
2150
+ // src/apis/misc/mounts.ts
2151
+ var MountsApi = class extends ApiBase {
2152
+ getSkins(ids) {
2153
+ return __async(this, null, function* () {
2154
+ if (ids)
2155
+ return yield this.buildRequest(endpoints.mountsSkins.byId, { ids });
2156
+ return yield this.buildRequest(endpoints.mountsSkins.all, {});
2157
+ });
2158
+ }
2159
+ getTypes(ids) {
2160
+ return __async(this, null, function* () {
2161
+ if (ids)
2162
+ return yield this.buildRequest(endpoints.mountsTypes.byId, { ids });
2163
+ return yield this.buildRequest(endpoints.mountsTypes.all, {});
2164
+ });
2165
+ }
2166
+ };
2167
+
2168
+ // src/apis/misc/novelties.ts
2169
+ var NoveltiesApi = class extends ApiBase {
2170
+ get(ids) {
2171
+ return __async(this, null, function* () {
2172
+ if (ids)
2173
+ return yield this.buildRequest(endpoints.novelties.byId, { ids });
2174
+ return yield this.buildRequest(endpoints.novelties.all, {});
2175
+ });
2176
+ }
2177
+ };
2178
+
2179
+ // src/apis/misc/outfits.ts
2180
+ var OutfitsApi = class extends ApiBase {
2181
+ get(ids) {
2182
+ return __async(this, null, function* () {
2183
+ if (ids)
2184
+ return yield this.buildRequest(endpoints.outfits.byId, { ids });
2185
+ return yield this.buildRequest(endpoints.outfits.all, {});
2186
+ });
2187
+ }
2188
+ };
2189
+
2190
+ // src/apis/misc/pets.ts
2191
+ var PetsApi = class extends ApiBase {
2192
+ get(ids) {
2193
+ return __async(this, null, function* () {
2194
+ if (ids)
2195
+ return yield this.buildRequest(endpoints.pets.byId, { ids });
2196
+ return yield this.buildRequest(endpoints.pets.all, {});
2197
+ });
2198
+ }
2199
+ };
2200
+
2201
+ // src/apis/misc/quaggans.ts
2202
+ var QuaggansApi = class extends ApiBase {
2203
+ get(ids) {
2204
+ return __async(this, null, function* () {
2205
+ if (ids)
2206
+ return yield this.buildRequest(endpoints.quaggans.byId, { ids });
2207
+ return yield this.buildRequest(endpoints.quaggans.all, {});
2208
+ });
2209
+ }
2210
+ };
2211
+
2212
+ // src/apis/misc/quests.ts
2213
+ var QuestsApi = class extends ApiBase {
2214
+ get(ids) {
2215
+ return __async(this, null, function* () {
2216
+ if (ids)
2217
+ return yield this.buildRequest(endpoints.quests.byId, { ids });
2218
+ return yield this.buildRequest(endpoints.quests.all, {});
2219
+ });
2220
+ }
2221
+ };
2222
+
2223
+ // src/apis/misc/races.ts
2224
+ var RacesApi = class extends ApiBase {
2225
+ get(ids) {
2226
+ return __async(this, null, function* () {
2227
+ if (ids)
2228
+ return yield this.buildRequest(endpoints.races.byId, { ids });
2229
+ return yield this.buildRequest(endpoints.races.all, {});
2230
+ });
2231
+ }
2232
+ };
2233
+
2234
+ // src/apis/misc/raids.ts
2235
+ var RaidsApi = class extends ApiBase {
2236
+ get(ids) {
2237
+ return __async(this, null, function* () {
2238
+ if (ids)
2239
+ return yield this.buildRequest(endpoints.raids.byId, { ids });
2240
+ return yield this.buildRequest(endpoints.raids.all, {});
2241
+ });
2242
+ }
2243
+ };
2244
+
2245
+ // src/apis/misc/recipes.ts
2246
+ var RecipesApi = class extends ApiBase {
2247
+ /**
2248
+ * TODO: Schema management
2249
+ * NOTE: The Api sometimes returns incorrect item ids in "output_id" fields
2250
+ * Returns information about recipes that were discovered by players in the game.
2251
+ *
2252
+ * @param ids - Recipe ids
2253
+ * @returns Recipe details
2254
+ */
2255
+ get(ids) {
2256
+ return __async(this, null, function* () {
2257
+ return yield this.buildRequest(endpoints.recipes.byId, { ids });
2258
+ });
2259
+ }
2260
+ /**
2261
+ * Allows searching for recipe.
2262
+ *
2263
+ * @param type - Either "input" or "output"
2264
+ * @param ids - Item ids to be searched for
2265
+ * @returns List of item ids where these items are used
2266
+ */
2267
+ search(type, ids) {
2268
+ return __async(this, null, function* () {
2269
+ return yield this.buildRequest(endpoints.recipes.search, { type, ids });
2270
+ });
2271
+ }
2272
+ };
2273
+
2274
+ // src/apis/misc/skills.ts
2275
+ var SkillsApi = class extends ApiBase {
2276
+ /**
2277
+ * Returns information about skills usable by players in the game.
2278
+ *
2279
+ * @param ids - Skill ids
2280
+ * @returns Complete skill information
2281
+ */
2282
+ get(ids) {
2283
+ return __async(this, null, function* () {
2284
+ return yield this.buildRequest(endpoints.skills, { ids });
2285
+ });
2286
+ }
2287
+ };
2288
+
2289
+ // src/apis/misc/skins.ts
2290
+ var SkinsApi = class extends ApiBase {
2291
+ get(ids) {
2292
+ return __async(this, null, function* () {
2293
+ if (ids)
2294
+ return yield this.buildRequest(endpoints.skins.byId, { ids });
2295
+ return yield this.buildRequest(endpoints.skins.all, {});
2296
+ });
2297
+ }
2298
+ };
2299
+
2300
+ // src/apis/misc/specializations.ts
2301
+ var SpecializationsApi = class extends ApiBase {
2302
+ get(ids) {
2303
+ return __async(this, null, function* () {
2304
+ if (ids)
2305
+ return yield this.buildRequest(endpoints.specializations.byId, { ids });
2306
+ return yield this.buildRequest(endpoints.specializations.all, {});
2307
+ });
2308
+ }
2309
+ };
2310
+
2311
+ // src/apis/misc/stories.ts
2312
+ var StoriesApi = class extends ApiBase {
2313
+ getStories(ids) {
2314
+ return __async(this, null, function* () {
2315
+ if (ids)
2316
+ return yield this.buildRequest(endpoints.stories.byId, { ids });
2317
+ return yield this.buildRequest(endpoints.stories.all, {});
2318
+ });
2319
+ }
2320
+ getSeasons(ids) {
2321
+ return __async(this, null, function* () {
2322
+ if (ids)
2323
+ return yield this.buildRequest(endpoints.seasons.byId, { ids });
2324
+ return yield this.buildRequest(endpoints.seasons.all, {});
2325
+ });
2326
+ }
2327
+ };
2328
+
2329
+ // src/apis/misc/subtoken.ts
2330
+ var SubtokenApi = class extends ApiBase {
2331
+ /**
2332
+ * /v2/createsubtoken Api
2333
+ *
2334
+ * @param expire Expiration date. Either valid date format, or ISO-8601
2335
+ * @param permissions Api token permissions
2336
+ * @param urls Specific /v2/ api urls to allow access to
2337
+ */
2338
+ get(expire, permissions, urls) {
2339
+ return __async(this, null, function* () {
2340
+ try {
2341
+ expire = new Date(expire).toISOString();
2342
+ } catch (e) {
2343
+ if (e instanceof RangeError) {
2344
+ logger.error("Date must be of valid, or of ISO-8601 format.");
2345
+ throw new RangeError();
2346
+ }
2347
+ }
2348
+ if (urls) {
2349
+ return yield this.buildRequest(endpoints.createSubtoken.url, {
2350
+ expire,
2351
+ permissions,
2352
+ urls
2353
+ });
2354
+ }
2355
+ return yield this.buildRequest(endpoints.createSubtoken.noUrl, {
2356
+ expire,
2357
+ permissions
2358
+ });
2359
+ });
2360
+ }
2361
+ };
2362
+
2363
+ // src/apis/misc/titles.ts
2364
+ var TitlesApi = class extends ApiBase {
2365
+ get(ids) {
2366
+ return __async(this, null, function* () {
2367
+ if (ids)
2368
+ return yield this.buildRequest(endpoints.titles.byId, { ids });
2369
+ return yield this.buildRequest(endpoints.titles.all, {});
2370
+ });
2371
+ }
2372
+ };
2373
+
2374
+ // src/apis/misc/tokeninfo.ts
2375
+ var TokenInfoApi = class extends ApiBase {
2376
+ /**
2377
+ * Returns information about the supplied API key.
2378
+ *
2379
+ * @returns Token details
2380
+ */
2381
+ get() {
2382
+ return __async(this, null, function* () {
2383
+ return yield this.buildRequest(endpoints.tokenInfo, {});
2384
+ });
2385
+ }
2386
+ };
2387
+
2388
+ // src/apis/misc/traits.ts
2389
+ var TraitsApi = class extends ApiBase {
2390
+ get(ids) {
2391
+ return __async(this, null, function* () {
2392
+ if (ids)
2393
+ return yield this.buildRequest(endpoints.traits.byId, { ids });
2394
+ return yield this.buildRequest(endpoints.traits.all, {});
2395
+ });
2396
+ }
2397
+ };
2398
+
2399
+ // src/apis/misc/worldbosses.ts
2400
+ var WorldBossesApi = class extends ApiBase {
2401
+ /**
2402
+ * Returns information about scheduled World bosses in Core Tyria that reward boss chests that can be be opened once a day in-game.
2403
+ *
2404
+ * @returns List of available world bosses
2405
+ */
2406
+ get() {
2407
+ return __async(this, null, function* () {
2408
+ return yield this.buildRequest(endpoints.worldBosses, {});
2409
+ });
2410
+ }
2411
+ };
2412
+
2413
+ // src/apis/misc/worlds.ts
2414
+ var WorldsApi = class extends ApiBase {
2415
+ get(ids) {
2416
+ return __async(this, null, function* () {
2417
+ if (ids)
2418
+ return yield this.buildRequest(endpoints.worlds.byId, { ids });
2419
+ return yield this.buildRequest(endpoints.worlds.all, {});
2420
+ });
2421
+ }
2422
+ };
2423
+
2424
+ // src/apis/pvp/pvp.ts
2425
+ var PvPApi = class extends ApiBase {
2426
+ getAmulets(ids) {
2427
+ return __async(this, null, function* () {
2428
+ if (ids)
2429
+ return yield this.buildRequest(endpoints.pvp.amuletsById, { ids });
2430
+ return yield this.buildRequest(endpoints.pvp.amuletsAll, {});
2431
+ });
2432
+ }
2433
+ getGames(ids) {
2434
+ return __async(this, null, function* () {
2435
+ if (ids)
2436
+ return yield this.buildRequest(endpoints.pvp.gamesById, { ids });
2437
+ return yield this.buildRequest(endpoints.pvp.gamesAll, {});
2438
+ });
2439
+ }
2440
+ getHeroes(ids) {
2441
+ return __async(this, null, function* () {
2442
+ if (ids)
2443
+ return yield this.buildRequest(endpoints.pvp.heroesById, { ids });
2444
+ return yield this.buildRequest(endpoints.pvp.heroesAll, {});
2445
+ });
2446
+ }
2447
+ getRanks(ids) {
2448
+ return __async(this, null, function* () {
2449
+ if (ids)
2450
+ return yield this.buildRequest(endpoints.pvp.ranksById, { ids });
2451
+ return yield this.buildRequest(endpoints.pvp.ranksAll, {});
2452
+ });
2453
+ }
2454
+ getSeasons(ids) {
2455
+ return __async(this, null, function* () {
2456
+ if (ids)
2457
+ return yield this.buildRequest(endpoints.pvp.seasonsById, { ids });
2458
+ return yield this.buildRequest(endpoints.pvp.seasonsAll, {});
2459
+ });
2460
+ }
2461
+ /**
2462
+ * Returns information about League season leaderboards for either NA or EU.
2463
+ *
2464
+ * @param id - PvP season id
2465
+ * @param type - For season 1-4, legendary or guild type. For season 5+, "ladder"
2466
+ * @param region - EU or NA region
2467
+ * @returns - Season laderboards
2468
+ */
2469
+ getLeaderboards(id, type, region) {
2470
+ return __async(this, null, function* () {
2471
+ return yield this.buildRequest(endpoints.pvp.leaderboards, { id, type, region });
2472
+ });
2473
+ }
2474
+ /**
2475
+ * Returns information about player pips.
2476
+ *
2477
+ * @returns Information about player's historical pvp standings
2478
+ */
2479
+ getStandings() {
2480
+ return __async(this, null, function* () {
2481
+ return yield this.buildRequest(endpoints.pvp.standings, {});
2482
+ });
2483
+ }
2484
+ /**
2485
+ * Resource returns information about wins and losses in the account's PvP matches.
2486
+ *
2487
+ * @returns Information about player's PvP stats
2488
+ */
2489
+ getStats() {
2490
+ return __async(this, null, function* () {
2491
+ return yield this.buildRequest(endpoints.pvp.stats, {});
2492
+ });
2493
+ }
2494
+ };
2495
+
2496
+ // src/apis/wvw/wvw.ts
2497
+ var WorldVsWorldApi = class extends ApiBase {
2498
+ getAbilities(ids) {
2499
+ return __async(this, null, function* () {
2500
+ if (ids)
2501
+ return yield this.buildRequest(endpoints.wvw.abilitiesById, { ids });
2502
+ return yield this.buildRequest(endpoints.wvw.abilities, {});
2503
+ });
2504
+ }
2505
+ getMatches(ids) {
2506
+ return __async(this, null, function* () {
2507
+ if (ids) {
2508
+ return yield this.buildRequest(endpoints.wvw.matchesById, { ids });
2509
+ }
2510
+ return yield this.buildRequest(endpoints.wvw.matches, {});
2511
+ });
2512
+ }
2513
+ /**
2514
+ * Returns further details about the specified match, including the total score, kills and deaths, and further details for each map.
2515
+ * The same information as getMatches(), however more limited.
2516
+ *
2517
+ * @param type - Overview, Scores, or Stats for the matches
2518
+ * @param world - World id
2519
+ * @returns Match description
2520
+ */
2521
+ getMatchesByWorld(type, world) {
2522
+ return __async(this, null, function* () {
2523
+ if (type === "overview") {
2524
+ return yield this.buildRequest(endpoints.wvw.matchesByWorld, {
2525
+ type,
2526
+ world
2527
+ });
2528
+ }
2529
+ if (type === "scores") {
2530
+ return yield this.buildRequest(endpoints.wvw.matchesByWorld, {
2531
+ type,
2532
+ world
2533
+ });
2534
+ }
2535
+ return yield this.buildRequest(endpoints.wvw.matchesByWorld, {
2536
+ type,
2537
+ world
2538
+ });
2539
+ });
2540
+ }
2541
+ getObjectives(ids) {
2542
+ return __async(this, null, function* () {
2543
+ if (ids)
2544
+ return yield this.buildRequest(endpoints.wvw.objectivesById, { ids });
2545
+ return yield this.buildRequest(endpoints.wvw.objectives, {});
2546
+ });
2547
+ }
2548
+ getRanks(ids) {
2549
+ return __async(this, null, function* () {
2550
+ if (ids)
2551
+ return yield this.buildRequest(endpoints.wvw.ranksById, { ids });
2552
+ return yield this.buildRequest(endpoints.wvw.ranks, {});
2553
+ });
2554
+ }
2555
+ getUpgrades(ids) {
2556
+ return __async(this, null, function* () {
2557
+ if (ids)
2558
+ return yield this.buildRequest(endpoints.wvw.ranksById, { ids });
2559
+ return yield this.buildRequest(endpoints.wvw.ranks, {});
2560
+ });
2561
+ }
2562
+ };
2563
+
2564
+ // src/api.ts
2565
+ var GW2Api = class extends ApiBase {
2566
+ constructor() {
2567
+ super(...arguments);
2568
+ /**
2569
+ * /v2/account Api
2570
+ */
2571
+ this.account = new AccountApi(this.getParams());
2572
+ /**
2573
+ * /v2/achievements Api
2574
+ */
2575
+ this.achievements = new AchievementsApi(this.getParams());
2576
+ /**
2577
+ * /v2/characters Api
2578
+ */
2579
+ this.characters = new CharactersApi(this.getParams());
2580
+ /**
2581
+ * /v2/colors Api
2582
+ */
2583
+ this.colors = new ColorsApi(this.getParams());
2584
+ /**
2585
+ * /v2/commerce Api
2586
+ */
2587
+ this.commerce = new CommerceApi(this.getParams());
2588
+ /**
2589
+ * /v2/continents Api
2590
+ */
2591
+ this.continents = new ContinentsApi(this.getParams());
2592
+ /**
2593
+ * /v2/currencies Api
2594
+ */
2595
+ this.currencies = new CurrenciesApi(this.getParams());
2596
+ /**
2597
+ * /v2/emblem Api
2598
+ */
2599
+ this.emblem = new EmblemApi(this.getParams());
2600
+ /**
2601
+ * /v2/emotes Api
2602
+ */
2603
+ this.emotes = new EmotesApi(this.getParams());
2604
+ /**
2605
+ * /v2/gliders Api
2606
+ */
2607
+ this.gliders = new GlidersApi(this.getParams());
2608
+ /**
2609
+ * /v2/guild Api
2610
+ */
2611
+ this.guild = new GuildApi(this.getParams());
2612
+ /**
2613
+ * /v2/home Api
2614
+ */
2615
+ this.home = new HomeApi(this.getParams());
2616
+ /**
2617
+ * /v2/items Api
2618
+ */
2619
+ this.items = new ItemsApi(this.getParams());
2620
+ /**
2621
+ * /v2/itemstats Api
2622
+ */
2623
+ this.itemstats = new ItemStatsApi(this.getParams());
2624
+ /**
2625
+ * /v2/legendaryarmory Api
2626
+ */
2627
+ this.legendaryArmory = new LegendaryArmoryApi(this.getParams());
2628
+ /**
2629
+ * /v2/legends Api
2630
+ */
2631
+ this.legends = new LegendsApi(this.getParams());
2632
+ /**
2633
+ * /v2/mailcarriers Api
2634
+ */
2635
+ this.mailCarriers = new MailCarriersApi(this.getParams());
2636
+ /**
2637
+ * /v2/mapchests Api
2638
+ */
2639
+ this.mapChests = new MapChestsApi(this.getParams());
2640
+ /**
2641
+ * /v2/maps Api
2642
+ */
2643
+ this.maps = new MapsApi(this.getParams());
2644
+ /**
2645
+ * /v2/masteries Api
2646
+ */
2647
+ this.masteries = new MasteriesApi(this.getParams());
2648
+ /**
2649
+ * /v2/materials Api
2650
+ */
2651
+ this.materials = new MaterialsApi(this.getParams());
2652
+ /**
2653
+ * /v2/minis Api
2654
+ */
2655
+ this.minis = new MinisApi(this.getParams());
2656
+ /**
2657
+ * /v2/mounts Api
2658
+ */
2659
+ this.mounts = new MountsApi(this.getParams());
2660
+ /**
2661
+ * /v2/novelties Api
2662
+ */
2663
+ this.novelties = new NoveltiesApi(this.getParams());
2664
+ /**
2665
+ * /v2/outfits Api
2666
+ */
2667
+ this.outfits = new OutfitsApi(this.getParams());
2668
+ /**
2669
+ * /v2/pets Api
2670
+ */
2671
+ this.pets = new PetsApi(this.getParams());
2672
+ /**
2673
+ * /v2/pvp Api
2674
+ */
2675
+ this.pvp = new PvPApi(this.getParams());
2676
+ /**
2677
+ * /v2/quaggans Api
2678
+ */
2679
+ this.quaggans = new QuaggansApi(this.getParams());
2680
+ /**
2681
+ * /v2/quests Api
2682
+ */
2683
+ this.quests = new QuestsApi(this.getParams());
2684
+ /**
2685
+ * /v2/races Api
2686
+ */
2687
+ this.races = new RacesApi(this.getParams());
2688
+ /**
2689
+ * /v2/raids Api
2690
+ */
2691
+ this.raids = new RaidsApi(this.getParams());
2692
+ /**
2693
+ * /v2/recipes Api
2694
+ */
2695
+ this.recipes = new RecipesApi(this.getParams());
2696
+ /**
2697
+ * /v2/skills Api
2698
+ */
2699
+ this.skills = new SkillsApi(this.getParams());
2700
+ /**
2701
+ * /v2/skins Api
2702
+ */
2703
+ this.skins = new SkinsApi(this.getParams());
2704
+ /**
2705
+ * /v2/specializations Api
2706
+ */
2707
+ this.specializations = new SpecializationsApi(this.getParams());
2708
+ /**
2709
+ * /v2/stories Api
2710
+ */
2711
+ this.stories = new StoriesApi(this.getParams());
2712
+ /**
2713
+ * /v2/subtoken Api
2714
+ */
2715
+ this.subtoken = new SubtokenApi(this.getParams());
2716
+ /**
2717
+ * /v2/titles Api
2718
+ */
2719
+ this.titles = new TitlesApi(this.getParams());
2720
+ /**
2721
+ * /v2/tokeninfo Api
2722
+ */
2723
+ this.tokenInfo = new TokenInfoApi(this.getParams());
2724
+ /**
2725
+ * /v2/traits Api
2726
+ */
2727
+ this.traits = new TraitsApi(this.getParams());
2728
+ /**
2729
+ * /v2/worldbosses Api
2730
+ */
2731
+ this.worldBosses = new WorldBossesApi(this.getParams());
2732
+ /**
2733
+ * /v2/worlds Api
2734
+ */
2735
+ this.worlds = new WorldsApi(this.getParams());
2736
+ /**
2737
+ * /v2/wvw Api
2738
+ */
2739
+ this.wvw = new WorldVsWorldApi(this.getParams());
2740
+ }
2741
+ };
2742
+
2743
+ export { ApiLanguage, GW2Api, LogLevel, setLogLevel, setPathLogging };
2744
+ //# sourceMappingURL=out.js.map
2745
+ //# sourceMappingURL=index.mjs.map