@yaelouuu/fortnite-api 4.5.0 → 4.6.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/events.d.ts +19 -7
- package/dist/resources/events.js +25 -10
- package/dist/resources/oauth.d.ts +11 -1
- package/dist/resources/oauth.js +10 -0
- package/dist/resources/profiles.d.ts +8 -3
- package/dist/resources/profiles.js +16 -6
- package/dist/resources/weapons.d.ts +12 -3
- package/dist/resources/weapons.js +16 -3
- package/dist/types/index.d.ts +112 -5
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FortniteAPI } from "../client";
|
|
2
|
-
import { EventWindows, PlayerEventHistory, TournamentDetails, ScoringRules, EventLeaderboard, PlayerEventData, EligibilityStatus, ArenaHype, EventRewards } from "../types";
|
|
2
|
+
import { EventWindows, PlayerEventHistory, TournamentDetails, ScoringRules, EventLeaderboard, PlayerEventData, EligibilityStatus, PlayerEligibilityResult, ArenaHype, EventRewards } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Events Resource
|
|
5
5
|
* Handles tournament and competitive events data
|
|
@@ -58,13 +58,25 @@ export declare class EventsResource {
|
|
|
58
58
|
*/
|
|
59
59
|
getPlayerEventData(eventId: string, eventWindowId: string, accountId: string, fortniteToken?: string): Promise<PlayerEventData>;
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* @param eventId - Event ID
|
|
64
|
-
* @param
|
|
65
|
-
* @returns
|
|
61
|
+
* Get parsed tournament eligibility requirements.
|
|
62
|
+
* No user token needed — requirements are extracted from tournament metadata.
|
|
63
|
+
* @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
|
|
64
|
+
* @param eventWindowId - Optional: filter to a specific event window
|
|
65
|
+
* @returns Parsed eligibility requirements
|
|
66
|
+
*/
|
|
67
|
+
checkEligibility(eventId: string, eventWindowId?: string): Promise<EligibilityStatus>;
|
|
68
|
+
/**
|
|
69
|
+
* Check a player's eligibility against tournament requirements.
|
|
70
|
+
* Cross-references ranked data with tournament requirements — no user token needed.
|
|
71
|
+
* @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
|
|
72
|
+
* @param accountId - Epic Games Account ID to check
|
|
73
|
+
* @param options - Optional platform and eventWindowId
|
|
74
|
+
* @returns Player eligibility check results
|
|
66
75
|
*/
|
|
67
|
-
|
|
76
|
+
checkPlayerEligibility(eventId: string, accountId: string, options?: {
|
|
77
|
+
platform?: string;
|
|
78
|
+
eventWindowId?: string;
|
|
79
|
+
}): Promise<PlayerEligibilityResult>;
|
|
68
80
|
/**
|
|
69
81
|
* Get Arena hype and division
|
|
70
82
|
* @param accountId - Account ID
|
package/dist/resources/events.js
CHANGED
|
@@ -95,17 +95,32 @@ class EventsResource {
|
|
|
95
95
|
return this.client.request(`/events/${eventId}/windows/${eventWindowId}/players/${accountId}`, { headers }, "v2");
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* @param eventId - Event ID
|
|
101
|
-
* @param
|
|
102
|
-
* @returns
|
|
98
|
+
* Get parsed tournament eligibility requirements.
|
|
99
|
+
* No user token needed — requirements are extracted from tournament metadata.
|
|
100
|
+
* @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
|
|
101
|
+
* @param eventWindowId - Optional: filter to a specific event window
|
|
102
|
+
* @returns Parsed eligibility requirements
|
|
103
|
+
*/
|
|
104
|
+
async checkEligibility(eventId, eventWindowId) {
|
|
105
|
+
const query = eventWindowId ? `?eventWindowId=${eventWindowId}` : "";
|
|
106
|
+
return this.client.request(`/events/${eventId}/eligibility${query}`, {}, "v2");
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Check a player's eligibility against tournament requirements.
|
|
110
|
+
* Cross-references ranked data with tournament requirements — no user token needed.
|
|
111
|
+
* @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
|
|
112
|
+
* @param accountId - Epic Games Account ID to check
|
|
113
|
+
* @param options - Optional platform and eventWindowId
|
|
114
|
+
* @returns Player eligibility check results
|
|
103
115
|
*/
|
|
104
|
-
async
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
async checkPlayerEligibility(eventId, accountId, options) {
|
|
117
|
+
const params = new URLSearchParams();
|
|
118
|
+
if (options?.platform)
|
|
119
|
+
params.set("platform", options.platform);
|
|
120
|
+
if (options?.eventWindowId)
|
|
121
|
+
params.set("eventWindowId", options.eventWindowId);
|
|
122
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
123
|
+
return this.client.request(`/events/${eventId}/eligibility/${accountId}${query}`, {}, "v2");
|
|
109
124
|
}
|
|
110
125
|
/**
|
|
111
126
|
* Get Arena hype and division
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FortniteAPI } from "../client";
|
|
2
|
-
import { OAuthCompleteResponse, OAuthDeviceRefreshResponse, OAuthFlowResponse, OAuthRefreshResponse } from "../types";
|
|
2
|
+
import { OAuthCompleteResponse, OAuthDeviceRefreshResponse, OAuthExchangeCodeResponse, OAuthFlowResponse, OAuthRefreshResponse } from "../types";
|
|
3
3
|
export declare class OauthResource {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
@@ -18,6 +18,16 @@ export declare class OauthResource {
|
|
|
18
18
|
* Use when access token expires (~2 hours)
|
|
19
19
|
*/
|
|
20
20
|
refreshToken(refreshToken: string): Promise<OAuthRefreshResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* Exchange authorization code for tokens - POST /oauth/exchange-code
|
|
23
|
+
* Clean web OAuth flow (no device code warning)
|
|
24
|
+
*/
|
|
25
|
+
exchangeCode(params: {
|
|
26
|
+
code: string;
|
|
27
|
+
redirectUri: string;
|
|
28
|
+
clientId?: string;
|
|
29
|
+
clientSecret?: string;
|
|
30
|
+
}): Promise<OAuthExchangeCodeResponse>;
|
|
21
31
|
/**
|
|
22
32
|
* Refresh with device auth - POST /oauth/refresh-device
|
|
23
33
|
* Use device auth credentials to get fresh tokens (never expires)
|
package/dist/resources/oauth.js
CHANGED
|
@@ -32,6 +32,16 @@ class OauthResource {
|
|
|
32
32
|
body: JSON.stringify({ refreshToken }),
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Exchange authorization code for tokens - POST /oauth/exchange-code
|
|
37
|
+
* Clean web OAuth flow (no device code warning)
|
|
38
|
+
*/
|
|
39
|
+
async exchangeCode(params) {
|
|
40
|
+
return this.client.request("/oauth/exchange-code", {
|
|
41
|
+
method: "POST",
|
|
42
|
+
body: JSON.stringify(params),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
35
45
|
/**
|
|
36
46
|
* Refresh with device auth - POST /oauth/refresh-device
|
|
37
47
|
* Use device auth credentials to get fresh tokens (never expires)
|
|
@@ -4,19 +4,24 @@ export declare class ProfilesResource {
|
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
6
6
|
/**
|
|
7
|
-
* Get profile progress by display name
|
|
7
|
+
* Get profile progress (ranked divisions, levels) by display name
|
|
8
|
+
* @param displayName - Epic Games display name
|
|
8
9
|
*/
|
|
9
10
|
getProgress(displayName: string): Promise<any>;
|
|
10
11
|
/**
|
|
11
12
|
* Get profile stats by display name
|
|
13
|
+
* @param displayName - Epic Games display name
|
|
14
|
+
* @param timeWindow - Time period: "season" or "lifetime" (default: "lifetime")
|
|
12
15
|
*/
|
|
13
|
-
getStats(displayName: string): Promise<ProfileStats>;
|
|
16
|
+
getStats(displayName: string, timeWindow?: "season" | "lifetime"): Promise<ProfileStats>;
|
|
14
17
|
/**
|
|
15
18
|
* Get account info by ID
|
|
19
|
+
* @param accountId - Epic Games Account ID
|
|
16
20
|
*/
|
|
17
21
|
getAccount(accountId: string): Promise<Profile>;
|
|
18
22
|
/**
|
|
19
|
-
* Get multiple display names
|
|
23
|
+
* Get multiple display names by account IDs
|
|
24
|
+
* @param accountIds - Array of account IDs (max 100)
|
|
20
25
|
*/
|
|
21
26
|
getDisplayNames(accountIds: string[]): Promise<Record<string, string>>;
|
|
22
27
|
}
|
|
@@ -6,29 +6,39 @@ class ProfilesResource {
|
|
|
6
6
|
this.client = client;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Get profile progress by display name
|
|
9
|
+
* Get profile progress (ranked divisions, levels) by display name
|
|
10
|
+
* @param displayName - Epic Games display name
|
|
10
11
|
*/
|
|
11
12
|
async getProgress(displayName) {
|
|
12
|
-
return this.client.request(`/profile/progress?displayName=${displayName}`);
|
|
13
|
+
return this.client.request(`/profile/progress?displayName=${encodeURIComponent(displayName)}`);
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Get profile stats by display name
|
|
17
|
+
* @param displayName - Epic Games display name
|
|
18
|
+
* @param timeWindow - Time period: "season" or "lifetime" (default: "lifetime")
|
|
16
19
|
*/
|
|
17
|
-
async getStats(displayName) {
|
|
18
|
-
|
|
20
|
+
async getStats(displayName, timeWindow) {
|
|
21
|
+
const params = new URLSearchParams({
|
|
22
|
+
displayName,
|
|
23
|
+
});
|
|
24
|
+
if (timeWindow)
|
|
25
|
+
params.set("timeWindow", timeWindow);
|
|
26
|
+
return this.client.request(`/profile/stats?${params.toString()}`);
|
|
19
27
|
}
|
|
20
28
|
/**
|
|
21
29
|
* Get account info by ID
|
|
30
|
+
* @param accountId - Epic Games Account ID
|
|
22
31
|
*/
|
|
23
32
|
async getAccount(accountId) {
|
|
24
33
|
return this.client.request(`/account/${accountId}`);
|
|
25
34
|
}
|
|
26
35
|
/**
|
|
27
|
-
* Get multiple display names
|
|
36
|
+
* Get multiple display names by account IDs
|
|
37
|
+
* @param accountIds - Array of account IDs (max 100)
|
|
28
38
|
*/
|
|
29
39
|
async getDisplayNames(accountIds) {
|
|
30
40
|
const ids = accountIds.join(",");
|
|
31
|
-
return this.client.request(`/displaynames/multiple?ids=${ids}`);
|
|
41
|
+
return this.client.request(`/displaynames/multiple?ids=${encodeURIComponent(ids)}`);
|
|
32
42
|
}
|
|
33
43
|
}
|
|
34
44
|
exports.ProfilesResource = ProfilesResource;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { FortniteAPI } from "../client";
|
|
2
|
-
import {
|
|
2
|
+
import { WeaponsResponse } from "../types";
|
|
3
3
|
export declare class WeaponsResource {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
6
6
|
/**
|
|
7
|
-
* Get weapons
|
|
7
|
+
* Get weapons data with optional filtering
|
|
8
|
+
* @param options - Query options
|
|
9
|
+
* @param options.version - Version filter: "current" (current season), "all" (every weapon), "unversioned", or a specific version like "39.50"
|
|
10
|
+
* @param options.category - Filter by category: assault-rifles, shotguns, smgs, snipers, pistols, explosives, marksman-rifles, bows, crossbows, melee, light-machine-guns
|
|
11
|
+
* @param options.search - Search weapons by name (e.g. "pump", "assault", "bolt")
|
|
12
|
+
* @returns Weapons response with metadata and data
|
|
8
13
|
*/
|
|
9
|
-
getWeapons(
|
|
14
|
+
getWeapons(options?: {
|
|
15
|
+
version?: string;
|
|
16
|
+
category?: string;
|
|
17
|
+
search?: string;
|
|
18
|
+
}): Promise<WeaponsResponse>;
|
|
10
19
|
}
|
|
@@ -6,10 +6,23 @@ class WeaponsResource {
|
|
|
6
6
|
this.client = client;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Get weapons
|
|
9
|
+
* Get weapons data with optional filtering
|
|
10
|
+
* @param options - Query options
|
|
11
|
+
* @param options.version - Version filter: "current" (current season), "all" (every weapon), "unversioned", or a specific version like "39.50"
|
|
12
|
+
* @param options.category - Filter by category: assault-rifles, shotguns, smgs, snipers, pistols, explosives, marksman-rifles, bows, crossbows, melee, light-machine-guns
|
|
13
|
+
* @param options.search - Search weapons by name (e.g. "pump", "assault", "bolt")
|
|
14
|
+
* @returns Weapons response with metadata and data
|
|
10
15
|
*/
|
|
11
|
-
async getWeapons() {
|
|
12
|
-
|
|
16
|
+
async getWeapons(options) {
|
|
17
|
+
const params = new URLSearchParams();
|
|
18
|
+
if (options?.version)
|
|
19
|
+
params.set("version", options.version);
|
|
20
|
+
if (options?.category)
|
|
21
|
+
params.set("category", options.category);
|
|
22
|
+
if (options?.search)
|
|
23
|
+
params.set("search", options.search);
|
|
24
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
25
|
+
return this.client.request(`/weapons${query}`, {}, "v2");
|
|
13
26
|
}
|
|
14
27
|
}
|
|
15
28
|
exports.WeaponsResource = WeaponsResource;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -180,9 +180,21 @@ export interface TournamentEligibilityResponse {
|
|
|
180
180
|
newest_tournament_date: string | null;
|
|
181
181
|
recent_tournaments: TournamentTrackerEntry[];
|
|
182
182
|
}
|
|
183
|
-
export interface
|
|
184
|
-
|
|
183
|
+
export interface WeaponsResponse {
|
|
184
|
+
version: string;
|
|
185
|
+
count: number;
|
|
186
|
+
source: "iesdev" | "lootpool" | "codenames" | "none";
|
|
187
|
+
codenames?: string[];
|
|
188
|
+
lootPool?: {
|
|
189
|
+
patchVersion: string;
|
|
190
|
+
lastUpdated: string;
|
|
191
|
+
replaysProcessed: number;
|
|
192
|
+
};
|
|
193
|
+
message?: string;
|
|
194
|
+
data: Record<string, WeaponsInfos>;
|
|
185
195
|
}
|
|
196
|
+
/** @deprecated Use WeaponsResponse instead */
|
|
197
|
+
export type Weapons = WeaponsResponse;
|
|
186
198
|
export interface WeaponsInfos {
|
|
187
199
|
id: string;
|
|
188
200
|
displayName: string;
|
|
@@ -192,9 +204,15 @@ export interface WeaponsInfos {
|
|
|
192
204
|
icon: string;
|
|
193
205
|
type: string;
|
|
194
206
|
category: string | null;
|
|
195
|
-
season: number;
|
|
207
|
+
season: number | null;
|
|
208
|
+
unversioned: boolean;
|
|
196
209
|
series: string;
|
|
197
210
|
stats: WeaponsStats;
|
|
211
|
+
images: {
|
|
212
|
+
icon: string | null;
|
|
213
|
+
iconNoBackground: string | null;
|
|
214
|
+
largeIcon: string | null;
|
|
215
|
+
};
|
|
198
216
|
}
|
|
199
217
|
export interface GameplayTags {
|
|
200
218
|
gameplayTags: Array<String>;
|
|
@@ -479,9 +497,98 @@ export interface PlayerEventData {
|
|
|
479
497
|
percentile?: number;
|
|
480
498
|
sessions?: Array<any>;
|
|
481
499
|
}
|
|
500
|
+
export interface RankRequirement {
|
|
501
|
+
raw: string;
|
|
502
|
+
trackId?: string;
|
|
503
|
+
minimumRank?: number;
|
|
504
|
+
}
|
|
505
|
+
export interface WindowRequirements {
|
|
506
|
+
mfa: boolean;
|
|
507
|
+
eula: string | null;
|
|
508
|
+
anticheat: string | null;
|
|
509
|
+
rankRequirements: RankRequirement[] | null;
|
|
510
|
+
}
|
|
511
|
+
export interface EligibilityWindow {
|
|
512
|
+
eventWindowId: string;
|
|
513
|
+
beginTime: string;
|
|
514
|
+
endTime: string;
|
|
515
|
+
round: number;
|
|
516
|
+
requireAllTokens: string[];
|
|
517
|
+
requireAnyTokens: string[];
|
|
518
|
+
requireNoneTokensCaller: string[];
|
|
519
|
+
teammateEligibility: string | null;
|
|
520
|
+
requirements: WindowRequirements;
|
|
521
|
+
}
|
|
522
|
+
export interface EligibilityRequirements {
|
|
523
|
+
minimumAccountLevel: number | null;
|
|
524
|
+
platforms: string[];
|
|
525
|
+
systemFeatures: string[];
|
|
526
|
+
tournamentType: string | null;
|
|
527
|
+
regionLockType: string | null;
|
|
528
|
+
accountLockType: string | null;
|
|
529
|
+
teamLockType: string | null;
|
|
530
|
+
disqualifyType: string | null;
|
|
531
|
+
}
|
|
482
532
|
export interface EligibilityStatus {
|
|
483
|
-
|
|
484
|
-
|
|
533
|
+
eventId: string;
|
|
534
|
+
region: string;
|
|
535
|
+
groupId: string;
|
|
536
|
+
name: string;
|
|
537
|
+
requirements: EligibilityRequirements;
|
|
538
|
+
windows: EligibilityWindow[];
|
|
539
|
+
}
|
|
540
|
+
export interface EligibilityCheck {
|
|
541
|
+
status: "pass" | "fail" | "unknown";
|
|
542
|
+
required?: any;
|
|
543
|
+
message?: string;
|
|
544
|
+
playerPlatform?: string;
|
|
545
|
+
}
|
|
546
|
+
export interface RankCheck {
|
|
547
|
+
status: "pass" | "fail" | "unknown";
|
|
548
|
+
type: "OR";
|
|
549
|
+
details: Array<{
|
|
550
|
+
trackId: string;
|
|
551
|
+
minimumRank: number;
|
|
552
|
+
playerDivision: number | null;
|
|
553
|
+
status: "pass" | "fail" | "unknown";
|
|
554
|
+
}>;
|
|
555
|
+
}
|
|
556
|
+
export interface PlayerEligibilityWindow {
|
|
557
|
+
eventWindowId: string;
|
|
558
|
+
checks: {
|
|
559
|
+
mfa?: EligibilityCheck;
|
|
560
|
+
eula?: EligibilityCheck;
|
|
561
|
+
rank?: RankCheck;
|
|
562
|
+
requireNoneTokensCaller?: EligibilityCheck;
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
export interface PlayerEligibilityResult {
|
|
566
|
+
eventId: string;
|
|
567
|
+
accountId: string;
|
|
568
|
+
region: string;
|
|
569
|
+
name: string;
|
|
570
|
+
checks: {
|
|
571
|
+
minimumAccountLevel?: EligibilityCheck;
|
|
572
|
+
platform?: EligibilityCheck;
|
|
573
|
+
systemFeatures?: EligibilityCheck;
|
|
574
|
+
};
|
|
575
|
+
windows: PlayerEligibilityWindow[];
|
|
576
|
+
playerRanks: Record<string, {
|
|
577
|
+
currentDivision: number | null;
|
|
578
|
+
highestDivision: number | null;
|
|
579
|
+
currentPlayerRanking: number | null;
|
|
580
|
+
}>;
|
|
581
|
+
checkedAt: string;
|
|
582
|
+
}
|
|
583
|
+
export interface OAuthExchangeCodeResponse {
|
|
584
|
+
success: boolean;
|
|
585
|
+
accessToken: string;
|
|
586
|
+
refreshToken: string;
|
|
587
|
+
expiresIn: number;
|
|
588
|
+
tokenType: string;
|
|
589
|
+
scope: string;
|
|
590
|
+
accountId: string;
|
|
591
|
+
displayName: string | null;
|
|
485
592
|
}
|
|
486
593
|
export interface ArenaHype {
|
|
487
594
|
accountId: string;
|