@yaelouuu/fortnite-api 6.2.0 → 7.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/resources/events.d.ts +7 -26
- package/dist/resources/events.js +9 -38
- package/dist/resources/profiles.d.ts +39 -5
- package/dist/resources/profiles.js +53 -5
- package/dist/resources/stats.d.ts +4 -2
- package/dist/resources/stats.js +4 -4
- package/dist/types/index.d.ts +41 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FortniteAPI } from "../client";
|
|
2
|
-
import { EventWindows, PlayerEventHistory, TournamentDetails, ScoringRules, EventLeaderboard, PlayerEventData,
|
|
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,13 @@ export declare class EventsResource {
|
|
|
58
58
|
*/
|
|
59
59
|
getPlayerEventData(eventId: string, eventWindowId: string, accountId: string, fortniteToken?: string): Promise<PlayerEventData>;
|
|
60
60
|
/**
|
|
61
|
-
* Get
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* @
|
|
61
|
+
* Get the raw token set for one or more players.
|
|
62
|
+
* Tokens are eligibility flags earned by participating in tournaments
|
|
63
|
+
* (e.g. qualifying tokens, ban tokens).
|
|
64
|
+
* No user token required — uses service auth.
|
|
65
|
+
* @param accountIds - One or more Epic account IDs
|
|
66
66
|
*/
|
|
67
|
-
|
|
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
|
|
75
|
-
*/
|
|
76
|
-
checkPlayerEligibility(eventId: string, accountId: string, options?: {
|
|
77
|
-
platform?: string;
|
|
78
|
-
eventWindowId?: string;
|
|
79
|
-
}): Promise<PlayerEligibilityResult>;
|
|
80
|
-
/**
|
|
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
|
|
85
|
-
*/
|
|
86
|
-
getArenaHype(accountId: string, fortniteToken?: string): Promise<ArenaHype>;
|
|
67
|
+
getPlayerTokens(accountIds: string | string[]): Promise<PlayerTokensResponse>;
|
|
87
68
|
/**
|
|
88
69
|
* Get event rewards/prizes
|
|
89
70
|
* @param eventId - Event ID
|
package/dist/resources/events.js
CHANGED
|
@@ -95,45 +95,16 @@ class EventsResource {
|
|
|
95
95
|
return this.client.request(`/events/${eventId}/windows/${eventWindowId}/players/${accountId}`, { headers }, "v2");
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
* Get
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* @
|
|
98
|
+
* Get the raw token set for one or more players.
|
|
99
|
+
* Tokens are eligibility flags earned by participating in tournaments
|
|
100
|
+
* (e.g. qualifying tokens, ban tokens).
|
|
101
|
+
* No user token required — uses service auth.
|
|
102
|
+
* @param accountIds - One or more Epic account IDs
|
|
103
103
|
*/
|
|
104
|
-
async
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
/**
|
|
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
|
|
115
|
-
*/
|
|
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");
|
|
104
|
+
async getPlayerTokens(accountIds) {
|
|
105
|
+
const ids = Array.isArray(accountIds) ? accountIds : [accountIds];
|
|
106
|
+
const qs = ids.map(encodeURIComponent).join("%2C");
|
|
107
|
+
return this.client.request(`/events/tokens?teamAccountIds=${qs}`, {}, "v1");
|
|
137
108
|
}
|
|
138
109
|
/**
|
|
139
110
|
* 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
|
|
7
|
-
* @param
|
|
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
|
-
|
|
18
|
+
getLevel(accountId: string, fortniteToken: string): Promise<ProfileLevel>;
|
|
10
19
|
/**
|
|
11
|
-
* Get enriched ranked progress
|
|
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<
|
|
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
|
|
10
|
-
* @param
|
|
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
|
|
13
|
-
return this.client.request(`/profile/
|
|
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
|
|
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
|
-
|
|
19
|
-
|
|
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
|
/**
|
package/dist/resources/stats.js
CHANGED
|
@@ -22,10 +22,10 @@ class StatsResource {
|
|
|
22
22
|
headers["x-fortnite-token"] = fortniteToken;
|
|
23
23
|
}
|
|
24
24
|
const queryParams = new URLSearchParams();
|
|
25
|
-
if (options?.
|
|
26
|
-
queryParams.append("
|
|
27
|
-
if (options?.
|
|
28
|
-
queryParams.append("
|
|
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();
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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: {
|