@yaelouuu/fortnite-api 7.1.1 → 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/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 battle pass items
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 battle pass items
9
+ * Get current Battle Pass content and rewards
10
+ * @param lang - Language code (default: en)
10
11
  */
11
- async getBattlePass() {
12
- return this.client.request("/shop/battlepass");
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 current season information
7
+ * Get tournament asset bundles (images, icons, rewards)
8
8
  */
9
9
  getBundlesTournament(): Promise<TournamentsBundle>;
10
10
  /**
11
- * Get current season information
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 current season information
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 current season information
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): Promise<CosmeticsPaginatedResponse>;
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'>): Promise<CosmeticsPaginatedResponse>;
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
- return this.client.request(`/cosmetics/${id}`);
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
- return this.client.request(`/cosmetics/search?${queryParams.toString()}`);
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,5 +1,5 @@
1
1
  import { FortniteAPI } from "../client";
2
- import { EventLeaderboard, PlayerTokensResponse } from "../types";
2
+ import { EventLeaderboard, PlayerTokensResponse, PlayerWindowStanding } from "../types";
3
3
  /**
4
4
  * Events Resource
5
5
  * Handles tournament and competitive events leaderboard data
@@ -27,6 +27,24 @@ export declare class EventsResource {
27
27
  * @param accountId - Epic account ID of the player to look up
28
28
  */
29
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>;
30
48
  /**
31
49
  * Get the raw token set for one or more players.
32
50
  * Tokens are eligibility flags earned by participating in tournaments
@@ -40,6 +40,28 @@ class EventsResource {
40
40
  async getPlayerLeaderboard(eventId, eventWindowId, accountId) {
41
41
  return this.client.request(`/events/${eventId}/windows/${eventWindowId}/leaderboard/player?accountId=${encodeURIComponent(accountId)}`, {}, "v2");
42
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
+ }
43
65
  /**
44
66
  * Get the raw token set for one or more players.
45
67
  * Tokens are eligibility flags earned by participating in tournaments
@@ -24,11 +24,11 @@ export declare class FNResource {
24
24
  */
25
25
  getEnabledFeatures(): Promise<EnabledFeatures>;
26
26
  /**
27
- * Check game version
28
- * @param platform - Platform name (Windows, Mac, etc.)
29
- * @param version - Version string to check
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: string): Promise<VersionCheck>;
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
@@ -42,12 +42,13 @@ class FNResource {
42
42
  return this.client.request("/fn/enabled-features", {}, "v2");
43
43
  }
44
44
  /**
45
- * Check game version
46
- * @param platform - Platform name (Windows, Mac, etc.)
47
- * @param version - Version string to check
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
- return this.client.request(`/fn/version/${platform}?version=${encodeURIComponent(version)}`, {}, "v2");
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)
@@ -4,15 +4,26 @@ export declare class MapResource {
4
4
  private client;
5
5
  constructor(client: FortniteAPI);
6
6
  /**
7
- * Get current Fortnite map with POIs
8
- * @param version - Optional specific map version to retrieve
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");
9
18
  */
10
- getCurrent(version?: string): Promise<MapResponse>;
19
+ getCurrent(version?: string, mode?: string, lang?: string): Promise<MapResponse>;
11
20
  /**
12
- * Get current map image URL
13
- * @param version - Optional specific map version to retrieve
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>`.
14
25
  */
15
- getImage(version?: string): Promise<MapImageResponse>;
26
+ getImage(version?: string, mode?: string): Promise<MapImageResponse>;
16
27
  /**
17
28
  * Get historical map data
18
29
  * @param options.chapter - Filter by chapter number
@@ -6,19 +6,42 @@ class MapResource {
6
6
  this.client = client;
7
7
  }
8
8
  /**
9
- * Get current Fortnite map with POIs
10
- * @param version - Optional specific map version to retrieve
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");
11
20
  */
12
- async getCurrent(version) {
13
- const query = version ? `?version=${encodeURIComponent(version)}` : "";
21
+ async getCurrent(version, mode, lang) {
22
+ const params = new URLSearchParams();
23
+ if (version)
24
+ params.set("version", version);
25
+ if (mode)
26
+ params.set("mode", mode);
27
+ if (lang)
28
+ params.set("lang", lang);
29
+ const query = params.toString() ? `?${params.toString()}` : "";
14
30
  return this.client.request(`/map${query}`);
15
31
  }
16
32
  /**
17
- * Get current map image URL
18
- * @param version - Optional specific map version to retrieve
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>`.
19
37
  */
20
- async getImage(version) {
21
- const query = version ? `?version=${encodeURIComponent(version)}` : "";
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()}` : "";
22
45
  return this.client.request(`/map/image${query}`);
23
46
  }
24
47
  /**
@@ -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
  }
@@ -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
- return this.client.request("/news/br");
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
- return this.client.request("/news/stw");
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
- return this.client.request("/news/creative");
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
- return this.client.request("/news");
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;
@@ -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;