@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.
Files changed (38) hide show
  1. package/dist/client.d.ts +6 -0
  2. package/dist/client.js +24 -0
  3. package/dist/resources/account.d.ts +6 -0
  4. package/dist/resources/account.js +9 -0
  5. package/dist/resources/battlepass.d.ts +3 -2
  6. package/dist/resources/battlepass.js +5 -3
  7. package/dist/resources/bundles.d.ts +2 -2
  8. package/dist/resources/bundles.js +2 -2
  9. package/dist/resources/cosmetics.d.ts +14 -3
  10. package/dist/resources/cosmetics.js +18 -5
  11. package/dist/resources/events.d.ts +22 -50
  12. package/dist/resources/events.js +31 -87
  13. package/dist/resources/fn.d.ts +4 -4
  14. package/dist/resources/fn.js +5 -4
  15. package/dist/resources/map.d.ts +3 -2
  16. package/dist/resources/map.js +9 -3
  17. package/dist/resources/news.d.ts +8 -4
  18. package/dist/resources/news.js +16 -8
  19. package/dist/resources/oauth.d.ts +26 -1
  20. package/dist/resources/oauth.js +28 -0
  21. package/dist/resources/parsing.d.ts +90 -5
  22. package/dist/resources/parsing.js +170 -24
  23. package/dist/resources/playlists.d.ts +7 -3
  24. package/dist/resources/playlists.js +13 -6
  25. package/dist/resources/profiles.d.ts +7 -2
  26. package/dist/resources/profiles.js +13 -3
  27. package/dist/resources/quests.d.ts +3 -44
  28. package/dist/resources/quests.js +3 -44
  29. package/dist/resources/replays.d.ts +82 -0
  30. package/dist/resources/replays.js +105 -0
  31. package/dist/resources/shop.d.ts +5 -4
  32. package/dist/resources/shop.js +6 -4
  33. package/dist/resources/tournaments.d.ts +42 -1
  34. package/dist/resources/tournaments.js +53 -0
  35. package/dist/resources/weapons.d.ts +19 -15
  36. package/dist/resources/weapons.js +22 -15
  37. package/dist/types/index.d.ts +73 -0
  38. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { FortniteAPI } from "../client";
2
- import { OAuthCompleteResponse, OAuthDeviceRefreshResponse, OAuthExchangeCodeResponse, OAuthFlowResponse, OAuthRefreshResponse } from "../types";
2
+ import { OAuthCompleteResponse, OAuthDeviceRefreshResponse, OAuthExchangeCodeResponse, OAuthFlowResponse, OAuthRefreshResponse, OAuthAuthorizeUrlResponse } from "../types";
3
3
  export declare class OauthResource {
4
4
  private client;
5
5
  constructor(client: FortniteAPI);
@@ -37,4 +37,29 @@ export declare class OauthResource {
37
37
  deviceId: string;
38
38
  secret: string;
39
39
  }): Promise<OAuthDeviceRefreshResponse>;
40
+ /**
41
+ * Get Epic Games authorization URL - GET /oauth/authorize-url
42
+ * Returns the URL to redirect the user to for standard Epic login (no device confirmation page).
43
+ * After login, Epic redirects to your redirect_uri with ?code=...
44
+ * Then call linkAccount() with that code to get the Fortnite access token and device auth.
45
+ * @param redirectUri - Optional redirect URI registered with Epic
46
+ */
47
+ getAuthorizeUrl(redirectUri?: string): Promise<OAuthAuthorizeUrlResponse>;
48
+ /**
49
+ * Link Epic account - POST /oauth/link
50
+ * Exchanges an Epic authorization code (from GET /oauth/authorize-url flow) for a
51
+ * Fortnite access token and device auth credentials.
52
+ * Store the returned deviceAuth (accountId + deviceId + secret) and use refreshDevice()
53
+ * to silently re-authenticate in the future — no browser required.
54
+ * @param params.code - Authorization code returned by Epic in the redirect URI
55
+ * @param params.redirectUri - Must match the redirect URI used in getAuthorizeUrl()
56
+ * @param params.clientId - Optional custom Epic OAuth client ID
57
+ * @param params.clientSecret - Optional custom Epic OAuth client secret
58
+ */
59
+ linkAccount(params: {
60
+ code: string;
61
+ redirectUri?: string;
62
+ clientId?: string;
63
+ clientSecret?: string;
64
+ }): Promise<OAuthCompleteResponse>;
40
65
  }
@@ -52,5 +52,33 @@ class OauthResource {
52
52
  body: JSON.stringify(params),
53
53
  });
54
54
  }
55
+ /**
56
+ * Get Epic Games authorization URL - GET /oauth/authorize-url
57
+ * Returns the URL to redirect the user to for standard Epic login (no device confirmation page).
58
+ * After login, Epic redirects to your redirect_uri with ?code=...
59
+ * Then call linkAccount() with that code to get the Fortnite access token and device auth.
60
+ * @param redirectUri - Optional redirect URI registered with Epic
61
+ */
62
+ async getAuthorizeUrl(redirectUri) {
63
+ const query = redirectUri ? `?redirectUri=${encodeURIComponent(redirectUri)}` : "";
64
+ return this.client.request(`/oauth/authorize-url${query}`, {}, "v1");
65
+ }
66
+ /**
67
+ * Link Epic account - POST /oauth/link
68
+ * Exchanges an Epic authorization code (from GET /oauth/authorize-url flow) for a
69
+ * Fortnite access token and device auth credentials.
70
+ * Store the returned deviceAuth (accountId + deviceId + secret) and use refreshDevice()
71
+ * to silently re-authenticate in the future — no browser required.
72
+ * @param params.code - Authorization code returned by Epic in the redirect URI
73
+ * @param params.redirectUri - Must match the redirect URI used in getAuthorizeUrl()
74
+ * @param params.clientId - Optional custom Epic OAuth client ID
75
+ * @param params.clientSecret - Optional custom Epic OAuth client secret
76
+ */
77
+ async linkAccount(params) {
78
+ return this.client.request("/oauth/link", {
79
+ method: "POST",
80
+ body: JSON.stringify(params),
81
+ }, "v1");
82
+ }
55
83
  }
56
84
  exports.OauthResource = OauthResource;
@@ -3,16 +3,101 @@ import { ParsedReplayData } from "../types";
3
3
  export declare class ParsingResource {
4
4
  private client;
5
5
  constructor(client: FortniteAPI);
6
+ private buildFormData;
7
+ private buildMultiFormData;
6
8
  /**
7
- * Parse a single Fortnite replay file
8
- * @param file - File object (Browser) or Blob/Buffer (Node.js)
9
- * @param filename - Optional filename (required in Node.js)
9
+ * Parse a single Fortnite replay file — full parse.
10
+ * Subject to per-plan parsing quota limits (5 credits).
11
+ * @param file - File object (Browser) or Blob (Node.js)
12
+ * @param filename - Filename (required in Node.js when passing a Blob)
10
13
  */
11
14
  parseReplay(file: File | Blob, filename?: string): Promise<ParsedReplayData>;
12
15
  /**
13
- * Parse multiple Fortnite replay files in batch
16
+ * Parse a single replay stats only (faster, skips movement/zones/kill feed).
17
+ * Returns: name, replayId, version, stats (elims, damage, accuracy, placement, assists, etc.).
18
+ * Subject to per-plan parsing quota limits (1 credit).
19
+ * @param file - File object or Blob
20
+ * @param filename - Filename (required in Node.js)
21
+ */
22
+ parseReplayStats(file: File | Blob, filename?: string): Promise<ParsedReplayData>;
23
+ /**
24
+ * Parse a single replay — map context.
25
+ * Returns: bus flight path + drop window, all storm circles with timing, supply drops, llamas, reboot vans.
26
+ * Subject to per-plan parsing quota limits (5 credits).
27
+ * @param file - File object or Blob
28
+ * @param filename - Filename (required in Node.js)
29
+ */
30
+ parseReplayMap(file: File | Blob, filename?: string): Promise<ParsedReplayData>;
31
+ /**
32
+ * Parse a single replay — ground loot data.
33
+ * Returns all items that were on the ground near the player: position, item ID, picked-up status and time.
34
+ * Subject to per-plan parsing quota limits (5 credits).
35
+ * @param file - File object or Blob
36
+ * @param filename - Filename (required in Node.js)
37
+ */
38
+ parseReplayLoot(file: File | Blob, filename?: string): Promise<ParsedReplayData>;
39
+ /**
40
+ * Parse a single replay — match timeline.
41
+ * Returns all events relative to bus drop: kills, knocks, own death, damage dealt/taken, healed, pickups.
42
+ * Subject to per-plan parsing quota limits (5 credits).
43
+ * @param file - File object or Blob
44
+ * @param filename - Filename (required in Node.js)
45
+ */
46
+ parseReplayTimeline(file: File | Blob, filename?: string): Promise<ParsedReplayData>;
47
+ /**
48
+ * Parse a single replay — storm zone data.
49
+ * Returns all safe zone phases with circle positions, timing, damage per tick, and phase count.
50
+ * Subject to per-plan parsing quota limits (5 credits).
51
+ * @param file - File object or Blob
52
+ * @param filename - Filename (required in Node.js)
53
+ */
54
+ parseReplayZones(file: File | Blob, filename?: string): Promise<ParsedReplayData>;
55
+ /**
56
+ * Parse a single replay — full player lobby.
57
+ * Returns all players with placement, kills, death info, cosmetics, and team data.
58
+ * Subject to per-plan parsing quota limits (5 credits).
59
+ * @param file - File object or Blob
60
+ * @param filename - Filename (required in Node.js)
61
+ */
62
+ parseReplayLobby(file: File | Blob, filename?: string): Promise<ParsedReplayData>;
63
+ /**
64
+ * Parse a single replay — full broadcast payload.
65
+ * Combines all data: header, stats, full lobby, storm zones, map objects, ground loot, and timeline.
66
+ * Equivalent to calling all parse endpoints in one request.
67
+ * Subject to per-plan parsing quota limits (20 credits).
68
+ * @param file - File object or Blob
69
+ * @param filename - Filename (required in Node.js)
70
+ */
71
+ 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).
14
76
  * @param files - Array of File objects or Blobs
15
- * @param filenames - Optional array of filenames (required in Node.js)
77
+ * @param filenames - Filenames (required in Node.js when passing Blobs)
16
78
  */
17
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[]>;
18
103
  }
@@ -5,48 +5,194 @@ class ParsingResource {
5
5
  constructor(client) {
6
6
  this.client = client;
7
7
  }
8
- /**
9
- * Parse a single Fortnite replay file
10
- * @param file - File object (Browser) or Blob/Buffer (Node.js)
11
- * @param filename - Optional filename (required in Node.js)
12
- */
13
- async parseReplay(file, filename) {
8
+ buildFormData(file, filename) {
14
9
  const formData = new FormData();
15
- // In browser: File object has name
16
- // In Node.js: Need to pass filename
17
10
  if (file instanceof File) {
18
- formData.append("File", file);
11
+ formData.append("file", file);
19
12
  }
20
13
  else {
21
- formData.append("File", file, filename || "replay.replay");
14
+ formData.append("file", file, filename || "replay.replay");
22
15
  }
23
- const response = await this.client.requestMultipart("/parsing", formData);
16
+ return formData;
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
+ /**
31
+ * Parse a single Fortnite replay file — full parse.
32
+ * Subject to per-plan parsing quota limits (5 credits).
33
+ * @param file - File object (Browser) or Blob (Node.js)
34
+ * @param filename - Filename (required in Node.js when passing a Blob)
35
+ */
36
+ async parseReplay(file, filename) {
37
+ const response = await this.client.requestMultipart("/parsing", this.buildFormData(file, filename));
24
38
  if (!response.success || !response.data) {
25
39
  throw new Error(response.error || "Failed to parse replay");
26
40
  }
27
41
  return response.data;
28
42
  }
29
43
  /**
30
- * Parse multiple Fortnite replay files in batch
44
+ * Parse a single replay stats only (faster, skips movement/zones/kill feed).
45
+ * Returns: name, replayId, version, stats (elims, damage, accuracy, placement, assists, etc.).
46
+ * Subject to per-plan parsing quota limits (1 credit).
47
+ * @param file - File object or Blob
48
+ * @param filename - Filename (required in Node.js)
49
+ */
50
+ async parseReplayStats(file, filename) {
51
+ const response = await this.client.requestMultipart("/parsing/stats", this.buildFormData(file, filename));
52
+ if (!response.success || !response.data) {
53
+ throw new Error(response.error || "Failed to parse replay stats");
54
+ }
55
+ return response.data;
56
+ }
57
+ /**
58
+ * Parse a single replay — map context.
59
+ * Returns: bus flight path + drop window, all storm circles with timing, supply drops, llamas, reboot vans.
60
+ * Subject to per-plan parsing quota limits (5 credits).
61
+ * @param file - File object or Blob
62
+ * @param filename - Filename (required in Node.js)
63
+ */
64
+ async parseReplayMap(file, filename) {
65
+ const response = await this.client.requestMultipart("/parsing/map", this.buildFormData(file, filename));
66
+ if (!response.success || !response.data) {
67
+ throw new Error(response.error || "Failed to parse replay map");
68
+ }
69
+ return response.data;
70
+ }
71
+ /**
72
+ * Parse a single replay — ground loot data.
73
+ * Returns all items that were on the ground near the player: position, item ID, picked-up status and time.
74
+ * Subject to per-plan parsing quota limits (5 credits).
75
+ * @param file - File object or Blob
76
+ * @param filename - Filename (required in Node.js)
77
+ */
78
+ async parseReplayLoot(file, filename) {
79
+ const response = await this.client.requestMultipart("/parsing/loot", this.buildFormData(file, filename));
80
+ if (!response.success || !response.data) {
81
+ throw new Error(response.error || "Failed to parse replay loot");
82
+ }
83
+ return response.data;
84
+ }
85
+ /**
86
+ * Parse a single replay — match timeline.
87
+ * Returns all events relative to bus drop: kills, knocks, own death, damage dealt/taken, healed, pickups.
88
+ * Subject to per-plan parsing quota limits (5 credits).
89
+ * @param file - File object or Blob
90
+ * @param filename - Filename (required in Node.js)
91
+ */
92
+ async parseReplayTimeline(file, filename) {
93
+ const response = await this.client.requestMultipart("/parsing/timeline", this.buildFormData(file, filename));
94
+ if (!response.success || !response.data) {
95
+ throw new Error(response.error || "Failed to parse replay timeline");
96
+ }
97
+ return response.data;
98
+ }
99
+ /**
100
+ * Parse a single replay — storm zone data.
101
+ * Returns all safe zone phases with circle positions, timing, damage per tick, and phase count.
102
+ * Subject to per-plan parsing quota limits (5 credits).
103
+ * @param file - File object or Blob
104
+ * @param filename - Filename (required in Node.js)
105
+ */
106
+ async parseReplayZones(file, filename) {
107
+ const response = await this.client.requestMultipart("/parsing/zones", this.buildFormData(file, filename));
108
+ if (!response.success || !response.data) {
109
+ throw new Error(response.error || "Failed to parse replay zones");
110
+ }
111
+ return response.data;
112
+ }
113
+ /**
114
+ * Parse a single replay — full player lobby.
115
+ * Returns all players with placement, kills, death info, cosmetics, and team data.
116
+ * Subject to per-plan parsing quota limits (5 credits).
117
+ * @param file - File object or Blob
118
+ * @param filename - Filename (required in Node.js)
119
+ */
120
+ async parseReplayLobby(file, filename) {
121
+ const response = await this.client.requestMultipart("/parsing/lobby", this.buildFormData(file, filename));
122
+ if (!response.success || !response.data) {
123
+ throw new Error(response.error || "Failed to parse replay lobby");
124
+ }
125
+ return response.data;
126
+ }
127
+ /**
128
+ * Parse a single replay — full broadcast payload.
129
+ * Combines all data: header, stats, full lobby, storm zones, map objects, ground loot, and timeline.
130
+ * Equivalent to calling all parse endpoints in one request.
131
+ * Subject to per-plan parsing quota limits (20 credits).
132
+ * @param file - File object or Blob
133
+ * @param filename - Filename (required in Node.js)
134
+ */
135
+ async parseReplayBroadcast(file, filename) {
136
+ const response = await this.client.requestMultipart("/parsing/broadcast", this.buildFormData(file, filename));
137
+ if (!response.success || !response.data) {
138
+ throw new Error(response.error || "Failed to parse replay broadcast");
139
+ }
140
+ return response.data;
141
+ }
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).
31
146
  * @param files - Array of File objects or Blobs
32
- * @param filenames - Optional array of filenames (required in Node.js)
147
+ * @param filenames - Filenames (required in Node.js when passing Blobs)
33
148
  */
34
149
  async parseMultipleReplays(files, filenames) {
35
- const formData = new FormData();
36
- files.forEach((file, index) => {
37
- if (file instanceof File) {
38
- formData.append("Files", file);
39
- }
40
- else {
41
- const name = filenames?.[index] || `replay-${index}.replay`;
42
- formData.append("Files", file, name);
43
- }
44
- });
45
- const response = await this.client.requestMultipart("/parsing/multiple", formData);
150
+ const response = await this.client.requestMultipart("/parsing/multiple", this.buildMultiFormData(files, filenames));
46
151
  if (!response.success || !response.results) {
47
152
  throw new Error(response.error || "Failed to parse replays");
48
153
  }
49
154
  return response.results;
50
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
+ }
51
197
  }
52
198
  exports.ParsingResource = ParsingResource;
@@ -5,14 +5,18 @@ export declare class PlaylistsResource {
5
5
  constructor(client: FortniteAPI);
6
6
  /**
7
7
  * Get all Fortnite playlists/gamemodes
8
+ * @param lang - Language code (default: en)
8
9
  */
9
- getAll(): Promise<PlaylistsResponse>;
10
+ getAll(lang?: string): Promise<PlaylistsResponse>;
10
11
  /**
11
12
  * Get currently active playlists/gamemodes
13
+ * @param lang - Language code (default: en)
12
14
  */
13
- getActive(): Promise<ActivePlaylistsResponse>;
15
+ getActive(lang?: string): Promise<ActivePlaylistsResponse>;
14
16
  /**
15
17
  * Get a specific playlist by ID
18
+ * @param playlistId - Playlist identifier
19
+ * @param lang - Language code (default: en)
16
20
  */
17
- getById(playlistId: string): Promise<PlaylistResponse>;
21
+ getById(playlistId: string, lang?: string): Promise<PlaylistResponse>;
18
22
  }
@@ -7,21 +7,28 @@ class PlaylistsResource {
7
7
  }
8
8
  /**
9
9
  * Get all Fortnite playlists/gamemodes
10
+ * @param lang - Language code (default: en)
10
11
  */
11
- async getAll() {
12
- return this.client.request("/playlists", {}, "v2");
12
+ async getAll(lang) {
13
+ const query = lang ? `?lang=${encodeURIComponent(lang)}` : "";
14
+ return this.client.request(`/playlists${query}`, {}, "v2");
13
15
  }
14
16
  /**
15
17
  * Get currently active playlists/gamemodes
18
+ * @param lang - Language code (default: en)
16
19
  */
17
- async getActive() {
18
- return this.client.request("/playlists/active", {}, "v2");
20
+ async getActive(lang) {
21
+ const query = lang ? `?lang=${encodeURIComponent(lang)}` : "";
22
+ return this.client.request(`/playlists/active${query}`, {}, "v2");
19
23
  }
20
24
  /**
21
25
  * Get a specific playlist by ID
26
+ * @param playlistId - Playlist identifier
27
+ * @param lang - Language code (default: en)
22
28
  */
23
- async getById(playlistId) {
24
- return this.client.request(`/playlists/${playlistId}`, {}, "v2");
29
+ async getById(playlistId, lang) {
30
+ const query = lang ? `?lang=${encodeURIComponent(lang)}` : "";
31
+ return this.client.request(`/playlists/${playlistId}${query}`, {}, "v2");
25
32
  }
26
33
  }
27
34
  exports.PlaylistsResource = PlaylistsResource;
@@ -18,9 +18,14 @@ export declare class ProfilesResource {
18
18
  getLevel(accountId: string, fortniteToken: string): Promise<ProfileLevel>;
19
19
  /**
20
20
  * Get enriched ranked progress — human-readable rank names, game mode labels, season dates.
21
- * @param displayName - Epic Games display name
21
+ * Accepts either a display name or an account ID. Account ID is preferred: it is faster
22
+ * (skips the name→ID lookup) and is not affected by display name changes.
23
+ * @param displayName - Epic Games display name (ignored if accountId is provided)
24
+ * @param options - Optional: pass `accountId` to bypass the name lookup
22
25
  */
23
- getRanked(displayName: string): Promise<RankedProgress[]>;
26
+ getRanked(displayName: string, options?: {
27
+ accountId?: string;
28
+ }): Promise<RankedProgress[]>;
24
29
  /**
25
30
  * Get all available ranked game mode tracks — modes, division counts, and season dates.
26
31
  * @param options - Optional filters
@@ -24,10 +24,20 @@ class ProfilesResource {
24
24
  }
25
25
  /**
26
26
  * Get enriched ranked progress — human-readable rank names, game mode labels, season dates.
27
- * @param displayName - Epic Games display name
27
+ * Accepts either a display name or an account ID. Account ID is preferred: it is faster
28
+ * (skips the name→ID lookup) and is not affected by display name changes.
29
+ * @param displayName - Epic Games display name (ignored if accountId is provided)
30
+ * @param options - Optional: pass `accountId` to bypass the name lookup
28
31
  */
29
- async getRanked(displayName) {
30
- return this.client.request(`/profile/ranked?displayName=${encodeURIComponent(displayName)}`);
32
+ async getRanked(displayName, options) {
33
+ const params = new URLSearchParams();
34
+ if (options?.accountId) {
35
+ params.append("accountId", options.accountId);
36
+ }
37
+ else {
38
+ params.append("displayName", displayName);
39
+ }
40
+ return this.client.request(`/profile/ranked?${params.toString()}`);
31
41
  }
32
42
  /**
33
43
  * Get all available ranked game mode tracks — modes, division counts, and season dates.
@@ -1,53 +1,12 @@
1
1
  import { FortniteAPI } from "../client";
2
2
  import { QuestsResponse } from "../types";
3
- /**
4
- * QuestsResource provides access to Fortnite quests and account progression data
5
- *
6
- * This resource allows you to fetch player quest progress, XP, playtime, and account level.
7
- * All methods require the user's personal Fortnite OAuth token obtained through the OAuth flow.
8
- *
9
- * @example
10
- * ```typescript
11
- * // Get quests for an account
12
- * const quests = await client.quests.getQuests(
13
- * "account-id-here",
14
- * "user-fortnite-token-here"
15
- * );
16
- * ```
17
- */
18
3
  export declare class QuestsResource {
19
4
  private client;
20
5
  constructor(client: FortniteAPI);
21
6
  /**
22
- * Get account quests and level information
23
- *
24
- * Retrieves comprehensive quest data including:
25
- * - Active quest progress and completion status
26
- * - Account XP and level information
27
- * - Total playtime statistics
28
- * - Quest rewards and milestones
29
- *
30
- * **Authentication**: Requires user's personal Fortnite OAuth token
31
- *
32
- * **API Version**: v2
33
- *
34
- * **Rate Limit**: Standard API rate limits apply
35
- *
36
- * @param accountId - Epic Games Account ID (32 character hexadecimal string)
37
- * @param fortniteToken - User's Fortnite access token obtained from OAuth flow
38
- *
39
- * @returns Promise resolving to quest progress, XP, playtime, and account level data
40
- *
41
- * @throws {FortniteAPIError} When the request fails (invalid token, account not found, etc.)
42
- *
43
- * @example
44
- * ```typescript
45
- * const accountId = "a1b2c3d4e5f6..."; // 32 character account ID
46
- * const token = "eg1~..."; // User's Fortnite OAuth token
47
- *
48
- * const questData = await client.quests.getQuests(accountId, token);
49
- * console.log(questData);
50
- * ```
7
+ * Get active quests and challenges for a player. Requires x-fortnite-token.
8
+ * @param accountId - Epic Games account ID
9
+ * @param fortniteToken - User's Fortnite access token (required)
51
10
  */
52
11
  getQuests(accountId: string, fortniteToken: string): Promise<QuestsResponse>;
53
12
  }
@@ -1,55 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QuestsResource = void 0;
4
- /**
5
- * QuestsResource provides access to Fortnite quests and account progression data
6
- *
7
- * This resource allows you to fetch player quest progress, XP, playtime, and account level.
8
- * All methods require the user's personal Fortnite OAuth token obtained through the OAuth flow.
9
- *
10
- * @example
11
- * ```typescript
12
- * // Get quests for an account
13
- * const quests = await client.quests.getQuests(
14
- * "account-id-here",
15
- * "user-fortnite-token-here"
16
- * );
17
- * ```
18
- */
19
4
  class QuestsResource {
20
5
  constructor(client) {
21
6
  this.client = client;
22
7
  }
23
8
  /**
24
- * Get account quests and level information
25
- *
26
- * Retrieves comprehensive quest data including:
27
- * - Active quest progress and completion status
28
- * - Account XP and level information
29
- * - Total playtime statistics
30
- * - Quest rewards and milestones
31
- *
32
- * **Authentication**: Requires user's personal Fortnite OAuth token
33
- *
34
- * **API Version**: v2
35
- *
36
- * **Rate Limit**: Standard API rate limits apply
37
- *
38
- * @param accountId - Epic Games Account ID (32 character hexadecimal string)
39
- * @param fortniteToken - User's Fortnite access token obtained from OAuth flow
40
- *
41
- * @returns Promise resolving to quest progress, XP, playtime, and account level data
42
- *
43
- * @throws {FortniteAPIError} When the request fails (invalid token, account not found, etc.)
44
- *
45
- * @example
46
- * ```typescript
47
- * const accountId = "a1b2c3d4e5f6..."; // 32 character account ID
48
- * const token = "eg1~..."; // User's Fortnite OAuth token
49
- *
50
- * const questData = await client.quests.getQuests(accountId, token);
51
- * console.log(questData);
52
- * ```
9
+ * Get active quests and challenges for a player. Requires x-fortnite-token.
10
+ * @param accountId - Epic Games account ID
11
+ * @param fortniteToken - User's Fortnite access token (required)
53
12
  */
54
13
  async getQuests(accountId, fortniteToken) {
55
14
  return this.client.request(`/quests/${accountId}`, {