guildwars2-ts 1.0.4 → 1.1.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/LICENSE CHANGED
@@ -1,16 +1,16 @@
1
- ISC License
2
-
3
- Copyright (c) 2023 Ivan Sosnov
4
- Copyright (c) 2021 Julio Sansossio (parts of request base code)
5
-
6
- Permission to use, copy, modify, and/or distribute this software for any
7
- purpose with or without fee is hereby granted, provided that the above
8
- copyright notice and this permission notice appear in all copies.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
- PERFORMANCE OF THIS SOFTWARE.
1
+ ISC License
2
+
3
+ Copyright (c) 2023 Ivan Sosnov
4
+ Copyright (c) 2021 Julio Sansossio (parts of request base code)
5
+
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted, provided that the above
8
+ copyright notice and this permission notice appear in all copies.
9
+
10
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md CHANGED
@@ -51,4 +51,4 @@ If you find any kinds of errors in the program code, or wish to add/update any o
51
51
  [npm-image]: https://img.shields.io/npm/v/guildwars2-ts
52
52
  [npm-link]: https://www.npmjs.com/package/guildwars2-ts
53
53
  [license]: https://img.shields.io/gitlab/license/dinckelman%2Fguildwars2-ts
54
- [license-file]: ./LICENSE
54
+ [license-file]: LICENSE
package/dist/index.d.mts CHANGED
@@ -50,8 +50,6 @@ declare class ApiBase {
50
50
  constructor(apiParams?: ApiParams);
51
51
  /**
52
52
  * Parameters for the api response, at top level
53
- *
54
- * @returns Api parameters
55
53
  */
56
54
  protected getParams(): ApiParams;
57
55
  /**
@@ -64,22 +62,20 @@ declare class ApiBase {
64
62
  protected buildRequest<T extends z.ZodType>(endpoint: Endpoint, apiParams: UrlParams, responseType: T): Promise<z.infer<T>>;
65
63
  /**
66
64
  * Retries failed requests
67
- * TODO: Fix logic. Rate-limits are almost impossible hit, but other generic requests will fail and loop forever
68
65
  *
69
66
  * @param endpoint - Endpoint to which a request was originally made
70
67
  * @param prevOptions - Axios request options
71
68
  * @param responseType - Originally requested schema
72
69
  * @param apiParams - Query string
70
+ * @param rateLimitAttempt - Current rate-limit retry counter
73
71
  * @param prevError - Error that caused a retry
74
- * @returns Successful request, or error
75
72
  */
76
- protected retryRequest<T extends z.ZodType>(endpoint: Endpoint, prevOptions: RawAxiosRequestConfig, responseType: T, apiParams: UrlParams, prevError?: unknown): Promise<T>;
73
+ protected retryRequest<T extends z.ZodType>(endpoint: Endpoint, prevOptions: RawAxiosRequestConfig, responseType: T, apiParams: UrlParams, rateLimitAttempt?: number, prevError?: unknown): Promise<T>;
77
74
  /**
78
75
  * Builds final Api url from the endpoint and provided parameters
79
76
  *
80
77
  * @param endpoint - Api endpoint
81
78
  * @param urlParams - Parameters
82
- * @returns Finalized endpoint Url
83
79
  */
84
80
  private _getApiUrl;
85
81
  }
@@ -6291,7 +6287,7 @@ declare const ProfessionsDTO: z.ZodArray<z.ZodObject<{
6291
6287
  /** The skill id. Can be resolved against /v2/skills. */
6292
6288
  id: z.ZodNumber;
6293
6289
  /** The skill bar slot that this weapon skill can be used in. */
6294
- slot: z.ZodEnum<["Profession_1", "Weapon_1", "Weapon_2", "Weapon_3", "Weapon_4", "Weapon_5", "Utility", "Heal", "Elite"]>;
6290
+ slot: z.ZodUnion<[z.ZodEnum<["Profession_1", "Utility", "Heal", "Elite"]>, z.ZodType<`Weapon_${number}`, z.ZodTypeDef, `Weapon_${number}`>]>;
6295
6291
  /** The name of the offhand weapon this skill requires to be equipped. This field is usually only present for Thief skills. */
6296
6292
  offhand: z.ZodOptional<z.ZodString>;
6297
6293
  /** The Elementalist attunement that this skill requires. This field is usually only present for Elementalist skills. */
@@ -6300,13 +6296,13 @@ declare const ProfessionsDTO: z.ZodArray<z.ZodObject<{
6300
6296
  source: z.ZodOptional<z.ZodString>;
6301
6297
  }, "strip", z.ZodTypeAny, {
6302
6298
  id: number;
6303
- slot: "Utility" | "Profession_1" | "Weapon_1" | "Weapon_2" | "Weapon_3" | "Weapon_4" | "Weapon_5" | "Heal" | "Elite";
6299
+ slot: "Utility" | "Profession_1" | "Heal" | "Elite" | `Weapon_${number}`;
6304
6300
  offhand?: string | undefined;
6305
6301
  attunement?: string | undefined;
6306
6302
  source?: string | undefined;
6307
6303
  }, {
6308
6304
  id: number;
6309
- slot: "Utility" | "Profession_1" | "Weapon_1" | "Weapon_2" | "Weapon_3" | "Weapon_4" | "Weapon_5" | "Heal" | "Elite";
6305
+ slot: "Utility" | "Profession_1" | "Heal" | "Elite" | `Weapon_${number}`;
6310
6306
  offhand?: string | undefined;
6311
6307
  attunement?: string | undefined;
6312
6308
  source?: string | undefined;
@@ -6314,7 +6310,7 @@ declare const ProfessionsDTO: z.ZodArray<z.ZodObject<{
6314
6310
  }, "strip", z.ZodTypeAny, {
6315
6311
  skills: {
6316
6312
  id: number;
6317
- slot: "Utility" | "Profession_1" | "Weapon_1" | "Weapon_2" | "Weapon_3" | "Weapon_4" | "Weapon_5" | "Heal" | "Elite";
6313
+ slot: "Utility" | "Profession_1" | "Heal" | "Elite" | `Weapon_${number}`;
6318
6314
  offhand?: string | undefined;
6319
6315
  attunement?: string | undefined;
6320
6316
  source?: string | undefined;
@@ -6324,7 +6320,7 @@ declare const ProfessionsDTO: z.ZodArray<z.ZodObject<{
6324
6320
  }, {
6325
6321
  skills: {
6326
6322
  id: number;
6327
- slot: "Utility" | "Profession_1" | "Weapon_1" | "Weapon_2" | "Weapon_3" | "Weapon_4" | "Weapon_5" | "Heal" | "Elite";
6323
+ slot: "Utility" | "Profession_1" | "Heal" | "Elite" | `Weapon_${number}`;
6328
6324
  offhand?: string | undefined;
6329
6325
  attunement?: string | undefined;
6330
6326
  source?: string | undefined;
@@ -6361,7 +6357,7 @@ declare const ProfessionsDTO: z.ZodArray<z.ZodObject<{
6361
6357
  weapons: Partial<Record<"Axe" | "Dagger" | "Focus" | "Greatsword" | "Hammer" | "Mace" | "Pistol" | "Rifle" | "Scepter" | "Shield" | "Speargun" | "Staff" | "Sword" | "Torch" | "Trident" | "Warhorn" | "Longbow" | "Shortbow" | "Spear", {
6362
6358
  skills: {
6363
6359
  id: number;
6364
- slot: "Utility" | "Profession_1" | "Weapon_1" | "Weapon_2" | "Weapon_3" | "Weapon_4" | "Weapon_5" | "Heal" | "Elite";
6360
+ slot: "Utility" | "Profession_1" | "Heal" | "Elite" | `Weapon_${number}`;
6365
6361
  offhand?: string | undefined;
6366
6362
  attunement?: string | undefined;
6367
6363
  source?: string | undefined;
@@ -6395,7 +6391,7 @@ declare const ProfessionsDTO: z.ZodArray<z.ZodObject<{
6395
6391
  weapons: Partial<Record<"Axe" | "Dagger" | "Focus" | "Greatsword" | "Hammer" | "Mace" | "Pistol" | "Rifle" | "Scepter" | "Shield" | "Speargun" | "Staff" | "Sword" | "Torch" | "Trident" | "Warhorn" | "Longbow" | "Shortbow" | "Spear", {
6396
6392
  skills: {
6397
6393
  id: number;
6398
- slot: "Utility" | "Profession_1" | "Weapon_1" | "Weapon_2" | "Weapon_3" | "Weapon_4" | "Weapon_5" | "Heal" | "Elite";
6394
+ slot: "Utility" | "Profession_1" | "Heal" | "Elite" | `Weapon_${number}`;
6399
6395
  offhand?: string | undefined;
6400
6396
  attunement?: string | undefined;
6401
6397
  source?: string | undefined;
@@ -11098,12 +11094,6 @@ declare class GuildApi extends ApiBase {
11098
11094
  name: string;
11099
11095
  role: "Member" | "Captain";
11100
11096
  }[];
11101
- seasons: {
11102
- id: string;
11103
- rating: number;
11104
- wins: number;
11105
- losses: number;
11106
- }[];
11107
11097
  id: number;
11108
11098
  name: string;
11109
11099
  aggregate: {
@@ -11114,20 +11104,20 @@ declare class GuildApi extends ApiBase {
11114
11104
  forfeits: number;
11115
11105
  };
11116
11106
  ladders: {
11117
- ranked: {
11107
+ ranked?: {
11118
11108
  wins: number;
11119
11109
  losses: number;
11120
11110
  desertions: number;
11121
11111
  byes: number;
11122
11112
  forfeits: number;
11123
- };
11124
- unranked: {
11113
+ } | undefined;
11114
+ unranked?: {
11125
11115
  wins: number;
11126
11116
  losses: number;
11127
11117
  desertions: number;
11128
11118
  byes: number;
11129
11119
  forfeits: number;
11130
- };
11120
+ } | undefined;
11131
11121
  };
11132
11122
  games: {
11133
11123
  id: string;
@@ -11143,6 +11133,12 @@ declare class GuildApi extends ApiBase {
11143
11133
  rating_change: number;
11144
11134
  season?: string | undefined;
11145
11135
  }[];
11136
+ seasons?: {
11137
+ id: string;
11138
+ rating: number;
11139
+ wins: number;
11140
+ losses: number;
11141
+ }[] | undefined;
11146
11142
  }[]>;
11147
11143
  /**
11148
11144
  * Returns information about the items in a guild's treasury.
@@ -11858,7 +11854,7 @@ declare class SkillsApi extends ApiBase {
11858
11854
  type: "Weapon" | "Utility" | "Heal" | "Elite" | "Bundle" | "Monster" | "Pet" | "Profession" | "Toolbelt" | "Transform";
11859
11855
  description: string;
11860
11856
  icon: string;
11861
- slot: ("Utility" | "Elite" | "Pet" | `Downed_${number}` | `Profession_${number}` | `Weapon_${number}`) & ("Utility" | "Elite" | "Pet" | `Downed_${number}` | `Profession_${number}` | `Weapon_${number}` | undefined);
11857
+ slot: ("Utility" | "Elite" | `Weapon_${number}` | "Pet" | `Downed_${number}` | `Profession_${number}`) & ("Utility" | "Elite" | `Weapon_${number}` | "Pet" | `Downed_${number}` | `Profession_${number}` | undefined);
11862
11858
  chat_link: string;
11863
11859
  flags: ("NoUnderwater" | "GroundTargeted")[];
11864
11860
  weapon_type: string;
@@ -12423,213 +12419,109 @@ declare class WorldVsWorldApi extends ApiBase {
12423
12419
  }
12424
12420
 
12425
12421
  declare class GW2Api extends ApiBase {
12426
- /**
12427
- * /v2/account Api
12428
- */
12422
+ /** /v2/account Api */
12429
12423
  readonly account: AccountApi;
12430
- /**
12431
- * /v2/achievements Api
12432
- */
12424
+ /** /v2/achievements Api */
12433
12425
  readonly achievements: AchievementsApi;
12434
- /**
12435
- * /v2/backstory Api
12436
- */
12426
+ /** /v2/backstory Api */
12437
12427
  readonly backstory: BackstoryApi;
12438
- /**
12439
- * /v2/build Api
12440
- */
12428
+ /** /v2/build Api */
12441
12429
  readonly build: BuildApi;
12442
- /**
12443
- * /v2/characters Api
12444
- */
12430
+ /** /v2/characters Api */
12445
12431
  readonly characters: CharactersApi;
12446
- /**
12447
- * /v2/colors Api
12448
- */
12432
+ /** /v2/colors Api */
12449
12433
  readonly colors: ColorsApi;
12450
- /**
12451
- * /v2/commerce Api
12452
- */
12434
+ /** /v2/commerce Api */
12453
12435
  readonly commerce: CommerceApi;
12454
- /**
12455
- * /v2/continents Api
12456
- */
12436
+ /** /v2/continents Api */
12457
12437
  readonly continents: ContinentsApi;
12458
- /**
12459
- * /v2/currencies Api
12460
- */
12438
+ /** /v2/currencies Api */
12461
12439
  readonly currencies: CurrenciesApi;
12462
- /**
12463
- * /v2/dailycrafting Api
12464
- */
12440
+ /** /v2/dailycrafting Api */
12465
12441
  readonly dailyCrafting: DailyCraftingApi;
12466
- /**
12467
- * /v2/dungeons Api
12468
- */
12442
+ /** /v2/dungeons Api */
12469
12443
  readonly dungeons: DungeonsApi;
12470
- /**
12471
- * /v2/emblem Api
12472
- */
12444
+ /** /v2/emblem Api */
12473
12445
  readonly emblem: EmblemApi;
12474
- /**
12475
- * /v2/emotes Api
12476
- */
12446
+ /** /v2/emotes Api */
12477
12447
  readonly emotes: EmotesApi;
12478
- /**
12479
- * /v2/files Api
12480
- */
12448
+ /** /v2/files Api */
12481
12449
  readonly files: FilesApi;
12482
- /**
12483
- * /v2/finishers Api
12484
- */
12450
+ /** /v2/finishers Api */
12485
12451
  readonly finishers: FinishersApi;
12486
- /**
12487
- * /v2/gliders Api
12488
- */
12452
+ /** /v2/gliders Api */
12489
12453
  readonly gliders: GlidersApi;
12490
- /**
12491
- * /v2/guild Api
12492
- */
12454
+ /** /v2/guild Api */
12493
12455
  readonly guild: GuildApi;
12494
- /**
12495
- * /v2/home Api
12496
- */
12456
+ /** /v2/home Api */
12497
12457
  readonly home: HomeApi;
12498
- /**
12499
- * /v2/items Api
12500
- */
12458
+ /** /v2/items Api */
12501
12459
  readonly items: ItemsApi;
12502
- /**
12503
- * /v2/itemstats Api
12504
- */
12460
+ /** /v2/itemstats Api */
12505
12461
  readonly itemstats: ItemStatsApi;
12506
- /**
12507
- * /v2/jadebots Api
12508
- */
12462
+ /** /v2/jadebots Api */
12509
12463
  readonly jadebots: JadebotsApi;
12510
- /**
12511
- * /v2/legendaryarmory Api
12512
- */
12464
+ /** /v2/legendaryarmory Api */
12513
12465
  readonly legendaryArmory: LegendaryArmoryApi;
12514
- /**
12515
- * /v2/legends Api
12516
- */
12466
+ /** /v2/legends Api */
12517
12467
  readonly legends: LegendsApi;
12518
- /**
12519
- * /v2/mailcarriers Api
12520
- */
12468
+ /** /v2/mailcarriers Api */
12521
12469
  readonly mailCarriers: MailCarriersApi;
12522
- /**
12523
- * /v2/mapchests Api
12524
- */
12470
+ /** /v2/mapchests Api */
12525
12471
  readonly mapChests: MapChestsApi;
12526
- /**
12527
- * /v2/maps Api
12528
- */
12472
+ /** /v2/maps Api */
12529
12473
  readonly maps: MapsApi;
12530
- /**
12531
- * /v2/masteries Api
12532
- */
12474
+ /** /v2/masteries Api */
12533
12475
  readonly masteries: MasteriesApi;
12534
- /**
12535
- * /v2/materials Api
12536
- */
12476
+ /** /v2/materials Api */
12537
12477
  readonly materials: MaterialsApi;
12538
- /**
12539
- * /v2/minis Api
12540
- */
12478
+ /** /v2/minis Api */
12541
12479
  readonly minis: MinisApi;
12542
- /**
12543
- * /v2/mounts Api
12544
- */
12480
+ /** /v2/mounts Api */
12545
12481
  readonly mounts: MountsApi;
12546
- /**
12547
- * /v2/novelties Api
12548
- */
12482
+ /** /v2/novelties Api */
12549
12483
  readonly novelties: NoveltiesApi;
12550
- /**
12551
- * /v2/outfits Api
12552
- */
12484
+ /** /v2/outfits Api */
12553
12485
  readonly outfits: OutfitsApi;
12554
- /**
12555
- * /v2/pets Api
12556
- */
12486
+ /** /v2/pets Api */
12557
12487
  readonly pets: PetsApi;
12558
- /**
12559
- * /v2/professions Api
12560
- */
12488
+ /** /v2/professions Api */
12561
12489
  readonly professions: ProfessionsApi;
12562
- /**
12563
- * /v2/pvp Api
12564
- */
12490
+ /** /v2/pvp Api */
12565
12491
  readonly pvp: PvPApi;
12566
- /**
12567
- * /v2/quaggans Api
12568
- */
12492
+ /** /v2/quaggans Api */
12569
12493
  readonly quaggans: QuaggansApi;
12570
- /**
12571
- * /v2/quests Api
12572
- */
12494
+ /** /v2/quests Api */
12573
12495
  readonly quests: QuestsApi;
12574
- /**
12575
- * /v2/races Api
12576
- */
12496
+ /** /v2/races Api */
12577
12497
  readonly races: RacesApi;
12578
- /**
12579
- * /v2/raids Api
12580
- */
12498
+ /** /v2/raids Api */
12581
12499
  readonly raids: RaidsApi;
12582
- /**
12583
- * /v2/recipes Api
12584
- */
12500
+ /** /v2/recipes Api */
12585
12501
  readonly recipes: RecipesApi;
12586
- /**
12587
- * /v2/skiffs Api
12588
- */
12502
+ /** /v2/skiffs Api */
12589
12503
  readonly skiffs: SkiffsApi;
12590
- /**
12591
- * /v2/skills Api
12592
- */
12504
+ /** /v2/skills Api */
12593
12505
  readonly skills: SkillsApi;
12594
- /**
12595
- * /v2/skins Api
12596
- */
12506
+ /** /v2/skins Api */
12597
12507
  readonly skins: SkinsApi;
12598
- /**
12599
- * /v2/specializations Api
12600
- */
12508
+ /** /v2/specializations Api */
12601
12509
  readonly specializations: SpecializationsApi;
12602
- /**
12603
- * /v2/stories Api
12604
- */
12510
+ /** /v2/stories Api */
12605
12511
  readonly stories: StoriesApi;
12606
- /**
12607
- * /v2/subtoken Api
12608
- */
12512
+ /** /v2/subtoken Api */
12609
12513
  readonly subtoken: SubtokenApi;
12610
- /**
12611
- * /v2/titles Api
12612
- */
12514
+ /** /v2/titles Api */
12613
12515
  readonly titles: TitlesApi;
12614
- /**
12615
- * /v2/tokeninfo Api
12616
- */
12516
+ /** /v2/tokeninfo Api */
12617
12517
  readonly tokenInfo: TokenInfoApi;
12618
- /**
12619
- * /v2/traits Api
12620
- */
12518
+ /** /v2/traits Api */
12621
12519
  readonly traits: TraitsApi;
12622
- /**
12623
- * /v2/worldbosses Api
12624
- */
12520
+ /** /v2/worldbosses Api */
12625
12521
  readonly worldBosses: WorldBossesApi;
12626
- /**
12627
- * /v2/worlds Api
12628
- */
12522
+ /** /v2/worlds Api */
12629
12523
  readonly worlds: WorldsApi;
12630
- /**
12631
- * /v2/wvw Api
12632
- */
12524
+ /** /v2/wvw Api */
12633
12525
  readonly wvw: WorldVsWorldApi;
12634
12526
  }
12635
12527