@yaelouuu/fortnite-api 6.2.0 → 7.1.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 { EventWindows, PlayerEventHistory, TournamentDetails, ScoringRules, EventLeaderboard, PlayerEventData, EligibilityStatus, PlayerEligibilityResult, ArenaHype, EventRewards } from "../types";
2
+ import { EventWindows, PlayerEventHistory, TournamentDetails, ScoringRules, EventLeaderboard, PlayerEventData, EventRewards, PlayerTokensResponse } from "../types";
3
3
  /**
4
4
  * Events Resource
5
5
  * Handles tournament and competitive events data
@@ -58,32 +58,21 @@ export declare class EventsResource {
58
58
  */
59
59
  getPlayerEventData(eventId: string, eventWindowId: string, accountId: string, fortniteToken?: string): Promise<PlayerEventData>;
60
60
  /**
61
- * Get parsed tournament eligibility requirements.
62
- * No user token needed requirements are extracted from tournament metadata.
63
- * @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
64
- * @param eventWindowId - Optional: filter to a specific event window
65
- * @returns Parsed eligibility requirements
66
- */
67
- checkEligibility(eventId: string, eventWindowId?: string): Promise<EligibilityStatus>;
68
- /**
69
- * Check a player's eligibility against tournament requirements.
70
- * Cross-references ranked data with tournament requirements — no user token needed.
71
- * @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
72
- * @param accountId - Epic Games Account ID to check
73
- * @param options - Optional platform and eventWindowId
74
- * @returns Player eligibility check results
61
+ * Find a player's rank and surrounding entries in an event window leaderboard.
62
+ * Works for any placement including beyond top 10k. No user token required.
63
+ * @param eventId - Event ID
64
+ * @param eventWindowId - Event window ID
65
+ * @param accountId - Epic account ID of the player to look up
75
66
  */
76
- checkPlayerEligibility(eventId: string, accountId: string, options?: {
77
- platform?: string;
78
- eventWindowId?: string;
79
- }): Promise<PlayerEligibilityResult>;
67
+ getPlayerLeaderboard(eventId: string, eventWindowId: string, accountId: string): Promise<EventLeaderboard>;
80
68
  /**
81
- * Get Arena hype and division
82
- * @param accountId - Account ID
83
- * @param fortniteToken - Optional user Fortnite token
84
- * @returns Arena hype, division, and progress
69
+ * Get the raw token set for one or more players.
70
+ * Tokens are eligibility flags earned by participating in tournaments
71
+ * (e.g. qualifying tokens, ban tokens).
72
+ * No user token required uses service auth.
73
+ * @param accountIds - One or more Epic account IDs
85
74
  */
86
- getArenaHype(accountId: string, fortniteToken?: string): Promise<ArenaHype>;
75
+ getPlayerTokens(accountIds: string | string[]): Promise<PlayerTokensResponse>;
87
76
  /**
88
77
  * Get event rewards/prizes
89
78
  * @param eventId - Event ID
@@ -95,45 +95,26 @@ class EventsResource {
95
95
  return this.client.request(`/events/${eventId}/windows/${eventWindowId}/players/${accountId}`, { headers }, "v2");
96
96
  }
97
97
  /**
98
- * Get parsed tournament eligibility requirements.
99
- * No user token needed requirements are extracted from tournament metadata.
100
- * @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
101
- * @param eventWindowId - Optional: filter to a specific event window
102
- * @returns Parsed eligibility requirements
98
+ * Find a player's rank and surrounding entries in an event window leaderboard.
99
+ * Works for any placement including beyond top 10k. No user token required.
100
+ * @param eventId - Event ID
101
+ * @param eventWindowId - Event window ID
102
+ * @param accountId - Epic account ID of the player to look up
103
103
  */
104
- async checkEligibility(eventId, eventWindowId) {
105
- const query = eventWindowId ? `?eventWindowId=${eventWindowId}` : "";
106
- return this.client.request(`/events/${eventId}/eligibility${query}`, {}, "v2");
104
+ async getPlayerLeaderboard(eventId, eventWindowId, accountId) {
105
+ return this.client.request(`/events/${eventId}/windows/${eventWindowId}/leaderboard/player?accountId=${encodeURIComponent(accountId)}`, {}, "v2");
107
106
  }
108
107
  /**
109
- * Check a player's eligibility against tournament requirements.
110
- * Cross-references ranked data with tournament requirements no user token needed.
111
- * @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
112
- * @param accountId - Epic Games Account ID to check
113
- * @param options - Optional platform and eventWindowId
114
- * @returns Player eligibility check results
108
+ * Get the raw token set for one or more players.
109
+ * Tokens are eligibility flags earned by participating in tournaments
110
+ * (e.g. qualifying tokens, ban tokens).
111
+ * No user token required uses service auth.
112
+ * @param accountIds - One or more Epic account IDs
115
113
  */
116
- async checkPlayerEligibility(eventId, accountId, options) {
117
- const params = new URLSearchParams();
118
- if (options?.platform)
119
- params.set("platform", options.platform);
120
- if (options?.eventWindowId)
121
- params.set("eventWindowId", options.eventWindowId);
122
- const query = params.toString() ? `?${params.toString()}` : "";
123
- return this.client.request(`/events/${eventId}/eligibility/${accountId}${query}`, {}, "v2");
124
- }
125
- /**
126
- * Get Arena hype and division
127
- * @param accountId - Account ID
128
- * @param fortniteToken - Optional user Fortnite token
129
- * @returns Arena hype, division, and progress
130
- */
131
- async getArenaHype(accountId, fortniteToken) {
132
- const headers = {};
133
- if (fortniteToken) {
134
- headers["x-fortnite-token"] = fortniteToken;
135
- }
136
- return this.client.request(`/events/arena/${accountId}`, { headers }, "v2");
114
+ async getPlayerTokens(accountIds) {
115
+ const ids = Array.isArray(accountIds) ? accountIds : [accountIds];
116
+ const qs = ids.map(encodeURIComponent).join("%2C");
117
+ return this.client.request(`/events/tokens?teamAccountIds=${qs}`, {}, "v1");
137
118
  }
138
119
  /**
139
120
  * Get event rewards/prizes
@@ -1,15 +1,49 @@
1
1
  import { FortniteAPI } from "../client";
2
+ import { ProfileLevel, RankedProgress, TrackDefinition } from "../types";
2
3
  export declare class ProfilesResource {
3
4
  private client;
4
5
  constructor(client: FortniteAPI);
5
6
  /**
6
- * Get profile progress (track progress, levels) by display name
7
- * @param displayName - Epic Games display name
7
+ * Get raw Habanero track progress for a single account. Public — no token required.
8
+ * @param accountId - Epic account ID
9
+ */
10
+ getProgress(accountId: string): Promise<any>;
11
+ /**
12
+ * Get a player's XP, level, accountLevel, and battle pass tier.
13
+ * Parsed from QueryProfile (profileId=athena) on the MCP service.
14
+ * Requires the player's own Fortnite OAuth token — cannot be used for other accounts.
15
+ * @param accountId - Epic account ID
16
+ * @param fortniteToken - User's Fortnite OAuth token (required)
8
17
  */
9
- getProgress(displayName: string): Promise<any>;
18
+ getLevel(accountId: string, fortniteToken: string): Promise<ProfileLevel>;
10
19
  /**
11
- * Get enriched ranked progress by display name (human-readable ranks, game modes, season dates)
20
+ * Get enriched ranked progress human-readable rank names, game mode labels, season dates.
12
21
  * @param displayName - Epic Games display name
13
22
  */
14
- getRanked(displayName: string): Promise<any>;
23
+ getRanked(displayName: string): Promise<RankedProgress[]>;
24
+ /**
25
+ * Get all available ranked game mode tracks — modes, division counts, and season dates.
26
+ * @param options - Optional filters
27
+ */
28
+ getTracks(options?: {
29
+ /** ISO 8601 — only return tracks ending before this date */
30
+ endsBefore?: string;
31
+ /** ISO 8601 — only return tracks ending after this date */
32
+ endsAfter?: string;
33
+ }): Promise<TrackDefinition[]>;
34
+ /**
35
+ * Get ranked track progress for multiple account IDs in one request (L3AGUE bulk endpoint).
36
+ * @param accountIds - Array of Epic account IDs
37
+ */
38
+ getBulkTrackProgress(accountIds: string[]): Promise<any[]>;
39
+ /**
40
+ * Get a Habanero game leaderboard centered around an account.
41
+ * @param gameId - Habanero game identifier (e.g. "HazelnutSpread")
42
+ * @param accountId - Epic account ID to center the leaderboard around
43
+ * @param options - Query options
44
+ */
45
+ getGameLeaderboard(gameId: string, accountId: string, options?: {
46
+ fromIndex?: number;
47
+ findTeams?: boolean;
48
+ }): Promise<any>;
15
49
  }
@@ -6,18 +6,66 @@ class ProfilesResource {
6
6
  this.client = client;
7
7
  }
8
8
  /**
9
- * Get profile progress (track progress, levels) by display name
10
- * @param displayName - Epic Games display name
9
+ * Get raw Habanero track progress for a single account. Public — no token required.
10
+ * @param accountId - Epic account ID
11
+ */
12
+ async getProgress(accountId) {
13
+ return this.client.request(`/profile/progress?accountId=${encodeURIComponent(accountId)}`);
14
+ }
15
+ /**
16
+ * Get a player's XP, level, accountLevel, and battle pass tier.
17
+ * Parsed from QueryProfile (profileId=athena) on the MCP service.
18
+ * Requires the player's own Fortnite OAuth token — cannot be used for other accounts.
19
+ * @param accountId - Epic account ID
20
+ * @param fortniteToken - User's Fortnite OAuth token (required)
11
21
  */
12
- async getProgress(displayName) {
13
- return this.client.request(`/profile/progress?displayName=${encodeURIComponent(displayName)}`);
22
+ async getLevel(accountId, fortniteToken) {
23
+ return this.client.request(`/profile/level?accountId=${encodeURIComponent(accountId)}`, { headers: { "x-fortnite-token": fortniteToken } });
14
24
  }
15
25
  /**
16
- * Get enriched ranked progress by display name (human-readable ranks, game modes, season dates)
26
+ * Get enriched ranked progress human-readable rank names, game mode labels, season dates.
17
27
  * @param displayName - Epic Games display name
18
28
  */
19
29
  async getRanked(displayName) {
20
30
  return this.client.request(`/profile/ranked?displayName=${encodeURIComponent(displayName)}`);
21
31
  }
32
+ /**
33
+ * Get all available ranked game mode tracks — modes, division counts, and season dates.
34
+ * @param options - Optional filters
35
+ */
36
+ async getTracks(options) {
37
+ const params = new URLSearchParams();
38
+ if (options?.endsBefore)
39
+ params.append("endsBefore", options.endsBefore);
40
+ if (options?.endsAfter)
41
+ params.append("endsAfter", options.endsAfter);
42
+ const qs = params.toString();
43
+ return this.client.request(`/profile/tracks${qs ? `?${qs}` : ""}`);
44
+ }
45
+ /**
46
+ * Get ranked track progress for multiple account IDs in one request (L3AGUE bulk endpoint).
47
+ * @param accountIds - Array of Epic account IDs
48
+ */
49
+ async getBulkTrackProgress(accountIds) {
50
+ return this.client.request("/profile/trackprogress/bulk", {
51
+ method: "POST",
52
+ headers: { "Content-Type": "application/json" },
53
+ body: JSON.stringify(accountIds),
54
+ });
55
+ }
56
+ /**
57
+ * Get a Habanero game leaderboard centered around an account.
58
+ * @param gameId - Habanero game identifier (e.g. "HazelnutSpread")
59
+ * @param accountId - Epic account ID to center the leaderboard around
60
+ * @param options - Query options
61
+ */
62
+ async getGameLeaderboard(gameId, accountId, options) {
63
+ const params = new URLSearchParams({ accountId });
64
+ if (options?.fromIndex != null)
65
+ params.append("fromIndex", String(options.fromIndex));
66
+ if (options?.findTeams != null)
67
+ params.append("findTeams", String(options.findTeams));
68
+ return this.client.request(`/profile/leaderboard/${encodeURIComponent(gameId)}?${params.toString()}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" });
69
+ }
22
70
  }
23
71
  exports.ProfilesResource = ProfilesResource;
@@ -15,8 +15,10 @@ export declare class StatsResource {
15
15
  * @returns Player statistics
16
16
  */
17
17
  getPlayerStats(accountId: string, options?: {
18
- startDate?: string;
19
- endDate?: string;
18
+ /** Unix timestamp (e.g. 1773900001). NOT an ISO date string. */
19
+ startTime?: string | number;
20
+ /** Unix timestamp (e.g. 1782950340). NOT an ISO date string. */
21
+ endTime?: string | number;
20
22
  stats?: string[];
21
23
  }, fortniteToken?: string): Promise<PlayerStats>;
22
24
  /**
@@ -22,10 +22,10 @@ class StatsResource {
22
22
  headers["x-fortnite-token"] = fortniteToken;
23
23
  }
24
24
  const queryParams = new URLSearchParams();
25
- if (options?.startDate)
26
- queryParams.append("startDate", options.startDate);
27
- if (options?.endDate)
28
- queryParams.append("endDate", options.endDate);
25
+ if (options?.startTime)
26
+ queryParams.append("startTime", String(options.startTime));
27
+ if (options?.endTime)
28
+ queryParams.append("endTime", String(options.endTime));
29
29
  if (options?.stats)
30
30
  queryParams.append("stats", options.stats.join(","));
31
31
  const query = queryParams.toString();
@@ -484,6 +484,47 @@ export interface SuggestedFriend {
484
484
  displayName?: string;
485
485
  mutualFriends?: number;
486
486
  }
487
+ export interface ProfileLevel {
488
+ accountId: string;
489
+ /** Current season level */
490
+ level: number | null;
491
+ /** Current season XP */
492
+ xp: number | null;
493
+ /** Cumulative lifetime account level across all seasons — used for eligibility requirements */
494
+ accountLevel: number | null;
495
+ battlePass: {
496
+ tier: number | null;
497
+ xp: number | null;
498
+ purchased: boolean;
499
+ };
500
+ }
501
+ export interface RankedProgress {
502
+ trackguid: string;
503
+ rankingType: string | null;
504
+ gameMode: string;
505
+ seasonId: string | null;
506
+ seasonBegin: string | null;
507
+ seasonEnd: string | null;
508
+ isCurrent: boolean;
509
+ currentDivision: number;
510
+ currentRank: string;
511
+ highestDivision: number;
512
+ highestRank: string;
513
+ rankProgress: number | null;
514
+ unrealRank: number | null;
515
+ }
516
+ export interface TrackDefinition {
517
+ trackguid: string;
518
+ trackId: string;
519
+ rankingType: string;
520
+ divisionCount: number;
521
+ beginTime: string | null;
522
+ endTime: string | null;
523
+ [key: string]: any;
524
+ }
525
+ export interface PlayerTokensResponse {
526
+ [accountId: string]: string[];
527
+ }
487
528
  export interface PlayerStats {
488
529
  accountId: string;
489
530
  stats: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaelouuu/fortnite-api",
3
- "version": "6.2.0",
3
+ "version": "7.1.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",