@blizzard-api/sc2 1.0.4 → 1.0.5

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.d.ts CHANGED
@@ -1,5 +1,11 @@
1
- import { Resource } from '@blizzard-api/core';
1
+ import { Resource } from "@blizzard-api/core";
2
2
 
3
+ //#region src/account/account.d.ts
4
+ /**
5
+ * Returns the player information for the specified account ID.
6
+ * @param accountId The account ID
7
+ * @returns The player resource. See {@link Resource}.
8
+ */
3
9
  /**
4
10
  * Returns the player information for the specified account ID.
5
11
  * @param accountId The account ID
@@ -7,46 +13,52 @@ import { Resource } from '@blizzard-api/core';
7
13
  */
8
14
  declare function player(accountId: string): Resource<Array<unknown>>;
9
15
 
16
+ //#endregion
17
+ //#region src/base.d.ts
10
18
  /**
11
19
  * Base interface for Blizzard API responses.
12
20
  */
13
21
  interface ResponseBase {
14
- _links: {
15
- self: {
16
- href: string;
17
- };
22
+ _links: {
23
+ self: {
24
+ href: string;
18
25
  };
26
+ };
19
27
  }
20
28
  type StarcraftRegion = 'cn' | 'eu' | 'kr' | 'tw' | 'us';
21
29
 
30
+ //#endregion
31
+ //#region src/ladder/types.d.ts
22
32
  interface GrandmasterLeaderboardResponse {
23
- ladderTeams: Array<LadderTeam>;
33
+ ladderTeams: Array<LadderTeam>;
24
34
  }
25
35
  interface SeasonResponse {
26
- endDate: string;
27
- number: number;
28
- seasonId: number;
29
- startDate: string;
30
- year: number;
36
+ endDate: string;
37
+ number: number;
38
+ seasonId: number;
39
+ startDate: string;
40
+ year: number;
31
41
  }
32
42
  interface LadderTeam {
33
- joinTimestamp: number;
34
- losses: number;
35
- mmr: number;
36
- points: number;
37
- previousRank: number;
38
- teamMembers: Array<TeamMember>;
39
- wins: number;
43
+ joinTimestamp: number;
44
+ losses: number;
45
+ mmr: number;
46
+ points: number;
47
+ previousRank: number;
48
+ teamMembers: Array<TeamMember>;
49
+ wins: number;
40
50
  }
41
51
  interface TeamMember {
42
- clanTag?: string;
43
- displayName: string;
44
- favoriteRace: 'protoss' | 'random' | 'terran' | 'zerg';
45
- id: string;
46
- realm: number;
47
- region: number;
52
+ clanTag?: string;
53
+ displayName: string;
54
+ favoriteRace: 'protoss' | 'random' | 'terran' | 'zerg';
55
+ id: string;
56
+ realm: number;
57
+ region: number;
48
58
  }
49
59
 
60
+ //#endregion
61
+ //#region src/ladder/ladder.d.ts
50
62
  /**
51
63
  * Returns the grandmaster leaderboard for the specified region.
52
64
  * @param regionId The region ID
@@ -60,29 +72,33 @@ declare function grandmasterLeaderboard(regionId: StarcraftRegion): Resource<Gra
60
72
  */
61
73
  declare function season(regionId: StarcraftRegion): Resource<SeasonResponse>;
62
74
 
75
+ //#endregion
76
+ //#region src/league/types.d.ts
63
77
  interface LeagueDataResponse extends ResponseBase {
64
- key: Key;
65
- tier: Array<Tier>;
78
+ key: Key;
79
+ tier: Array<Tier>;
66
80
  }
67
81
  type StarcraftLeagueId = 'bronze' | 'diamond' | 'gold' | 'grandmaster' | 'master' | 'platinum' | 'silver';
68
82
  type StarcraftLeagueQueue = 'hots-1v1' | 'hots-2v2' | 'hots-3v3' | 'hots-4v4' | 'lotv-1v1' | 'lotv-2v2' | 'lotv-3v3' | 'lotv-4v4' | 'lotv-archon' | 'wol-1v1' | 'wol-2v2' | 'wol-3v3' | 'wol-4v4';
69
83
  type StarcraftLeagueTeamType = 'arranged' | 'random';
70
84
  interface Division {
71
- id: number;
72
- ladder_id: number;
73
- member_count: number;
85
+ id: number;
86
+ ladder_id: number;
87
+ member_count: number;
74
88
  }
75
89
  interface Key {
76
- league_id: number;
77
- queue_id: number;
78
- season_id: number;
79
- team_type: number;
90
+ league_id: number;
91
+ queue_id: number;
92
+ season_id: number;
93
+ team_type: number;
80
94
  }
81
95
  interface Tier {
82
- division: Array<Division>;
83
- id: number;
96
+ division: Array<Division>;
97
+ id: number;
84
98
  }
85
99
 
100
+ //#endregion
101
+ //#region src/league/league.d.ts
86
102
  /**
87
103
  * Returns the league data for the specified season, queue, team type, and league.
88
104
  * @param seasonId The season ID
@@ -93,131 +109,135 @@ interface Tier {
93
109
  */
94
110
  declare function getLeagueData(seasonId: string, queueId: StarcraftLeagueQueue, teamType: StarcraftLeagueTeamType, leagueId: StarcraftLeagueId): Resource<LeagueDataResponse>;
95
111
 
112
+ //#endregion
113
+ //#region src/legacy/types.d.ts
96
114
  interface LegacyAchievementsResponse {
97
- achievements: Array<Achievement$1>;
98
- categories: Array<Category$1>;
115
+ achievements: Array<Achievement$1>;
116
+ categories: Array<Category$1>;
99
117
  }
100
118
  interface LegacyLaddersResponse {
101
- currentSeason: Array<unknown>;
102
- previousSeason: Array<unknown>;
103
- showcasePlacement: Array<unknown>;
119
+ currentSeason: Array<unknown>;
120
+ previousSeason: Array<unknown>;
121
+ showcasePlacement: Array<unknown>;
104
122
  }
105
123
  interface LegacyMatchHistoryResponse {
106
- matches: Array<Match>;
124
+ matches: Array<Match>;
107
125
  }
108
126
  interface LegacyProfileResponse {
109
- achievements: Achievements;
110
- campaign: Campaign;
111
- career: Career;
112
- clanName: string;
113
- clanTag: string;
114
- displayName: string;
115
- id: string;
116
- portrait: Icon;
117
- profilePath: string;
118
- realm: number;
119
- rewards: Rewards;
120
- season: Season;
121
- swarmLevels: SwarmLevels;
127
+ achievements: Achievements;
128
+ campaign: Campaign;
129
+ career: Career;
130
+ clanName: string;
131
+ clanTag: string;
132
+ displayName: string;
133
+ id: string;
134
+ portrait: Icon;
135
+ profilePath: string;
136
+ realm: number;
137
+ rewards: Rewards;
138
+ season: Season;
139
+ swarmLevels: SwarmLevels;
122
140
  }
123
141
  interface LegacyRewardsResponse {
124
- animations: Array<Animation>;
125
- portraits: Array<Animation>;
126
- protossDecals: Array<Animation>;
127
- skins: Array<Animation>;
128
- terranDecals: Array<Animation>;
129
- zergDecals: Array<Animation>;
142
+ animations: Array<Animation>;
143
+ portraits: Array<Animation>;
144
+ protossDecals: Array<Animation>;
145
+ skins: Array<Animation>;
146
+ terranDecals: Array<Animation>;
147
+ zergDecals: Array<Animation>;
130
148
  }
131
149
  interface Achievement$1 {
132
- achievementId: string;
133
- categoryId: string;
134
- description: string;
135
- icon: Icon;
136
- points: number;
137
- title: string;
150
+ achievementId: string;
151
+ categoryId: string;
152
+ description: string;
153
+ icon: Icon;
154
+ points: number;
155
+ title: string;
138
156
  }
139
157
  interface Achievements {
140
- achievements: Array<{
141
- achievementId: string;
142
- completionDate: number;
143
- }>;
144
- points: Points;
158
+ achievements: Array<{
159
+ achievementId: string;
160
+ completionDate: number;
161
+ }>;
162
+ points: Points;
145
163
  }
146
164
  interface Animation {
147
- achievementId: string;
148
- command?: '/dance';
149
- icon: Icon;
150
- id: string;
151
- name?: string;
152
- title: string;
165
+ achievementId: string;
166
+ command?: '/dance';
167
+ icon: Icon;
168
+ id: string;
169
+ name?: string;
170
+ title: string;
153
171
  }
154
172
  interface Campaign {
155
- hots: string;
156
- wol: string;
173
+ hots: string;
174
+ wol: string;
157
175
  }
158
176
  interface Career {
159
- careerTotalGames: number;
160
- highest1v1Rank: string;
161
- highestTeamRank: string;
162
- primaryRace: string;
163
- protossWins: number;
164
- seasonTotalGames: number;
165
- terranWins: number;
166
- zergWins: number;
177
+ careerTotalGames: number;
178
+ highest1v1Rank: string;
179
+ highestTeamRank: string;
180
+ primaryRace: string;
181
+ protossWins: number;
182
+ seasonTotalGames: number;
183
+ terranWins: number;
184
+ zergWins: number;
167
185
  }
168
186
  interface Category$1 {
169
- categoryId: string;
170
- children?: Array<Category$1>;
171
- featuredAchievementId: string;
172
- title: string;
187
+ categoryId: string;
188
+ children?: Array<Category$1>;
189
+ featuredAchievementId: string;
190
+ title: string;
173
191
  }
174
192
  interface Icon {
175
- h: number;
176
- offset: number;
177
- url: string;
178
- w: number;
179
- x: number;
180
- y: number;
193
+ h: number;
194
+ offset: number;
195
+ url: string;
196
+ w: number;
197
+ x: number;
198
+ y: number;
181
199
  }
182
200
  interface Match {
183
- date: number;
184
- decision: 'Left' | 'Loss' | 'Win';
185
- map: string;
186
- speed: 'Fast' | 'Faster';
187
- type: '2v2' | '3v3' | 'Co-Op' | 'Custom';
201
+ date: number;
202
+ decision: 'Left' | 'Loss' | 'Win';
203
+ map: string;
204
+ speed: 'Fast' | 'Faster';
205
+ type: '2v2' | '3v3' | 'Co-Op' | 'Custom';
188
206
  }
189
207
  interface Points {
190
- categoryPoints: Record<string, number>;
191
- totalPoints: number;
208
+ categoryPoints: Record<string, number>;
209
+ totalPoints: number;
192
210
  }
193
211
  interface Rewards {
194
- earned: Array<string>;
195
- selected: Array<string>;
212
+ earned: Array<string>;
213
+ selected: Array<string>;
196
214
  }
197
215
  interface Season {
198
- seasonId: number;
199
- seasonNumber: number;
200
- seasonYear: number;
201
- stats: Array<Stat>;
202
- totalGamesThisSeason: number;
216
+ seasonId: number;
217
+ seasonNumber: number;
218
+ seasonYear: number;
219
+ stats: Array<Stat>;
220
+ totalGamesThisSeason: number;
203
221
  }
204
222
  interface Stat {
205
- games: number;
206
- type: string;
207
- wins: number;
223
+ games: number;
224
+ type: string;
225
+ wins: number;
208
226
  }
209
227
  interface SwarmLevels {
210
- level: number;
211
- protoss: SwarmLevelsByRace;
212
- terran: SwarmLevelsByRace;
213
- zerg: SwarmLevelsByRace;
228
+ level: number;
229
+ protoss: SwarmLevelsByRace;
230
+ terran: SwarmLevelsByRace;
231
+ zerg: SwarmLevelsByRace;
214
232
  }
215
233
  interface SwarmLevelsByRace {
216
- currentLevelXP: number;
217
- level: number;
218
- totalLevelXP: number;
234
+ currentLevelXP: number;
235
+ level: number;
236
+ totalLevelXP: number;
219
237
  }
220
238
 
239
+ //#endregion
240
+ //#region src/legacy/legacy.d.ts
221
241
  /**
222
242
  * Returns the legacy achievements for the specified region.
223
243
  * @param regionId The region ID for Starcraft.
@@ -262,75 +282,79 @@ declare function legacyProfile(regionId: StarcraftRegion, realmId: 1 | 2, profil
262
282
  */
263
283
  declare function legacyRewards(regionId: StarcraftRegion): Resource<LegacyRewardsResponse>;
264
284
 
285
+ //#endregion
286
+ //#region src/profile/types.d.ts
265
287
  interface LadderResponse {
266
- allLadderMemberships: Array<unknown>;
267
- ladderTeams: Array<unknown>;
268
- ranksAndPools: Array<unknown>;
288
+ allLadderMemberships: Array<unknown>;
289
+ ladderTeams: Array<unknown>;
290
+ ranksAndPools: Array<unknown>;
269
291
  }
270
292
  interface LadderSummaryResponse {
271
- allLadderMemberships: Array<unknown>;
272
- placementMatches: Array<unknown>;
273
- showCaseEntries: Array<unknown>;
293
+ allLadderMemberships: Array<unknown>;
294
+ placementMatches: Array<unknown>;
295
+ showCaseEntries: Array<unknown>;
274
296
  }
275
297
  interface MetadataResponse {
276
- avatarUrl: string;
277
- name: string;
278
- profileId: string;
279
- profileUrl: string;
280
- realmId: number;
281
- regionId: number;
298
+ avatarUrl: string;
299
+ name: string;
300
+ profileId: string;
301
+ profileUrl: string;
302
+ realmId: number;
303
+ regionId: number;
282
304
  }
283
305
  interface StaticProfileResponse {
284
- achievements: Array<Achievement>;
285
- categories: Array<Category>;
286
- criteria: Array<Criterion>;
287
- rewards: Array<Reward>;
306
+ achievements: Array<Achievement>;
307
+ categories: Array<Category>;
308
+ criteria: Array<Criterion>;
309
+ rewards: Array<Reward>;
288
310
  }
289
311
  interface Achievement {
290
- categoryId: string;
291
- chainAchievementIds: Array<string>;
292
- chainRewardSize: number;
293
- criteriaIds?: Array<string>;
294
- description: string;
295
- flags: number;
296
- id: string;
297
- imageUrl: string;
298
- isChained: boolean;
299
- points: number;
300
- title: string;
301
- uiOrderHint: number;
312
+ categoryId: string;
313
+ chainAchievementIds: Array<string>;
314
+ chainRewardSize: number;
315
+ criteriaIds?: Array<string>;
316
+ description: string;
317
+ flags: number;
318
+ id: string;
319
+ imageUrl: string;
320
+ isChained: boolean;
321
+ points: number;
322
+ title: string;
323
+ uiOrderHint: number;
302
324
  }
303
325
  interface Category {
304
- childrenCategoryIds: Array<string>;
305
- featuredAchievementId: string;
306
- id: string;
307
- medalTiers?: Array<number>;
308
- name: string;
309
- parentCategoryId: null | string;
310
- points: number;
311
- uiOrderHint: number;
326
+ childrenCategoryIds: Array<string>;
327
+ featuredAchievementId: string;
328
+ id: string;
329
+ medalTiers?: Array<number>;
330
+ name: string;
331
+ parentCategoryId: null | string;
332
+ points: number;
333
+ uiOrderHint: number;
312
334
  }
313
335
  interface Criterion {
314
- achievementId: string;
315
- description: string;
316
- evaluationClass: 'Achv' | 'Clnt' | 'S2Gm' | 'Sunk' | 'Trny';
317
- flags: number;
318
- id: string;
319
- necessaryQuantity: number;
320
- uiOrderHint: number;
336
+ achievementId: string;
337
+ description: string;
338
+ evaluationClass: 'Achv' | 'Clnt' | 'S2Gm' | 'Sunk' | 'Trny';
339
+ flags: number;
340
+ id: string;
341
+ necessaryQuantity: number;
342
+ uiOrderHint: number;
321
343
  }
322
344
  interface Reward {
323
- achievementId?: string;
324
- command?: '/dance';
325
- flags: number;
326
- id: string;
327
- imageUrl: string;
328
- isSkin: boolean;
329
- name: string;
330
- uiOrderHint: number;
331
- unlockableType: string;
345
+ achievementId?: string;
346
+ command?: '/dance';
347
+ flags: number;
348
+ id: string;
349
+ imageUrl: string;
350
+ isSkin: boolean;
351
+ name: string;
352
+ uiOrderHint: number;
353
+ unlockableType: string;
332
354
  }
333
355
 
356
+ //#endregion
357
+ //#region src/profile/profile.d.ts
334
358
  /**
335
359
  * Returns the ladder information for the specified profile and ladder.
336
360
  * @param regionId The region ID for Starcraft.
@@ -371,22 +395,26 @@ declare function profile(regionId: StarcraftRegion, realmId: 1 | 2, profileId: n
371
395
  */
372
396
  declare function staticProfile(regionId: StarcraftRegion): Resource<StaticProfileResponse>;
373
397
 
398
+ //#endregion
399
+ //#region src/index.d.ts
374
400
  declare const sc2: {
375
- player: typeof player;
376
- grandmasterLeaderboard: typeof grandmasterLeaderboard;
377
- season: typeof season;
378
- getLeagueData: typeof getLeagueData;
379
- legacyAchievements: typeof legacyAchievements;
380
- legacyLadder: typeof legacyLadder;
381
- legacyLadders: typeof legacyLadders;
382
- legacyMatchHistory: typeof legacyMatchHistory;
383
- legacyProfile: typeof legacyProfile;
384
- legacyRewards: typeof legacyRewards;
385
- ladder: typeof ladder;
386
- ladderSummary: typeof ladderSummary;
387
- metadata: typeof metadata;
388
- profile: typeof profile;
389
- staticProfile: typeof staticProfile;
401
+ player: typeof player;
402
+ grandmasterLeaderboard: typeof grandmasterLeaderboard;
403
+ season: typeof season;
404
+ getLeagueData: typeof getLeagueData;
405
+ legacyAchievements: typeof legacyAchievements;
406
+ legacyLadder: typeof legacyLadder;
407
+ legacyLadders: typeof legacyLadders;
408
+ legacyMatchHistory: typeof legacyMatchHistory;
409
+ legacyProfile: typeof legacyProfile;
410
+ legacyRewards: typeof legacyRewards;
411
+ ladder: typeof ladder;
412
+ ladderSummary: typeof ladderSummary;
413
+ metadata: typeof metadata;
414
+ profile: typeof profile;
415
+ staticProfile: typeof staticProfile;
390
416
  };
391
417
 
392
- export { type GrandmasterLeaderboardResponse, type LadderResponse, type LadderSummaryResponse, type LeagueDataResponse, type LegacyAchievementsResponse, type LegacyLaddersResponse, type LegacyMatchHistoryResponse, type LegacyProfileResponse, type LegacyRewardsResponse, type MetadataResponse, type SeasonResponse, type StarcraftLeagueId, type StarcraftLeagueQueue, type StarcraftLeagueTeamType, type StaticProfileResponse, sc2 as default, getLeagueData, grandmasterLeaderboard, ladder, ladderSummary, legacyAchievements, legacyLadder, legacyLadders, legacyMatchHistory, legacyProfile, legacyRewards, metadata, player, profile, sc2, season, staticProfile };
418
+ //#endregion
419
+ export { GrandmasterLeaderboardResponse, LadderResponse, LadderSummaryResponse, LeagueDataResponse, LegacyAchievementsResponse, LegacyLaddersResponse, LegacyMatchHistoryResponse, LegacyProfileResponse, LegacyRewardsResponse, MetadataResponse, SeasonResponse, StarcraftLeagueId, StarcraftLeagueQueue, StarcraftLeagueTeamType, StaticProfileResponse, sc2 as default, getLeagueData, grandmasterLeaderboard, ladder, ladderSummary, legacyAchievements, legacyLadder, legacyLadders, legacyMatchHistory, legacyProfile, legacyRewards, metadata, player, profile, sc2, season, staticProfile };
420
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,150 +1,294 @@
1
- // src/account/account.ts
1
+ //#region src/account/account.ts
2
+ /**
3
+
4
+ * Returns the player information for the specified account ID.
5
+
6
+ * @param accountId The account ID
7
+
8
+ * @returns The player resource. See {@link Resource}.
9
+
10
+ */
2
11
  function player(accountId) {
3
- return {
4
- path: `/sc2/player/${accountId}`
5
- };
12
+ return { path: `/sc2/player/${accountId}` };
6
13
  }
7
14
 
8
- // src/base.ts
9
- var starcraftRegion = {
10
- cn: 5,
11
- eu: 2,
12
- kr: 3,
13
- tw: 3,
14
- us: 1
15
+ //#endregion
16
+ //#region src/base.ts
17
+ const starcraftRegion = {
18
+ cn: 5,
19
+ eu: 2,
20
+ kr: 3,
21
+ tw: 3,
22
+ us: 1
15
23
  };
16
24
 
17
- // src/ladder/ladder.ts
25
+ //#endregion
26
+ //#region src/ladder/ladder.ts
27
+ /**
28
+
29
+ * Returns the grandmaster leaderboard for the specified region.
30
+
31
+ * @param regionId The region ID
32
+
33
+ * @returns The grandmaster leaderboard resource. See {@link GrandmasterLeaderboardResponse}.
34
+
35
+ */
18
36
  function grandmasterLeaderboard(regionId) {
19
- return {
20
- path: `/sc2/ladder/grandmaster/${starcraftRegion[regionId]}`
21
- };
37
+ return { path: `/sc2/ladder/grandmaster/${starcraftRegion[regionId]}` };
22
38
  }
39
+ /**
40
+
41
+ * Returns the season information for the specified region.
42
+
43
+ * @param regionId The region ID
44
+
45
+ * @returns The season resource. See {@link SeasonResponse}.
46
+
47
+ */
23
48
  function season(regionId) {
24
- return {
25
- path: `/sc2/ladder/season/${starcraftRegion[regionId]}`
26
- };
49
+ return { path: `/sc2/ladder/season/${starcraftRegion[regionId]}` };
27
50
  }
28
51
 
29
- // src/league/league.ts
30
- var starcraftLeagueQueue = {
31
- "hots-1v1": 101,
32
- "hots-2v2": 102,
33
- "hots-3v3": 103,
34
- "hots-4v4": 104,
35
- "lotv-1v1": 201,
36
- "lotv-2v2": 202,
37
- "lotv-3v3": 203,
38
- "lotv-4v4": 204,
39
- "lotv-archon": 206,
40
- "wol-1v1": 1,
41
- "wol-2v2": 2,
42
- "wol-3v3": 3,
43
- "wol-4v4": 4
52
+ //#endregion
53
+ //#region src/league/league.ts
54
+ const starcraftLeagueQueue = {
55
+ "hots-1v1": 101,
56
+ "hots-2v2": 102,
57
+ "hots-3v3": 103,
58
+ "hots-4v4": 104,
59
+ "lotv-1v1": 201,
60
+ "lotv-2v2": 202,
61
+ "lotv-3v3": 203,
62
+ "lotv-4v4": 204,
63
+ "lotv-archon": 206,
64
+ "wol-1v1": 1,
65
+ "wol-2v2": 2,
66
+ "wol-3v3": 3,
67
+ "wol-4v4": 4
44
68
  };
45
- var starcraftLeagueTeam = {
46
- arranged: 0,
47
- random: 1
69
+ const starcraftLeagueTeam = {
70
+ arranged: 0,
71
+ random: 1
48
72
  };
49
- var starcraftLeagueId = {
50
- bronze: 0,
51
- diamond: 4,
52
- gold: 2,
53
- grandmaster: 6,
54
- master: 5,
55
- platinum: 3,
56
- silver: 1
73
+ const starcraftLeagueId = {
74
+ bronze: 0,
75
+ diamond: 4,
76
+ gold: 2,
77
+ grandmaster: 6,
78
+ master: 5,
79
+ platinum: 3,
80
+ silver: 1
57
81
  };
82
+ /**
83
+
84
+ * Returns the league data for the specified season, queue, team type, and league.
85
+
86
+ * @param seasonId The season ID
87
+
88
+ * @param queueId The queue ID
89
+
90
+ * @param teamType The team type
91
+
92
+ * @param leagueId The league ID
93
+
94
+ * @returns The league data resource. See {@link LeagueDataResponse}.
95
+
96
+ */
58
97
  function getLeagueData(seasonId, queueId, teamType, leagueId) {
59
- return {
60
- path: `/data/sc2/league/${seasonId}/${starcraftLeagueQueue[queueId]}/${starcraftLeagueTeam[teamType]}/${starcraftLeagueId[leagueId]}`
61
- };
98
+ return { path: `/data/sc2/league/${seasonId}/${starcraftLeagueQueue[queueId]}/${starcraftLeagueTeam[teamType]}/${starcraftLeagueId[leagueId]}` };
62
99
  }
63
100
 
64
- // src/legacy/legacy.ts
101
+ //#endregion
102
+ //#region src/legacy/legacy.ts
103
+ /**
104
+
105
+ * Returns the legacy achievements for the specified region.
106
+
107
+ * @param regionId The region ID for Starcraft.
108
+
109
+ * @returns A resource representing the legacy achievements. See {@link LegacyAchievementsResponse}
110
+
111
+ */
65
112
  function legacyAchievements(regionId) {
66
- return {
67
- path: `/sc2/legacy/data/achievements/${starcraftRegion[regionId]}`
68
- };
113
+ return { path: `/sc2/legacy/data/achievements/${starcraftRegion[regionId]}` };
69
114
  }
115
+ /**
116
+
117
+ * Returns the ladder information for the specified ladder.
118
+
119
+ * @param regionId The region ID for Starcraft.
120
+
121
+ * @param ladderId The ID of the ladder.
122
+
123
+ * @returns A resource representing the ladder. See {@link LadderResponse}
124
+
125
+ */
70
126
  function legacyLadder(regionId, ladderId) {
71
- return {
72
- path: `/sc2/legacy/ladder/${starcraftRegion[regionId]}/${ladderId}`
73
- };
127
+ return { path: `/sc2/legacy/ladder/${starcraftRegion[regionId]}/${ladderId}` };
74
128
  }
129
+ /**
130
+
131
+ * Returns the ladders for the specified profile.
132
+
133
+ * @param regionId The region ID for Starcraft.
134
+
135
+ * @param realmId 1 or 2
136
+
137
+ * @param profileId The ID of the profile.
138
+
139
+ * @returns A resource representing the ladders for the given profile. See {@link LegacyLaddersResponse}
140
+
141
+ */
75
142
  function legacyLadders(regionId, realmId, profileId) {
76
- return {
77
- path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladders`
78
- };
143
+ return { path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladders` };
79
144
  }
145
+ /**
146
+
147
+ * Returns the match history for the specified profile.
148
+
149
+ * @param regionId The region ID for Starcraft.
150
+
151
+ * @param realmId 1 or 2
152
+
153
+ * @param profileId The ID of the profile.
154
+
155
+ * @returns A resource representing the match history for the given profile. See {@link LegacyMatchHistoryResponse}
156
+
157
+ */
80
158
  function legacyMatchHistory(regionId, realmId, profileId) {
81
- return {
82
- path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/matches`
83
- };
159
+ return { path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/matches` };
84
160
  }
161
+ /**
162
+
163
+ * Returns the profile for the specified profile.
164
+
165
+ * @param regionId The region ID for Starcraft.
166
+
167
+ * @param realmId 1 or 2
168
+
169
+ * @param profileId The ID of the profile.
170
+
171
+ * @returns A resource representing the profile for the given ID. See {@link LegacyProfileResponse}
172
+
173
+ */
85
174
  function legacyProfile(regionId, realmId, profileId) {
86
- return {
87
- path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`
88
- };
175
+ return { path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}` };
89
176
  }
177
+ /**
178
+
179
+ * Returns the rewards for the specified region.
180
+
181
+ * @param regionId The region ID for Starcraft.
182
+
183
+ * @returns A resource representing the rewards for the given region. See {@link LegacyRewardsResponse}
184
+
185
+ */
90
186
  function legacyRewards(regionId) {
91
- return {
92
- path: `/sc2/legacy/data/rewards/${starcraftRegion[regionId]}`
93
- };
187
+ return { path: `/sc2/legacy/data/rewards/${starcraftRegion[regionId]}` };
94
188
  }
95
189
 
96
- // src/profile/profile.ts
190
+ //#endregion
191
+ //#region src/profile/profile.ts
192
+ /**
193
+
194
+ * Returns the ladder information for the specified profile and ladder.
195
+
196
+ * @param regionId The region ID for Starcraft.
197
+
198
+ * @param realmId 1 or 2
199
+
200
+ * @param profileId The ID of the profile.
201
+
202
+ * @param ladderId The ID of the ladder.
203
+
204
+ * @returns A resource representing the ladder. See {@link LadderResponse}
205
+
206
+ */
97
207
  function ladder(regionId, realmId, profileId, ladderId) {
98
- return {
99
- path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/${ladderId}`
100
- };
208
+ return { path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/${ladderId}` };
101
209
  }
210
+ /**
211
+
212
+ * Returns the ladder summary information for the specified profile.
213
+
214
+ * @param regionId The region ID for Starcraft.
215
+
216
+ * @param realmId 1 or 2
217
+
218
+ * @param profileId The ID of the profile.
219
+
220
+ * @returns A resource representing the ladder summary. See {@link LadderSummaryResponse}
221
+
222
+ */
102
223
  function ladderSummary(regionId, realmId, profileId) {
103
- return {
104
- path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/summary`
105
- };
224
+ return { path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/summary` };
106
225
  }
226
+ /**
227
+
228
+ * Returns the metadata information for the specified profile.
229
+
230
+ * @param regionId The region ID for Starcraft.
231
+
232
+ * @param realmId 1 or 2
233
+
234
+ * @param profileId The ID of the profile.
235
+
236
+ * @returns A resource representing the metadata. See {@link MetadataResponse}
237
+
238
+ */
107
239
  function metadata(regionId, realmId, profileId) {
108
- return {
109
- path: `/sc2/metadata/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`
110
- };
240
+ return { path: `/sc2/metadata/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}` };
111
241
  }
242
+ /**
243
+
244
+ * Returns the profile information for the specified profile.
245
+
246
+ * @param regionId The region ID for Starcraft.
247
+
248
+ * @param realmId 1 or 2
249
+
250
+ * @param profileId The ID of the profile.
251
+
252
+ * @returns A resource representing the profile. See {@link MetadataResponse}
253
+
254
+ */
112
255
  function profile(regionId, realmId, profileId) {
113
- return {
114
- path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`
115
- };
256
+ return { path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}` };
116
257
  }
258
+ /**
259
+
260
+ *
261
+
262
+ * @param regionId The region ID for Starcraft.
263
+
264
+ * @returns A resource representing the static profile. See {@link StaticProfileResponse}
265
+
266
+ */
117
267
  function staticProfile(regionId) {
118
- return {
119
- path: `/sc2/static/profile/${starcraftRegion[regionId]}`
120
- };
268
+ return { path: `/sc2/static/profile/${starcraftRegion[regionId]}` };
121
269
  }
122
270
 
123
- // src/index.ts
124
- var sc2 = {
125
- //Account
126
- player,
127
- //Ladder
128
- grandmasterLeaderboard,
129
- season,
130
- //League
131
- getLeagueData,
132
- //Legacy
133
- legacyAchievements,
134
- legacyLadder,
135
- legacyLadders,
136
- legacyMatchHistory,
137
- legacyProfile,
138
- legacyRewards,
139
- //Profile
140
- ladder,
141
- ladderSummary,
142
- metadata,
143
- profile,
144
- staticProfile
271
+ //#endregion
272
+ //#region src/index.ts
273
+ const sc2 = {
274
+ player,
275
+ grandmasterLeaderboard,
276
+ season,
277
+ getLeagueData,
278
+ legacyAchievements,
279
+ legacyLadder,
280
+ legacyLadders,
281
+ legacyMatchHistory,
282
+ legacyProfile,
283
+ legacyRewards,
284
+ ladder,
285
+ ladderSummary,
286
+ metadata,
287
+ profile,
288
+ staticProfile
145
289
  };
146
290
  var src_default = sc2;
147
291
 
292
+ //#endregion
148
293
  export { src_default as default, getLeagueData, grandmasterLeaderboard, ladder, ladderSummary, legacyAchievements, legacyLadder, legacyLadders, legacyMatchHistory, legacyProfile, legacyRewards, metadata, player, profile, sc2, season, staticProfile };
149
- //# sourceMappingURL=index.js.map
150
294
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/account/account.ts","../src/base.ts","../src/ladder/ladder.ts","../src/league/league.ts","../src/legacy/legacy.ts","../src/profile/profile.ts","../src/index.ts"],"names":[],"mappings":";AAOO,SAAS,OAAO,SAA6C,EAAA;AAClE,EAAO,OAAA;AAAA,IACL,IAAA,EAAM,eAAe,SAAS,CAAA;AAAA,GAChC;AACF;;;ACGO,IAAM,eAAmD,GAAA;AAAA,EAC9D,EAAI,EAAA,CAAA;AAAA,EACJ,EAAI,EAAA,CAAA;AAAA,EACJ,EAAI,EAAA,CAAA;AAAA,EACJ,EAAI,EAAA,C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AAAA,EACA;AACF;AACA,IAAO,WAAQ,GAAA","file":"index.js","sourcesContent":["import type { Resource } from '@blizzard-api/core';\r\n\r\n/**\r\n * Returns the player information for the specified account ID.\r\n * @param accountId The account ID\r\n * @returns The player resource. See {@link Resource}.\r\n */\r\nexport function player(accountId: string): Resource<Array<unknown>> {\r\n return {\r\n path: `/sc2/player/${accountId}`,\r\n };\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\r\n//The region (1=US, 2=EU, 3=KO and TW, 5=CN).\r\nexport type StarcraftRegion = 'cn' | 'eu' | 'kr' | 'tw' | 'us';\r\n\r\nexport const starcraftRegion: Record<StarcraftRegion, number> = {\r\n cn: 5,\r\n eu: 2,\r\n kr: 3,\r\n tw: 3,\r\n us: 1,\r\n};\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { starcraftRegion, type StarcraftRegion } from '../base';\r\nimport type { GrandmasterLeaderboardResponse, SeasonResponse } from './types';\r\n\r\n/**\r\n * Returns the grandmaster leaderboard for the specified region.\r\n * @param regionId The region ID\r\n * @returns The grandmaster leaderboard resource. See {@link GrandmasterLeaderboardResponse}.\r\n */\r\nexport function grandmasterLeaderboard(regionId: StarcraftRegion): Resource<GrandmasterLeaderboardResponse> {\r\n return {\r\n path: `/sc2/ladder/grandmaster/${starcraftRegion[regionId]}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the season information for the specified region.\r\n * @param regionId The region ID\r\n * @returns The season resource. See {@link SeasonResponse}.\r\n */\r\nexport function season(regionId: StarcraftRegion): Resource<SeasonResponse> {\r\n return {\r\n path: `/sc2/ladder/season/${starcraftRegion[regionId]}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport type { LeagueDataResponse, StarcraftLeagueId, StarcraftLeagueQueue, StarcraftLeagueTeamType } from './types';\r\n\r\nconst starcraftLeagueQueue: Record<StarcraftLeagueQueue, number> = {\r\n 'hots-1v1': 101,\r\n 'hots-2v2': 102,\r\n 'hots-3v3': 103,\r\n 'hots-4v4': 104,\r\n 'lotv-1v1': 201,\r\n 'lotv-2v2': 202,\r\n 'lotv-3v3': 203,\r\n 'lotv-4v4': 204,\r\n 'lotv-archon': 206,\r\n 'wol-1v1': 1,\r\n 'wol-2v2': 2,\r\n 'wol-3v3': 3,\r\n 'wol-4v4': 4,\r\n};\r\n\r\nconst starcraftLeagueTeam: Record<StarcraftLeagueTeamType, number> = {\r\n arranged: 0,\r\n random: 1,\r\n};\r\n\r\nconst starcraftLeagueId: Record<StarcraftLeagueId, number> = {\r\n bronze: 0,\r\n diamond: 4,\r\n gold: 2,\r\n grandmaster: 6,\r\n master: 5,\r\n platinum: 3,\r\n silver: 1,\r\n};\r\n\r\n/**\r\n * Returns the league data for the specified season, queue, team type, and league.\r\n * @param seasonId The season ID\r\n * @param queueId The queue ID\r\n * @param teamType The team type\r\n * @param leagueId The league ID\r\n * @returns The league data resource. See {@link LeagueDataResponse}.\r\n */\r\nexport function getLeagueData(\r\n seasonId: string,\r\n queueId: StarcraftLeagueQueue,\r\n teamType: StarcraftLeagueTeamType,\r\n leagueId: StarcraftLeagueId,\r\n): Resource<LeagueDataResponse> {\r\n return {\r\n path: `/data/sc2/league/${seasonId}/${starcraftLeagueQueue[queueId]}/${starcraftLeagueTeam[teamType]}/${starcraftLeagueId[leagueId]}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { starcraftRegion, type StarcraftRegion } from '../base';\r\nimport type {\r\n LegacyAchievementsResponse,\r\n LegacyLaddersResponse,\r\n LegacyMatchHistoryResponse,\r\n LegacyProfileResponse,\r\n LegacyRewardsResponse,\r\n} from './types';\r\n\r\n/**\r\n * Returns the legacy achievements for the specified region.\r\n * @param regionId The region ID for Starcraft.\r\n * @returns A resource representing the legacy achievements. See {@link LegacyAchievementsResponse}\r\n */\r\nexport function legacyAchievements(regionId: StarcraftRegion): Resource<LegacyAchievementsResponse> {\r\n return {\r\n path: `/sc2/legacy/data/achievements/${starcraftRegion[regionId]}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the ladder information for the specified ladder.\r\n * @param regionId The region ID for Starcraft.\r\n * @param ladderId The ID of the ladder.\r\n * @returns A resource representing the ladder. See {@link LadderResponse}\r\n */\r\nexport function legacyLadder(regionId: StarcraftRegion, ladderId: number): Resource<unknown> {\r\n return {\r\n path: `/sc2/legacy/ladder/${starcraftRegion[regionId]}/${ladderId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the ladders for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the ladders for the given profile. See {@link LegacyLaddersResponse}\r\n */\r\nexport function legacyLadders(\r\n regionId: StarcraftRegion,\r\n realmId: 1 | 2,\r\n profileId: number,\r\n): Resource<LegacyLaddersResponse> {\r\n return {\r\n path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladders`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the match history for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the match history for the given profile. See {@link LegacyMatchHistoryResponse}\r\n */\r\nexport function legacyMatchHistory(\r\n regionId: StarcraftRegion,\r\n realmId: 1 | 2,\r\n profileId: number,\r\n): Resource<LegacyMatchHistoryResponse> {\r\n return {\r\n path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/matches`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the profile for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the profile for the given ID. See {@link LegacyProfileResponse}\r\n */\r\nexport function legacyProfile(\r\n regionId: StarcraftRegion,\r\n realmId: 1 | 2,\r\n profileId: number,\r\n): Resource<LegacyProfileResponse> {\r\n return {\r\n path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the rewards for the specified region.\r\n * @param regionId The region ID for Starcraft.\r\n * @returns A resource representing the rewards for the given region. See {@link LegacyRewardsResponse}\r\n */\r\nexport function legacyRewards(regionId: StarcraftRegion): Resource<LegacyRewardsResponse> {\r\n return {\r\n path: `/sc2/legacy/data/rewards/${starcraftRegion[regionId]}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { starcraftRegion, type StarcraftRegion } from '../base';\r\nimport type { LadderResponse, LadderSummaryResponse, MetadataResponse, StaticProfileResponse } from './types';\r\n\r\n/**\r\n * Returns the ladder information for the specified profile and ladder.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @param ladderId The ID of the ladder.\r\n * @returns A resource representing the ladder. See {@link LadderResponse}\r\n */\r\nexport function ladder(\r\n regionId: StarcraftRegion,\r\n realmId: 1 | 2,\r\n profileId: number,\r\n ladderId: number,\r\n): Resource<LadderResponse> {\r\n return {\r\n path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/${ladderId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the ladder summary information for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the ladder summary. See {@link LadderSummaryResponse}\r\n */\r\nexport function ladderSummary(\r\n regionId: StarcraftRegion,\r\n realmId: 1 | 2,\r\n profileId: number,\r\n): Resource<LadderSummaryResponse> {\r\n return {\r\n path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/summary`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the metadata information for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the metadata. See {@link MetadataResponse}\r\n */\r\nexport function metadata(regionId: StarcraftRegion, realmId: 1 | 2, profileId: number): Resource<MetadataResponse> {\r\n return {\r\n path: `/sc2/metadata/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the profile information for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the profile. See {@link MetadataResponse}\r\n */\r\nexport function profile(regionId: StarcraftRegion, realmId: 1 | 2, profileId: number): Resource<MetadataResponse> {\r\n return {\r\n path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`,\r\n };\r\n}\r\n\r\n/**\r\n *\r\n * @param regionId The region ID for Starcraft.\r\n * @returns A resource representing the static profile. See {@link StaticProfileResponse}\r\n */\r\nexport function staticProfile(regionId: StarcraftRegion): Resource<StaticProfileResponse> {\r\n return {\r\n path: `/sc2/static/profile/${starcraftRegion[regionId]}`,\r\n };\r\n}\r\n","import { player } from './account/account';\r\nimport { grandmasterLeaderboard, season } from './ladder/ladder';\r\nimport { getLeagueData } from './league/league';\r\nimport {\r\n legacyAchievements,\r\n legacyLadder,\r\n legacyLadders,\r\n legacyMatchHistory,\r\n legacyProfile,\r\n legacyRewards,\r\n} from './legacy/legacy';\r\nimport { ladder, ladderSummary, metadata, profile, staticProfile } from './profile/profile';\r\n\r\nconst sc2 = {\r\n //Account\r\n player,\r\n //Ladder\r\n grandmasterLeaderboard,\r\n season,\r\n //League\r\n getLeagueData,\r\n //Legacy\r\n legacyAchievements,\r\n legacyLadder,\r\n legacyLadders,\r\n legacyMatchHistory,\r\n legacyProfile,\r\n legacyRewards,\r\n //Profile\r\n ladder,\r\n ladderSummary,\r\n metadata,\r\n profile,\r\n staticProfile,\r\n};\r\nexport default sc2;\r\nexport { sc2 };\r\n\r\n//Account\r\nexport * from './account/account';\r\n//Ladder\r\nexport * from './ladder/ladder';\r\nexport type * from './ladder/types';\r\n//League\r\nexport * from './league/league';\r\nexport type * from './league/types';\r\n//Legacy\r\nexport * from './legacy/legacy';\r\nexport type * from './legacy/types';\r\n//Profile\r\nexport * from './profile/profile';\r\nexport type * from './profile/types';\r\n"]}
1
+ {"version":3,"file":"index.js","names":["accountId: string","starcraftRegion: Record<StarcraftRegion, number>","regionId: StarcraftRegion","starcraftLeagueQueue: Record<StarcraftLeagueQueue, number>","starcraftLeagueTeam: Record<StarcraftLeagueTeamType, number>","starcraftLeagueId: Record<StarcraftLeagueId, number>","seasonId: string","queueId: StarcraftLeagueQueue","teamType: StarcraftLeagueTeamType","leagueId: StarcraftLeagueId","regionId: StarcraftRegion","ladderId: number","realmId: 1 | 2","profileId: number","regionId: StarcraftRegion","realmId: 1 | 2","profileId: number","ladderId: number"],"sources":["../src/account/account.ts","../src/base.ts","../src/ladder/ladder.ts","../src/league/league.ts","../src/legacy/legacy.ts","../src/profile/profile.ts","../src/index.ts"],"sourcesContent":["import type { Resource } from '@blizzard-api/core';\r\n\r\n/**\r\n * Returns the player information for the specified account ID.\r\n * @param accountId The account ID\r\n * @returns The player resource. See {@link Resource}.\r\n */\r\nexport function player(accountId: string): Resource<Array<unknown>> {\r\n return {\r\n path: `/sc2/player/${accountId}`,\r\n };\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\r\n//The region (1=US, 2=EU, 3=KO and TW, 5=CN).\r\nexport type StarcraftRegion = 'cn' | 'eu' | 'kr' | 'tw' | 'us';\r\n\r\nexport const starcraftRegion: Record<StarcraftRegion, number> = {\r\n cn: 5,\r\n eu: 2,\r\n kr: 3,\r\n tw: 3,\r\n us: 1,\r\n};\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { starcraftRegion, type StarcraftRegion } from '../base';\r\nimport type { GrandmasterLeaderboardResponse, SeasonResponse } from './types';\r\n\r\n/**\r\n * Returns the grandmaster leaderboard for the specified region.\r\n * @param regionId The region ID\r\n * @returns The grandmaster leaderboard resource. See {@link GrandmasterLeaderboardResponse}.\r\n */\r\nexport function grandmasterLeaderboard(regionId: StarcraftRegion): Resource<GrandmasterLeaderboardResponse> {\r\n return {\r\n path: `/sc2/ladder/grandmaster/${starcraftRegion[regionId]}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the season information for the specified region.\r\n * @param regionId The region ID\r\n * @returns The season resource. See {@link SeasonResponse}.\r\n */\r\nexport function season(regionId: StarcraftRegion): Resource<SeasonResponse> {\r\n return {\r\n path: `/sc2/ladder/season/${starcraftRegion[regionId]}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport type { LeagueDataResponse, StarcraftLeagueId, StarcraftLeagueQueue, StarcraftLeagueTeamType } from './types';\r\n\r\nconst starcraftLeagueQueue: Record<StarcraftLeagueQueue, number> = {\r\n 'hots-1v1': 101,\r\n 'hots-2v2': 102,\r\n 'hots-3v3': 103,\r\n 'hots-4v4': 104,\r\n 'lotv-1v1': 201,\r\n 'lotv-2v2': 202,\r\n 'lotv-3v3': 203,\r\n 'lotv-4v4': 204,\r\n 'lotv-archon': 206,\r\n 'wol-1v1': 1,\r\n 'wol-2v2': 2,\r\n 'wol-3v3': 3,\r\n 'wol-4v4': 4,\r\n};\r\n\r\nconst starcraftLeagueTeam: Record<StarcraftLeagueTeamType, number> = {\r\n arranged: 0,\r\n random: 1,\r\n};\r\n\r\nconst starcraftLeagueId: Record<StarcraftLeagueId, number> = {\r\n bronze: 0,\r\n diamond: 4,\r\n gold: 2,\r\n grandmaster: 6,\r\n master: 5,\r\n platinum: 3,\r\n silver: 1,\r\n};\r\n\r\n/**\r\n * Returns the league data for the specified season, queue, team type, and league.\r\n * @param seasonId The season ID\r\n * @param queueId The queue ID\r\n * @param teamType The team type\r\n * @param leagueId The league ID\r\n * @returns The league data resource. See {@link LeagueDataResponse}.\r\n */\r\nexport function getLeagueData(\r\n seasonId: string,\r\n queueId: StarcraftLeagueQueue,\r\n teamType: StarcraftLeagueTeamType,\r\n leagueId: StarcraftLeagueId,\r\n): Resource<LeagueDataResponse> {\r\n return {\r\n path: `/data/sc2/league/${seasonId}/${starcraftLeagueQueue[queueId]}/${starcraftLeagueTeam[teamType]}/${starcraftLeagueId[leagueId]}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { starcraftRegion, type StarcraftRegion } from '../base';\r\nimport type {\r\n LegacyAchievementsResponse,\r\n LegacyLaddersResponse,\r\n LegacyMatchHistoryResponse,\r\n LegacyProfileResponse,\r\n LegacyRewardsResponse,\r\n} from './types';\r\n\r\n/**\r\n * Returns the legacy achievements for the specified region.\r\n * @param regionId The region ID for Starcraft.\r\n * @returns A resource representing the legacy achievements. See {@link LegacyAchievementsResponse}\r\n */\r\nexport function legacyAchievements(regionId: StarcraftRegion): Resource<LegacyAchievementsResponse> {\r\n return {\r\n path: `/sc2/legacy/data/achievements/${starcraftRegion[regionId]}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the ladder information for the specified ladder.\r\n * @param regionId The region ID for Starcraft.\r\n * @param ladderId The ID of the ladder.\r\n * @returns A resource representing the ladder. See {@link LadderResponse}\r\n */\r\nexport function legacyLadder(regionId: StarcraftRegion, ladderId: number): Resource<unknown> {\r\n return {\r\n path: `/sc2/legacy/ladder/${starcraftRegion[regionId]}/${ladderId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the ladders for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the ladders for the given profile. See {@link LegacyLaddersResponse}\r\n */\r\nexport function legacyLadders(\r\n regionId: StarcraftRegion,\r\n realmId: 1 | 2,\r\n profileId: number,\r\n): Resource<LegacyLaddersResponse> {\r\n return {\r\n path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladders`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the match history for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the match history for the given profile. See {@link LegacyMatchHistoryResponse}\r\n */\r\nexport function legacyMatchHistory(\r\n regionId: StarcraftRegion,\r\n realmId: 1 | 2,\r\n profileId: number,\r\n): Resource<LegacyMatchHistoryResponse> {\r\n return {\r\n path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/matches`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the profile for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the profile for the given ID. See {@link LegacyProfileResponse}\r\n */\r\nexport function legacyProfile(\r\n regionId: StarcraftRegion,\r\n realmId: 1 | 2,\r\n profileId: number,\r\n): Resource<LegacyProfileResponse> {\r\n return {\r\n path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the rewards for the specified region.\r\n * @param regionId The region ID for Starcraft.\r\n * @returns A resource representing the rewards for the given region. See {@link LegacyRewardsResponse}\r\n */\r\nexport function legacyRewards(regionId: StarcraftRegion): Resource<LegacyRewardsResponse> {\r\n return {\r\n path: `/sc2/legacy/data/rewards/${starcraftRegion[regionId]}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { starcraftRegion, type StarcraftRegion } from '../base';\r\nimport type { LadderResponse, LadderSummaryResponse, MetadataResponse, StaticProfileResponse } from './types';\r\n\r\n/**\r\n * Returns the ladder information for the specified profile and ladder.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @param ladderId The ID of the ladder.\r\n * @returns A resource representing the ladder. See {@link LadderResponse}\r\n */\r\nexport function ladder(\r\n regionId: StarcraftRegion,\r\n realmId: 1 | 2,\r\n profileId: number,\r\n ladderId: number,\r\n): Resource<LadderResponse> {\r\n return {\r\n path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/${ladderId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the ladder summary information for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the ladder summary. See {@link LadderSummaryResponse}\r\n */\r\nexport function ladderSummary(\r\n regionId: StarcraftRegion,\r\n realmId: 1 | 2,\r\n profileId: number,\r\n): Resource<LadderSummaryResponse> {\r\n return {\r\n path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/summary`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the metadata information for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the metadata. See {@link MetadataResponse}\r\n */\r\nexport function metadata(regionId: StarcraftRegion, realmId: 1 | 2, profileId: number): Resource<MetadataResponse> {\r\n return {\r\n path: `/sc2/metadata/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`,\r\n };\r\n}\r\n\r\n/**\r\n * Returns the profile information for the specified profile.\r\n * @param regionId The region ID for Starcraft.\r\n * @param realmId 1 or 2\r\n * @param profileId The ID of the profile.\r\n * @returns A resource representing the profile. See {@link MetadataResponse}\r\n */\r\nexport function profile(regionId: StarcraftRegion, realmId: 1 | 2, profileId: number): Resource<MetadataResponse> {\r\n return {\r\n path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`,\r\n };\r\n}\r\n\r\n/**\r\n *\r\n * @param regionId The region ID for Starcraft.\r\n * @returns A resource representing the static profile. See {@link StaticProfileResponse}\r\n */\r\nexport function staticProfile(regionId: StarcraftRegion): Resource<StaticProfileResponse> {\r\n return {\r\n path: `/sc2/static/profile/${starcraftRegion[regionId]}`,\r\n };\r\n}\r\n","import { player } from './account/account';\r\nimport { grandmasterLeaderboard, season } from './ladder/ladder';\r\nimport { getLeagueData } from './league/league';\r\nimport {\r\n legacyAchievements,\r\n legacyLadder,\r\n legacyLadders,\r\n legacyMatchHistory,\r\n legacyProfile,\r\n legacyRewards,\r\n} from './legacy/legacy';\r\nimport { ladder, ladderSummary, metadata, profile, staticProfile } from './profile/profile';\r\n\r\nconst sc2 = {\r\n //Account\r\n player,\r\n //Ladder\r\n grandmasterLeaderboard,\r\n season,\r\n //League\r\n getLeagueData,\r\n //Legacy\r\n legacyAchievements,\r\n legacyLadder,\r\n legacyLadders,\r\n legacyMatchHistory,\r\n legacyProfile,\r\n legacyRewards,\r\n //Profile\r\n ladder,\r\n ladderSummary,\r\n metadata,\r\n profile,\r\n staticProfile,\r\n};\r\nexport default sc2;\r\nexport { sc2 };\r\n\r\n//Account\r\nexport * from './account/account';\r\n//Ladder\r\nexport * from './ladder/ladder';\r\nexport type * from './ladder/types';\r\n//League\r\nexport * from './league/league';\r\nexport type * from './league/types';\r\n//Legacy\r\nexport * from './legacy/legacy';\r\nexport type * from './legacy/types';\r\n//Profile\r\nexport * from './profile/profile';\r\nexport type * from './profile/types';\r\n"],"mappings":";;;;;;;;;;AAOA,SAAgB,OAAOA,WAA6C;AAClE,QAAO,EACL,OAAO,cAAc,UAAU,EAChC;AACF;;;;ACGD,MAAaC,kBAAmD;CAC9D,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACL;;;;;;;;;;;;;ACXD,SAAgB,uBAAuBC,UAAqE;AAC1G,QAAO,EACL,OAAO,0BAA0B,gBAAgB,UAAU,EAC5D;AACF;;;;;;;;;;AAOD,SAAgB,OAAOA,UAAqD;AAC1E,QAAO,EACL,OAAO,qBAAqB,gBAAgB,UAAU,EACvD;AACF;;;;ACrBD,MAAMC,uBAA6D;CACjE,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,eAAe;CACf,WAAW;CAC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S,EAC5F;AACF;;;;;;;;;;;;;;AASD,SAAgB,cACdH,UACAC,SACAC,WACiC;AACjC,QAAO,EACL,OAAO,eAAe,gBAAgB,UAAU,GAAG,QAAQ,GAAG,UAAU,iBACzE;AACF;;;;;;;;;;;;;;AASD,SAAgB,SAASF,UAA2BC,SAAgBC,WAA+C;AACjH,QAAO,EACL,OAAO,wBAAwB,gBAAgB,UAAU,GAAG,QAAQ,GAAG,UAAU,EAClF;AACF;;;;;;;;;;;;;;AASD,SAAgB,QAAQF,UAA2BC,SAAgBC,WAA+C;AAChH,QAAO,EACL,OAAO,eAAe,gBAAgB,UAAU,GAAG,QAAQ,GAAG,UAAU,EACzE;AACF;;;;;;;;;;AAOD,SAAgB,cAAcF,UAA4D;AACxF,QAAO,EACL,OAAO,sBAAsB,gBAAgB,UAAU,EACxD;AACF;;;;AC9DD,MAAM,MAAM;CAEV;CAEA;CACA;CAEA;CAEA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;AACD;AACD,kBAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blizzard-api/sc2",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "license": "MIT",
5
5
  "author": "Putro",
6
6
  "description": "A series of helpers to interact with the Starcraft II Blizzard API",
@@ -32,14 +32,14 @@
32
32
  ],
33
33
  "dependencies": {},
34
34
  "peerDependencies": {
35
- "@blizzard-api/core": "2.1.0"
35
+ "@blizzard-api/core": "2.1.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@blizzard-api/core": "2.1.0"
38
+ "@blizzard-api/core": "2.1.1"
39
39
  },
40
40
  "scripts": {
41
- "build": "tsup",
42
- "dev": "tsup --watch",
41
+ "build": "tsdown",
42
+ "dev": "tsdown --watch",
43
43
  "test": "vitest run",
44
44
  "test:coverage": "pnpm test -- --coverage",
45
45
  "test:watch": "vitest watch"