@yaelouuu/fortnite-api 7.1.1 → 7.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.
@@ -1,5 +1,5 @@
1
1
  import { FortniteAPI } from "../client";
2
- import { Leaderboard, TournamentTrackerResponse, TournamentEligibilityResponse, EventTokenEligibilityResponse } from "../types";
2
+ import { Leaderboard, TournamentTrackerResponse, TournamentEligibilityResponse, EventTokenEligibilityResponse, CashPrizesResponse, PayoutTable } from "../types";
3
3
  export declare class TournamentsResource {
4
4
  private client;
5
5
  constructor(client: FortniteAPI);
@@ -170,6 +170,47 @@ export declare class TournamentsResource {
170
170
  * );
171
171
  * ```
172
172
  */
173
+ /**
174
+ * Get all payout tables across all event windows.
175
+ *
176
+ * Player-specific data is stripped — only the reward/prize structures are returned.
177
+ * The response is an object keyed by event window ID (e.g. `"epicgames_S40_RankedCupSolo_EU_1_Elite"`).
178
+ * Response is cached for 4 hours.
179
+ *
180
+ * No authentication required.
181
+ */
182
+ getCashPrizes(): Promise<CashPrizesResponse>;
183
+ /**
184
+ * Get the payout table for a specific event window.
185
+ *
186
+ * @param eventWindowId - Event window identifier (e.g. `"epicgames_S40_RankedCupSolo_EU_1_Elite"`)
187
+ *
188
+ * @throws {FortniteAPIError} 404 if no payout table exists for the given event window
189
+ */
190
+ getCashPrize(eventWindowId: string): Promise<PayoutTable>;
191
+ /**
192
+ * Get top performers for a specific tracked stat across the entire leaderboard.
193
+ * Fetches all pages in parallel so high-stat but low-placed teams are always included.
194
+ * Response includes an `availableStats` array listing every stat key tracked in this tournament.
195
+ * Requires pro or custom plan.
196
+ * @param eventId - Event identifier (e.g. "epicgames_Bratwurst_Official")
197
+ * @param eventWindowId - Event window identifier (e.g. "Bratwurst_UpperBracket_Day1")
198
+ * @param statKey - Tracked stat key to rank by (e.g. TEAM_ELIMS_STAT_INDEX, DamageDealt, Headshots)
199
+ * @param top - Number of teams to return (default: 10, max: 100)
200
+ */
201
+ getEventStats(eventId: string, eventWindowId: string, statKey: string, top?: number): Promise<any>;
202
+ /**
203
+ * Get all tracked stats for a specific team.
204
+ * Returns every stat tracked in this tournament for that team (total + per-game), plus their
205
+ * rank in the requested statKey across all teams in the event.
206
+ * Accepts an Epic account ID (32 hex chars) or display name — clan tags are stripped for matching.
207
+ * Requires pro or custom plan.
208
+ * @param eventId - Event identifier
209
+ * @param eventWindowId - Event window identifier
210
+ * @param statKey - Stat to show this team's rank in (e.g. DamageDealt, TEAM_ELIMS_STAT_INDEX)
211
+ * @param teamIdentifier - Epic account ID or display name of any player on the team
212
+ */
213
+ getTeamEventStats(eventId: string, eventWindowId: string, statKey: string, teamIdentifier: string): Promise<any>;
173
214
  getLeaderboardV2(params: {
174
215
  eventId: string;
175
216
  eventWindowId: string;
@@ -225,6 +225,59 @@ class TournamentsResource {
225
225
  * );
226
226
  * ```
227
227
  */
228
+ /**
229
+ * Get all payout tables across all event windows.
230
+ *
231
+ * Player-specific data is stripped — only the reward/prize structures are returned.
232
+ * The response is an object keyed by event window ID (e.g. `"epicgames_S40_RankedCupSolo_EU_1_Elite"`).
233
+ * Response is cached for 4 hours.
234
+ *
235
+ * No authentication required.
236
+ */
237
+ async getCashPrizes() {
238
+ return this.client.request("/events/cashprizes");
239
+ }
240
+ /**
241
+ * Get the payout table for a specific event window.
242
+ *
243
+ * @param eventWindowId - Event window identifier (e.g. `"epicgames_S40_RankedCupSolo_EU_1_Elite"`)
244
+ *
245
+ * @throws {FortniteAPIError} 404 if no payout table exists for the given event window
246
+ */
247
+ async getCashPrize(eventWindowId) {
248
+ return this.client.request(`/events/cashprize/${encodeURIComponent(eventWindowId)}`);
249
+ }
250
+ /**
251
+ * Get top performers for a specific tracked stat across the entire leaderboard.
252
+ * Fetches all pages in parallel so high-stat but low-placed teams are always included.
253
+ * Response includes an `availableStats` array listing every stat key tracked in this tournament.
254
+ * Requires pro or custom plan.
255
+ * @param eventId - Event identifier (e.g. "epicgames_Bratwurst_Official")
256
+ * @param eventWindowId - Event window identifier (e.g. "Bratwurst_UpperBracket_Day1")
257
+ * @param statKey - Tracked stat key to rank by (e.g. TEAM_ELIMS_STAT_INDEX, DamageDealt, Headshots)
258
+ * @param top - Number of teams to return (default: 10, max: 100)
259
+ */
260
+ async getEventStats(eventId, eventWindowId, statKey, top) {
261
+ const params = new URLSearchParams();
262
+ if (top != null)
263
+ params.append("top", String(top));
264
+ const qs = params.toString();
265
+ return this.client.request(`/events/stats/${encodeURIComponent(eventId)}/${encodeURIComponent(eventWindowId)}/${encodeURIComponent(statKey)}${qs ? `?${qs}` : ""}`);
266
+ }
267
+ /**
268
+ * Get all tracked stats for a specific team.
269
+ * Returns every stat tracked in this tournament for that team (total + per-game), plus their
270
+ * rank in the requested statKey across all teams in the event.
271
+ * Accepts an Epic account ID (32 hex chars) or display name — clan tags are stripped for matching.
272
+ * Requires pro or custom plan.
273
+ * @param eventId - Event identifier
274
+ * @param eventWindowId - Event window identifier
275
+ * @param statKey - Stat to show this team's rank in (e.g. DamageDealt, TEAM_ELIMS_STAT_INDEX)
276
+ * @param teamIdentifier - Epic account ID or display name of any player on the team
277
+ */
278
+ async getTeamEventStats(eventId, eventWindowId, statKey, teamIdentifier) {
279
+ return this.client.request(`/events/stats/${encodeURIComponent(eventId)}/${encodeURIComponent(eventWindowId)}/${encodeURIComponent(statKey)}/${encodeURIComponent(teamIdentifier)}`);
280
+ }
228
281
  async getLeaderboardV2(params, teams, fortniteToken) {
229
282
  const query = new URLSearchParams({
230
283
  eventId: params.eventId,
@@ -1,33 +1,37 @@
1
1
  import { FortniteAPI } from "../client";
2
- import { WeaponsResponse, RarityDefinitionsResponse } from "../types";
2
+ import { WeaponsResponse, RarityDefinitionsResponse, AvailablePatchesResponse } from "../types";
3
3
  export declare class WeaponsResource {
4
4
  private client;
5
5
  constructor(client: FortniteAPI);
6
6
  /**
7
7
  * Get weapons data with optional filtering
8
- * @param options - Query options
9
- * @param options.version - Version filter: "current" (loot pool), "all" (every weapon), or a specific patch like "39.50"
10
- * @param options.category - Filter by category: assault-rifle, shotgun, smg, sniper, pistol, explosive, bow, crossbow, melee, light-machine-gun
11
- * @param options.search - Search weapons by name (e.g. "pump", "assault", "bolt")
12
- * @param options.gamemode - Filter by gamemode: "br" (Battle Royale) or "og" (OG mode)
13
- * @param options.rarity - Filter by rarity: common, uncommon, rare, epic, legendary, mythic, transcendent
14
- * @param options.type - Filter by weapon type: ranged, melee, consumable, trap, gadget
15
- * @param options.ammoType - Filter by ammo type: light, medium, heavy, shells, rockets, energy, arrows
16
- * @param options.season - Filter by season availability: "CH6S7" or "6.7" format
17
- * @returns Weapons response with metadata, availableSeasons, and weapon data
8
+ * @param options.patch - Patch version (e.g. "32.00"). Defaults to current patch.
9
+ * @param options.category - Filter by category (e.g. Assault, Shotgun)
10
+ * @param options.search - Search weapons by name
11
+ * @param options.gamemode - Filter by gamemode: "BattleRoyale" or "ZeroBuild"
12
+ * @param options.rarity - Filter by rarity (e.g. rare, epic, legendary)
13
+ * @param options.type - Filter by weapon type (e.g. ranged, melee)
14
+ * @param options.ammoType - Filter by ammo type (e.g. light, medium, heavy)
15
+ * @param options.itemType - Filter by item type
16
+ * @param options.lang - Language code (default: en)
18
17
  */
19
18
  getWeapons(options?: {
20
- version?: string;
19
+ patch?: string;
21
20
  category?: string;
22
21
  search?: string;
23
- gamemode?: "br" | "og";
22
+ gamemode?: string;
24
23
  rarity?: string;
25
24
  type?: string;
26
25
  ammoType?: string;
27
- season?: string;
26
+ itemType?: string;
27
+ lang?: string;
28
28
  }): Promise<WeaponsResponse>;
29
29
  /**
30
- * Get rarity definitions (colors, display names, backend values)
30
+ * Get all available weapon patches, with the current patch flagged
31
+ */
32
+ getAvailablePatches(): Promise<AvailablePatchesResponse>;
33
+ /**
34
+ * Get rarity definitions and their display colors
31
35
  */
32
36
  getRarityDefinitions(): Promise<RarityDefinitionsResponse>;
33
37
  }
@@ -7,21 +7,20 @@ class WeaponsResource {
7
7
  }
8
8
  /**
9
9
  * Get weapons data with optional filtering
10
- * @param options - Query options
11
- * @param options.version - Version filter: "current" (loot pool), "all" (every weapon), or a specific patch like "39.50"
12
- * @param options.category - Filter by category: assault-rifle, shotgun, smg, sniper, pistol, explosive, bow, crossbow, melee, light-machine-gun
13
- * @param options.search - Search weapons by name (e.g. "pump", "assault", "bolt")
14
- * @param options.gamemode - Filter by gamemode: "br" (Battle Royale) or "og" (OG mode)
15
- * @param options.rarity - Filter by rarity: common, uncommon, rare, epic, legendary, mythic, transcendent
16
- * @param options.type - Filter by weapon type: ranged, melee, consumable, trap, gadget
17
- * @param options.ammoType - Filter by ammo type: light, medium, heavy, shells, rockets, energy, arrows
18
- * @param options.season - Filter by season availability: "CH6S7" or "6.7" format
19
- * @returns Weapons response with metadata, availableSeasons, and weapon data
10
+ * @param options.patch - Patch version (e.g. "32.00"). Defaults to current patch.
11
+ * @param options.category - Filter by category (e.g. Assault, Shotgun)
12
+ * @param options.search - Search weapons by name
13
+ * @param options.gamemode - Filter by gamemode: "BattleRoyale" or "ZeroBuild"
14
+ * @param options.rarity - Filter by rarity (e.g. rare, epic, legendary)
15
+ * @param options.type - Filter by weapon type (e.g. ranged, melee)
16
+ * @param options.ammoType - Filter by ammo type (e.g. light, medium, heavy)
17
+ * @param options.itemType - Filter by item type
18
+ * @param options.lang - Language code (default: en)
20
19
  */
21
20
  async getWeapons(options) {
22
21
  const params = new URLSearchParams();
23
- if (options?.version)
24
- params.set("version", options.version);
22
+ if (options?.patch)
23
+ params.set("patch", options.patch);
25
24
  if (options?.category)
26
25
  params.set("category", options.category);
27
26
  if (options?.search)
@@ -34,13 +33,21 @@ class WeaponsResource {
34
33
  params.set("type", options.type);
35
34
  if (options?.ammoType)
36
35
  params.set("ammoType", options.ammoType);
37
- if (options?.season)
38
- params.set("season", options.season);
36
+ if (options?.itemType)
37
+ params.set("itemType", options.itemType);
38
+ if (options?.lang)
39
+ params.set("lang", options.lang);
39
40
  const query = params.toString() ? `?${params.toString()}` : "";
40
41
  return this.client.request(`/weapons${query}`, {}, "v2");
41
42
  }
42
43
  /**
43
- * Get rarity definitions (colors, display names, backend values)
44
+ * Get all available weapon patches, with the current patch flagged
45
+ */
46
+ async getAvailablePatches() {
47
+ return this.client.request("/weapons/patches", {}, "v2");
48
+ }
49
+ /**
50
+ * Get rarity definitions and their display colors
44
51
  */
45
52
  async getRarityDefinitions() {
46
53
  return this.client.request("/weapons/rarity", {}, "v2");
@@ -695,6 +695,9 @@ export interface PlayerEligibilityResult {
695
695
  }>;
696
696
  checkedAt: string;
697
697
  }
698
+ export interface OAuthAuthorizeUrlResponse {
699
+ url: string;
700
+ }
698
701
  export interface OAuthExchangeCodeResponse {
699
702
  success: boolean;
700
703
  accessToken: string;
@@ -705,6 +708,67 @@ export interface OAuthExchangeCodeResponse {
705
708
  accountId: string;
706
709
  displayName: string | null;
707
710
  }
711
+ export interface PlayerWindowStandingSession {
712
+ sessionId: string;
713
+ placement: number;
714
+ teamId: string;
715
+ teamAccountIds: string[];
716
+ score: number;
717
+ trackedStats: Record<string, number>;
718
+ gameSessionId?: string;
719
+ gameSessionKey?: string;
720
+ liveSessionId?: string;
721
+ }
722
+ /**
723
+ * Player standing in a specific event window.
724
+ * Returned by GET /api/v2/events/{eventId}/windows/{eventWindowId}/players/{accountId}
725
+ */
726
+ export interface PlayerWindowStanding {
727
+ eventId: string;
728
+ eventWindowId: string;
729
+ teamAccountIds: string[];
730
+ teamAccountDisplayNames?: string[];
731
+ pointsEarned: number;
732
+ rank: number;
733
+ percentile?: number;
734
+ sessionHistory: PlayerWindowStandingSession[];
735
+ }
736
+ export interface PayoutTableReward {
737
+ itemType: string;
738
+ itemId?: string;
739
+ itemGuid?: string;
740
+ templateId?: string;
741
+ quantity: number;
742
+ rewardType?: string;
743
+ }
744
+ export interface PayoutTableRankEntry {
745
+ threshold: number;
746
+ items: PayoutTableReward[];
747
+ }
748
+ export interface PayoutTablePercentileEntry {
749
+ scorePercent: number;
750
+ scoreRank: number;
751
+ items: PayoutTableReward[];
752
+ }
753
+ /**
754
+ * Payout table for a specific event window.
755
+ * `scoringType` determines which array is populated:
756
+ * - `"rank"` → `rankPayoutTable` is present
757
+ * - `"percentile"` → `percentilePayoutTable` is present
758
+ */
759
+ export interface PayoutTable {
760
+ scoringType: "rank" | "percentile" | string;
761
+ rankPayoutTable?: PayoutTableRankEntry[];
762
+ percentilePayoutTable?: PayoutTablePercentileEntry[];
763
+ [key: string]: any;
764
+ }
765
+ /**
766
+ * All payout tables keyed by event window ID.
767
+ * Returned by GET /api/v1/events/cashprizes
768
+ */
769
+ export interface CashPrizesResponse {
770
+ [eventWindowId: string]: PayoutTable;
771
+ }
708
772
  export interface ArenaHype {
709
773
  accountId: string;
710
774
  currentHype?: number;
@@ -804,6 +868,15 @@ export interface RarityDefinitionsResponse {
804
868
  status: number;
805
869
  data: RarityDefinition[];
806
870
  }
871
+ export interface AvailablePatchInfo {
872
+ patch: string;
873
+ isCurrent: boolean;
874
+ }
875
+ export interface AvailablePatchesResponse {
876
+ status: number;
877
+ current: string | null;
878
+ patches: AvailablePatchInfo[];
879
+ }
807
880
  export interface CrewPackResponse {
808
881
  status: number;
809
882
  data: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaelouuu/fortnite-api",
3
- "version": "7.1.1",
3
+ "version": "7.2.0",
4
4
  "description": "SDK for Fortnite API - api-fortnite.com - Author : Yael Brinkert",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",