@yaelouuu/fortnite-api 5.0.0 → 6.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/client.d.ts +2 -2
- package/dist/client.js +0 -0
- package/dist/errors.d.ts +0 -0
- package/dist/errors.js +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/dist/resources/battlepass.d.ts +0 -0
- package/dist/resources/battlepass.js +1 -1
- package/dist/resources/bundles.d.ts +0 -0
- package/dist/resources/bundles.js +0 -0
- package/dist/resources/calendar.d.ts +0 -0
- package/dist/resources/calendar.js +0 -0
- package/dist/resources/cosmetics.js +4 -0
- package/dist/resources/map.d.ts +10 -3
- package/dist/resources/map.js +18 -6
- package/dist/resources/oauth.d.ts +0 -0
- package/dist/resources/oauth.js +0 -0
- package/dist/resources/parsing.d.ts +0 -0
- package/dist/resources/parsing.js +0 -0
- package/dist/resources/profiles.d.ts +0 -0
- package/dist/resources/profiles.js +0 -0
- package/dist/resources/quests.d.ts +1 -1
- package/dist/resources/quests.js +2 -2
- package/dist/resources/shop.d.ts +0 -0
- package/dist/resources/shop.js +0 -0
- package/dist/resources/tournaments.d.ts +22 -10
- package/dist/resources/tournaments.js +28 -16
- package/dist/resources/weapons.d.ts +5 -1
- package/dist/resources/weapons.js +6 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.js +0 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -49,9 +49,9 @@ export declare class FortniteAPI {
|
|
|
49
49
|
/**
|
|
50
50
|
* Internal method to make HTTP requests
|
|
51
51
|
*/
|
|
52
|
-
request<T>(endpoint: string, options?: RequestInit, version?: "v1" | "v2"
|
|
52
|
+
request<T>(endpoint: string, options?: RequestInit, version?: "v1" | "v2"): Promise<T>;
|
|
53
53
|
/**
|
|
54
54
|
* Internal method for multipart/form-data requests (file uploads)
|
|
55
55
|
*/
|
|
56
|
-
requestMultipart<T>(endpoint: string, formData: FormData, version?: "v1" | "v2"
|
|
56
|
+
requestMultipart<T>(endpoint: string, formData: FormData, version?: "v1" | "v2"): Promise<T>;
|
|
57
57
|
}
|
package/dist/client.js
CHANGED
|
File without changes
|
package/dist/errors.d.ts
CHANGED
|
File without changes
|
package/dist/errors.js
CHANGED
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -22,6 +22,10 @@ class CosmeticsResource {
|
|
|
22
22
|
queryParams.set("set", params.set);
|
|
23
23
|
if (params?.search)
|
|
24
24
|
queryParams.set("search", params.search);
|
|
25
|
+
if (params?.season)
|
|
26
|
+
queryParams.set("season", params.season.toString());
|
|
27
|
+
if (params?.chapter)
|
|
28
|
+
queryParams.set("chapter", params.chapter.toString());
|
|
25
29
|
const query = queryParams.toString();
|
|
26
30
|
const endpoint = query ? `/cosmetics/all?${query}` : "/cosmetics/all";
|
|
27
31
|
return this.client.request(endpoint);
|
package/dist/resources/map.d.ts
CHANGED
|
@@ -5,14 +5,21 @@ export declare class MapResource {
|
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
6
6
|
/**
|
|
7
7
|
* Get current Fortnite map with POIs
|
|
8
|
+
* @param version - Optional specific map version to retrieve
|
|
8
9
|
*/
|
|
9
|
-
getCurrent(): Promise<MapResponse>;
|
|
10
|
+
getCurrent(version?: string): Promise<MapResponse>;
|
|
10
11
|
/**
|
|
11
12
|
* Get current map image URL
|
|
13
|
+
* @param version - Optional specific map version to retrieve
|
|
12
14
|
*/
|
|
13
|
-
getImage(): Promise<MapImageResponse>;
|
|
15
|
+
getImage(version?: string): Promise<MapImageResponse>;
|
|
14
16
|
/**
|
|
15
17
|
* Get historical map data
|
|
18
|
+
* @param options.chapter - Filter by chapter number
|
|
19
|
+
* @param options.season - Filter by season number
|
|
16
20
|
*/
|
|
17
|
-
getHistory(
|
|
21
|
+
getHistory(options?: {
|
|
22
|
+
chapter?: number;
|
|
23
|
+
season?: number;
|
|
24
|
+
}): Promise<MapHistoryResponse>;
|
|
18
25
|
}
|
package/dist/resources/map.js
CHANGED
|
@@ -7,21 +7,33 @@ class MapResource {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Get current Fortnite map with POIs
|
|
10
|
+
* @param version - Optional specific map version to retrieve
|
|
10
11
|
*/
|
|
11
|
-
async getCurrent() {
|
|
12
|
-
|
|
12
|
+
async getCurrent(version) {
|
|
13
|
+
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
14
|
+
return this.client.request(`/map${query}`);
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Get current map image URL
|
|
18
|
+
* @param version - Optional specific map version to retrieve
|
|
16
19
|
*/
|
|
17
|
-
async getImage() {
|
|
18
|
-
|
|
20
|
+
async getImage(version) {
|
|
21
|
+
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
22
|
+
return this.client.request(`/map/image${query}`);
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* Get historical map data
|
|
26
|
+
* @param options.chapter - Filter by chapter number
|
|
27
|
+
* @param options.season - Filter by season number
|
|
22
28
|
*/
|
|
23
|
-
async getHistory() {
|
|
24
|
-
|
|
29
|
+
async getHistory(options) {
|
|
30
|
+
const params = new URLSearchParams();
|
|
31
|
+
if (options?.chapter)
|
|
32
|
+
params.set("chapter", options.chapter.toString());
|
|
33
|
+
if (options?.season)
|
|
34
|
+
params.set("season", options.season.toString());
|
|
35
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
36
|
+
return this.client.request(`/map/history${query}`);
|
|
25
37
|
}
|
|
26
38
|
}
|
|
27
39
|
exports.MapResource = MapResource;
|
|
File without changes
|
package/dist/resources/oauth.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/resources/quests.js
CHANGED
|
@@ -31,7 +31,7 @@ class QuestsResource {
|
|
|
31
31
|
*
|
|
32
32
|
* **Authentication**: Requires user's personal Fortnite OAuth token
|
|
33
33
|
*
|
|
34
|
-
* **API Version**:
|
|
34
|
+
* **API Version**: v2
|
|
35
35
|
*
|
|
36
36
|
* **Rate Limit**: Standard API rate limits apply
|
|
37
37
|
*
|
|
@@ -56,7 +56,7 @@ class QuestsResource {
|
|
|
56
56
|
headers: {
|
|
57
57
|
"x-fortnite-token": fortniteToken,
|
|
58
58
|
},
|
|
59
|
-
}, "
|
|
59
|
+
}, "v2");
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
exports.QuestsResource = QuestsResource;
|
package/dist/resources/shop.d.ts
CHANGED
|
File without changes
|
package/dist/resources/shop.js
CHANGED
|
File without changes
|
|
@@ -4,17 +4,15 @@ export declare class TournamentsResource {
|
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
6
6
|
/**
|
|
7
|
-
* Get
|
|
8
|
-
* No parameters needed - uses API's default account
|
|
7
|
+
* Get currently active and upcoming tournaments, enriched with CMS metadata
|
|
9
8
|
*/
|
|
10
9
|
getCurrent(): Promise<any>;
|
|
11
10
|
/**
|
|
12
|
-
* Get past
|
|
13
|
-
* No parameters needed - uses API's default account
|
|
11
|
+
* Get all tournaments including past ones, enriched with CMS metadata
|
|
14
12
|
*/
|
|
15
13
|
getPast(): Promise<any>;
|
|
16
14
|
/**
|
|
17
|
-
* Get global events with metadata
|
|
15
|
+
* Get global events with metadata (alias for getCurrent)
|
|
18
16
|
*/
|
|
19
17
|
getGlobal(): Promise<any>;
|
|
20
18
|
getSessions(params: {
|
|
@@ -35,12 +33,26 @@ export declare class TournamentsResource {
|
|
|
35
33
|
}, fortniteToken: string): Promise<any>;
|
|
36
34
|
/**
|
|
37
35
|
* Get tournament leaderboard
|
|
38
|
-
*
|
|
39
|
-
*
|
|
36
|
+
*
|
|
37
|
+
* The `leaderboardDef` parameter serves two distinct purposes depending on the tournament type:
|
|
38
|
+
*
|
|
39
|
+
* **1. Ranked Cup (rank-tier leaderboards)**
|
|
40
|
+
* Pass the rank-tier def ID found in `eventWindow.metadata.defaultLeaderboardByRank`.
|
|
41
|
+
* The server resolves this to a different internal window ID to return rank-filtered results.
|
|
42
|
+
* Example: `"ranked_br_division_7"`
|
|
43
|
+
*
|
|
44
|
+
* **2. Cumulative leaderboard**
|
|
45
|
+
* Pass the cumulative def ID found in `eventWindow.scoreLocations` where
|
|
46
|
+
* `isMainWindowLeaderboard === false`. The server forwards this as Epic's `sm=` query param,
|
|
47
|
+
* returning the combined leaderboard across all sessions in the same group (e.g. Day 1 + Day 2).
|
|
48
|
+
* Example: `"S40_FNCSMajor1_PlayInStage_CumulativeLeaderboardDef"`
|
|
49
|
+
*
|
|
50
|
+
* @param params.eventId - Event ID (e.g. `"epicgames_S40_FNCSMajor1_PlayInStage_EU"`)
|
|
51
|
+
* @param params.eventWindowId - Event window ID (e.g. `"S40_FNCSMajor1_PlayInStage_Day1_EU"`)
|
|
40
52
|
* @param params.page - Page number (default: 0)
|
|
41
|
-
* @param params.leaderboardDef - Optional leaderboard definition
|
|
42
|
-
* @param params.accountId - Optional account ID
|
|
43
|
-
* @param fortniteToken - Optional user's Fortnite token for personalized view
|
|
53
|
+
* @param params.leaderboardDef - Optional leaderboard definition ID (Ranked Cup tier or cumulative def)
|
|
54
|
+
* @param params.accountId - Optional account ID — highlights that player in the response
|
|
55
|
+
* @param fortniteToken - Optional user's Fortnite access token for personalized view
|
|
44
56
|
*/
|
|
45
57
|
getLeaderboard(params: {
|
|
46
58
|
eventId: string;
|
|
@@ -6,21 +6,19 @@ class TournamentsResource {
|
|
|
6
6
|
this.client = client;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Get
|
|
10
|
-
* No parameters needed - uses API's default account
|
|
9
|
+
* Get currently active and upcoming tournaments, enriched with CMS metadata
|
|
11
10
|
*/
|
|
12
11
|
async getCurrent() {
|
|
13
|
-
return this.client.request("/events/
|
|
12
|
+
return this.client.request("/events/global");
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
|
-
* Get past
|
|
17
|
-
* No parameters needed - uses API's default account
|
|
15
|
+
* Get all tournaments including past ones, enriched with CMS metadata
|
|
18
16
|
*/
|
|
19
17
|
async getPast() {
|
|
20
|
-
return this.client.request("/events/
|
|
18
|
+
return this.client.request("/events/global/history");
|
|
21
19
|
}
|
|
22
20
|
/**
|
|
23
|
-
* Get global events with metadata
|
|
21
|
+
* Get global events with metadata (alias for getCurrent)
|
|
24
22
|
*/
|
|
25
23
|
async getGlobal() {
|
|
26
24
|
return this.client.request("/events/global");
|
|
@@ -43,7 +41,7 @@ class TournamentsResource {
|
|
|
43
41
|
region: params.region,
|
|
44
42
|
platform: params.platform,
|
|
45
43
|
}).toString();
|
|
46
|
-
return this.client.request(`/events/
|
|
44
|
+
return this.client.request(`/events/player?${query}`, {
|
|
47
45
|
headers: {
|
|
48
46
|
"x-fortnite-token": fortniteToken,
|
|
49
47
|
},
|
|
@@ -51,12 +49,26 @@ class TournamentsResource {
|
|
|
51
49
|
}
|
|
52
50
|
/**
|
|
53
51
|
* Get tournament leaderboard
|
|
54
|
-
*
|
|
55
|
-
*
|
|
52
|
+
*
|
|
53
|
+
* The `leaderboardDef` parameter serves two distinct purposes depending on the tournament type:
|
|
54
|
+
*
|
|
55
|
+
* **1. Ranked Cup (rank-tier leaderboards)**
|
|
56
|
+
* Pass the rank-tier def ID found in `eventWindow.metadata.defaultLeaderboardByRank`.
|
|
57
|
+
* The server resolves this to a different internal window ID to return rank-filtered results.
|
|
58
|
+
* Example: `"ranked_br_division_7"`
|
|
59
|
+
*
|
|
60
|
+
* **2. Cumulative leaderboard**
|
|
61
|
+
* Pass the cumulative def ID found in `eventWindow.scoreLocations` where
|
|
62
|
+
* `isMainWindowLeaderboard === false`. The server forwards this as Epic's `sm=` query param,
|
|
63
|
+
* returning the combined leaderboard across all sessions in the same group (e.g. Day 1 + Day 2).
|
|
64
|
+
* Example: `"S40_FNCSMajor1_PlayInStage_CumulativeLeaderboardDef"`
|
|
65
|
+
*
|
|
66
|
+
* @param params.eventId - Event ID (e.g. `"epicgames_S40_FNCSMajor1_PlayInStage_EU"`)
|
|
67
|
+
* @param params.eventWindowId - Event window ID (e.g. `"S40_FNCSMajor1_PlayInStage_Day1_EU"`)
|
|
56
68
|
* @param params.page - Page number (default: 0)
|
|
57
|
-
* @param params.leaderboardDef - Optional leaderboard definition
|
|
58
|
-
* @param params.accountId - Optional account ID
|
|
59
|
-
* @param fortniteToken - Optional user's Fortnite token for personalized view
|
|
69
|
+
* @param params.leaderboardDef - Optional leaderboard definition ID (Ranked Cup tier or cumulative def)
|
|
70
|
+
* @param params.accountId - Optional account ID — highlights that player in the response
|
|
71
|
+
* @param fortniteToken - Optional user's Fortnite access token for personalized view
|
|
60
72
|
*/
|
|
61
73
|
async getLeaderboard(params, fortniteToken) {
|
|
62
74
|
const { eventId, eventWindowId, page = 0, leaderboardDef, accountId, } = params;
|
|
@@ -78,7 +90,7 @@ class TournamentsResource {
|
|
|
78
90
|
},
|
|
79
91
|
}
|
|
80
92
|
: undefined;
|
|
81
|
-
return this.client.request(`/events/leaderboard?${query.toString()}`, options);
|
|
93
|
+
return this.client.request(`/events/global/leaderboard?${query.toString()}`, options);
|
|
82
94
|
}
|
|
83
95
|
/**
|
|
84
96
|
* Get tournament participation history for a player
|
|
@@ -87,7 +99,7 @@ class TournamentsResource {
|
|
|
87
99
|
* @param fortniteToken - User's Fortnite access token (from OAuth flow)
|
|
88
100
|
*/
|
|
89
101
|
async getTracker(accountId, fortniteToken) {
|
|
90
|
-
return this.client.request(`/
|
|
102
|
+
return this.client.request(`/events/tracker?accountId=${accountId}`, {
|
|
91
103
|
headers: {
|
|
92
104
|
"x-fortnite-token": fortniteToken,
|
|
93
105
|
},
|
|
@@ -110,7 +122,7 @@ class TournamentsResource {
|
|
|
110
122
|
if (options?.requiredTournaments) {
|
|
111
123
|
params.append("requiredTournaments", options.requiredTournaments.toString());
|
|
112
124
|
}
|
|
113
|
-
return this.client.request(`/
|
|
125
|
+
return this.client.request(`/events/tracker/eligibility?${params.toString()}`, {
|
|
114
126
|
headers: {
|
|
115
127
|
"x-fortnite-token": fortniteToken,
|
|
116
128
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FortniteAPI } from "../client";
|
|
2
|
-
import { WeaponsResponse } from "../types";
|
|
2
|
+
import { WeaponsResponse, RarityDefinitionsResponse } from "../types";
|
|
3
3
|
export declare class WeaponsResource {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
@@ -26,4 +26,8 @@ export declare class WeaponsResource {
|
|
|
26
26
|
ammoType?: string;
|
|
27
27
|
season?: string;
|
|
28
28
|
}): Promise<WeaponsResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Get rarity definitions (colors, display names, backend values)
|
|
31
|
+
*/
|
|
32
|
+
getRarityDefinitions(): Promise<RarityDefinitionsResponse>;
|
|
29
33
|
}
|
|
@@ -39,5 +39,11 @@ class WeaponsResource {
|
|
|
39
39
|
const query = params.toString() ? `?${params.toString()}` : "";
|
|
40
40
|
return this.client.request(`/weapons${query}`, {}, "v2");
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Get rarity definitions (colors, display names, backend values)
|
|
44
|
+
*/
|
|
45
|
+
async getRarityDefinitions() {
|
|
46
|
+
return this.client.request("/weapons/rarity", {}, "v2");
|
|
47
|
+
}
|
|
42
48
|
}
|
|
43
49
|
exports.WeaponsResource = WeaponsResource;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -720,6 +720,18 @@ export interface CosmeticsSearchParams {
|
|
|
720
720
|
rarity?: string;
|
|
721
721
|
set?: string;
|
|
722
722
|
search?: string;
|
|
723
|
+
season?: number;
|
|
724
|
+
chapter?: number;
|
|
725
|
+
}
|
|
726
|
+
export interface RarityDefinition {
|
|
727
|
+
value: string;
|
|
728
|
+
displayValue: string;
|
|
729
|
+
backendValue: string;
|
|
730
|
+
color: string;
|
|
731
|
+
}
|
|
732
|
+
export interface RarityDefinitionsResponse {
|
|
733
|
+
status: number;
|
|
734
|
+
data: RarityDefinition[];
|
|
723
735
|
}
|
|
724
736
|
export interface CrewPackResponse {
|
|
725
737
|
status: number;
|
package/dist/types/index.js
CHANGED
|
File without changes
|