@wardbox/whisper 0.2.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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -0
  3. package/dist/client-B7r2KpHz.js +838 -0
  4. package/dist/client-CxR21ld-.cjs +913 -0
  5. package/dist/client-DrrSDGBt.d.cts +181 -0
  6. package/dist/client-DrrSDGBt.d.cts.map +1 -0
  7. package/dist/client-Xu0AwrUw.d.ts +181 -0
  8. package/dist/client-Xu0AwrUw.d.ts.map +1 -0
  9. package/dist/core/index.cjs +15 -0
  10. package/dist/core/index.d.cts +208 -0
  11. package/dist/core/index.d.cts.map +1 -0
  12. package/dist/core/index.d.ts +208 -0
  13. package/dist/core/index.d.ts.map +1 -0
  14. package/dist/core/index.js +2 -0
  15. package/dist/errors-7wdVIL5Y.d.cts +111 -0
  16. package/dist/errors-7wdVIL5Y.d.cts.map +1 -0
  17. package/dist/errors-DofVFslx.d.ts +111 -0
  18. package/dist/errors-DofVFslx.d.ts.map +1 -0
  19. package/dist/index.cjs +8 -0
  20. package/dist/index.d.cts +3 -0
  21. package/dist/index.d.ts +3 -0
  22. package/dist/index.js +2 -0
  23. package/dist/lol/index.cjs +436 -0
  24. package/dist/lol/index.d.cts +7232 -0
  25. package/dist/lol/index.d.cts.map +1 -0
  26. package/dist/lol/index.d.ts +7232 -0
  27. package/dist/lol/index.d.ts.map +1 -0
  28. package/dist/lol/index.js +425 -0
  29. package/dist/lor/index.cjs +44 -0
  30. package/dist/lor/index.d.cts +159 -0
  31. package/dist/lor/index.d.cts.map +1 -0
  32. package/dist/lor/index.d.ts +159 -0
  33. package/dist/lor/index.d.ts.map +1 -0
  34. package/dist/lor/index.js +44 -0
  35. package/dist/riftbound/index.cjs +25 -0
  36. package/dist/riftbound/index.d.cts +97 -0
  37. package/dist/riftbound/index.d.cts.map +1 -0
  38. package/dist/riftbound/index.d.ts +97 -0
  39. package/dist/riftbound/index.d.ts.map +1 -0
  40. package/dist/riftbound/index.js +26 -0
  41. package/dist/riot/index.cjs +31 -0
  42. package/dist/riot/index.d.cts +101 -0
  43. package/dist/riot/index.d.cts.map +1 -0
  44. package/dist/riot/index.d.ts +101 -0
  45. package/dist/riot/index.d.ts.map +1 -0
  46. package/dist/riot/index.js +32 -0
  47. package/dist/tft/index.cjs +152 -0
  48. package/dist/tft/index.d.cts +581 -0
  49. package/dist/tft/index.d.cts.map +1 -0
  50. package/dist/tft/index.d.ts +581 -0
  51. package/dist/tft/index.d.ts.map +1 -0
  52. package/dist/tft/index.js +149 -0
  53. package/dist/val/index.cjs +166 -0
  54. package/dist/val/index.d.cts +952 -0
  55. package/dist/val/index.d.cts.map +1 -0
  56. package/dist/val/index.d.ts +952 -0
  57. package/dist/val/index.d.ts.map +1 -0
  58. package/dist/val/index.js +161 -0
  59. package/package.json +137 -0
@@ -0,0 +1,149 @@
1
+ //#region src/tft/spectator-tft-v5.ts
2
+ /**
3
+ * TFT Spectator API (v5).
4
+ *
5
+ * Access live TFT game data. Use this to check if a player is currently
6
+ * in a TFT game.
7
+ *
8
+ * All methods require a {@link PlatformRoute} (e.g., 'na1', 'euw1').
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { spectatorTftV5 } from '@wardbox/whisper/tft';
13
+ *
14
+ * const game = await spectatorTftV5.getCurrentGame(client, 'na1', puuid);
15
+ * console.log(`In TFT game on map ${game.mapId}`);
16
+ * ```
17
+ */
18
+ const spectatorTftV5 = { async getCurrentGame(client, route, puuid) {
19
+ return (await client.request(route, `/lol/spectator/tft/v5/active-games/by-puuid/${encodeURIComponent(puuid)}`, "spectator-tft-v5.getCurrentGame")).data;
20
+ } };
21
+ //#endregion
22
+ //#region src/tft/tft-league-v1.ts
23
+ /**
24
+ * TFT League API (v1).
25
+ *
26
+ * Query TFT ranked league standings, entries by PUUID, and full league data
27
+ * for challenger/grandmaster/master tiers. Also includes top-rated ladder
28
+ * for Hyper Roll and Double Up queues.
29
+ *
30
+ * All methods require a {@link PlatformRoute} (e.g., 'na1', 'euw1').
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * import { tftLeagueV1 } from '@wardbox/whisper/tft';
35
+ *
36
+ * const challenger = await tftLeagueV1.getChallengerLeague(client, 'na1');
37
+ * console.log(challenger.entries.length);
38
+ * ```
39
+ */
40
+ const tftLeagueV1 = {
41
+ async getChallengerLeague(client, route, options) {
42
+ const params = options?.queue !== void 0 ? { queue: options.queue } : void 0;
43
+ return (await client.request(route, "/tft/league/v1/challenger", "tft-league-v1.getChallengerLeague", params ? { params } : void 0)).data;
44
+ },
45
+ async getGrandmasterLeague(client, route, options) {
46
+ const params = options?.queue !== void 0 ? { queue: options.queue } : void 0;
47
+ return (await client.request(route, "/tft/league/v1/grandmaster", "tft-league-v1.getGrandmasterLeague", params ? { params } : void 0)).data;
48
+ },
49
+ async getMasterLeague(client, route, options) {
50
+ const params = options?.queue !== void 0 ? { queue: options.queue } : void 0;
51
+ return (await client.request(route, "/tft/league/v1/master", "tft-league-v1.getMasterLeague", params ? { params } : void 0)).data;
52
+ },
53
+ async getLeagueEntriesByPuuid(client, route, puuid, options) {
54
+ const params = options?.queue !== void 0 ? { queue: options.queue } : void 0;
55
+ return (await client.request(route, `/tft/league/v1/by-puuid/${encodeURIComponent(puuid)}`, "tft-league-v1.getLeagueEntriesByPuuid", params ? { params } : void 0)).data;
56
+ },
57
+ async getLeagueEntries(client, route, tier, division, options) {
58
+ const params = {};
59
+ if (options) {
60
+ if (options.queue !== void 0) params.queue = options.queue;
61
+ if (options.page !== void 0) params.page = String(options.page);
62
+ }
63
+ return (await client.request(route, `/tft/league/v1/entries/${encodeURIComponent(tier)}/${encodeURIComponent(division)}`, "tft-league-v1.getLeagueEntries", Object.keys(params).length > 0 ? { params } : void 0)).data;
64
+ },
65
+ async getLeagueById(client, route, leagueId) {
66
+ return (await client.request(route, `/tft/league/v1/leagues/${encodeURIComponent(leagueId)}`, "tft-league-v1.getLeagueById")).data;
67
+ },
68
+ async getTopRatedLadder(client, route, queue) {
69
+ return (await client.request(route, `/tft/league/v1/rated-ladders/${encodeURIComponent(queue)}/top`, "tft-league-v1.getTopRatedLadder")).data;
70
+ }
71
+ };
72
+ //#endregion
73
+ //#region src/tft/tft-match-v1.ts
74
+ /**
75
+ * TFT Match API (v1).
76
+ *
77
+ * Retrieve TFT match history and match details by PUUID or match ID.
78
+ *
79
+ * All methods require a {@link RegionalRoute} (americas, europe, asia, sea).
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * import { tftMatchV1 } from '@wardbox/whisper/tft';
84
+ *
85
+ * const matchIds = await tftMatchV1.getMatchIdsByPuuid(client, 'americas', 'puuid-123');
86
+ * const match = await tftMatchV1.getMatch(client, 'americas', matchIds[0]);
87
+ * ```
88
+ */
89
+ const tftMatchV1 = {
90
+ async getMatchIdsByPuuid(client, route, puuid, options) {
91
+ const params = {};
92
+ if (options) {
93
+ for (const [key, value] of Object.entries(options)) if (value !== void 0) params[key] = String(value);
94
+ }
95
+ return (await client.request(route, `/tft/match/v1/matches/by-puuid/${encodeURIComponent(puuid)}/ids`, "tft-match-v1.getMatchIdsByPuuid", Object.keys(params).length > 0 ? { params } : void 0)).data;
96
+ },
97
+ async getMatch(client, route, matchId) {
98
+ return (await client.request(route, `/tft/match/v1/matches/${encodeURIComponent(matchId)}`, "tft-match-v1.getMatch")).data;
99
+ }
100
+ };
101
+ //#endregion
102
+ //#region src/tft/tft-status-v1.ts
103
+ /**
104
+ * TFT Status API (v1).
105
+ *
106
+ * Retrieve TFT platform status information including incidents and maintenances.
107
+ *
108
+ * All methods require a {@link PlatformRoute} (e.g., 'na1', 'euw1').
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * import { tftStatusV1 } from '@wardbox/whisper/tft';
113
+ *
114
+ * const status = await tftStatusV1.getPlatformData(client, 'na1');
115
+ * console.log(status.name, status.incidents.length);
116
+ * ```
117
+ */
118
+ const tftStatusV1 = { async getPlatformData(client, route) {
119
+ return (await client.request(route, "/tft/status/v1/platform-data", "tft-status-v1.getPlatformData")).data;
120
+ } };
121
+ //#endregion
122
+ //#region src/tft/tft-summoner-v1.ts
123
+ /**
124
+ * TFT Summoner API (v1).
125
+ *
126
+ * Access TFT summoner data by PUUID or RSO access token.
127
+ *
128
+ * All methods require a {@link PlatformRoute} (e.g., 'na1', 'euw1').
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * import { tftSummonerV1 } from '@wardbox/whisper/tft';
133
+ *
134
+ * const summoner = await tftSummonerV1.getByPuuid(client, 'na1', puuid);
135
+ * console.log(summoner.summonerLevel);
136
+ * ```
137
+ */
138
+ const tftSummonerV1 = {
139
+ async getByPuuid(client, route, puuid) {
140
+ return (await client.request(route, `/tft/summoner/v1/summoners/by-puuid/${encodeURIComponent(puuid)}`, "tft-summoner-v1.getByPuuid")).data;
141
+ },
142
+ async getByAccessToken(client, route, accessToken) {
143
+ return (await client.request(route, "/tft/summoner/v1/summoners/me", "tft-summoner-v1.getByAccessToken", { headers: { Authorization: `Bearer ${accessToken}` } })).data;
144
+ }
145
+ };
146
+ //#endregion
147
+ export { spectatorTftV5, tftLeagueV1, tftMatchV1, tftStatusV1, tftSummonerV1 };
148
+
149
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,166 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/types/val-platform.ts
3
+ /** Valorant platform routing constants for IDE discoverability */
4
+ const VAL_PLATFORM = {
5
+ AP: "ap",
6
+ BR: "br",
7
+ EU: "eu",
8
+ KR: "kr",
9
+ LATAM: "latam",
10
+ NA: "na",
11
+ ESPORTS: "esports"
12
+ };
13
+ //#endregion
14
+ //#region src/val/val-console-match-v1.ts
15
+ /**
16
+ * Valorant Console Match API (v1).
17
+ *
18
+ * Retrieve match details and match history for Valorant console players.
19
+ * Console endpoints require a `platformType` parameter for matchlist
20
+ * and leaderboard queries.
21
+ *
22
+ * All methods require a {@link ValPlatformRoute} (e.g., 'na', 'eu', 'ap').
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import { valConsoleMatchV1 } from '@wardbox/whisper/val';
27
+ *
28
+ * const match = await valConsoleMatchV1.getMatch(client, 'na', 'match-id-123');
29
+ * const matchlist = await valConsoleMatchV1.getMatchlist(client, 'na', 'puuid-123', 'playstation');
30
+ * ```
31
+ */
32
+ const valConsoleMatchV1 = {
33
+ async getMatch(client, route, matchId) {
34
+ return (await client.request(route, `/val/match/console/v1/matches/${encodeURIComponent(matchId)}`, "val-console-match-v1.getMatch")).data;
35
+ },
36
+ async getMatchlist(client, route, puuid, platformType) {
37
+ return (await client.request(route, `/val/match/console/v1/matchlists/by-puuid/${encodeURIComponent(puuid)}`, "val-console-match-v1.getMatchlist", { params: { platformType } })).data;
38
+ },
39
+ async getRecentMatches(client, route, queue) {
40
+ return (await client.request(route, `/val/match/console/v1/recent-matches/by-queue/${encodeURIComponent(queue)}`, "val-console-match-v1.getRecentMatches")).data;
41
+ }
42
+ };
43
+ //#endregion
44
+ //#region src/val/val-console-ranked-v1.ts
45
+ /**
46
+ * Valorant Console Ranked API (v1).
47
+ *
48
+ * Retrieve competitive leaderboard data for console players by act.
49
+ * Console leaderboard queries require a `platformType` parameter.
50
+ *
51
+ * All methods require a {@link ValPlatformRoute} (e.g., 'na', 'eu', 'ap').
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * import { valConsoleRankedV1 } from '@wardbox/whisper/val';
56
+ *
57
+ * const lb = await valConsoleRankedV1.getLeaderboard(client, 'na', 'act-id', 'playstation');
58
+ * console.log(lb.totalPlayers, 'console ranked players');
59
+ * ```
60
+ */
61
+ const valConsoleRankedV1 = { async getLeaderboard(client, route, actId, platformType, options) {
62
+ const params = { platformType };
63
+ if (options?.size !== void 0) params.size = String(options.size);
64
+ if (options?.startIndex !== void 0) params.startIndex = String(options.startIndex);
65
+ return (await client.request(route, `/val/console/ranked/v1/leaderboards/by-act/${encodeURIComponent(actId)}`, "val-console-ranked-v1.getLeaderboard", { params })).data;
66
+ } };
67
+ //#endregion
68
+ //#region src/val/val-content-v1.ts
69
+ /**
70
+ * Valorant Content API (v1).
71
+ *
72
+ * Retrieve game content including agents, maps, game modes, and cosmetics.
73
+ *
74
+ * All methods require a {@link ValPlatformRoute} (e.g., 'na', 'eu', 'ap').
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * import { valContentV1 } from '@wardbox/whisper/val';
79
+ *
80
+ * const content = await valContentV1.getContent(client, 'na');
81
+ * console.log(content.characters.length, 'agents available');
82
+ * ```
83
+ */
84
+ const valContentV1 = { async getContent(client, route, options) {
85
+ const params = options?.locale ? { locale: options.locale } : void 0;
86
+ return (await client.request(route, "/val/content/v1/contents", "val-content-v1.getContent", params ? { params } : void 0)).data;
87
+ } };
88
+ //#endregion
89
+ //#region src/val/val-match-v1.ts
90
+ /**
91
+ * Valorant Match API (v1).
92
+ *
93
+ * Retrieve match details, match history, and recent matches for Valorant.
94
+ *
95
+ * All methods require a {@link ValPlatformRoute} (e.g., 'na', 'eu', 'ap').
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * import { valMatchV1 } from '@wardbox/whisper/val';
100
+ *
101
+ * const match = await valMatchV1.getMatch(client, 'na', 'match-id-123');
102
+ * const matchlist = await valMatchV1.getMatchlist(client, 'na', 'puuid-123');
103
+ * ```
104
+ */
105
+ const valMatchV1 = {
106
+ async getMatch(client, route, matchId) {
107
+ return (await client.request(route, `/val/match/v1/matches/${encodeURIComponent(matchId)}`, "val-match-v1.getMatch")).data;
108
+ },
109
+ async getMatchlist(client, route, puuid) {
110
+ return (await client.request(route, `/val/match/v1/matchlists/by-puuid/${encodeURIComponent(puuid)}`, "val-match-v1.getMatchlist")).data;
111
+ },
112
+ async getRecentMatches(client, route, queue) {
113
+ return (await client.request(route, `/val/match/v1/recent-matches/by-queue/${encodeURIComponent(queue)}`, "val-match-v1.getRecentMatches")).data;
114
+ }
115
+ };
116
+ //#endregion
117
+ //#region src/val/val-ranked-v1.ts
118
+ /**
119
+ * Valorant Ranked API (v1).
120
+ *
121
+ * Retrieve competitive leaderboard data by act.
122
+ *
123
+ * All methods require a {@link ValPlatformRoute} (e.g., 'na', 'eu', 'ap').
124
+ *
125
+ * @example
126
+ * ```typescript
127
+ * import { valRankedV1 } from '@wardbox/whisper/val';
128
+ *
129
+ * const leaderboard = await valRankedV1.getLeaderboard(client, 'na', 'act-id-123');
130
+ * console.log(leaderboard.totalPlayers, 'ranked players');
131
+ * ```
132
+ */
133
+ const valRankedV1 = { async getLeaderboard(client, route, actId, options) {
134
+ const params = {};
135
+ if (options?.size !== void 0) params.size = String(options.size);
136
+ if (options?.startIndex !== void 0) params.startIndex = String(options.startIndex);
137
+ return (await client.request(route, `/val/ranked/v1/leaderboards/by-act/${encodeURIComponent(actId)}`, "val-ranked-v1.getLeaderboard", Object.keys(params).length > 0 ? { params } : void 0)).data;
138
+ } };
139
+ //#endregion
140
+ //#region src/val/val-status-v1.ts
141
+ /**
142
+ * Valorant Status API (v1).
143
+ *
144
+ * Retrieve platform status information including incidents and maintenances.
145
+ *
146
+ * All methods require a {@link ValPlatformRoute} (e.g., 'na', 'eu', 'ap').
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * import { valStatusV1 } from '@wardbox/whisper/val';
151
+ *
152
+ * const status = await valStatusV1.getPlatformData(client, 'na');
153
+ * console.log(status.name, status.incidents.length);
154
+ * ```
155
+ */
156
+ const valStatusV1 = { async getPlatformData(client, route) {
157
+ return (await client.request(route, "/val/status/v1/platform-data", "val-status-v1.getPlatformData")).data;
158
+ } };
159
+ //#endregion
160
+ exports.VAL_PLATFORM = VAL_PLATFORM;
161
+ exports.valConsoleMatchV1 = valConsoleMatchV1;
162
+ exports.valConsoleRankedV1 = valConsoleRankedV1;
163
+ exports.valContentV1 = valContentV1;
164
+ exports.valMatchV1 = valMatchV1;
165
+ exports.valRankedV1 = valRankedV1;
166
+ exports.valStatusV1 = valStatusV1;