@blizzard-api/d3 1.0.5 → 2.0.0

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/README.md CHANGED
@@ -1,75 +1,75 @@
1
- # @blizzard-api/d3
2
-
3
- This package aims to make it easier for you to integrate with the Blizzard Battle.net API, specifically for Diablo 3.
4
-
5
- ## Installation
6
-
7
- ```sh
8
- npm i @blizzard-api/core @blizzard-api/d3
9
- ```
10
-
11
- ## Usage
12
-
13
- You can get paths, namespaces, parameters and more for a specific endpoint by calling it from the `d3` export.
14
-
15
- ```ts
16
- import { d3 } from "@blizzard-api/d3"
17
- //or
18
- import d3 from "@blizzard-api/d3"
19
-
20
- const achievement = d3.achievement(123);
21
- ^ { path: string, namespace?: string, parameters?: Record<string, never> }
22
- ```
23
-
24
- If you don't want to use the exported d3 object, you can also access the functions directly:
25
-
26
- ```ts
27
- import { achievement } from "@blizzard-api/d3"
28
-
29
- const achi = achievement(123);
30
- ^ { path: string, namespace?: string, parameters?: Record<string, never> }
31
- ```
32
-
33
- ### Types
34
-
35
- If you need the response types, they are also exported with "Response" appended, so to get the response type from the above code, you can import it like this:
36
-
37
- ```ts
38
- import type { AchievementResponse } from '@blizzard-api/d3';
39
- ```
40
-
41
- If you simply want to use the existing object, you can use the helper, `ExtractResourceType`, from `@blizzard-api/core` like so:
42
-
43
- ```ts
44
- import { d3 } from "@blizzard-api/d3"
45
-
46
- const achievement = d3.achievement(123);
47
- ^ { path: string, namespace?: string, parameters?: Record<string, never> }
48
-
49
- type AchievementResponse = ExtractResourceType<typeof achievement>;
50
- ```
51
-
52
- ## Notes on Types
53
-
54
- The types are manually created from using the Blizzard API documentation, and are as accurate as possible with smoke testing each endpoint. However, no-one is perfect so there is likely to be some discrepancies. If you encounter any issues with the types from this package, please open an issue or a pull request.
55
-
56
- ### Client
57
-
58
- While this package is made to function on it's own, it performs even better when combined with `@blizzard-api/client` where you can easily request data combining the two libraries.
59
-
60
- ```ts
61
- import { createBlizzardApiClient } from '@blizzard-api/client';
62
- import { d3 } from '@blizzard-api/d3';
63
-
64
- const client = await createBlizzardApiClient({
65
- key: 'environment.blizzardClientId',
66
- secret: 'environment.blizzardClientSecret',
67
- origin: 'eu',
68
- });
69
-
70
- //Response will automatically be typed with the appropriate values
71
- const response = await client.sendRequest(d3.commodities());
72
-
73
- console.log(response);
74
- ^ typeof AuctionHouseCommoditiesResponse
75
- ```
1
+ # @blizzard-api/d3
2
+
3
+ This package aims to make it easier for you to integrate with the Blizzard Battle.net API, specifically for Diablo 3.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm i @blizzard-api/core @blizzard-api/d3
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ You can get paths, namespaces, parameters and more for a specific endpoint by calling it from the `d3` export.
14
+
15
+ ```ts
16
+ import { d3 } from "@blizzard-api/d3"
17
+ //or
18
+ import d3 from "@blizzard-api/d3"
19
+
20
+ const achievement = d3.achievement(123);
21
+ ^ { path: string, namespace?: string, parameters?: Record<string, never> }
22
+ ```
23
+
24
+ If you don't want to use the exported d3 object, you can also access the functions directly:
25
+
26
+ ```ts
27
+ import { achievement } from "@blizzard-api/d3"
28
+
29
+ const achi = achievement(123);
30
+ ^ { path: string, namespace?: string, parameters?: Record<string, never> }
31
+ ```
32
+
33
+ ### Types
34
+
35
+ If you need the response types, they are also exported with "Response" appended, so to get the response type from the above code, you can import it like this:
36
+
37
+ ```ts
38
+ import type { AchievementResponse } from '@blizzard-api/d3';
39
+ ```
40
+
41
+ If you simply want to use the existing object, you can use the helper, `ExtractResourceType`, from `@blizzard-api/core` like so:
42
+
43
+ ```ts
44
+ import { d3 } from "@blizzard-api/d3"
45
+
46
+ const achievement = d3.achievement(123);
47
+ ^ { path: string, namespace?: string, parameters?: Record<string, never> }
48
+
49
+ type AchievementResponse = ExtractResourceType<typeof achievement>;
50
+ ```
51
+
52
+ ## Notes on Types
53
+
54
+ The types are manually created from using the Blizzard API documentation, and are as accurate as possible with smoke testing each endpoint. However, no-one is perfect so there is likely to be some discrepancies. If you encounter any issues with the types from this package, please open an issue or a pull request.
55
+
56
+ ### Client
57
+
58
+ While this package is made to function on it's own, it performs even better when combined with `@blizzard-api/client` where you can easily request data combining the two libraries.
59
+
60
+ ```ts
61
+ import { createBlizzardApiClient } from '@blizzard-api/client';
62
+ import { d3 } from '@blizzard-api/d3';
63
+
64
+ const client = await createBlizzardApiClient({
65
+ key: 'environment.blizzardClientId',
66
+ secret: 'environment.blizzardClientSecret',
67
+ origin: 'eu',
68
+ });
69
+
70
+ //Response will automatically be typed with the appropriate values
71
+ const response = await client.sendRequest(d3.commodities());
72
+
73
+ console.log(response);
74
+ ^ typeof AuctionHouseCommoditiesResponse
75
+ ```
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Resource } from "@blizzard-api/core";
1
+ import { Href, Resource, ResponseBase } from "@blizzard-api/core";
2
2
 
3
3
  //#region src/act/types.d.ts
4
4
  interface ActIndexResponse {
@@ -34,7 +34,6 @@ declare function act(actId: number): Resource<ActResponse>;
34
34
  * @returns The act index resource. See {@link ActIndexResponse}.
35
35
  */
36
36
  declare function actIndex(): Resource<ActIndexResponse>;
37
-
38
37
  //#endregion
39
38
  //#region src/artisan-and-recipe/types.d.ts
40
39
  interface ArtisanResponse {
@@ -78,7 +77,6 @@ interface Tier {
78
77
  interface Training {
79
78
  tiers: Array<Tier>;
80
79
  }
81
-
82
80
  //#endregion
83
81
  //#region src/artisan-and-recipe/artisan-and-recipe.d.ts
84
82
  /**
@@ -94,7 +92,6 @@ declare function artisan(artisanSlug: string): Resource<ArtisanResponse>;
94
92
  * @returns The recipe resource. See {@link RecipeResponse}.
95
93
  */
96
94
  declare function recipe(artisanSlug: string, recipeSlug: string): Resource<RecipeResponse>;
97
-
98
95
  //#endregion
99
96
  //#region src/character-class-and-skill/types.d.ts
100
97
  interface CharacterClassResponse {
@@ -132,7 +129,6 @@ interface SkillCategory {
132
129
  name: string;
133
130
  slug: string;
134
131
  }
135
-
136
132
  //#endregion
137
133
  //#region src/character-class-and-skill/character-class-and-skill.d.ts
138
134
  /**
@@ -148,7 +144,6 @@ declare function characterClass(characterClassSlug: string): Resource<CharacterC
148
144
  * @returns The skill resource. See {@link SkillResponse}.
149
145
  */
150
146
  declare function skill(characterClassSlug: string, skillSlug: string): Resource<SkillResponse>;
151
-
152
147
  //#endregion
153
148
  //#region src/follower/types.d.ts
154
149
  interface FollowerResponse {
@@ -167,7 +162,6 @@ interface Skill$1 {
167
162
  slug: string;
168
163
  tooltipUrl: string;
169
164
  }
170
-
171
165
  //#endregion
172
166
  //#region src/follower/follower.d.ts
173
167
  /**
@@ -176,27 +170,11 @@ interface Skill$1 {
176
170
  * @returns The follower resource. See {@link FollowerResponse}.
177
171
  */
178
172
  declare function follower(followerSlug: string): Resource<FollowerResponse>;
179
-
180
- //#endregion
181
- //#region src/base.d.ts
182
- /**
183
- * Base interface for Blizzard API responses.
184
- */
185
- interface ResponseBase {
186
- _links: {
187
- self: {
188
- href: string;
189
- };
190
- };
191
- }
192
-
193
173
  //#endregion
194
174
  //#region src/game-data/types.d.ts
195
175
  interface EraIndexResponse extends ResponseBase {
196
176
  current_era: number;
197
- era: Array<{
198
- href: string;
199
- }>;
177
+ era: Array<Href>;
200
178
  generated_by: string;
201
179
  last_update_time: string;
202
180
  }
@@ -222,9 +200,7 @@ interface SeasonIndexResponse extends ResponseBase {
222
200
  current_season: number;
223
201
  generated_by: string;
224
202
  last_update_time: string;
225
- season: Array<{
226
- href: string;
227
- }>;
203
+ season: Array<Href>;
228
204
  service_current_season: number;
229
205
  service_season_state: string;
230
206
  }
@@ -260,9 +236,7 @@ interface EraLeaderboard {
260
236
  interface Leaderboard {
261
237
  hardcore?: boolean;
262
238
  hero_class_string?: string;
263
- ladder: {
264
- href: string;
265
- };
239
+ ladder: Href;
266
240
  team_size?: number;
267
241
  }
268
242
  type LeaderboardId = 'AchievementPoints' | 'BattleTag' | 'ClanName' | 'CompletedTime' | 'GameAccount' | 'HeroBattleTag' | 'HeroClanTag' | 'HeroClass' | 'HeroGender' | 'HeroId' | 'HeroLevel' | 'HeroVisualItems' | 'ParagonLevel' | 'Rank' | 'RiftLevel' | 'RiftTime';
@@ -285,7 +259,6 @@ interface RowData {
285
259
  interface Self {
286
260
  href: string;
287
261
  }
288
-
289
262
  //#endregion
290
263
  //#region src/game-data/game-data.d.ts
291
264
  /**
@@ -324,7 +297,6 @@ declare function seasonIndex(): Resource<SeasonIndexResponse>;
324
297
  * @returns The season leaderboard resource. See {@link SeasonLeaderboardResponse}.
325
298
  */
326
299
  declare function seasonLeaderboard(id: number, leaderboard: string): Resource<SeasonLeaderboardResponse>;
327
-
328
300
  //#endregion
329
301
  //#region src/item-type/types.d.ts
330
302
  interface ItemTypeIndexResponse {
@@ -339,7 +311,6 @@ interface ItemTypeResponse {
339
311
  path: string;
340
312
  slug: string;
341
313
  }
342
-
343
314
  //#endregion
344
315
  //#region src/item-type/item-type.d.ts
345
316
  /**
@@ -353,7 +324,6 @@ declare function itemType(itemTypeSlug: string): Resource<Array<ItemTypeResponse
353
324
  * @returns The item type index resource. See {@link ItemTypeIndexResponse}.
354
325
  */
355
326
  declare function itemTypeIndex(): Resource<Array<ItemTypeIndexResponse>>;
356
-
357
327
  //#endregion
358
328
  //#region src/item/types.d.ts
359
329
  interface Attributes {
@@ -396,7 +366,6 @@ interface Type {
396
366
  id: string;
397
367
  twoHanded: boolean;
398
368
  }
399
-
400
369
  //#endregion
401
370
  //#region src/item/item.d.ts
402
371
  /**
@@ -405,7 +374,6 @@ interface Type {
405
374
  * @returns The item resource. See {@link ItemResponse}.
406
375
  */
407
376
  declare function item(itemSlugAndId: string): Resource<ItemResponse>;
408
-
409
377
  //#endregion
410
378
  //#region src/profile/types.d.ts
411
379
  interface AccountHeroFollowerItemsResponse {
@@ -618,7 +586,7 @@ interface HeroProgression {
618
586
  }
619
587
  interface Item {
620
588
  displayColor?: DisplayColor;
621
- dyeColor?: Item;
589
+ dyeColor?: Dye;
622
590
  icon: string;
623
591
  id: string;
624
592
  name: string;
@@ -720,7 +688,6 @@ interface TimePlayed {
720
688
  'witch-doctor': number;
721
689
  wizard: number;
722
690
  }
723
-
724
691
  //#endregion
725
692
  //#region src/profile/profile.d.ts
726
693
  /**
@@ -750,7 +717,6 @@ declare function accountHeroFollowerItems(battleTag: string, heroId: number): Re
750
717
  * @returns The hero items resource. See {@link AccountHeroResponse}.
751
718
  */
752
719
  declare function accountHeroItems(battleTag: string, heroId: number): Resource<AccountHeroResponse>;
753
-
754
720
  //#endregion
755
721
  //#region src/index.d.ts
756
722
  declare const d3: {
@@ -775,7 +741,6 @@ declare const d3: {
775
741
  seasonIndex: typeof seasonIndex;
776
742
  seasonLeaderboard: typeof seasonLeaderboard;
777
743
  };
778
-
779
744
  //#endregion
780
745
  export { AccountHeroFollowerItemsResponse, AccountHeroItemsResponse, AccountHeroResponse, AccountResponse, ActIndexResponse, ActResponse, ArtisanResponse, Attributes, CharacterClassResponse, EraIndexResponse, EraLeaderboardResponse, EraResponse, FollowerResponse, ItemResponse, ItemTypeIndexResponse, ItemTypeResponse, Primary, RandomAffix, RecipeResponse, SeasonIndexResponse, SeasonLeaderboardResponse, SeasonResponse, SkillResponse, Type, account, accountHero, accountHeroFollowerItems, accountHeroItems, act, actIndex, artisan, characterClass, d3, d3 as default, era, eraIndex, eraLeaderboard, follower, item, itemType, itemTypeIndex, recipe, season, seasonIndex, seasonLeaderboard, skill };
781
746
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,276 +1,189 @@
1
- //#region src/base.ts
2
- const base = "d3/data";
3
- const profileBase = `d3/profile`;
4
- const gameDataBase = `data/d3`;
1
+ import { d3BasePath, d3GameDataBasePath, d3ProfileBasePath } from "@blizzard-api/core";
5
2
 
6
- //#endregion
7
3
  //#region src/act/act.ts
8
4
  /**
9
-
10
5
  * Returns the act information for the specified act ID.
11
-
12
6
  * @param actId The ID of the act.
13
-
14
7
  * @returns The act resource. See {@link ActResponse}.
15
-
16
8
  */
17
9
  function act(actId) {
18
- return { path: `${base}/act/${actId}` };
10
+ return { path: `${d3BasePath}/act/${actId}` };
19
11
  }
20
12
  /**
21
-
22
13
  * Returns the index of acts.
23
-
24
14
  * @returns The act index resource. See {@link ActIndexResponse}.
25
-
26
15
  */
27
16
  function actIndex() {
28
- return { path: `${base}/act` };
17
+ return { path: `${d3BasePath}/act` };
29
18
  }
30
19
 
31
20
  //#endregion
32
21
  //#region src/artisan-and-recipe/artisan-and-recipe.ts
33
22
  /**
34
-
35
23
  * Returns the artisan information for the specified artisan slug.
36
-
37
24
  * @param artisanSlug The slug of the artisan.
38
-
39
25
  * @returns The artisan resource. See {@link ArtisanResponse}.
40
-
41
26
  */
42
27
  function artisan(artisanSlug) {
43
- return { path: `${base}/artisan/${artisanSlug}` };
28
+ return { path: `${d3BasePath}/artisan/${artisanSlug}` };
44
29
  }
45
30
  /**
46
-
47
31
  * Returns the recipe information for the specified artisan and recipe slugs.
48
-
49
32
  * @param artisanSlug The slug of the artisan.
50
-
51
33
  * @param recipeSlug The slug of the recipe.
52
-
53
34
  * @returns The recipe resource. See {@link RecipeResponse}.
54
-
55
35
  */
56
36
  function recipe(artisanSlug, recipeSlug) {
57
- return { path: `${base}/artisan/${artisanSlug}/recipe/${recipeSlug}` };
37
+ return { path: `${d3BasePath}/artisan/${artisanSlug}/recipe/${recipeSlug}` };
58
38
  }
59
39
 
60
40
  //#endregion
61
41
  //#region src/character-class-and-skill/character-class-and-skill.ts
62
42
  /**
63
-
64
43
  * Returns the character class information for the specified character class slug.
65
-
66
44
  * @param characterClassSlug The slug of the character class.
67
-
68
45
  * @returns The character class resource. See {@link CharacterClassResponse}.
69
-
70
46
  */
71
47
  function characterClass(characterClassSlug) {
72
- return { path: `${base}/character-class/${characterClassSlug}` };
48
+ return { path: `${d3BasePath}/character-class/${characterClassSlug}` };
73
49
  }
74
50
  /**
75
-
76
51
  * Returns the skill information for the specified character class and skill slugs.
77
-
78
52
  * @param characterClassSlug The slug of the character class.
79
-
80
53
  * @param skillSlug The slug of the skill.
81
-
82
54
  * @returns The skill resource. See {@link SkillResponse}.
83
-
84
55
  */
85
56
  function skill(characterClassSlug, skillSlug) {
86
- return { path: `${base}/hero/${characterClassSlug}/skill/${skillSlug}` };
57
+ return { path: `${d3BasePath}/hero/${characterClassSlug}/skill/${skillSlug}` };
87
58
  }
88
59
 
89
60
  //#endregion
90
61
  //#region src/follower/follower.ts
91
62
  /**
92
-
93
63
  * Returns the follower information for the specified follower slug.
94
-
95
64
  * @param followerSlug The slug of the follower.
96
-
97
65
  * @returns The follower resource. See {@link FollowerResponse}.
98
-
99
66
  */
100
67
  function follower(followerSlug) {
101
- return { path: `${base}/follower/${followerSlug}` };
68
+ return { path: `${d3BasePath}/follower/${followerSlug}` };
102
69
  }
103
70
 
104
71
  //#endregion
105
72
  //#region src/game-data/game-data.ts
106
73
  /**
107
-
108
74
  * Returns the era information for the specified era ID.
109
-
110
75
  * @param id The ID of the era.
111
-
112
76
  * @returns The era resource. See {@link EraResponse}.
113
-
114
77
  */
115
78
  function era(id) {
116
- return { path: `${gameDataBase}/era/${id}` };
79
+ return { path: `${d3GameDataBasePath}/era/${id}` };
117
80
  }
118
81
  /**
119
-
120
82
  * Returns the era index.
121
-
122
83
  * @returns The era index resource. See {@link EraIndexResponse}.
123
-
124
84
  */
125
85
  function eraIndex() {
126
- return { path: `${gameDataBase}/era` };
86
+ return { path: `${d3GameDataBasePath}/era` };
127
87
  }
128
88
  /**
129
-
130
89
  * Returns the era leaderboard for the specified era ID and leaderboard.
131
-
132
90
  * @param id The ID of the era.
133
-
134
91
  * @param leaderboard The name of the leaderboard.
135
-
136
92
  * @returns The era leaderboard resource. See {@link EraLeaderboardResponse}.
137
-
138
93
  */
139
94
  function eraLeaderboard(id, leaderboard) {
140
- return { path: `${gameDataBase}/era/${id}/leaderboard/${leaderboard}` };
95
+ return { path: `${d3GameDataBasePath}/era/${id}/leaderboard/${leaderboard}` };
141
96
  }
142
97
  /**
143
-
144
98
  * Returns the season information for the specified season ID.
145
-
146
99
  * @param id The ID of the season.
147
-
148
100
  * @returns The season resource. See {@link SeasonResponse}.
149
-
150
101
  */
151
102
  function season(id) {
152
- return { path: `${gameDataBase}/season/${id}` };
103
+ return { path: `${d3GameDataBasePath}/season/${id}` };
153
104
  }
154
105
  /**
155
-
156
106
  * Returns the season index.
157
-
158
107
  * @returns The season index resource. See {@link SeasonIndexResponse}.
159
-
160
108
  */
161
109
  function seasonIndex() {
162
- return { path: `${gameDataBase}/season` };
110
+ return { path: `${d3GameDataBasePath}/season` };
163
111
  }
164
112
  /**
165
-
166
113
  * Returns the season leaderboard for the specified season ID and leaderboard.
167
-
168
114
  * @param id The ID of the season.
169
-
170
115
  * @param leaderboard The name of the leaderboard.
171
-
172
116
  * @returns The season leaderboard resource. See {@link SeasonLeaderboardResponse}.
173
-
174
117
  */
175
118
  function seasonLeaderboard(id, leaderboard) {
176
- return { path: `${gameDataBase}/season/${id}/leaderboard/${leaderboard}` };
119
+ return { path: `${d3GameDataBasePath}/season/${id}/leaderboard/${leaderboard}` };
177
120
  }
178
121
 
179
122
  //#endregion
180
123
  //#region src/item-type/item-type.ts
181
124
  /**
182
-
183
125
  * Returns the item type information for the specified item type slug.
184
-
185
126
  * @param itemTypeSlug The slug of the item type, example: "sword2h"
186
-
187
127
  * @returns The item type resource. See {@link ItemTypeResponse}.
188
-
189
128
  */
190
129
  function itemType(itemTypeSlug) {
191
- return { path: `${base}/item-type/${itemTypeSlug}` };
130
+ return { path: `${d3BasePath}/item-type/${itemTypeSlug}` };
192
131
  }
193
132
  /**
194
-
195
133
  * Returns the item type index.
196
-
197
134
  * @returns The item type index resource. See {@link ItemTypeIndexResponse}.
198
-
199
135
  */
200
136
  function itemTypeIndex() {
201
- return { path: `${base}/item-type` };
137
+ return { path: `${d3BasePath}/item-type` };
202
138
  }
203
139
 
204
140
  //#endregion
205
141
  //#region src/item/item.ts
206
142
  /**
207
-
208
143
  * Returns the item information for the specified item slug and ID.
209
-
210
144
  * @param itemSlugAndId The slug and ID of the item, example: "corrupted-ashbringer-Unique_Sword_2H_104_x1".
211
-
212
145
  * @returns The item resource. See {@link ItemResponse}.
213
-
214
146
  */
215
147
  function item(itemSlugAndId) {
216
- return { path: `${base}/item/${itemSlugAndId}` };
148
+ return { path: `${d3BasePath}/item/${itemSlugAndId}` };
217
149
  }
218
150
 
219
151
  //#endregion
220
152
  //#region src/profile/profile.ts
221
153
  /**
222
-
223
154
  * Returns the account information for the specified battle tag.
224
-
225
155
  * @param battleTag The battle tag of the account.
226
-
227
156
  * @returns The account resource. See {@link AccountResponse}.
228
-
229
157
  */
230
158
  function account(battleTag) {
231
- return { path: `${profileBase}/${battleTag}` };
159
+ return { path: `${d3ProfileBasePath}/${encodeURIComponent(battleTag)}` };
232
160
  }
233
161
  /**
234
-
235
162
  * Returns the hero information for the specified battle tag and hero ID.
236
-
237
163
  * @param battleTag The battle tag of the account.
238
-
239
164
  * @param heroId The ID of the hero.
240
-
241
165
  * @returns The hero resource. See {@link AccountHeroResponse}.
242
-
243
166
  */
244
167
  function accountHero(battleTag, heroId) {
245
- return { path: `${profileBase}/${battleTag}/hero/${heroId}` };
168
+ return { path: `${d3ProfileBasePath}/${encodeURIComponent(battleTag)}/hero/${heroId}` };
246
169
  }
247
170
  /**
248
-
249
171
  * Returns the follower items for the specified battle tag and hero ID.
250
-
251
172
  * @param battleTag The battle tag of the account.
252
-
253
173
  * @param heroId The ID of the hero.
254
-
255
174
  * @returns The follower items resource. See {@link AccountHeroFollowerItemsResponse}.
256
-
257
175
  */
258
176
  function accountHeroFollowerItems(battleTag, heroId) {
259
- return { path: `${profileBase}/${battleTag}/hero/${heroId}/follower-items` };
177
+ return { path: `${d3ProfileBasePath}/${encodeURIComponent(battleTag)}/hero/${heroId}/follower-items` };
260
178
  }
261
179
  /**
262
-
263
180
  * Returns the items for the specified battle tag and hero ID.
264
-
265
181
  * @param battleTag The battle tag of the account.
266
-
267
182
  * @param heroId The ID of the hero.
268
-
269
183
  * @returns The hero items resource. See {@link AccountHeroResponse}.
270
-
271
184
  */
272
185
  function accountHeroItems(battleTag, heroId) {
273
- return { path: `${profileBase}/${battleTag}/hero/${heroId}/items` };
186
+ return { path: `${d3ProfileBasePath}/${encodeURIComponent(battleTag)}/hero/${heroId}/items` };
274
187
  }
275
188
 
276
189
  //#endregion
@@ -297,8 +210,7 @@ const d3 = {
297
210
  seasonIndex,
298
211
  seasonLeaderboard
299
212
  };
300
- var src_default = d3;
301
213
 
302
214
  //#endregion
303
- export { account, accountHero, accountHeroFollowerItems, accountHeroItems, act, actIndex, artisan, characterClass, d3, src_default as default, era, eraIndex, eraLeaderboard, follower, item, itemType, itemTypeIndex, recipe, season, seasonIndex, seasonLeaderboard, skill };
215
+ export { account, accountHero, accountHeroFollowerItems, accountHeroItems, act, actIndex, artisan, characterClass, d3, d3 as default, era, eraIndex, eraLeaderboard, follower, item, itemType, itemTypeIndex, recipe, season, seasonIndex, seasonLeaderboard, skill };
304
216
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["actId: number","artisanSlug: string","recipeSlug: string","characterClassSlug: string","skillSlug: string","followerSlug: string","id: number","leaderboard: string","itemTypeSlug: string","itemSlugAndId: string","battleTag: string","heroId: number"],"sources":["../src/base.ts","../src/act/act.ts","../src/artisan-and-recipe/artisan-and-recipe.ts","../src/character-class-and-skill/character-class-and-skill.ts","../src/follower/follower.ts","../src/game-data/game-data.ts","../src/item-type/item-type.ts","../src/item/item.ts","../src/profile/profile.ts","../src/index.ts"],"sourcesContent":["export const base = 'd3/data';\r\n\r\nexport const profileBase = `d3/profile`;\r\n\r\n//Why is the game data APIs base root the reverse of the regular base?\r\nexport const gameDataBase = `data/d3`;\r\n\r\n/**\r\n * Base interface for Blizzard API responses.\r\n */\r\nexport interface ResponseBase {\r\n _links: {\r\n self: {\r\n href: string;\r\n };\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { ActIndexResponse, ActResponse } from './types';\r\n\r\n/**\r\n * Returns the act information for the specified act ID.\r\n * @param actId The ID of the act.\r\n * @returns The act resource. See {@link ActResponse}.\r\n */\r\nexport function act(actId: number): Resource<ActResponse> {\r\n return {\r\n path: `${base}/act/${actId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the index of acts.\r\n * @returns The act index resource. See {@link ActIndexResponse}.\r\n */\r\nexport function actIndex(): Resource<ActIndexResponse> {\r\n return {\r\n path: `${base}/act`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { ArtisanResponse, RecipeResponse } from './types';\r\n\r\n/**\r\n * Returns the artisan information for the specified artisan slug.\r\n * @param artisanSlug The slug of the artisan.\r\n * @returns The artisan resource. See {@link ArtisanResponse}.\r\n */\r\nexport function artisan(artisanSlug: string): Resource<ArtisanResponse> {\r\n return {\r\n path: `${base}/artisan/${artisanSlug}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the recipe information for the specified artisan and recipe slugs.\r\n * @param artisanSlug The slug of the artisan.\r\n * @param recipeSlug The slug of the recipe.\r\n * @returns The recipe resource. See {@link RecipeResponse}.\r\n */\r\nexport function recipe(artisanSlug: string, recipeSlug: string): Resource<RecipeResponse> {\r\n return {\r\n path: `${base}/artisan/${artisanSlug}/recipe/${recipeSlug}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { CharacterClassResponse, SkillResponse } from './types';\r\n\r\n/**\r\n * Returns the character class information for the specified character class slug.\r\n * @param characterClassSlug The slug of the character class.\r\n * @returns The character class resource. See {@link CharacterClassResponse}.\r\n */\r\nexport function characterClass(characterClassSlug: string): Resource<CharacterClassResponse> {\r\n return {\r\n path: `${base}/character-class/${characterClassSlug}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the skill information for the specified character class and skill slugs.\r\n * @param characterClassSlug The slug of the character class.\r\n * @param skillSlug The slug of the skill.\r\n * @returns The skill resource. See {@link SkillResponse}.\r\n */\r\nexport function skill(characterClassSlug: string, skillSlug: string): Resource<SkillResponse> {\r\n return {\r\n path: `${base}/hero/${characterClassSlug}/skill/${skillSlug}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { FollowerResponse } from './types';\r\n\r\n/**\r\n * Returns the follower information for the specified follower slug.\r\n * @param followerSlug The slug of the follower.\r\n * @returns The follower resource. See {@link FollowerResponse}.\r\n */\r\nexport function follower(followerSlug: string): Resource<FollowerResponse> {\r\n return {\r\n path: `${base}/follower/${followerSlug}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { gameDataBase } from '../base';\r\nimport type {\r\n EraIndexResponse,\r\n EraLeaderboardResponse,\r\n EraResponse,\r\n SeasonIndexResponse,\r\n SeasonLeaderboardResponse,\r\n SeasonResponse,\r\n} from './types';\r\n\r\n/**\r\n * Returns the era information for the specified era ID.\r\n * @param id The ID of the era.\r\n * @returns The era resource. See {@link EraResponse}.\r\n */\r\nexport function era(id: number): Resource<EraResponse> {\r\n return {\r\n path: `${gameDataBase}/era/${id}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the era index.\r\n * @returns The era index resource. See {@link EraIndexResponse}.\r\n */\r\nexport function eraIndex(): Resource<EraIndexResponse> {\r\n return {\r\n path: `${gameDataBase}/era`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the era leaderboard for the specified era ID and leaderboard.\r\n * @param id The ID of the era.\r\n * @param leaderboard The name of the leaderboard.\r\n * @returns The era leaderboard resource. See {@link EraLeaderboardResponse}.\r\n */\r\nexport function eraLeaderboard(id: number, leaderboard: string): Resource<EraLeaderboardResponse> {\r\n return {\r\n path: `${gameDataBase}/era/${id}/leaderboard/${leaderboard}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the season information for the specified season ID.\r\n * @param id The ID of the season.\r\n * @returns The season resource. See {@link SeasonResponse}.\r\n */\r\nexport function season(id: number): Resource<SeasonResponse> {\r\n return {\r\n path: `${gameDataBase}/season/${id}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the season index.\r\n * @returns The season index resource. See {@link SeasonIndexResponse}.\r\n */\r\nexport function seasonIndex(): Resource<SeasonIndexResponse> {\r\n return {\r\n path: `${gameDataBase}/season`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the season leaderboard for the specified season ID and leaderboard.\r\n * @param id The ID of the season.\r\n * @param leaderboard The name of the leaderboard.\r\n * @returns The season leaderboard resource. See {@link SeasonLeaderboardResponse}.\r\n */\r\nexport function seasonLeaderboard(id: number, leaderboard: string): Resource<SeasonLeaderboardResponse> {\r\n return {\r\n path: `${gameDataBase}/season/${id}/leaderboard/${leaderboard}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { ItemTypeIndexResponse, ItemTypeResponse } from './types';\r\n\r\n/**\r\n * Returns the item type information for the specified item type slug.\r\n * @param itemTypeSlug The slug of the item type, example: \"sword2h\"\r\n * @returns The item type resource. See {@link ItemTypeResponse}.\r\n */\r\nexport function itemType(itemTypeSlug: string): Resource<Array<ItemTypeResponse>> {\r\n return {\r\n path: `${base}/item-type/${itemTypeSlug}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the item type index.\r\n * @returns The item type index resource. See {@link ItemTypeIndexResponse}.\r\n */\r\nexport function itemTypeIndex(): Resource<Array<ItemTypeIndexResponse>> {\r\n return {\r\n path: `${base}/item-type`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { ItemResponse } from './types';\r\n\r\n/**\r\n * Returns the item information for the specified item slug and ID.\r\n * @param itemSlugAndId The slug and ID of the item, example: \"corrupted-ashbringer-Unique_Sword_2H_104_x1\".\r\n * @returns The item resource. See {@link ItemResponse}.\r\n */\r\nexport function item(itemSlugAndId: string): Resource<ItemResponse> {\r\n return {\r\n path: `${base}/item/${itemSlugAndId}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { profileBase } from '../base';\r\nimport type { AccountHeroFollowerItemsResponse, AccountHeroResponse, AccountResponse } from './types';\r\n\r\n/**\r\n * Returns the account information for the specified battle tag.\r\n * @param battleTag The battle tag of the account.\r\n * @returns The account resource. See {@link AccountResponse}.\r\n */\r\nexport function account(battleTag: string): Resource<AccountResponse> {\r\n return {\r\n path: `${profileBase}/${battleTag}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the hero information for the specified battle tag and hero ID.\r\n * @param battleTag The battle tag of the account.\r\n * @param heroId The ID of the hero.\r\n * @returns The hero resource. See {@link AccountHeroResponse}.\r\n */\r\nexport function accountHero(battleTag: string, heroId: number): Resource<AccountHeroResponse> {\r\n return {\r\n path: `${profileBase}/${battleTag}/hero/${heroId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the follower items for the specified battle tag and hero ID.\r\n * @param battleTag The battle tag of the account.\r\n * @param heroId The ID of the hero.\r\n * @returns The follower items resource. See {@link AccountHeroFollowerItemsResponse}.\r\n */\r\nexport function accountHeroFollowerItems(\r\n battleTag: string,\r\n heroId: number,\r\n): Resource<AccountHeroFollowerItemsResponse> {\r\n return {\r\n path: `${profileBase}/${battleTag}/hero/${heroId}/follower-items`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the items for the specified battle tag and hero ID.\r\n * @param battleTag The battle tag of the account.\r\n * @param heroId The ID of the hero.\r\n * @returns The hero items resource. See {@link AccountHeroResponse}.\r\n */\r\nexport function accountHeroItems(battleTag: string, heroId: number): Resource<AccountHeroResponse> {\r\n return {\r\n path: `${profileBase}/${battleTag}/hero/${heroId}/items`,\r\n };\r\n}\r\n","import { act, actIndex } from './act/act';\r\nimport { artisan, recipe } from './artisan-and-recipe/artisan-and-recipe';\r\nimport { characterClass, skill } from './character-class-and-skill/character-class-and-skill';\r\nimport { follower } from './follower/follower';\r\nimport { era, eraIndex, eraLeaderboard, season, seasonIndex, seasonLeaderboard } from './game-data/game-data';\r\nimport { itemType, itemTypeIndex } from './item-type/item-type';\r\nimport { item } from './item/item';\r\nimport { account, accountHero, accountHeroFollowerItems, accountHeroItems } from './profile/profile';\r\n\r\nconst d3 = {\r\n //Act\r\n act,\r\n actIndex,\r\n //Artisan and Recipe\r\n artisan,\r\n recipe,\r\n //Follower\r\n follower,\r\n //Character Class and Skill\r\n characterClass,\r\n skill,\r\n //Item Type\r\n itemType,\r\n itemTypeIndex,\r\n //Item\r\n item,\r\n //Profile\r\n account,\r\n accountHero,\r\n accountHeroFollowerItems,\r\n accountHeroItems,\r\n //Game Data\r\n era,\r\n eraIndex,\r\n eraLeaderboard,\r\n season,\r\n seasonIndex,\r\n seasonLeaderboard,\r\n};\r\nexport default d3;\r\nexport { d3 };\r\n\r\n//Act\r\nexport * from './act/act';\r\nexport type * from './act/types';\r\n//Artisan and Recipe\r\nexport * from './artisan-and-recipe/artisan-and-recipe';\r\nexport type * from './artisan-and-recipe/types';\r\n//Character Class and Skill\r\nexport * from './character-class-and-skill/character-class-and-skill';\r\nexport type * from './character-class-and-skill/types';\r\n//Follower\r\nexport * from './follower/follower';\r\nexport type * from './follower/types';\r\n//Game Data\r\nexport * from './game-data/game-data';\r\nexport type * from './game-data/types';\r\n//Item\r\nexport * from './item/item';\r\nexport type * from './item/types';\r\n//Item Type\r\nexport * from './item-type/item-type';\r\nexport type * from './item-type/types';\r\n//Profile\r\nexport * from './profile/profile';\r\nexport type * from './profile/types';\r\n"],"mappings":";AAAA,MAAa,OAAO;AAEpB,MAAa,eAAe;AAG5B,MAAa,gBAAgB;;;;;;;;;;;;;ACI7B,SAAgB,IAAIA,OAAsC;AACxD,QAAO,EACL,OAAO,EAAE,KAAK,OAAO,MAAM,EAC5B;AACF;;;;;;;;AAMD,SAAgB,WAAuC;AACrD,QAAO,EACL,OAAO,EAAE,KAAK,MACf;AACF;;;;;;;;;;;;;ACdD,SAAgB,QAAQC,aAAgD;AACtE,QAAO,EACL,OAAO,EAAE,KAAK,WAAW,YAAY,EACtC;AACF;;;;;;;;;;;;AAQD,SAAgB,OAAOA,aAAqBC,YAA8C;AACxF,QAAO,EACL,OAAO,EAAE,KAAK,WAAW,YAAY,UAAU,WAAW,EAC3D;AACF;;;;;;;;;;;;;AChBD,SAAgB,eAAeC,oBAA8D;AAC3F,QAAO,EACL,OAAO,EAAE,KAAK,mBAAmB,mBAAmB,EACrD;AACF;;;;;;;;;;;;AAQD,SAAgB,MAAMA,oBAA4BC,WAA4C;AAC5F,QAAO,EACL,OAAO,EAAE,KAAK,QAAQ,mBAAmB,SAAS,UAAU,EAC7D;AACF;;;;;;;;;;;;;AChBD,SAAgB,SAASC,cAAkD;AACzE,QAAO,EACL,OAAO,EAAE,KAAK,YAAY,aAAa,EACxC;AACF;;;;;;;;;;;;;ACGD,SAAgB,IAAIC,IAAmC;AACrD,QAAO,EACL,OAAO,EAAE,aAAa,OAAO,GAAG,EACjC;AACF;;;;;;;;AAMD,SAAgB,WAAuC;AACrD,QAAO,EACL,OAAO,EAAE,aAAa,MACvB;AACF;;;;;;;;;;;;AAQD,SAAgB,eAAeA,IAAYC,aAAuD;AAChG,QAAO,EACL,OAAO,EAAE,aAAa,OAAO,GAAG,eAAe,YAAY,EAC5D;AACF;;;;;;;;;;AAOD,SAAgB,OAAOD,IAAsC;AAC3D,QAAO,EACL,OAAO,EAAE,aAAa,UAAU,GAAG,EACpC;AACF;;;;;;;;AAMD,SAAgB,cAA6C;AAC3D,QAAO,EACL,OAAO,EAAE,aAAa,SACvB;AACF;;;;;;;;;;;;AAQD,SAAgB,kBAAkBA,IAAYC,aAA0D;AACtG,QAAO,EACL,OAAO,EAAE,aAAa,UAAU,GAAG,eAAe,YAAY,EAC/D;AACF;;;;;;;;;;;;;AClED,SAAgB,SAASC,cAAyD;AAChF,QAAO,EACL,OAAO,EAAE,KAAK,aAAa,aAAa,EACzC;AACF;;;;;;;;AAMD,SAAgB,gBAAwD;AACtE,QAAO,EACL,OAAO,EAAE,KAAK,YACf;AACF;;;;;;;;;;;;;ACdD,SAAgB,KAAKC,eAA+C;AAClE,QAAO,EACL,OAAO,EAAE,KAAK,QAAQ,cAAc,EACrC;AACF;;;;;;;;;;;;;ACJD,SAAgB,QAAQC,WAA8C;AACpE,QAAO,EACL,OAAO,EAAE,YAAY,GAAG,UAAU,EACnC;AACF;;;;;;;;;;;;AAQD,SAAgB,YAAYA,WAAmBC,QAA+C;AAC5F,QAAO,EACL,OAAO,EAAE,YAAY,GAAG,UAAU,QAAQ,OAAO,EAClD;AACF;;;;;;;;;;;;AAQD,SAAgB,yBACdD,WACAC,QAC4C;AAC5C,QAAO,EACL,OAAO,EAAE,YAAY,GAAG,UAAU,QAAQ,OAAO,iBAClD;AACF;;;;;;;;;;;;AAQD,SAAgB,iBAAiBD,WAAmBC,QAA+C;AACjG,QAAO,EACL,OAAO,EAAE,YAAY,GAAG,UAAU,QAAQ,OAAO,QAClD;AACF;;;;AC3CD,MAAM,KAAK;CAET;CACA;CAEA;CACA;CAEA;CAEA;CACA;CAEA;CACA;CAEA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;AACD;AACD,kBAAe"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/act/act.ts","../src/artisan-and-recipe/artisan-and-recipe.ts","../src/character-class-and-skill/character-class-and-skill.ts","../src/follower/follower.ts","../src/game-data/game-data.ts","../src/item-type/item-type.ts","../src/item/item.ts","../src/profile/profile.ts","../src/index.ts"],"sourcesContent":["import type { Resource } from '@blizzard-api/core';\r\nimport { d3BasePath } from '@blizzard-api/core';\r\nimport type { ActIndexResponse, ActResponse } from './types';\r\n\r\n/**\r\n * Returns the act information for the specified act ID.\r\n * @param actId The ID of the act.\r\n * @returns The act resource. See {@link ActResponse}.\r\n */\r\nexport function act(actId: number): Resource<ActResponse> {\r\n return {\r\n path: `${d3BasePath}/act/${actId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the index of acts.\r\n * @returns The act index resource. See {@link ActIndexResponse}.\r\n */\r\nexport function actIndex(): Resource<ActIndexResponse> {\r\n return {\r\n path: `${d3BasePath}/act`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { d3BasePath } from '@blizzard-api/core';\r\nimport type { ArtisanResponse, RecipeResponse } from './types';\r\n\r\n/**\r\n * Returns the artisan information for the specified artisan slug.\r\n * @param artisanSlug The slug of the artisan.\r\n * @returns The artisan resource. See {@link ArtisanResponse}.\r\n */\r\nexport function artisan(artisanSlug: string): Resource<ArtisanResponse> {\r\n return {\r\n path: `${d3BasePath}/artisan/${artisanSlug}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the recipe information for the specified artisan and recipe slugs.\r\n * @param artisanSlug The slug of the artisan.\r\n * @param recipeSlug The slug of the recipe.\r\n * @returns The recipe resource. See {@link RecipeResponse}.\r\n */\r\nexport function recipe(artisanSlug: string, recipeSlug: string): Resource<RecipeResponse> {\r\n return {\r\n path: `${d3BasePath}/artisan/${artisanSlug}/recipe/${recipeSlug}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { d3BasePath } from '@blizzard-api/core';\r\nimport type { CharacterClassResponse, SkillResponse } from './types';\r\n\r\n/**\r\n * Returns the character class information for the specified character class slug.\r\n * @param characterClassSlug The slug of the character class.\r\n * @returns The character class resource. See {@link CharacterClassResponse}.\r\n */\r\nexport function characterClass(characterClassSlug: string): Resource<CharacterClassResponse> {\r\n return {\r\n path: `${d3BasePath}/character-class/${characterClassSlug}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the skill information for the specified character class and skill slugs.\r\n * @param characterClassSlug The slug of the character class.\r\n * @param skillSlug The slug of the skill.\r\n * @returns The skill resource. See {@link SkillResponse}.\r\n */\r\nexport function skill(characterClassSlug: string, skillSlug: string): Resource<SkillResponse> {\r\n return {\r\n path: `${d3BasePath}/hero/${characterClassSlug}/skill/${skillSlug}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { d3BasePath } from '@blizzard-api/core';\r\nimport type { FollowerResponse } from './types';\r\n\r\n/**\r\n * Returns the follower information for the specified follower slug.\r\n * @param followerSlug The slug of the follower.\r\n * @returns The follower resource. See {@link FollowerResponse}.\r\n */\r\nexport function follower(followerSlug: string): Resource<FollowerResponse> {\r\n return {\r\n path: `${d3BasePath}/follower/${followerSlug}`,\r\n };\r\n}\r\n","import { d3GameDataBasePath } from '@blizzard-api/core';\r\nimport type { Resource } from '@blizzard-api/core';\r\nimport type {\r\n EraIndexResponse,\r\n EraLeaderboardResponse,\r\n EraResponse,\r\n SeasonIndexResponse,\r\n SeasonLeaderboardResponse,\r\n SeasonResponse,\r\n} from './types';\r\n\r\n/**\r\n * Returns the era information for the specified era ID.\r\n * @param id The ID of the era.\r\n * @returns The era resource. See {@link EraResponse}.\r\n */\r\nexport function era(id: number): Resource<EraResponse> {\r\n return {\r\n path: `${d3GameDataBasePath}/era/${id}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the era index.\r\n * @returns The era index resource. See {@link EraIndexResponse}.\r\n */\r\nexport function eraIndex(): Resource<EraIndexResponse> {\r\n return {\r\n path: `${d3GameDataBasePath}/era`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the era leaderboard for the specified era ID and leaderboard.\r\n * @param id The ID of the era.\r\n * @param leaderboard The name of the leaderboard.\r\n * @returns The era leaderboard resource. See {@link EraLeaderboardResponse}.\r\n */\r\nexport function eraLeaderboard(id: number, leaderboard: string): Resource<EraLeaderboardResponse> {\r\n return {\r\n path: `${d3GameDataBasePath}/era/${id}/leaderboard/${leaderboard}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the season information for the specified season ID.\r\n * @param id The ID of the season.\r\n * @returns The season resource. See {@link SeasonResponse}.\r\n */\r\nexport function season(id: number): Resource<SeasonResponse> {\r\n return {\r\n path: `${d3GameDataBasePath}/season/${id}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the season index.\r\n * @returns The season index resource. See {@link SeasonIndexResponse}.\r\n */\r\nexport function seasonIndex(): Resource<SeasonIndexResponse> {\r\n return {\r\n path: `${d3GameDataBasePath}/season`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the season leaderboard for the specified season ID and leaderboard.\r\n * @param id The ID of the season.\r\n * @param leaderboard The name of the leaderboard.\r\n * @returns The season leaderboard resource. See {@link SeasonLeaderboardResponse}.\r\n */\r\nexport function seasonLeaderboard(id: number, leaderboard: string): Resource<SeasonLeaderboardResponse> {\r\n return {\r\n path: `${d3GameDataBasePath}/season/${id}/leaderboard/${leaderboard}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { d3BasePath } from '@blizzard-api/core';\r\nimport type { ItemTypeIndexResponse, ItemTypeResponse } from './types';\r\n\r\n/**\r\n * Returns the item type information for the specified item type slug.\r\n * @param itemTypeSlug The slug of the item type, example: \"sword2h\"\r\n * @returns The item type resource. See {@link ItemTypeResponse}.\r\n */\r\nexport function itemType(itemTypeSlug: string): Resource<Array<ItemTypeResponse>> {\r\n return {\r\n path: `${d3BasePath}/item-type/${itemTypeSlug}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the item type index.\r\n * @returns The item type index resource. See {@link ItemTypeIndexResponse}.\r\n */\r\nexport function itemTypeIndex(): Resource<Array<ItemTypeIndexResponse>> {\r\n return {\r\n path: `${d3BasePath}/item-type`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { d3BasePath } from '@blizzard-api/core';\r\nimport type { ItemResponse } from './types';\r\n\r\n/**\r\n * Returns the item information for the specified item slug and ID.\r\n * @param itemSlugAndId The slug and ID of the item, example: \"corrupted-ashbringer-Unique_Sword_2H_104_x1\".\r\n * @returns The item resource. See {@link ItemResponse}.\r\n */\r\nexport function item(itemSlugAndId: string): Resource<ItemResponse> {\r\n return {\r\n path: `${d3BasePath}/item/${itemSlugAndId}`,\r\n };\r\n}\r\n","import { d3ProfileBasePath } from '@blizzard-api/core';\r\nimport type { Resource } from '@blizzard-api/core';\r\nimport type { AccountHeroFollowerItemsResponse, AccountHeroResponse, AccountResponse } from './types';\r\n\r\n/**\r\n * Returns the account information for the specified battle tag.\r\n * @param battleTag The battle tag of the account.\r\n * @returns The account resource. See {@link AccountResponse}.\r\n */\r\nexport function account(battleTag: string): Resource<AccountResponse> {\r\n return {\r\n path: `${d3ProfileBasePath}/${encodeURIComponent(battleTag)}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the hero information for the specified battle tag and hero ID.\r\n * @param battleTag The battle tag of the account.\r\n * @param heroId The ID of the hero.\r\n * @returns The hero resource. See {@link AccountHeroResponse}.\r\n */\r\nexport function accountHero(battleTag: string, heroId: number): Resource<AccountHeroResponse> {\r\n return {\r\n path: `${d3ProfileBasePath}/${encodeURIComponent(battleTag)}/hero/${heroId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the follower items for the specified battle tag and hero ID.\r\n * @param battleTag The battle tag of the account.\r\n * @param heroId The ID of the hero.\r\n * @returns The follower items resource. See {@link AccountHeroFollowerItemsResponse}.\r\n */\r\nexport function accountHeroFollowerItems(\r\n battleTag: string,\r\n heroId: number,\r\n): Resource<AccountHeroFollowerItemsResponse> {\r\n return {\r\n path: `${d3ProfileBasePath}/${encodeURIComponent(battleTag)}/hero/${heroId}/follower-items`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the items for the specified battle tag and hero ID.\r\n * @param battleTag The battle tag of the account.\r\n * @param heroId The ID of the hero.\r\n * @returns The hero items resource. See {@link AccountHeroResponse}.\r\n */\r\nexport function accountHeroItems(battleTag: string, heroId: number): Resource<AccountHeroResponse> {\r\n return {\r\n path: `${d3ProfileBasePath}/${encodeURIComponent(battleTag)}/hero/${heroId}/items`,\r\n };\r\n}\r\n","import { act, actIndex } from './act/act';\r\nimport { artisan, recipe } from './artisan-and-recipe/artisan-and-recipe';\r\nimport { characterClass, skill } from './character-class-and-skill/character-class-and-skill';\r\nimport { follower } from './follower/follower';\r\nimport { era, eraIndex, eraLeaderboard, season, seasonIndex, seasonLeaderboard } from './game-data/game-data';\r\nimport { itemType, itemTypeIndex } from './item-type/item-type';\r\nimport { item } from './item/item';\r\nimport { account, accountHero, accountHeroFollowerItems, accountHeroItems } from './profile/profile';\r\n\r\nconst d3 = {\r\n //Act\r\n act,\r\n actIndex,\r\n //Artisan and Recipe\r\n artisan,\r\n recipe,\r\n //Follower\r\n follower,\r\n //Character Class and Skill\r\n characterClass,\r\n skill,\r\n //Item Type\r\n itemType,\r\n itemTypeIndex,\r\n //Item\r\n item,\r\n //Profile\r\n account,\r\n accountHero,\r\n accountHeroFollowerItems,\r\n accountHeroItems,\r\n //Game Data\r\n era,\r\n eraIndex,\r\n eraLeaderboard,\r\n season,\r\n seasonIndex,\r\n seasonLeaderboard,\r\n};\r\nexport default d3;\r\nexport { d3 };\r\n\r\n//Act\r\nexport * from './act/act';\r\nexport type * from './act/types';\r\n//Artisan and Recipe\r\nexport * from './artisan-and-recipe/artisan-and-recipe';\r\nexport type * from './artisan-and-recipe/types';\r\n//Character Class and Skill\r\nexport * from './character-class-and-skill/character-class-and-skill';\r\nexport type * from './character-class-and-skill/types';\r\n//Follower\r\nexport * from './follower/follower';\r\nexport type * from './follower/types';\r\n//Game Data\r\nexport * from './game-data/game-data';\r\nexport type * from './game-data/types';\r\n//Item\r\nexport * from './item/item';\r\nexport type * from './item/types';\r\n//Item Type\r\nexport * from './item-type/item-type';\r\nexport type * from './item-type/types';\r\n//Profile\r\nexport * from './profile/profile';\r\nexport type * from './profile/types';\r\n"],"mappings":";;;;;;;;AASA,SAAgB,IAAI,OAAsC;AACxD,QAAO,EACL,MAAM,GAAG,WAAW,OAAO,SAC5B;;;;;;AAOH,SAAgB,WAAuC;AACrD,QAAO,EACL,MAAM,GAAG,WAAW,OACrB;;;;;;;;;;ACbH,SAAgB,QAAQ,aAAgD;AACtE,QAAO,EACL,MAAM,GAAG,WAAW,WAAW,eAChC;;;;;;;;AASH,SAAgB,OAAO,aAAqB,YAA8C;AACxF,QAAO,EACL,MAAM,GAAG,WAAW,WAAW,YAAY,UAAU,cACtD;;;;;;;;;;ACfH,SAAgB,eAAe,oBAA8D;AAC3F,QAAO,EACL,MAAM,GAAG,WAAW,mBAAmB,sBACxC;;;;;;;;AASH,SAAgB,MAAM,oBAA4B,WAA4C;AAC5F,QAAO,EACL,MAAM,GAAG,WAAW,QAAQ,mBAAmB,SAAS,aACzD;;;;;;;;;;ACfH,SAAgB,SAAS,cAAkD;AACzE,QAAO,EACL,MAAM,GAAG,WAAW,YAAY,gBACjC;;;;;;;;;;ACIH,SAAgB,IAAI,IAAmC;AACrD,QAAO,EACL,MAAM,GAAG,mBAAmB,OAAO,MACpC;;;;;;AAOH,SAAgB,WAAuC;AACrD,QAAO,EACL,MAAM,GAAG,mBAAmB,OAC7B;;;;;;;;AASH,SAAgB,eAAe,IAAY,aAAuD;AAChG,QAAO,EACL,MAAM,GAAG,mBAAmB,OAAO,GAAG,eAAe,eACtD;;;;;;;AAQH,SAAgB,OAAO,IAAsC;AAC3D,QAAO,EACL,MAAM,GAAG,mBAAmB,UAAU,MACvC;;;;;;AAOH,SAAgB,cAA6C;AAC3D,QAAO,EACL,MAAM,GAAG,mBAAmB,UAC7B;;;;;;;;AASH,SAAgB,kBAAkB,IAAY,aAA0D;AACtG,QAAO,EACL,MAAM,GAAG,mBAAmB,UAAU,GAAG,eAAe,eACzD;;;;;;;;;;ACjEH,SAAgB,SAAS,cAAyD;AAChF,QAAO,EACL,MAAM,GAAG,WAAW,aAAa,gBAClC;;;;;;AAOH,SAAgB,gBAAwD;AACtE,QAAO,EACL,MAAM,GAAG,WAAW,aACrB;;;;;;;;;;ACbH,SAAgB,KAAK,eAA+C;AAClE,QAAO,EACL,MAAM,GAAG,WAAW,QAAQ,iBAC7B;;;;;;;;;;ACHH,SAAgB,QAAQ,WAA8C;AACpE,QAAO,EACL,MAAM,GAAG,kBAAkB,GAAG,mBAAmB,UAAU,IAC5D;;;;;;;;AASH,SAAgB,YAAY,WAAmB,QAA+C;AAC5F,QAAO,EACL,MAAM,GAAG,kBAAkB,GAAG,mBAAmB,UAAU,CAAC,QAAQ,UACrE;;;;;;;;AASH,SAAgB,yBACd,WACA,QAC4C;AAC5C,QAAO,EACL,MAAM,GAAG,kBAAkB,GAAG,mBAAmB,UAAU,CAAC,QAAQ,OAAO,kBAC5E;;;;;;;;AASH,SAAgB,iBAAiB,WAAmB,QAA+C;AACjG,QAAO,EACL,MAAM,GAAG,kBAAkB,GAAG,mBAAmB,UAAU,CAAC,QAAQ,OAAO,SAC5E;;;;;AC1CH,MAAM,KAAK;CAET;CACA;CAEA;CACA;CAEA;CAEA;CACA;CAEA;CACA;CAEA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACD"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@blizzard-api/d3",
3
- "version": "1.0.5",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "author": "Putro",
6
6
  "description": "A series of helpers to interact with the Diablo 3 Blizzard API",
7
7
  "repository": "https://github.com/Pewtro/blizzard-api/tree/main/packages/d3",
8
8
  "type": "module",
9
9
  "engines": {
10
- "node": "^18.18 || >=20.9"
10
+ "node": "^20.19.0 || ^22.13.0 || >=24"
11
11
  },
12
12
  "module": "./dist/index.js",
13
13
  "types": "./dist/index.d.ts",
@@ -34,10 +34,10 @@
34
34
  ],
35
35
  "dependencies": {},
36
36
  "peerDependencies": {
37
- "@blizzard-api/core": "2.1.1"
37
+ "@blizzard-api/core": "3.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@blizzard-api/core": "2.1.1"
40
+ "@blizzard-api/core": "3.0.0"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "tsdown",