@yaelouuu/fortnite-api 1.2.1 → 1.3.1
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/README.md +4 -0
- package/dist/resources/tournaments.d.ts +19 -1
- package/dist/resources/tournaments.js +34 -0
- package/dist/types/index.d.ts +22 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FortniteAPI } from "../client";
|
|
2
|
-
import { Leaderboard } from "../types";
|
|
2
|
+
import { Leaderboard, TournamentTrackerResponse, TournamentEligibilityResponse } from "../types";
|
|
3
3
|
export declare class TournamentsResource {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
@@ -28,4 +28,22 @@ export declare class TournamentsResource {
|
|
|
28
28
|
page?: number;
|
|
29
29
|
leaderboardDef?: string;
|
|
30
30
|
}): Promise<Leaderboard>;
|
|
31
|
+
/**
|
|
32
|
+
* Get tournament participation history for a player
|
|
33
|
+
* GET /tournament-tracker
|
|
34
|
+
* @param accountId - Epic Games Account ID
|
|
35
|
+
* @param fortniteToken - User's Fortnite access token (from OAuth flow)
|
|
36
|
+
*/
|
|
37
|
+
getTracker(accountId: string, fortniteToken: string): Promise<TournamentTrackerResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Check if a player is eligible for major tournaments
|
|
40
|
+
* GET /tournament-eligibility
|
|
41
|
+
* @param accountId - Epic Games Account ID
|
|
42
|
+
* @param fortniteToken - User's Fortnite access token (from OAuth flow)
|
|
43
|
+
* @param options - Optional configuration for eligibility check
|
|
44
|
+
*/
|
|
45
|
+
checkEligibility(accountId: string, fortniteToken: string, options?: {
|
|
46
|
+
days?: number;
|
|
47
|
+
requiredTournaments?: number;
|
|
48
|
+
}): Promise<TournamentEligibilityResponse>;
|
|
31
49
|
}
|
|
@@ -42,5 +42,39 @@ class TournamentsResource {
|
|
|
42
42
|
}).toString();
|
|
43
43
|
return this.client.request(`/events/leaderboard?${query}`);
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Get tournament participation history for a player
|
|
47
|
+
* GET /tournament-tracker
|
|
48
|
+
* @param accountId - Epic Games Account ID
|
|
49
|
+
* @param fortniteToken - User's Fortnite access token (from OAuth flow)
|
|
50
|
+
*/
|
|
51
|
+
async getTracker(accountId, fortniteToken) {
|
|
52
|
+
return this.client.request(`/tournament-tracker?accountId=${accountId}`, {
|
|
53
|
+
headers: {
|
|
54
|
+
"x-fortnite-token": fortniteToken,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if a player is eligible for major tournaments
|
|
60
|
+
* GET /tournament-eligibility
|
|
61
|
+
* @param accountId - Epic Games Account ID
|
|
62
|
+
* @param fortniteToken - User's Fortnite access token (from OAuth flow)
|
|
63
|
+
* @param options - Optional configuration for eligibility check
|
|
64
|
+
*/
|
|
65
|
+
async checkEligibility(accountId, fortniteToken, options) {
|
|
66
|
+
const params = new URLSearchParams({ accountId });
|
|
67
|
+
if (options?.days) {
|
|
68
|
+
params.append("days", options.days.toString());
|
|
69
|
+
}
|
|
70
|
+
if (options?.requiredTournaments) {
|
|
71
|
+
params.append("requiredTournaments", options.requiredTournaments.toString());
|
|
72
|
+
}
|
|
73
|
+
return this.client.request(`/tournament-eligibility?${params.toString()}`, {
|
|
74
|
+
headers: {
|
|
75
|
+
"x-fortnite-token": fortniteToken,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
45
79
|
}
|
|
46
80
|
exports.TournamentsResource = TournamentsResource;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -106,3 +106,25 @@ export interface BatchParsingResponse {
|
|
|
106
106
|
results?: ParsedReplayData[];
|
|
107
107
|
error?: string;
|
|
108
108
|
}
|
|
109
|
+
export interface TournamentTrackerEntry {
|
|
110
|
+
eventWindowId: string;
|
|
111
|
+
eventName: string;
|
|
112
|
+
eventId: string;
|
|
113
|
+
beginTime: string;
|
|
114
|
+
endTime: string;
|
|
115
|
+
region: string;
|
|
116
|
+
}
|
|
117
|
+
export interface TournamentTrackerResponse {
|
|
118
|
+
tournaments_played: TournamentTrackerEntry[];
|
|
119
|
+
total_count: number;
|
|
120
|
+
}
|
|
121
|
+
export interface TournamentEligibilityResponse {
|
|
122
|
+
eligible: boolean;
|
|
123
|
+
tournaments_played: number;
|
|
124
|
+
tournaments_required: number;
|
|
125
|
+
tournaments_remaining: number;
|
|
126
|
+
calculation_period_days: number;
|
|
127
|
+
oldest_tournament_date: string | null;
|
|
128
|
+
newest_tournament_date: string | null;
|
|
129
|
+
recent_tournaments: TournamentTrackerEntry[];
|
|
130
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaelouuu/fortnite-api",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "SDK for Fortnite Tournaments API by Royal Arena - Author :
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"description": "SDK for Fortnite Tournaments API by Royal Arena - Author : Yael Brinkert",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"tournaments",
|
|
16
16
|
"sdk"
|
|
17
17
|
],
|
|
18
|
-
"author": "
|
|
18
|
+
"author": "Yael BRINKERT",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^20.0.0",
|