@blizzard-api/sc2 1.0.4 → 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/dist/index.d.ts CHANGED
@@ -1,52 +1,46 @@
1
- import { Resource } from '@blizzard-api/core';
1
+ import { Resource, ResponseBase } from "@blizzard-api/core";
2
2
 
3
+ //#region src/account/account.d.ts
3
4
  /**
4
5
  * Returns the player information for the specified account ID.
5
6
  * @param accountId The account ID
6
7
  * @returns The player resource. See {@link Resource}.
7
8
  */
8
9
  declare function player(accountId: string): Resource<Array<unknown>>;
9
-
10
- /**
11
- * Base interface for Blizzard API responses.
12
- */
13
- interface ResponseBase {
14
- _links: {
15
- self: {
16
- href: string;
17
- };
18
- };
19
- }
10
+ //#endregion
11
+ //#region src/regions.d.ts
20
12
  type StarcraftRegion = 'cn' | 'eu' | 'kr' | 'tw' | 'us';
21
-
13
+ //#endregion
14
+ //#region src/ladder/types.d.ts
22
15
  interface GrandmasterLeaderboardResponse {
23
- ladderTeams: Array<LadderTeam>;
16
+ ladderTeams: Array<LadderTeam>;
24
17
  }
25
18
  interface SeasonResponse {
26
- endDate: string;
27
- number: number;
28
- seasonId: number;
29
- startDate: string;
30
- year: number;
19
+ endDate: string;
20
+ number: number;
21
+ seasonId: number;
22
+ startDate: string;
23
+ year: number;
31
24
  }
32
25
  interface LadderTeam {
33
- joinTimestamp: number;
34
- losses: number;
35
- mmr: number;
36
- points: number;
37
- previousRank: number;
38
- teamMembers: Array<TeamMember>;
39
- wins: number;
26
+ joinTimestamp: number;
27
+ losses: number;
28
+ mmr: number;
29
+ points: number;
30
+ previousRank: number;
31
+ teamMembers: Array<TeamMember>;
32
+ wins: number;
40
33
  }
41
34
  interface TeamMember {
42
- clanTag?: string;
43
- displayName: string;
44
- favoriteRace: 'protoss' | 'random' | 'terran' | 'zerg';
45
- id: string;
46
- realm: number;
47
- region: number;
48
- }
49
-
35
+ clanTag?: string;
36
+ displayName: string;
37
+ favoriteRace: 'protoss' | 'random' | 'terran' | 'zerg';
38
+ id: string;
39
+ realm: number;
40
+ region: number;
41
+ }
42
+ //#endregion
43
+ //#region src/ladder/ladder.d.ts
50
44
  /**
51
45
  * Returns the grandmaster leaderboard for the specified region.
52
46
  * @param regionId The region ID
@@ -59,30 +53,32 @@ declare function grandmasterLeaderboard(regionId: StarcraftRegion): Resource<Gra
59
53
  * @returns The season resource. See {@link SeasonResponse}.
60
54
  */
61
55
  declare function season(regionId: StarcraftRegion): Resource<SeasonResponse>;
62
-
56
+ //#endregion
57
+ //#region src/league/types.d.ts
63
58
  interface LeagueDataResponse extends ResponseBase {
64
- key: Key;
65
- tier: Array<Tier>;
59
+ key: Key;
60
+ tier: Array<Tier>;
66
61
  }
67
62
  type StarcraftLeagueId = 'bronze' | 'diamond' | 'gold' | 'grandmaster' | 'master' | 'platinum' | 'silver';
68
63
  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
64
  type StarcraftLeagueTeamType = 'arranged' | 'random';
70
65
  interface Division {
71
- id: number;
72
- ladder_id: number;
73
- member_count: number;
66
+ id: number;
67
+ ladder_id: number;
68
+ member_count: number;
74
69
  }
75
70
  interface Key {
76
- league_id: number;
77
- queue_id: number;
78
- season_id: number;
79
- team_type: number;
71
+ league_id: number;
72
+ queue_id: number;
73
+ season_id: number;
74
+ team_type: number;
80
75
  }
81
76
  interface Tier {
82
- division: Array<Division>;
83
- id: number;
77
+ division: Array<Division>;
78
+ id: number;
84
79
  }
85
-
80
+ //#endregion
81
+ //#region src/league/league.d.ts
86
82
  /**
87
83
  * Returns the league data for the specified season, queue, team type, and league.
88
84
  * @param seasonId The season ID
@@ -92,132 +88,139 @@ interface Tier {
92
88
  * @returns The league data resource. See {@link LeagueDataResponse}.
93
89
  */
94
90
  declare function getLeagueData(seasonId: string, queueId: StarcraftLeagueQueue, teamType: StarcraftLeagueTeamType, leagueId: StarcraftLeagueId): Resource<LeagueDataResponse>;
95
-
91
+ //#endregion
92
+ //#region src/legacy/types.d.ts
96
93
  interface LegacyAchievementsResponse {
97
- achievements: Array<Achievement$1>;
98
- categories: Array<Category$1>;
94
+ achievements: Array<Achievement$1>;
95
+ categories: Array<Category$1>;
99
96
  }
100
97
  interface LegacyLaddersResponse {
101
- currentSeason: Array<unknown>;
102
- previousSeason: Array<unknown>;
103
- showcasePlacement: Array<unknown>;
98
+ currentSeason: Array<unknown>;
99
+ previousSeason: Array<unknown>;
100
+ showcasePlacement: Array<unknown>;
104
101
  }
105
102
  interface LegacyMatchHistoryResponse {
106
- matches: Array<Match>;
103
+ matches: Array<Match>;
107
104
  }
108
105
  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;
106
+ achievements: Achievements;
107
+ campaign: Campaign;
108
+ career: Career;
109
+ clanName: string;
110
+ clanTag: string;
111
+ displayName: string;
112
+ id: string;
113
+ portrait: Icon;
114
+ profilePath: string;
115
+ realm: number;
116
+ rewards: Rewards;
117
+ season: Season;
118
+ swarmLevels: SwarmLevels;
122
119
  }
123
120
  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>;
121
+ animations: Array<Animation>;
122
+ portraits: Array<Animation>;
123
+ protossDecals: Array<Animation>;
124
+ skins: Array<Animation>;
125
+ terranDecals: Array<Animation>;
126
+ zergDecals: Array<Animation>;
130
127
  }
131
128
  interface Achievement$1 {
132
- achievementId: string;
133
- categoryId: string;
134
- description: string;
135
- icon: Icon;
136
- points: number;
137
- title: string;
129
+ achievementId: string;
130
+ categoryId: string;
131
+ description: string;
132
+ icon: Icon;
133
+ points: number;
134
+ title: string;
138
135
  }
139
136
  interface Achievements {
140
- achievements: Array<{
141
- achievementId: string;
142
- completionDate: number;
143
- }>;
144
- points: Points;
137
+ achievements: Array<{
138
+ achievementId: string;
139
+ completionDate: number;
140
+ }>;
141
+ points: Points;
145
142
  }
146
143
  interface Animation {
147
- achievementId: string;
148
- command?: '/dance';
149
- icon: Icon;
150
- id: string;
151
- name?: string;
152
- title: string;
144
+ achievementId: string;
145
+ command?: '/dance';
146
+ icon: Icon;
147
+ id: string;
148
+ name?: string;
149
+ title: string;
153
150
  }
154
151
  interface Campaign {
155
- hots: string;
156
- wol: string;
152
+ hots: string;
153
+ wol: string;
157
154
  }
158
155
  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;
156
+ careerTotalGames: number;
157
+ highest1v1Rank: string;
158
+ highestTeamRank: string;
159
+ primaryRace: string;
160
+ protossWins: number;
161
+ seasonTotalGames: number;
162
+ terranWins: number;
163
+ zergWins: number;
167
164
  }
168
165
  interface Category$1 {
169
- categoryId: string;
170
- children?: Array<Category$1>;
171
- featuredAchievementId: string;
172
- title: string;
166
+ categoryId: string;
167
+ children?: Array<CategoryChild>;
168
+ featuredAchievementId: string;
169
+ title: string;
170
+ }
171
+ interface CategoryChild {
172
+ categoryId: string;
173
+ featuredAchievementId: string;
174
+ title: string;
173
175
  }
174
176
  interface Icon {
175
- h: number;
176
- offset: number;
177
- url: string;
178
- w: number;
179
- x: number;
180
- y: number;
177
+ h: number;
178
+ offset: number;
179
+ url: string;
180
+ w: number;
181
+ x: number;
182
+ y: number;
181
183
  }
182
184
  interface Match {
183
- date: number;
184
- decision: 'Left' | 'Loss' | 'Win';
185
- map: string;
186
- speed: 'Fast' | 'Faster';
187
- type: '2v2' | '3v3' | 'Co-Op' | 'Custom';
185
+ date: number;
186
+ decision: 'Left' | 'Loss' | 'Win';
187
+ map: string;
188
+ speed: 'Fast' | 'Faster';
189
+ type: '2v2' | '3v3' | 'Co-Op' | 'Custom';
188
190
  }
189
191
  interface Points {
190
- categoryPoints: Record<string, number>;
191
- totalPoints: number;
192
+ categoryPoints: Record<string, number>;
193
+ totalPoints: number;
192
194
  }
193
195
  interface Rewards {
194
- earned: Array<string>;
195
- selected: Array<string>;
196
+ earned: Array<string>;
197
+ selected: Array<string>;
196
198
  }
197
199
  interface Season {
198
- seasonId: number;
199
- seasonNumber: number;
200
- seasonYear: number;
201
- stats: Array<Stat>;
202
- totalGamesThisSeason: number;
200
+ seasonId: number;
201
+ seasonNumber: number;
202
+ seasonYear: number;
203
+ stats: Array<Stat>;
204
+ totalGamesThisSeason: number;
203
205
  }
204
206
  interface Stat {
205
- games: number;
206
- type: string;
207
- wins: number;
207
+ games: number;
208
+ type: string;
209
+ wins: number;
208
210
  }
209
211
  interface SwarmLevels {
210
- level: number;
211
- protoss: SwarmLevelsByRace;
212
- terran: SwarmLevelsByRace;
213
- zerg: SwarmLevelsByRace;
212
+ level: number;
213
+ protoss: SwarmLevelsByRace;
214
+ terran: SwarmLevelsByRace;
215
+ zerg: SwarmLevelsByRace;
214
216
  }
215
217
  interface SwarmLevelsByRace {
216
- currentLevelXP: number;
217
- level: number;
218
- totalLevelXP: number;
218
+ currentLevelXP: number;
219
+ level: number;
220
+ totalLevelXP: number;
219
221
  }
220
-
222
+ //#endregion
223
+ //#region src/legacy/legacy.d.ts
221
224
  /**
222
225
  * Returns the legacy achievements for the specified region.
223
226
  * @param regionId The region ID for Starcraft.
@@ -261,76 +264,78 @@ declare function legacyProfile(regionId: StarcraftRegion, realmId: 1 | 2, profil
261
264
  * @returns A resource representing the rewards for the given region. See {@link LegacyRewardsResponse}
262
265
  */
263
266
  declare function legacyRewards(regionId: StarcraftRegion): Resource<LegacyRewardsResponse>;
264
-
267
+ //#endregion
268
+ //#region src/profile/types.d.ts
265
269
  interface LadderResponse {
266
- allLadderMemberships: Array<unknown>;
267
- ladderTeams: Array<unknown>;
268
- ranksAndPools: Array<unknown>;
270
+ allLadderMemberships: Array<unknown>;
271
+ ladderTeams: Array<unknown>;
272
+ ranksAndPools: Array<unknown>;
269
273
  }
270
274
  interface LadderSummaryResponse {
271
- allLadderMemberships: Array<unknown>;
272
- placementMatches: Array<unknown>;
273
- showCaseEntries: Array<unknown>;
275
+ allLadderMemberships: Array<unknown>;
276
+ placementMatches: Array<unknown>;
277
+ showCaseEntries: Array<unknown>;
274
278
  }
275
279
  interface MetadataResponse {
276
- avatarUrl: string;
277
- name: string;
278
- profileId: string;
279
- profileUrl: string;
280
- realmId: number;
281
- regionId: number;
280
+ avatarUrl: string;
281
+ name: string;
282
+ profileId: string;
283
+ profileUrl: string;
284
+ realmId: number;
285
+ regionId: number;
282
286
  }
283
287
  interface StaticProfileResponse {
284
- achievements: Array<Achievement>;
285
- categories: Array<Category>;
286
- criteria: Array<Criterion>;
287
- rewards: Array<Reward>;
288
+ achievements: Array<Achievement>;
289
+ categories: Array<Category>;
290
+ criteria: Array<Criterion>;
291
+ rewards: Array<Reward>;
288
292
  }
289
293
  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;
294
+ categoryId: string;
295
+ chainAchievementIds: Array<string>;
296
+ chainRewardSize: number;
297
+ criteriaIds?: Array<string>;
298
+ description: string;
299
+ flags: number;
300
+ id: string;
301
+ imageUrl: string;
302
+ isChained: boolean;
303
+ points: number;
304
+ title: string;
305
+ uiOrderHint: number;
302
306
  }
303
307
  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;
308
+ childrenCategoryIds: Array<string>;
309
+ featuredAchievementId: string;
310
+ id: string;
311
+ medalTiers?: Array<number>;
312
+ name: string;
313
+ parentCategoryId: null | string;
314
+ points: number;
315
+ uiOrderHint: number;
312
316
  }
313
317
  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;
318
+ achievementId: string;
319
+ description: string;
320
+ evaluationClass: 'Achv' | 'Clnt' | 'S2Gm' | 'Sunk' | 'Trny';
321
+ flags: number;
322
+ id: string;
323
+ necessaryQuantity: number;
324
+ uiOrderHint: number;
321
325
  }
322
326
  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;
332
- }
333
-
327
+ achievementId?: string;
328
+ command?: '/dance';
329
+ flags: number;
330
+ id: string;
331
+ imageUrl: string;
332
+ isSkin: boolean;
333
+ name: string;
334
+ uiOrderHint: number;
335
+ unlockableType: string;
336
+ }
337
+ //#endregion
338
+ //#region src/profile/profile.d.ts
334
339
  /**
335
340
  * Returns the ladder information for the specified profile and ladder.
336
341
  * @param regionId The region ID for Starcraft.
@@ -370,23 +375,25 @@ declare function profile(regionId: StarcraftRegion, realmId: 1 | 2, profileId: n
370
375
  * @returns A resource representing the static profile. See {@link StaticProfileResponse}
371
376
  */
372
377
  declare function staticProfile(regionId: StarcraftRegion): Resource<StaticProfileResponse>;
373
-
378
+ //#endregion
379
+ //#region src/index.d.ts
374
380
  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;
381
+ player: typeof player;
382
+ grandmasterLeaderboard: typeof grandmasterLeaderboard;
383
+ season: typeof season;
384
+ getLeagueData: typeof getLeagueData;
385
+ legacyAchievements: typeof legacyAchievements;
386
+ legacyLadder: typeof legacyLadder;
387
+ legacyLadders: typeof legacyLadders;
388
+ legacyMatchHistory: typeof legacyMatchHistory;
389
+ legacyProfile: typeof legacyProfile;
390
+ legacyRewards: typeof legacyRewards;
391
+ ladder: typeof ladder;
392
+ ladderSummary: typeof ladderSummary;
393
+ metadata: typeof metadata;
394
+ profile: typeof profile;
395
+ staticProfile: typeof staticProfile;
390
396
  };
391
-
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 };
397
+ //#endregion
398
+ export { GrandmasterLeaderboardResponse, LadderResponse, LadderSummaryResponse, LeagueDataResponse, LegacyAchievementsResponse, LegacyLaddersResponse, LegacyMatchHistoryResponse, LegacyProfileResponse, LegacyRewardsResponse, MetadataResponse, SeasonResponse, StarcraftLeagueId, StarcraftLeagueQueue, StarcraftLeagueTeamType, StaticProfileResponse, sc2 as default, sc2, getLeagueData, grandmasterLeaderboard, ladder, ladderSummary, legacyAchievements, legacyLadder, legacyLadders, legacyMatchHistory, legacyProfile, legacyRewards, metadata, player, profile, season, staticProfile };
399
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,150 +1,214 @@
1
- // src/account/account.ts
1
+ //#region src/account/account.ts
2
+ /**
3
+ * Returns the player information for the specified account ID.
4
+ * @param accountId The account ID
5
+ * @returns The player resource. See {@link Resource}.
6
+ */
2
7
  function player(accountId) {
3
- return {
4
- path: `/sc2/player/${accountId}`
5
- };
8
+ return { path: `/sc2/player/${accountId}` };
6
9
  }
7
10
 
8
- // src/base.ts
9
- var starcraftRegion = {
10
- cn: 5,
11
- eu: 2,
12
- kr: 3,
13
- tw: 3,
14
- us: 1
11
+ //#endregion
12
+ //#region src/regions.ts
13
+ const starcraftRegion = {
14
+ cn: 5,
15
+ eu: 2,
16
+ kr: 3,
17
+ tw: 3,
18
+ us: 1
15
19
  };
16
20
 
17
- // src/ladder/ladder.ts
21
+ //#endregion
22
+ //#region src/ladder/ladder.ts
23
+ /**
24
+ * Returns the grandmaster leaderboard for the specified region.
25
+ * @param regionId The region ID
26
+ * @returns The grandmaster leaderboard resource. See {@link GrandmasterLeaderboardResponse}.
27
+ */
18
28
  function grandmasterLeaderboard(regionId) {
19
- return {
20
- path: `/sc2/ladder/grandmaster/${starcraftRegion[regionId]}`
21
- };
29
+ return { path: `/sc2/ladder/grandmaster/${starcraftRegion[regionId]}` };
22
30
  }
31
+ /**
32
+ * Returns the season information for the specified region.
33
+ * @param regionId The region ID
34
+ * @returns The season resource. See {@link SeasonResponse}.
35
+ */
23
36
  function season(regionId) {
24
- return {
25
- path: `/sc2/ladder/season/${starcraftRegion[regionId]}`
26
- };
37
+ return { path: `/sc2/ladder/season/${starcraftRegion[regionId]}` };
27
38
  }
28
39
 
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
40
+ //#endregion
41
+ //#region src/league/league.ts
42
+ const starcraftLeagueQueue = {
43
+ "hots-1v1": 101,
44
+ "hots-2v2": 102,
45
+ "hots-3v3": 103,
46
+ "hots-4v4": 104,
47
+ "lotv-1v1": 201,
48
+ "lotv-2v2": 202,
49
+ "lotv-3v3": 203,
50
+ "lotv-4v4": 204,
51
+ "lotv-archon": 206,
52
+ "wol-1v1": 1,
53
+ "wol-2v2": 2,
54
+ "wol-3v3": 3,
55
+ "wol-4v4": 4
44
56
  };
45
- var starcraftLeagueTeam = {
46
- arranged: 0,
47
- random: 1
57
+ const starcraftLeagueTeam = {
58
+ arranged: 0,
59
+ random: 1
48
60
  };
49
- var starcraftLeagueId = {
50
- bronze: 0,
51
- diamond: 4,
52
- gold: 2,
53
- grandmaster: 6,
54
- master: 5,
55
- platinum: 3,
56
- silver: 1
61
+ const starcraftLeagueId = {
62
+ bronze: 0,
63
+ diamond: 4,
64
+ gold: 2,
65
+ grandmaster: 6,
66
+ master: 5,
67
+ platinum: 3,
68
+ silver: 1
57
69
  };
70
+ /**
71
+ * Returns the league data for the specified season, queue, team type, and league.
72
+ * @param seasonId The season ID
73
+ * @param queueId The queue ID
74
+ * @param teamType The team type
75
+ * @param leagueId The league ID
76
+ * @returns The league data resource. See {@link LeagueDataResponse}.
77
+ */
58
78
  function getLeagueData(seasonId, queueId, teamType, leagueId) {
59
- return {
60
- path: `/data/sc2/league/${seasonId}/${starcraftLeagueQueue[queueId]}/${starcraftLeagueTeam[teamType]}/${starcraftLeagueId[leagueId]}`
61
- };
79
+ return { path: `/data/sc2/league/${seasonId}/${starcraftLeagueQueue[queueId]}/${starcraftLeagueTeam[teamType]}/${starcraftLeagueId[leagueId]}` };
62
80
  }
63
81
 
64
- // src/legacy/legacy.ts
82
+ //#endregion
83
+ //#region src/legacy/legacy.ts
84
+ /**
85
+ * Returns the legacy achievements for the specified region.
86
+ * @param regionId The region ID for Starcraft.
87
+ * @returns A resource representing the legacy achievements. See {@link LegacyAchievementsResponse}
88
+ */
65
89
  function legacyAchievements(regionId) {
66
- return {
67
- path: `/sc2/legacy/data/achievements/${starcraftRegion[regionId]}`
68
- };
90
+ return { path: `/sc2/legacy/data/achievements/${starcraftRegion[regionId]}` };
69
91
  }
92
+ /**
93
+ * Returns the ladder information for the specified ladder.
94
+ * @param regionId The region ID for Starcraft.
95
+ * @param ladderId The ID of the ladder.
96
+ * @returns A resource representing the ladder. See {@link LadderResponse}
97
+ */
70
98
  function legacyLadder(regionId, ladderId) {
71
- return {
72
- path: `/sc2/legacy/ladder/${starcraftRegion[regionId]}/${ladderId}`
73
- };
99
+ return { path: `/sc2/legacy/ladder/${starcraftRegion[regionId]}/${ladderId}` };
74
100
  }
101
+ /**
102
+ * Returns the ladders for the specified profile.
103
+ * @param regionId The region ID for Starcraft.
104
+ * @param realmId 1 or 2
105
+ * @param profileId The ID of the profile.
106
+ * @returns A resource representing the ladders for the given profile. See {@link LegacyLaddersResponse}
107
+ */
75
108
  function legacyLadders(regionId, realmId, profileId) {
76
- return {
77
- path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladders`
78
- };
109
+ return { path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladders` };
79
110
  }
111
+ /**
112
+ * Returns the match history for the specified profile.
113
+ * @param regionId The region ID for Starcraft.
114
+ * @param realmId 1 or 2
115
+ * @param profileId The ID of the profile.
116
+ * @returns A resource representing the match history for the given profile. See {@link LegacyMatchHistoryResponse}
117
+ */
80
118
  function legacyMatchHistory(regionId, realmId, profileId) {
81
- return {
82
- path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/matches`
83
- };
119
+ return { path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/matches` };
84
120
  }
121
+ /**
122
+ * Returns the profile for the specified profile.
123
+ * @param regionId The region ID for Starcraft.
124
+ * @param realmId 1 or 2
125
+ * @param profileId The ID of the profile.
126
+ * @returns A resource representing the profile for the given ID. See {@link LegacyProfileResponse}
127
+ */
85
128
  function legacyProfile(regionId, realmId, profileId) {
86
- return {
87
- path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`
88
- };
129
+ return { path: `/sc2/legacy/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}` };
89
130
  }
131
+ /**
132
+ * Returns the rewards for the specified region.
133
+ * @param regionId The region ID for Starcraft.
134
+ * @returns A resource representing the rewards for the given region. See {@link LegacyRewardsResponse}
135
+ */
90
136
  function legacyRewards(regionId) {
91
- return {
92
- path: `/sc2/legacy/data/rewards/${starcraftRegion[regionId]}`
93
- };
137
+ return { path: `/sc2/legacy/data/rewards/${starcraftRegion[regionId]}` };
94
138
  }
95
139
 
96
- // src/profile/profile.ts
140
+ //#endregion
141
+ //#region src/profile/profile.ts
142
+ /**
143
+ * Returns the ladder information for the specified profile and ladder.
144
+ * @param regionId The region ID for Starcraft.
145
+ * @param realmId 1 or 2
146
+ * @param profileId The ID of the profile.
147
+ * @param ladderId The ID of the ladder.
148
+ * @returns A resource representing the ladder. See {@link LadderResponse}
149
+ */
97
150
  function ladder(regionId, realmId, profileId, ladderId) {
98
- return {
99
- path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/${ladderId}`
100
- };
151
+ return { path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/${ladderId}` };
101
152
  }
153
+ /**
154
+ * Returns the ladder summary information for the specified profile.
155
+ * @param regionId The region ID for Starcraft.
156
+ * @param realmId 1 or 2
157
+ * @param profileId The ID of the profile.
158
+ * @returns A resource representing the ladder summary. See {@link LadderSummaryResponse}
159
+ */
102
160
  function ladderSummary(regionId, realmId, profileId) {
103
- return {
104
- path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/summary`
105
- };
161
+ return { path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}/ladder/summary` };
106
162
  }
163
+ /**
164
+ * Returns the metadata information for the specified profile.
165
+ * @param regionId The region ID for Starcraft.
166
+ * @param realmId 1 or 2
167
+ * @param profileId The ID of the profile.
168
+ * @returns A resource representing the metadata. See {@link MetadataResponse}
169
+ */
107
170
  function metadata(regionId, realmId, profileId) {
108
- return {
109
- path: `/sc2/metadata/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`
110
- };
171
+ return { path: `/sc2/metadata/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}` };
111
172
  }
173
+ /**
174
+ * Returns the profile information for the specified profile.
175
+ * @param regionId The region ID for Starcraft.
176
+ * @param realmId 1 or 2
177
+ * @param profileId The ID of the profile.
178
+ * @returns A resource representing the profile. See {@link MetadataResponse}
179
+ */
112
180
  function profile(regionId, realmId, profileId) {
113
- return {
114
- path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}`
115
- };
181
+ return { path: `/sc2/profile/${starcraftRegion[regionId]}/${realmId}/${profileId}` };
116
182
  }
183
+ /**
184
+ *
185
+ * @param regionId The region ID for Starcraft.
186
+ * @returns A resource representing the static profile. See {@link StaticProfileResponse}
187
+ */
117
188
  function staticProfile(regionId) {
118
- return {
119
- path: `/sc2/static/profile/${starcraftRegion[regionId]}`
120
- };
189
+ return { path: `/sc2/static/profile/${starcraftRegion[regionId]}` };
121
190
  }
122
191
 
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
192
+ //#endregion
193
+ //#region src/index.ts
194
+ const sc2 = {
195
+ player,
196
+ grandmasterLeaderboard,
197
+ season,
198
+ getLeagueData,
199
+ legacyAchievements,
200
+ legacyLadder,
201
+ legacyLadders,
202
+ legacyMatchHistory,
203
+ legacyProfile,
204
+ legacyRewards,
205
+ ladder,
206
+ ladderSummary,
207
+ metadata,
208
+ profile,
209
+ staticProfile
145
210
  };
146
- var src_default = sc2;
147
211
 
148
- 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
212
+ //#endregion
213
+ export { sc2 as default, sc2, getLeagueData, grandmasterLeaderboard, ladder, ladderSummary, legacyAchievements, legacyLadder, legacyLadders, legacyMatchHistory, legacyProfile, legacyRewards, metadata, player, profile, season, staticProfile };
150
214
  //# 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":"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","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":[],"sources":["../src/account/account.ts","../src/regions.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","//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 } from '../regions';\r\nimport type { StarcraftRegion } from '../regions';\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 } from '../regions';\r\nimport type { StarcraftRegion } from '../regions';\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 } from '../regions';\r\nimport type { StarcraftRegion } from '../regions';\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,OAAO,WAA6C;AAClE,QAAO,EACL,MAAM,eAAe,aACtB;;;;;ACPH,MAAa,kBAAmD;CAC9D,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;;;;;;;;;ACCD,SAAgB,uBAAuB,UAAqE;AAC1G,QAAO,EACL,MAAM,2BAA2B,gBAAgB,aAClD;;;;;;;AAQH,SAAgB,OAAO,UAAqD;AAC1E,QAAO,EACL,MAAM,sBAAsB,gBAAgB,aAC7C;;;;;ACrBH,MAAM,uBAA6D;CACjE,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,eAAe;CACf,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACZ;AAED,MAAM,sBAA+D;CACnE,UAAU;CACV,QAAQ;CACT;AAED,MAAM,oBAAuD;CAC3D,QAAQ;CACR,SAAS;CACT,MAAM;CACN,aAAa;CACb,QAAQ;CACR,UAAU;CACV,QAAQ;CACT;;;;;;;;;AAUD,SAAgB,cACd,UACA,SACA,UACA,UAC8B;AAC9B,QAAO,EACL,MAAM,oBAAoB,SAAS,GAAG,qBAAqB,SAAS,GAAG,oBAAoB,UAAU,GAAG,kBAAkB,aAC3H;;;;;;;;;;AClCH,SAAgB,mBAAmB,UAAiE;AAClG,QAAO,EACL,MAAM,iCAAiC,gBAAgB,aACxD;;;;;;;;AASH,SAAgB,aAAa,UAA2B,UAAqC;AAC3F,QAAO,EACL,MAAM,sBAAsB,gBAAgB,UAAU,GAAG,YAC1D;;;;;;;;;AAUH,SAAgB,cACd,UACA,SACA,WACiC;AACjC,QAAO,EACL,MAAM,uBAAuB,gBAAgB,UAAU,GAAG,QAAQ,GAAG,UAAU,WAChF;;;;;;;;;AAUH,SAAgB,mBACd,UACA,SACA,WACsC;AACtC,QAAO,EACL,MAAM,uBAAuB,gBAAgB,UAAU,GAAG,QAAQ,GAAG,UAAU,WAChF;;;;;;;;;AAUH,SAAgB,cACd,UACA,SACA,WACiC;AACjC,QAAO,EACL,MAAM,uBAAuB,gBAAgB,UAAU,GAAG,QAAQ,GAAG,aACtE;;;;;;;AAQH,SAAgB,cAAc,UAA4D;AACxF,QAAO,EACL,MAAM,4BAA4B,gBAAgB,aACnD;;;;;;;;;;;;;AChFH,SAAgB,OACd,UACA,SACA,WACA,UAC0B;AAC1B,QAAO,EACL,MAAM,gBAAgB,gBAAgB,UAAU,GAAG,QAAQ,GAAG,UAAU,UAAU,YACnF;;;;;;;;;AAUH,SAAgB,cACd,UACA,SACA,WACiC;AACjC,QAAO,EACL,MAAM,gBAAgB,gBAAgB,UAAU,GAAG,QAAQ,GAAG,UAAU,kBACzE;;;;;;;;;AAUH,SAAgB,SAAS,UAA2B,SAAgB,WAA+C;AACjH,QAAO,EACL,MAAM,yBAAyB,gBAAgB,UAAU,GAAG,QAAQ,GAAG,aACxE;;;;;;;;;AAUH,SAAgB,QAAQ,UAA2B,SAAgB,WAA+C;AAChH,QAAO,EACL,MAAM,gBAAgB,gBAAgB,UAAU,GAAG,QAAQ,GAAG,aAC/D;;;;;;;AAQH,SAAgB,cAAc,UAA4D;AACxF,QAAO,EACL,MAAM,uBAAuB,gBAAgB,aAC9C;;;;;AC9DH,MAAM,MAAM;CAEV;CAEA;CACA;CAEA;CAEA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACD"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@blizzard-api/sc2",
3
- "version": "1.0.4",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "author": "Putro",
6
6
  "description": "A series of helpers to interact with the Starcraft II Blizzard API",
7
7
  "repository": "https://github.com/Pewtro/blizzard-api/tree/main/packages/sc2",
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",
@@ -32,14 +32,14 @@
32
32
  ],
33
33
  "dependencies": {},
34
34
  "peerDependencies": {
35
- "@blizzard-api/core": "2.1.0"
35
+ "@blizzard-api/core": "3.0.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@blizzard-api/core": "2.1.0"
38
+ "@blizzard-api/core": "3.0.0"
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"