@yaelouuu/fortnite-api 7.2.0 → 8.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/map.d.ts +17 -7
- package/dist/resources/map.js +25 -8
- package/dist/resources/parsing.d.ts +0 -32
- package/dist/resources/parsing.js +0 -67
- package/dist/resources/replays.d.ts +2 -4
- package/dist/resources/replays.js +2 -4
- package/dist/types/index.d.ts +63 -6
- package/package.json +1 -1
package/dist/resources/map.d.ts
CHANGED
|
@@ -4,16 +4,26 @@ export declare class MapResource {
|
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
6
6
|
/**
|
|
7
|
-
* Get
|
|
8
|
-
* @param version -
|
|
9
|
-
* @param
|
|
7
|
+
* Get a Fortnite map with its POIs and minimap metadata.
|
|
8
|
+
* @param version - Map version (patch number); defaults to the current version.
|
|
9
|
+
* @param mode - Which map to return: `br` (default), `og`, or `rotating:<codename>`.
|
|
10
|
+
* The available values are listed in the response's `data.modes`.
|
|
11
|
+
* @param lang - Language code for POI labels (default: `en`).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const br = await client.map.getCurrent();
|
|
15
|
+
* const og = await client.map.getCurrent(undefined, "og");
|
|
16
|
+
* const reload = await client.map.getCurrent(undefined, "rotating:blastberry");
|
|
17
|
+
* const old = await client.map.getCurrent("33.00");
|
|
10
18
|
*/
|
|
11
|
-
getCurrent(version?: string, lang?: string): Promise<MapResponse>;
|
|
19
|
+
getCurrent(version?: string, mode?: string, lang?: string): Promise<MapResponse>;
|
|
12
20
|
/**
|
|
13
|
-
* Get
|
|
14
|
-
*
|
|
21
|
+
* Get the map image (302 redirect to the raw image).
|
|
22
|
+
* Prefer reading `getCurrent().data.imageUrl`, which is the direct URL.
|
|
23
|
+
* @param version - Map version; defaults to current.
|
|
24
|
+
* @param mode - Which image: `br` (default), `og`, or `rotating:<codename>`.
|
|
15
25
|
*/
|
|
16
|
-
getImage(version?: string): Promise<MapImageResponse>;
|
|
26
|
+
getImage(version?: string, mode?: string): Promise<MapImageResponse>;
|
|
17
27
|
/**
|
|
18
28
|
* Get historical map data
|
|
19
29
|
* @param options.chapter - Filter by chapter number
|
package/dist/resources/map.js
CHANGED
|
@@ -6,25 +6,42 @@ class MapResource {
|
|
|
6
6
|
this.client = client;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Get
|
|
10
|
-
* @param version -
|
|
11
|
-
* @param
|
|
9
|
+
* Get a Fortnite map with its POIs and minimap metadata.
|
|
10
|
+
* @param version - Map version (patch number); defaults to the current version.
|
|
11
|
+
* @param mode - Which map to return: `br` (default), `og`, or `rotating:<codename>`.
|
|
12
|
+
* The available values are listed in the response's `data.modes`.
|
|
13
|
+
* @param lang - Language code for POI labels (default: `en`).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const br = await client.map.getCurrent();
|
|
17
|
+
* const og = await client.map.getCurrent(undefined, "og");
|
|
18
|
+
* const reload = await client.map.getCurrent(undefined, "rotating:blastberry");
|
|
19
|
+
* const old = await client.map.getCurrent("33.00");
|
|
12
20
|
*/
|
|
13
|
-
async getCurrent(version, lang) {
|
|
21
|
+
async getCurrent(version, mode, lang) {
|
|
14
22
|
const params = new URLSearchParams();
|
|
15
23
|
if (version)
|
|
16
24
|
params.set("version", version);
|
|
25
|
+
if (mode)
|
|
26
|
+
params.set("mode", mode);
|
|
17
27
|
if (lang)
|
|
18
28
|
params.set("lang", lang);
|
|
19
29
|
const query = params.toString() ? `?${params.toString()}` : "";
|
|
20
30
|
return this.client.request(`/map${query}`);
|
|
21
31
|
}
|
|
22
32
|
/**
|
|
23
|
-
* Get
|
|
24
|
-
*
|
|
33
|
+
* Get the map image (302 redirect to the raw image).
|
|
34
|
+
* Prefer reading `getCurrent().data.imageUrl`, which is the direct URL.
|
|
35
|
+
* @param version - Map version; defaults to current.
|
|
36
|
+
* @param mode - Which image: `br` (default), `og`, or `rotating:<codename>`.
|
|
25
37
|
*/
|
|
26
|
-
async getImage(version) {
|
|
27
|
-
const
|
|
38
|
+
async getImage(version, mode) {
|
|
39
|
+
const params = new URLSearchParams();
|
|
40
|
+
if (version)
|
|
41
|
+
params.set("version", version);
|
|
42
|
+
if (mode)
|
|
43
|
+
params.set("mode", mode);
|
|
44
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
28
45
|
return this.client.request(`/map/image${query}`);
|
|
29
46
|
}
|
|
30
47
|
/**
|
|
@@ -4,7 +4,6 @@ export declare class ParsingResource {
|
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
6
6
|
private buildFormData;
|
|
7
|
-
private buildMultiFormData;
|
|
8
7
|
/**
|
|
9
8
|
* Parse a single Fortnite replay file — full parse.
|
|
10
9
|
* Subject to per-plan parsing quota limits (5 credits).
|
|
@@ -69,35 +68,4 @@ export declare class ParsingResource {
|
|
|
69
68
|
* @param filename - Filename (required in Node.js)
|
|
70
69
|
*/
|
|
71
70
|
parseReplayBroadcast(file: File | Blob, filename?: string): Promise<ParsedReplayData>;
|
|
72
|
-
/**
|
|
73
|
-
* Parse multiple replay files in batch — full parse.
|
|
74
|
-
* All files are processed in parallel.
|
|
75
|
-
* Subject to per-plan parsing quota limits (10 credits).
|
|
76
|
-
* @param files - Array of File objects or Blobs
|
|
77
|
-
* @param filenames - Filenames (required in Node.js when passing Blobs)
|
|
78
|
-
*/
|
|
79
|
-
parseMultipleReplays(files: (File | Blob)[], filenames?: string[]): Promise<ParsedReplayData[]>;
|
|
80
|
-
/**
|
|
81
|
-
* Parse multiple replay files — stats only.
|
|
82
|
-
* Faster than full parse — skips movement, zones, and kill feed.
|
|
83
|
-
* Subject to per-plan parsing quota limits (5 credits).
|
|
84
|
-
* @param files - Array of File objects or Blobs
|
|
85
|
-
* @param filenames - Filenames (required in Node.js)
|
|
86
|
-
*/
|
|
87
|
-
parseMultipleReplaysStats(files: (File | Blob)[], filenames?: string[]): Promise<ParsedReplayData[]>;
|
|
88
|
-
/**
|
|
89
|
-
* Parse multiple replay files — map context for each.
|
|
90
|
-
* Returns bus path, storm circles, supply drops, llamas, reboot vans per file.
|
|
91
|
-
* Subject to per-plan parsing quota limits (10 credits).
|
|
92
|
-
* @param files - Array of File objects or Blobs
|
|
93
|
-
* @param filenames - Filenames (required in Node.js)
|
|
94
|
-
*/
|
|
95
|
-
parseMultipleReplaysMap(files: (File | Blob)[], filenames?: string[]): Promise<ParsedReplayData[]>;
|
|
96
|
-
/**
|
|
97
|
-
* Parse multiple replay files — ground loot data for each.
|
|
98
|
-
* Subject to per-plan parsing quota limits (10 credits).
|
|
99
|
-
* @param files - Array of File objects or Blobs
|
|
100
|
-
* @param filenames - Filenames (required in Node.js)
|
|
101
|
-
*/
|
|
102
|
-
parseMultipleReplaysLoot(files: (File | Blob)[], filenames?: string[]): Promise<ParsedReplayData[]>;
|
|
103
71
|
}
|
|
@@ -15,18 +15,6 @@ class ParsingResource {
|
|
|
15
15
|
}
|
|
16
16
|
return formData;
|
|
17
17
|
}
|
|
18
|
-
buildMultiFormData(files, filenames) {
|
|
19
|
-
const formData = new FormData();
|
|
20
|
-
files.forEach((file, index) => {
|
|
21
|
-
if (file instanceof File) {
|
|
22
|
-
formData.append("files", file);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
formData.append("files", file, filenames?.[index] || `replay-${index}.replay`);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
return formData;
|
|
29
|
-
}
|
|
30
18
|
/**
|
|
31
19
|
* Parse a single Fortnite replay file — full parse.
|
|
32
20
|
* Subject to per-plan parsing quota limits (5 credits).
|
|
@@ -139,60 +127,5 @@ class ParsingResource {
|
|
|
139
127
|
}
|
|
140
128
|
return response.data;
|
|
141
129
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Parse multiple replay files in batch — full parse.
|
|
144
|
-
* All files are processed in parallel.
|
|
145
|
-
* Subject to per-plan parsing quota limits (10 credits).
|
|
146
|
-
* @param files - Array of File objects or Blobs
|
|
147
|
-
* @param filenames - Filenames (required in Node.js when passing Blobs)
|
|
148
|
-
*/
|
|
149
|
-
async parseMultipleReplays(files, filenames) {
|
|
150
|
-
const response = await this.client.requestMultipart("/parsing/multiple", this.buildMultiFormData(files, filenames));
|
|
151
|
-
if (!response.success || !response.results) {
|
|
152
|
-
throw new Error(response.error || "Failed to parse replays");
|
|
153
|
-
}
|
|
154
|
-
return response.results;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Parse multiple replay files — stats only.
|
|
158
|
-
* Faster than full parse — skips movement, zones, and kill feed.
|
|
159
|
-
* Subject to per-plan parsing quota limits (5 credits).
|
|
160
|
-
* @param files - Array of File objects or Blobs
|
|
161
|
-
* @param filenames - Filenames (required in Node.js)
|
|
162
|
-
*/
|
|
163
|
-
async parseMultipleReplaysStats(files, filenames) {
|
|
164
|
-
const response = await this.client.requestMultipart("/parsing/multiple/stats", this.buildMultiFormData(files, filenames));
|
|
165
|
-
if (!response.success || !response.results) {
|
|
166
|
-
throw new Error(response.error || "Failed to parse replays stats");
|
|
167
|
-
}
|
|
168
|
-
return response.results;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Parse multiple replay files — map context for each.
|
|
172
|
-
* Returns bus path, storm circles, supply drops, llamas, reboot vans per file.
|
|
173
|
-
* Subject to per-plan parsing quota limits (10 credits).
|
|
174
|
-
* @param files - Array of File objects or Blobs
|
|
175
|
-
* @param filenames - Filenames (required in Node.js)
|
|
176
|
-
*/
|
|
177
|
-
async parseMultipleReplaysMap(files, filenames) {
|
|
178
|
-
const response = await this.client.requestMultipart("/parsing/multiple/map", this.buildMultiFormData(files, filenames));
|
|
179
|
-
if (!response.success || !response.results) {
|
|
180
|
-
throw new Error(response.error || "Failed to parse replays map");
|
|
181
|
-
}
|
|
182
|
-
return response.results;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Parse multiple replay files — ground loot data for each.
|
|
186
|
-
* Subject to per-plan parsing quota limits (10 credits).
|
|
187
|
-
* @param files - Array of File objects or Blobs
|
|
188
|
-
* @param filenames - Filenames (required in Node.js)
|
|
189
|
-
*/
|
|
190
|
-
async parseMultipleReplaysLoot(files, filenames) {
|
|
191
|
-
const response = await this.client.requestMultipart("/parsing/multiple/loot", this.buildMultiFormData(files, filenames));
|
|
192
|
-
if (!response.success || !response.results) {
|
|
193
|
-
throw new Error(response.error || "Failed to parse replays loot");
|
|
194
|
-
}
|
|
195
|
-
return response.results;
|
|
196
|
-
}
|
|
197
130
|
}
|
|
198
131
|
exports.ParsingResource = ParsingResource;
|
|
@@ -72,10 +72,8 @@ export declare class ReplaysResource {
|
|
|
72
72
|
*/
|
|
73
73
|
parseTimeline(matchId: string): Promise<ParsedReplayData>;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* Equivalent to calling all parse endpoints in one request.
|
|
78
|
-
* Subject to per-plan parsing quota limits (20 credits).
|
|
75
|
+
* @deprecated Use parse() instead. This compatibility route returns the
|
|
76
|
+
* same combined payload and shares parse()'s 5-credit quota.
|
|
79
77
|
* @param matchId - Match ID from Epic's tournament events API
|
|
80
78
|
*/
|
|
81
79
|
parseBroadcast(matchId: string): Promise<ParsedReplayData>;
|
|
@@ -92,10 +92,8 @@ class ReplaysResource {
|
|
|
92
92
|
return this.client.request(`/replays/${encodeURIComponent(matchId)}/parse/timeline`, {}, "v1");
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* Equivalent to calling all parse endpoints in one request.
|
|
98
|
-
* Subject to per-plan parsing quota limits (20 credits).
|
|
95
|
+
* @deprecated Use parse() instead. This compatibility route returns the
|
|
96
|
+
* same combined payload and shares parse()'s 5-credit quota.
|
|
99
97
|
* @param matchId - Match ID from Epic's tournament events API
|
|
100
98
|
*/
|
|
101
99
|
async parseBroadcast(matchId) {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -900,23 +900,80 @@ export interface CrewHistoryResponse {
|
|
|
900
900
|
lastModified: string;
|
|
901
901
|
};
|
|
902
902
|
}
|
|
903
|
+
/** Game mode a map response describes. `br`, `og`, or `rotating:<codename>` (e.g. `rotating:blastberry`). */
|
|
904
|
+
export type MapMode = "br" | "og" | (string & {});
|
|
905
|
+
/**
|
|
906
|
+
* World-space extent of the minimap image, in Unreal units (cm). Combine with
|
|
907
|
+
* `imageWidth`/`imageHeight` to plot a POI onto the image:
|
|
908
|
+
* `px = (x - minX) / (maxX - minX) * imageWidth` (and likewise y/height).
|
|
909
|
+
*/
|
|
910
|
+
export interface MapWorldBounds {
|
|
911
|
+
minX: number;
|
|
912
|
+
maxX: number;
|
|
913
|
+
minY: number;
|
|
914
|
+
maxY: number;
|
|
915
|
+
}
|
|
916
|
+
/** A single point of interest on the map. */
|
|
917
|
+
export interface MapPoi {
|
|
918
|
+
/** Display name, e.g. "TILTED TOWERS". Empty string when the game ships the POI unnamed. */
|
|
919
|
+
name: string;
|
|
920
|
+
/** Source gameplay tag, e.g. `Athena.Location.POI.TiltedTowers`. Stable across patches. */
|
|
921
|
+
tag?: string | null;
|
|
922
|
+
/** `named`, `landmark`, `generic`, or `unnamed`. */
|
|
923
|
+
type?: "named" | "landmark" | "generic" | "unnamed" | (string & {}) | null;
|
|
924
|
+
/** World X (Unreal units / cm). */
|
|
925
|
+
x?: number | null;
|
|
926
|
+
/** World Y (Unreal units / cm). */
|
|
927
|
+
y?: number | null;
|
|
928
|
+
/** World Z (Unreal units / cm). */
|
|
929
|
+
z?: number | null;
|
|
930
|
+
}
|
|
931
|
+
/** Map data for one version + mode. */
|
|
932
|
+
export interface MapData {
|
|
933
|
+
version: string;
|
|
934
|
+
chapter?: number | null;
|
|
935
|
+
season?: number | null;
|
|
936
|
+
patch?: string | null;
|
|
937
|
+
releaseDate?: string | null;
|
|
938
|
+
/** Which map this response describes: `br`, `og`, or `rotating:<codename>`. */
|
|
939
|
+
mode: MapMode;
|
|
940
|
+
/** Direct URL to the minimap image (raw GitHub). Prefer this over `map.getImage()`. */
|
|
941
|
+
imageUrl?: string | null;
|
|
942
|
+
/** Minimap image pixel dimensions — pair with `worldBounds` to plot POIs. */
|
|
943
|
+
imageWidth?: number | null;
|
|
944
|
+
imageHeight?: number | null;
|
|
945
|
+
worldBounds?: MapWorldBounds | null;
|
|
946
|
+
pois: MapPoi[];
|
|
947
|
+
/** Every mode available for this version — valid values for the `mode` query parameter. */
|
|
948
|
+
modes: MapMode[];
|
|
949
|
+
}
|
|
903
950
|
export interface MapResponse {
|
|
904
951
|
status: number;
|
|
905
|
-
data:
|
|
906
|
-
[key: string]: any;
|
|
907
|
-
};
|
|
952
|
+
data: MapData;
|
|
908
953
|
}
|
|
954
|
+
/** `map.getImage()` hits a 302 redirect to the raw image. Prefer `getCurrent().data.imageUrl`. */
|
|
909
955
|
export interface MapImageResponse {
|
|
910
956
|
status: number;
|
|
911
957
|
data: {
|
|
912
958
|
[key: string]: any;
|
|
913
959
|
};
|
|
914
960
|
}
|
|
961
|
+
/** One entry in the map history list. */
|
|
962
|
+
export interface MapHistoryEntry {
|
|
963
|
+
version: string;
|
|
964
|
+
chapter?: number | null;
|
|
965
|
+
season?: number | null;
|
|
966
|
+
patch?: string | null;
|
|
967
|
+
releaseDate?: string | null;
|
|
968
|
+
hasImage: boolean;
|
|
969
|
+
imageUrl?: string | null;
|
|
970
|
+
hasPois: boolean;
|
|
971
|
+
/** Modes available for this version (`br`, `og`, `rotating:<codename>`). */
|
|
972
|
+
modes: MapMode[];
|
|
973
|
+
}
|
|
915
974
|
export interface MapHistoryResponse {
|
|
916
975
|
status: number;
|
|
917
|
-
data:
|
|
918
|
-
[key: string]: any;
|
|
919
|
-
};
|
|
976
|
+
data: MapHistoryEntry[];
|
|
920
977
|
}
|
|
921
978
|
export interface PlaylistsResponse {
|
|
922
979
|
status: number;
|