@yaelouuu/fortnite-api 7.1.0 → 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.
- package/dist/client.d.ts +6 -0
- package/dist/client.js +24 -0
- package/dist/resources/account.d.ts +6 -0
- package/dist/resources/account.js +9 -0
- package/dist/resources/battlepass.d.ts +3 -2
- package/dist/resources/battlepass.js +5 -3
- package/dist/resources/bundles.d.ts +2 -2
- package/dist/resources/bundles.js +2 -2
- package/dist/resources/cosmetics.d.ts +14 -3
- package/dist/resources/cosmetics.js +18 -5
- package/dist/resources/events.d.ts +22 -50
- package/dist/resources/events.js +31 -87
- package/dist/resources/fn.d.ts +4 -4
- package/dist/resources/fn.js +5 -4
- package/dist/resources/map.d.ts +3 -2
- package/dist/resources/map.js +9 -3
- package/dist/resources/news.d.ts +8 -4
- package/dist/resources/news.js +16 -8
- package/dist/resources/oauth.d.ts +26 -1
- package/dist/resources/oauth.js +28 -0
- package/dist/resources/parsing.d.ts +90 -5
- package/dist/resources/parsing.js +170 -24
- package/dist/resources/playlists.d.ts +7 -3
- package/dist/resources/playlists.js +13 -6
- package/dist/resources/profiles.d.ts +7 -2
- package/dist/resources/profiles.js +13 -3
- package/dist/resources/quests.d.ts +3 -44
- package/dist/resources/quests.js +3 -44
- package/dist/resources/replays.d.ts +82 -0
- package/dist/resources/replays.js +105 -0
- package/dist/resources/shop.d.ts +5 -4
- package/dist/resources/shop.js +6 -4
- package/dist/resources/tournaments.d.ts +42 -1
- package/dist/resources/tournaments.js +53 -0
- package/dist/resources/weapons.d.ts +19 -15
- package/dist/resources/weapons.js +22 -15
- package/dist/types/index.d.ts +73 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { CalendarResource } from "./resources/calendar";
|
|
|
5
5
|
import { BundlesResource } from "./resources/bundles";
|
|
6
6
|
import { OauthResource } from "./resources/oauth";
|
|
7
7
|
import { ParsingResource } from "./resources/parsing";
|
|
8
|
+
import { ReplaysResource } from "./resources/replays";
|
|
8
9
|
import { WeaponsResource } from "./resources/weapons";
|
|
9
10
|
import { BattlePassResource } from "./resources/battlepass";
|
|
10
11
|
import { QuestsResource } from "./resources/quests";
|
|
@@ -32,6 +33,7 @@ export declare class FortniteAPI {
|
|
|
32
33
|
bundles: BundlesResource;
|
|
33
34
|
oauth: OauthResource;
|
|
34
35
|
parsing: ParsingResource;
|
|
36
|
+
replays: ReplaysResource;
|
|
35
37
|
weapons: WeaponsResource;
|
|
36
38
|
battlepass: BattlePassResource;
|
|
37
39
|
quests: QuestsResource;
|
|
@@ -50,6 +52,10 @@ export declare class FortniteAPI {
|
|
|
50
52
|
* Internal method to make HTTP requests
|
|
51
53
|
*/
|
|
52
54
|
request<T>(endpoint: string, options?: RequestInit, version?: "v1" | "v2"): Promise<T>;
|
|
55
|
+
/**
|
|
56
|
+
* Internal method for binary (application/octet-stream) downloads
|
|
57
|
+
*/
|
|
58
|
+
requestBinary(endpoint: string, version?: "v1" | "v2"): Promise<ArrayBuffer>;
|
|
53
59
|
/**
|
|
54
60
|
* Internal method for multipart/form-data requests (file uploads)
|
|
55
61
|
*/
|
package/dist/client.js
CHANGED
|
@@ -9,6 +9,7 @@ const errors_1 = require("./errors");
|
|
|
9
9
|
const bundles_1 = require("./resources/bundles");
|
|
10
10
|
const oauth_1 = require("./resources/oauth");
|
|
11
11
|
const parsing_1 = require("./resources/parsing");
|
|
12
|
+
const replays_1 = require("./resources/replays");
|
|
12
13
|
const weapons_1 = require("./resources/weapons");
|
|
13
14
|
const battlepass_1 = require("./resources/battlepass");
|
|
14
15
|
const quests_1 = require("./resources/quests");
|
|
@@ -35,6 +36,7 @@ class FortniteAPI {
|
|
|
35
36
|
this.bundles = new bundles_1.BundlesResource(this);
|
|
36
37
|
this.oauth = new oauth_1.OauthResource(this);
|
|
37
38
|
this.parsing = new parsing_1.ParsingResource(this);
|
|
39
|
+
this.replays = new replays_1.ReplaysResource(this);
|
|
38
40
|
this.weapons = new weapons_1.WeaponsResource(this);
|
|
39
41
|
this.battlepass = new battlepass_1.BattlePassResource(this);
|
|
40
42
|
this.quests = new quests_1.QuestsResource(this);
|
|
@@ -75,6 +77,28 @@ class FortniteAPI {
|
|
|
75
77
|
const data = await response.json();
|
|
76
78
|
return data;
|
|
77
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Internal method for binary (application/octet-stream) downloads
|
|
82
|
+
*/
|
|
83
|
+
async requestBinary(endpoint, version = "v1") {
|
|
84
|
+
const url = `${this.baseUrl}/${version}${endpoint}`;
|
|
85
|
+
const response = await fetch(url, {
|
|
86
|
+
headers: {
|
|
87
|
+
"x-api-key": this.apiKey,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
if (!response.ok) {
|
|
91
|
+
let errorData;
|
|
92
|
+
try {
|
|
93
|
+
errorData = await response.json();
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
errorData = { error: "Request failed" };
|
|
97
|
+
}
|
|
98
|
+
throw new errors_1.FortniteAPIError(errorData.error || `Request failed with status ${response.status}`, response.status, errorData);
|
|
99
|
+
}
|
|
100
|
+
return response.arrayBuffer();
|
|
101
|
+
}
|
|
78
102
|
/**
|
|
79
103
|
* Internal method for multipart/form-data requests (file uploads)
|
|
80
104
|
*/
|
|
@@ -56,4 +56,10 @@ export declare class AccountResource {
|
|
|
56
56
|
* @param accountIds - Array of Epic Games account IDs (comma-separated, max 100)
|
|
57
57
|
*/
|
|
58
58
|
getDisplayNames(accountIds: string[]): Promise<Account[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Epic ID SDK v2 lookup — returns extended account info via the Developer Portal API.
|
|
61
|
+
* Accepts one or more Epic account IDs.
|
|
62
|
+
* @param accountIds - One or more Epic account IDs (comma-separated)
|
|
63
|
+
*/
|
|
64
|
+
getEpicIdSdkAccounts(accountIds: string | string[]): Promise<any[]>;
|
|
59
65
|
}
|
|
@@ -107,5 +107,14 @@ class AccountResource {
|
|
|
107
107
|
const ids = accountIds.join(",");
|
|
108
108
|
return this.client.request(`/account/displaynames?ids=${encodeURIComponent(ids)}`, {}, "v1");
|
|
109
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Epic ID SDK v2 lookup — returns extended account info via the Developer Portal API.
|
|
112
|
+
* Accepts one or more Epic account IDs.
|
|
113
|
+
* @param accountIds - One or more Epic account IDs (comma-separated)
|
|
114
|
+
*/
|
|
115
|
+
async getEpicIdSdkAccounts(accountIds) {
|
|
116
|
+
const ids = Array.isArray(accountIds) ? accountIds.join(",") : accountIds;
|
|
117
|
+
return this.client.request(`/account/sdk?accountId=${encodeURIComponent(ids)}`, {}, "v1");
|
|
118
|
+
}
|
|
110
119
|
}
|
|
111
120
|
exports.AccountResource = AccountResource;
|
|
@@ -4,7 +4,8 @@ export declare class BattlePassResource {
|
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
6
6
|
/**
|
|
7
|
-
* Get current
|
|
7
|
+
* Get current Battle Pass content and rewards
|
|
8
|
+
* @param lang - Language code (default: en)
|
|
8
9
|
*/
|
|
9
|
-
getBattlePass(): Promise<BattlePass>;
|
|
10
|
+
getBattlePass(lang?: string): Promise<BattlePass>;
|
|
10
11
|
}
|
|
@@ -6,10 +6,12 @@ class BattlePassResource {
|
|
|
6
6
|
this.client = client;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Get current
|
|
9
|
+
* Get current Battle Pass content and rewards
|
|
10
|
+
* @param lang - Language code (default: en)
|
|
10
11
|
*/
|
|
11
|
-
async getBattlePass() {
|
|
12
|
-
|
|
12
|
+
async getBattlePass(lang) {
|
|
13
|
+
const query = lang ? `?lang=${encodeURIComponent(lang)}` : "";
|
|
14
|
+
return this.client.request(`/shop/battlepass${query}`);
|
|
13
15
|
}
|
|
14
16
|
}
|
|
15
17
|
exports.BattlePassResource = BattlePassResource;
|
|
@@ -4,11 +4,11 @@ export declare class BundlesResource {
|
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
6
6
|
/**
|
|
7
|
-
* Get
|
|
7
|
+
* Get tournament asset bundles (images, icons, rewards)
|
|
8
8
|
*/
|
|
9
9
|
getBundlesTournament(): Promise<TournamentsBundle>;
|
|
10
10
|
/**
|
|
11
|
-
* Get
|
|
11
|
+
* Get shop asset bundles
|
|
12
12
|
*/
|
|
13
13
|
getBundlesShop(): Promise<Shop>;
|
|
14
14
|
}
|
|
@@ -6,13 +6,13 @@ class BundlesResource {
|
|
|
6
6
|
this.client = client;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Get
|
|
9
|
+
* Get tournament asset bundles (images, icons, rewards)
|
|
10
10
|
*/
|
|
11
11
|
async getBundlesTournament() {
|
|
12
12
|
return this.client.request("/assets/bundles/tournaments");
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Get
|
|
15
|
+
* Get shop asset bundles
|
|
16
16
|
*/
|
|
17
17
|
async getBundlesShop() {
|
|
18
18
|
return this.client.request("/assets/bundles/shop");
|
|
@@ -5,21 +5,32 @@ export declare class CosmeticsResource {
|
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
6
6
|
/**
|
|
7
7
|
* Get all cosmetics with pagination and filters
|
|
8
|
+
* @param params.lang - Language code (default: en)
|
|
8
9
|
*/
|
|
9
|
-
getAll(params?: CosmeticsSearchParams
|
|
10
|
+
getAll(params?: CosmeticsSearchParams & {
|
|
11
|
+
lang?: string;
|
|
12
|
+
}): Promise<CosmeticsPaginatedResponse>;
|
|
10
13
|
/**
|
|
11
14
|
* Get a specific cosmetic by ID
|
|
15
|
+
* @param id - Cosmetic ID
|
|
16
|
+
* @param lang - Language code (default: en)
|
|
12
17
|
*/
|
|
13
|
-
getById(id: string): Promise<CosmeticsResponse<CosmeticItem>>;
|
|
18
|
+
getById(id: string, lang?: string): Promise<CosmeticsResponse<CosmeticItem>>;
|
|
14
19
|
/**
|
|
15
20
|
* Search cosmetics by name or description
|
|
21
|
+
* @param query - Search term
|
|
22
|
+
* @param params.lang - Language code (default: en)
|
|
16
23
|
*/
|
|
17
|
-
search(query: string, params?: Omit<CosmeticsSearchParams, 'search'>
|
|
24
|
+
search(query: string, params?: Omit<CosmeticsSearchParams, 'search'> & {
|
|
25
|
+
lang?: string;
|
|
26
|
+
}): Promise<CosmeticsPaginatedResponse>;
|
|
18
27
|
/**
|
|
19
28
|
* Get recently added cosmetics
|
|
29
|
+
* @param params.lang - Language code (default: en)
|
|
20
30
|
*/
|
|
21
31
|
getNew(params?: {
|
|
22
32
|
page?: number;
|
|
23
33
|
pageSize?: number;
|
|
34
|
+
lang?: string;
|
|
24
35
|
}): Promise<CosmeticsPaginatedResponse>;
|
|
25
36
|
}
|
|
@@ -7,6 +7,7 @@ class CosmeticsResource {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Get all cosmetics with pagination and filters
|
|
10
|
+
* @param params.lang - Language code (default: en)
|
|
10
11
|
*/
|
|
11
12
|
async getAll(params) {
|
|
12
13
|
const queryParams = new URLSearchParams();
|
|
@@ -26,18 +27,25 @@ class CosmeticsResource {
|
|
|
26
27
|
queryParams.set("season", params.season.toString());
|
|
27
28
|
if (params?.chapter)
|
|
28
29
|
queryParams.set("chapter", params.chapter.toString());
|
|
30
|
+
if (params?.lang)
|
|
31
|
+
queryParams.set("lang", params.lang);
|
|
29
32
|
const query = queryParams.toString();
|
|
30
33
|
const endpoint = query ? `/cosmetics/all?${query}` : "/cosmetics/all";
|
|
31
|
-
return this.client.request(endpoint);
|
|
34
|
+
return this.client.request(endpoint, {}, "v2");
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
34
37
|
* Get a specific cosmetic by ID
|
|
38
|
+
* @param id - Cosmetic ID
|
|
39
|
+
* @param lang - Language code (default: en)
|
|
35
40
|
*/
|
|
36
|
-
async getById(id) {
|
|
37
|
-
|
|
41
|
+
async getById(id, lang) {
|
|
42
|
+
const query = lang ? `?lang=${encodeURIComponent(lang)}` : "";
|
|
43
|
+
return this.client.request(`/cosmetics/${id}${query}`, {}, "v2");
|
|
38
44
|
}
|
|
39
45
|
/**
|
|
40
46
|
* Search cosmetics by name or description
|
|
47
|
+
* @param query - Search term
|
|
48
|
+
* @param params.lang - Language code (default: en)
|
|
41
49
|
*/
|
|
42
50
|
async search(query, params) {
|
|
43
51
|
const queryParams = new URLSearchParams();
|
|
@@ -52,10 +60,13 @@ class CosmeticsResource {
|
|
|
52
60
|
queryParams.set("rarity", params.rarity);
|
|
53
61
|
if (params?.set)
|
|
54
62
|
queryParams.set("set", params.set);
|
|
55
|
-
|
|
63
|
+
if (params?.lang)
|
|
64
|
+
queryParams.set("lang", params.lang);
|
|
65
|
+
return this.client.request(`/cosmetics/search?${queryParams.toString()}`, {}, "v2");
|
|
56
66
|
}
|
|
57
67
|
/**
|
|
58
68
|
* Get recently added cosmetics
|
|
69
|
+
* @param params.lang - Language code (default: en)
|
|
59
70
|
*/
|
|
60
71
|
async getNew(params) {
|
|
61
72
|
const queryParams = new URLSearchParams();
|
|
@@ -63,9 +74,11 @@ class CosmeticsResource {
|
|
|
63
74
|
queryParams.set("page", params.page.toString());
|
|
64
75
|
if (params?.pageSize)
|
|
65
76
|
queryParams.set("pageSize", params.pageSize.toString());
|
|
77
|
+
if (params?.lang)
|
|
78
|
+
queryParams.set("lang", params.lang);
|
|
66
79
|
const query = queryParams.toString();
|
|
67
80
|
const endpoint = query ? `/cosmetics/new?${query}` : "/cosmetics/new";
|
|
68
|
-
return this.client.request(endpoint);
|
|
81
|
+
return this.client.request(endpoint, {}, "v2");
|
|
69
82
|
}
|
|
70
83
|
}
|
|
71
84
|
exports.CosmeticsResource = CosmeticsResource;
|
|
@@ -1,44 +1,14 @@
|
|
|
1
1
|
import { FortniteAPI } from "../client";
|
|
2
|
-
import {
|
|
2
|
+
import { EventLeaderboard, PlayerTokensResponse, PlayerWindowStanding } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Events Resource
|
|
5
|
-
* Handles tournament and competitive events data
|
|
5
|
+
* Handles tournament and competitive events leaderboard data
|
|
6
6
|
*/
|
|
7
7
|
export declare class EventsResource {
|
|
8
8
|
private client;
|
|
9
9
|
constructor(client: FortniteAPI);
|
|
10
10
|
/**
|
|
11
|
-
* Get event
|
|
12
|
-
* @param eventId - Event ID
|
|
13
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
14
|
-
* @returns Event windows data
|
|
15
|
-
*/
|
|
16
|
-
getEventWindows(eventId: string, fortniteToken?: string): Promise<EventWindows>;
|
|
17
|
-
/**
|
|
18
|
-
* Get player event history
|
|
19
|
-
* @param accountId - Account ID
|
|
20
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
21
|
-
* @returns Array of events player participated in
|
|
22
|
-
*/
|
|
23
|
-
getPlayerHistory(accountId: string, fortniteToken?: string): Promise<PlayerEventHistory[]>;
|
|
24
|
-
/**
|
|
25
|
-
* Get tournament details
|
|
26
|
-
* @param eventId - Event ID
|
|
27
|
-
* @param eventWindowId - Event window ID
|
|
28
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
29
|
-
* @returns Tournament details
|
|
30
|
-
*/
|
|
31
|
-
getTournamentDetails(eventId: string, eventWindowId: string, fortniteToken?: string): Promise<TournamentDetails>;
|
|
32
|
-
/**
|
|
33
|
-
* Get event scoring rules
|
|
34
|
-
* @param eventId - Event ID
|
|
35
|
-
* @param eventWindowId - Event window ID
|
|
36
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
37
|
-
* @returns Scoring rules
|
|
38
|
-
*/
|
|
39
|
-
getScoringRules(eventId: string, eventWindowId: string, fortniteToken?: string): Promise<ScoringRules>;
|
|
40
|
-
/**
|
|
41
|
-
* Get event leaderboard
|
|
11
|
+
* Get the paginated leaderboard for a specific event window
|
|
42
12
|
* @param eventId - Event ID
|
|
43
13
|
* @param eventWindowId - Event window ID
|
|
44
14
|
* @param options - Query options
|
|
@@ -47,16 +17,8 @@ export declare class EventsResource {
|
|
|
47
17
|
*/
|
|
48
18
|
getLeaderboard(eventId: string, eventWindowId: string, options?: {
|
|
49
19
|
page?: number;
|
|
20
|
+
leaderboardDef?: string;
|
|
50
21
|
}, fortniteToken?: string): Promise<EventLeaderboard>;
|
|
51
|
-
/**
|
|
52
|
-
* Get player event data
|
|
53
|
-
* @param eventId - Event ID
|
|
54
|
-
* @param eventWindowId - Event window ID
|
|
55
|
-
* @param accountId - Account ID
|
|
56
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
57
|
-
* @returns Player's event performance data
|
|
58
|
-
*/
|
|
59
|
-
getPlayerEventData(eventId: string, eventWindowId: string, accountId: string, fortniteToken?: string): Promise<PlayerEventData>;
|
|
60
22
|
/**
|
|
61
23
|
* Find a player's rank and surrounding entries in an event window leaderboard.
|
|
62
24
|
* Works for any placement including beyond top 10k. No user token required.
|
|
@@ -65,6 +27,24 @@ export declare class EventsResource {
|
|
|
65
27
|
* @param accountId - Epic account ID of the player to look up
|
|
66
28
|
*/
|
|
67
29
|
getPlayerLeaderboard(eventId: string, eventWindowId: string, accountId: string): Promise<EventLeaderboard>;
|
|
30
|
+
/**
|
|
31
|
+
* Get a player's standing in a specific event window.
|
|
32
|
+
*
|
|
33
|
+
* Uses Epic's dedicated player endpoint — no leaderboard page scanning required.
|
|
34
|
+
* Returns rank, score, and full session history for the player directly.
|
|
35
|
+
* No user token required — uses service auth.
|
|
36
|
+
*
|
|
37
|
+
* @param eventId - Event identifier (e.g. `"epicgames_S40_FNCSMajor1_PlayInStage_EU"`)
|
|
38
|
+
* @param eventWindowId - Event window identifier (e.g. `"S40_FNCSMajor1_PlayInStage_Day1_EU"`)
|
|
39
|
+
* @param accountId - Epic account ID of the player
|
|
40
|
+
*/
|
|
41
|
+
getPlayerWindowStanding(eventId: string, eventWindowId: string, accountId: string): Promise<PlayerWindowStanding>;
|
|
42
|
+
/**
|
|
43
|
+
* Get a player's event participation history.
|
|
44
|
+
* Uses the V2 events endpoint with service token — no user token required.
|
|
45
|
+
* @param accountId - Epic account ID of the player
|
|
46
|
+
*/
|
|
47
|
+
getPlayerEventHistory(accountId: string): Promise<any>;
|
|
68
48
|
/**
|
|
69
49
|
* Get the raw token set for one or more players.
|
|
70
50
|
* Tokens are eligibility flags earned by participating in tournaments
|
|
@@ -73,12 +53,4 @@ export declare class EventsResource {
|
|
|
73
53
|
* @param accountIds - One or more Epic account IDs
|
|
74
54
|
*/
|
|
75
55
|
getPlayerTokens(accountIds: string | string[]): Promise<PlayerTokensResponse>;
|
|
76
|
-
/**
|
|
77
|
-
* Get event rewards/prizes
|
|
78
|
-
* @param eventId - Event ID
|
|
79
|
-
* @param eventWindowId - Event window ID
|
|
80
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
81
|
-
* @returns Event rewards structure
|
|
82
|
-
*/
|
|
83
|
-
getEventRewards(eventId: string, eventWindowId: string, fortniteToken?: string): Promise<EventRewards>;
|
|
84
56
|
}
|
package/dist/resources/events.js
CHANGED
|
@@ -3,68 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EventsResource = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Events Resource
|
|
6
|
-
* Handles tournament and competitive events data
|
|
6
|
+
* Handles tournament and competitive events leaderboard data
|
|
7
7
|
*/
|
|
8
8
|
class EventsResource {
|
|
9
9
|
constructor(client) {
|
|
10
10
|
this.client = client;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Get event
|
|
14
|
-
* @param eventId - Event ID
|
|
15
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
16
|
-
* @returns Event windows data
|
|
17
|
-
*/
|
|
18
|
-
async getEventWindows(eventId, fortniteToken) {
|
|
19
|
-
const headers = {};
|
|
20
|
-
if (fortniteToken) {
|
|
21
|
-
headers["x-fortnite-token"] = fortniteToken;
|
|
22
|
-
}
|
|
23
|
-
return this.client.request(`/events/${eventId}/windows`, { headers }, "v2");
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Get player event history
|
|
27
|
-
* @param accountId - Account ID
|
|
28
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
29
|
-
* @returns Array of events player participated in
|
|
30
|
-
*/
|
|
31
|
-
async getPlayerHistory(accountId, fortniteToken) {
|
|
32
|
-
const headers = {};
|
|
33
|
-
if (fortniteToken) {
|
|
34
|
-
headers["x-fortnite-token"] = fortniteToken;
|
|
35
|
-
}
|
|
36
|
-
return this.client.request(`/events/history/${accountId}`, { headers }, "v2");
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Get tournament details
|
|
40
|
-
* @param eventId - Event ID
|
|
41
|
-
* @param eventWindowId - Event window ID
|
|
42
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
43
|
-
* @returns Tournament details
|
|
44
|
-
*/
|
|
45
|
-
async getTournamentDetails(eventId, eventWindowId, fortniteToken) {
|
|
46
|
-
const headers = {};
|
|
47
|
-
if (fortniteToken) {
|
|
48
|
-
headers["x-fortnite-token"] = fortniteToken;
|
|
49
|
-
}
|
|
50
|
-
return this.client.request(`/events/${eventId}/windows/${eventWindowId}`, { headers }, "v2");
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get event scoring rules
|
|
54
|
-
* @param eventId - Event ID
|
|
55
|
-
* @param eventWindowId - Event window ID
|
|
56
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
57
|
-
* @returns Scoring rules
|
|
58
|
-
*/
|
|
59
|
-
async getScoringRules(eventId, eventWindowId, fortniteToken) {
|
|
60
|
-
const headers = {};
|
|
61
|
-
if (fortniteToken) {
|
|
62
|
-
headers["x-fortnite-token"] = fortniteToken;
|
|
63
|
-
}
|
|
64
|
-
return this.client.request(`/events/${eventId}/windows/${eventWindowId}/scoring`, { headers }, "v2");
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Get event leaderboard
|
|
13
|
+
* Get the paginated leaderboard for a specific event window
|
|
68
14
|
* @param eventId - Event ID
|
|
69
15
|
* @param eventWindowId - Event window ID
|
|
70
16
|
* @param options - Query options
|
|
@@ -76,23 +22,13 @@ class EventsResource {
|
|
|
76
22
|
if (fortniteToken) {
|
|
77
23
|
headers["x-fortnite-token"] = fortniteToken;
|
|
78
24
|
}
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
* @param accountId - Account ID
|
|
87
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
88
|
-
* @returns Player's event performance data
|
|
89
|
-
*/
|
|
90
|
-
async getPlayerEventData(eventId, eventWindowId, accountId, fortniteToken) {
|
|
91
|
-
const headers = {};
|
|
92
|
-
if (fortniteToken) {
|
|
93
|
-
headers["x-fortnite-token"] = fortniteToken;
|
|
94
|
-
}
|
|
95
|
-
return this.client.request(`/events/${eventId}/windows/${eventWindowId}/players/${accountId}`, { headers }, "v2");
|
|
25
|
+
const params = new URLSearchParams();
|
|
26
|
+
if (options?.page != null)
|
|
27
|
+
params.append("page", String(options.page));
|
|
28
|
+
if (options?.leaderboardDef)
|
|
29
|
+
params.append("leaderboardDef", options.leaderboardDef);
|
|
30
|
+
const qs = params.toString();
|
|
31
|
+
return this.client.request(`/events/${eventId}/windows/${eventWindowId}/leaderboard${qs ? `?${qs}` : ""}`, { headers }, "v2");
|
|
96
32
|
}
|
|
97
33
|
/**
|
|
98
34
|
* Find a player's rank and surrounding entries in an event window leaderboard.
|
|
@@ -104,6 +40,28 @@ class EventsResource {
|
|
|
104
40
|
async getPlayerLeaderboard(eventId, eventWindowId, accountId) {
|
|
105
41
|
return this.client.request(`/events/${eventId}/windows/${eventWindowId}/leaderboard/player?accountId=${encodeURIComponent(accountId)}`, {}, "v2");
|
|
106
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Get a player's standing in a specific event window.
|
|
45
|
+
*
|
|
46
|
+
* Uses Epic's dedicated player endpoint — no leaderboard page scanning required.
|
|
47
|
+
* Returns rank, score, and full session history for the player directly.
|
|
48
|
+
* No user token required — uses service auth.
|
|
49
|
+
*
|
|
50
|
+
* @param eventId - Event identifier (e.g. `"epicgames_S40_FNCSMajor1_PlayInStage_EU"`)
|
|
51
|
+
* @param eventWindowId - Event window identifier (e.g. `"S40_FNCSMajor1_PlayInStage_Day1_EU"`)
|
|
52
|
+
* @param accountId - Epic account ID of the player
|
|
53
|
+
*/
|
|
54
|
+
async getPlayerWindowStanding(eventId, eventWindowId, accountId) {
|
|
55
|
+
return this.client.request(`/events/${encodeURIComponent(eventId)}/windows/${encodeURIComponent(eventWindowId)}/players/${encodeURIComponent(accountId)}`, {}, "v2");
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get a player's event participation history.
|
|
59
|
+
* Uses the V2 events endpoint with service token — no user token required.
|
|
60
|
+
* @param accountId - Epic account ID of the player
|
|
61
|
+
*/
|
|
62
|
+
async getPlayerEventHistory(accountId) {
|
|
63
|
+
return this.client.request(`/events/players/${encodeURIComponent(accountId)}/history`, {}, "v2");
|
|
64
|
+
}
|
|
107
65
|
/**
|
|
108
66
|
* Get the raw token set for one or more players.
|
|
109
67
|
* Tokens are eligibility flags earned by participating in tournaments
|
|
@@ -116,19 +74,5 @@ class EventsResource {
|
|
|
116
74
|
const qs = ids.map(encodeURIComponent).join("%2C");
|
|
117
75
|
return this.client.request(`/events/tokens?teamAccountIds=${qs}`, {}, "v1");
|
|
118
76
|
}
|
|
119
|
-
/**
|
|
120
|
-
* Get event rewards/prizes
|
|
121
|
-
* @param eventId - Event ID
|
|
122
|
-
* @param eventWindowId - Event window ID
|
|
123
|
-
* @param fortniteToken - Optional user Fortnite token
|
|
124
|
-
* @returns Event rewards structure
|
|
125
|
-
*/
|
|
126
|
-
async getEventRewards(eventId, eventWindowId, fortniteToken) {
|
|
127
|
-
const headers = {};
|
|
128
|
-
if (fortniteToken) {
|
|
129
|
-
headers["x-fortnite-token"] = fortniteToken;
|
|
130
|
-
}
|
|
131
|
-
return this.client.request(`/events/${eventId}/windows/${eventWindowId}/rewards`, { headers }, "v2");
|
|
132
|
-
}
|
|
133
77
|
}
|
|
134
78
|
exports.EventsResource = EventsResource;
|
package/dist/resources/fn.d.ts
CHANGED
|
@@ -24,11 +24,11 @@ export declare class FNResource {
|
|
|
24
24
|
*/
|
|
25
25
|
getEnabledFeatures(): Promise<EnabledFeatures>;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @param platform - Platform
|
|
29
|
-
* @param version -
|
|
27
|
+
* Get the current Fortnite version for a platform, with optional version string to check against
|
|
28
|
+
* @param platform - Platform code (e.g. Windows, Android, iOS)
|
|
29
|
+
* @param version - Optional version string to check against
|
|
30
30
|
*/
|
|
31
|
-
checkVersion(platform: string, version
|
|
31
|
+
checkVersion(platform: string, version?: string): Promise<VersionCheck>;
|
|
32
32
|
/**
|
|
33
33
|
* Get privacy settings for an account (requires user token)
|
|
34
34
|
* @param accountId - Epic Games account ID
|
package/dist/resources/fn.js
CHANGED
|
@@ -42,12 +42,13 @@ class FNResource {
|
|
|
42
42
|
return this.client.request("/fn/enabled-features", {}, "v2");
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @param platform - Platform
|
|
47
|
-
* @param version -
|
|
45
|
+
* Get the current Fortnite version for a platform, with optional version string to check against
|
|
46
|
+
* @param platform - Platform code (e.g. Windows, Android, iOS)
|
|
47
|
+
* @param version - Optional version string to check against
|
|
48
48
|
*/
|
|
49
49
|
async checkVersion(platform, version) {
|
|
50
|
-
|
|
50
|
+
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
51
|
+
return this.client.request(`/fn/version/${platform}${query}`, {}, "v2");
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
53
54
|
* Get privacy settings for an account (requires user token)
|
package/dist/resources/map.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ export declare class MapResource {
|
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
6
6
|
/**
|
|
7
7
|
* Get current Fortnite map with POIs
|
|
8
|
-
* @param version - Optional
|
|
8
|
+
* @param version - Optional map version (patch number); defaults to current
|
|
9
|
+
* @param lang - Language code for POI labels (default: en)
|
|
9
10
|
*/
|
|
10
|
-
getCurrent(version?: string): Promise<MapResponse>;
|
|
11
|
+
getCurrent(version?: string, lang?: string): Promise<MapResponse>;
|
|
11
12
|
/**
|
|
12
13
|
* Get current map image URL
|
|
13
14
|
* @param version - Optional specific map version to retrieve
|
package/dist/resources/map.js
CHANGED
|
@@ -7,10 +7,16 @@ class MapResource {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Get current Fortnite map with POIs
|
|
10
|
-
* @param version - Optional
|
|
10
|
+
* @param version - Optional map version (patch number); defaults to current
|
|
11
|
+
* @param lang - Language code for POI labels (default: en)
|
|
11
12
|
*/
|
|
12
|
-
async getCurrent(version) {
|
|
13
|
-
const
|
|
13
|
+
async getCurrent(version, lang) {
|
|
14
|
+
const params = new URLSearchParams();
|
|
15
|
+
if (version)
|
|
16
|
+
params.set("version", version);
|
|
17
|
+
if (lang)
|
|
18
|
+
params.set("lang", lang);
|
|
19
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
14
20
|
return this.client.request(`/map${query}`);
|
|
15
21
|
}
|
|
16
22
|
/**
|
package/dist/resources/news.d.ts
CHANGED
|
@@ -5,18 +5,22 @@ export declare class NewsResource {
|
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
6
6
|
/**
|
|
7
7
|
* Get Battle Royale news
|
|
8
|
+
* @param lang - Language code (default: en)
|
|
8
9
|
*/
|
|
9
|
-
getBRNews(): Promise<NewsResponse<BRNews>>;
|
|
10
|
+
getBRNews(lang?: string): Promise<NewsResponse<BRNews>>;
|
|
10
11
|
/**
|
|
11
12
|
* Get Save The World news
|
|
13
|
+
* @param lang - Language code (default: en)
|
|
12
14
|
*/
|
|
13
|
-
getSTWNews(): Promise<NewsResponse<STWNews>>;
|
|
15
|
+
getSTWNews(lang?: string): Promise<NewsResponse<STWNews>>;
|
|
14
16
|
/**
|
|
15
17
|
* Get Creative news
|
|
18
|
+
* @param lang - Language code (default: en)
|
|
16
19
|
*/
|
|
17
|
-
getCreativeNews(): Promise<NewsResponse<CreativeNews>>;
|
|
20
|
+
getCreativeNews(lang?: string): Promise<NewsResponse<CreativeNews>>;
|
|
18
21
|
/**
|
|
19
22
|
* Get all news (BR, STW, Creative)
|
|
23
|
+
* @param lang - Language code (default: en)
|
|
20
24
|
*/
|
|
21
|
-
getAllNews(): Promise<NewsResponse<AllNews>>;
|
|
25
|
+
getAllNews(lang?: string): Promise<NewsResponse<AllNews>>;
|
|
22
26
|
}
|
package/dist/resources/news.js
CHANGED
|
@@ -7,27 +7,35 @@ class NewsResource {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Get Battle Royale news
|
|
10
|
+
* @param lang - Language code (default: en)
|
|
10
11
|
*/
|
|
11
|
-
async getBRNews() {
|
|
12
|
-
|
|
12
|
+
async getBRNews(lang) {
|
|
13
|
+
const query = lang ? `?lang=${encodeURIComponent(lang)}` : "";
|
|
14
|
+
return this.client.request(`/news/br${query}`);
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Get Save The World news
|
|
18
|
+
* @param lang - Language code (default: en)
|
|
16
19
|
*/
|
|
17
|
-
async getSTWNews() {
|
|
18
|
-
|
|
20
|
+
async getSTWNews(lang) {
|
|
21
|
+
const query = lang ? `?lang=${encodeURIComponent(lang)}` : "";
|
|
22
|
+
return this.client.request(`/news/stw${query}`);
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* Get Creative news
|
|
26
|
+
* @param lang - Language code (default: en)
|
|
22
27
|
*/
|
|
23
|
-
async getCreativeNews() {
|
|
24
|
-
|
|
28
|
+
async getCreativeNews(lang) {
|
|
29
|
+
const query = lang ? `?lang=${encodeURIComponent(lang)}` : "";
|
|
30
|
+
return this.client.request(`/news/creative${query}`);
|
|
25
31
|
}
|
|
26
32
|
/**
|
|
27
33
|
* Get all news (BR, STW, Creative)
|
|
34
|
+
* @param lang - Language code (default: en)
|
|
28
35
|
*/
|
|
29
|
-
async getAllNews() {
|
|
30
|
-
|
|
36
|
+
async getAllNews(lang) {
|
|
37
|
+
const query = lang ? `?lang=${encodeURIComponent(lang)}` : "";
|
|
38
|
+
return this.client.request(`/news${query}`);
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
exports.NewsResource = NewsResource;
|