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