@yaelouuu/fortnite-api 1.3.0 → 2.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/README.md CHANGED
@@ -8,6 +8,10 @@ JavaScript/TypeScript SDK for the Fortnite API by Royal Arena.
8
8
  npm install @yaelouuu/fortnite-api
9
9
  ```
10
10
 
11
+ ## API Key
12
+
13
+ Acquire your API Key by creating a Free Account here : https://api-fortnite.com
14
+
11
15
  ## Quick Start
12
16
 
13
17
  ```typescript
@@ -5,42 +5,62 @@ export declare class TournamentsResource {
5
5
  constructor(client: FortniteAPI);
6
6
  /**
7
7
  * Get current events
8
+ * No parameters needed - uses API's default account
8
9
  */
9
- getCurrent(params?: {
10
- accountId?: string;
11
- }): Promise<any>;
10
+ getCurrent(): Promise<any>;
12
11
  /**
13
12
  * Get past events
13
+ * No parameters needed - uses API's default account
14
14
  */
15
- getPast(params?: {
16
- accountId?: string;
17
- }): Promise<any>;
15
+ getPast(): Promise<any>;
18
16
  /**
19
- * Get global events
17
+ * Get global events with metadata
20
18
  */
21
19
  getGlobal(): Promise<any>;
20
+ /**
21
+ * Download events for a specific account
22
+ * Requires user's own Fortnite token
23
+ * @param params.accountId - Epic Games Account ID
24
+ * @param params.region - Region (EU, NAE, NAW, etc.)
25
+ * @param params.platform - Platform (Windows, PlayStation, etc.)
26
+ * @param fortniteToken - User's Fortnite access token (from OAuth flow)
27
+ */
28
+ download(params: {
29
+ accountId: string;
30
+ region: string;
31
+ platform: string;
32
+ }, fortniteToken: string): Promise<any>;
22
33
  /**
23
34
  * Get tournament leaderboard
35
+ * @param params.eventId - Event ID
36
+ * @param params.eventWindowId - Event window ID
37
+ * @param params.page - Page number (default: 0)
38
+ * @param params.leaderboardDef - Optional leaderboard definition
39
+ * @param params.accountId - Optional account ID to highlight
40
+ * @param fortniteToken - Optional user's Fortnite token for personalized view
24
41
  */
25
42
  getLeaderboard(params: {
26
43
  eventId: string;
27
44
  eventWindowId: string;
28
45
  page?: number;
29
46
  leaderboardDef?: string;
30
- }): Promise<Leaderboard>;
47
+ accountId?: string;
48
+ }, fortniteToken?: string): Promise<Leaderboard>;
31
49
  /**
32
50
  * Get tournament participation history for a player
33
- * GET /tournament-tracker
51
+ * Requires user's own Fortnite token
34
52
  * @param accountId - Epic Games Account ID
35
53
  * @param fortniteToken - User's Fortnite access token (from OAuth flow)
36
54
  */
37
55
  getTracker(accountId: string, fortniteToken: string): Promise<TournamentTrackerResponse>;
38
56
  /**
39
57
  * Check if a player is eligible for major tournaments
40
- * GET /tournament-eligibility
58
+ * Requires user's own Fortnite token
41
59
  * @param accountId - Epic Games Account ID
42
60
  * @param fortniteToken - User's Fortnite access token (from OAuth flow)
43
61
  * @param options - Optional configuration for eligibility check
62
+ * @param options.days - Number of days to check (default: 180, max: 365)
63
+ * @param options.requiredTournaments - Required tournaments for eligibility (default: 14, max: 50)
44
64
  */
45
65
  checkEligibility(accountId: string, fortniteToken: string, options?: {
46
66
  days?: number;
@@ -7,44 +7,78 @@ class TournamentsResource {
7
7
  }
8
8
  /**
9
9
  * Get current events
10
+ * No parameters needed - uses API's default account
10
11
  */
11
- async getCurrent(params) {
12
- const queryString = params?.accountId
13
- ? `?accountId=${params.accountId}`
14
- : "";
15
- return this.client.request(`/events/data/current${queryString}`);
12
+ async getCurrent() {
13
+ return this.client.request("/events/data/current");
16
14
  }
17
15
  /**
18
16
  * Get past events
17
+ * No parameters needed - uses API's default account
19
18
  */
20
- async getPast(params) {
21
- const queryString = params?.accountId
22
- ? `?accountId=${params.accountId}`
23
- : "";
24
- return this.client.request(`/events/data/past${queryString}`);
19
+ async getPast() {
20
+ return this.client.request("/events/data/past");
25
21
  }
26
22
  /**
27
- * Get global events
23
+ * Get global events with metadata
28
24
  */
29
25
  async getGlobal() {
30
26
  return this.client.request("/events/global");
31
27
  }
28
+ /**
29
+ * Download events for a specific account
30
+ * Requires user's own Fortnite token
31
+ * @param params.accountId - Epic Games Account ID
32
+ * @param params.region - Region (EU, NAE, NAW, etc.)
33
+ * @param params.platform - Platform (Windows, PlayStation, etc.)
34
+ * @param fortniteToken - User's Fortnite access token (from OAuth flow)
35
+ */
36
+ async download(params, fortniteToken) {
37
+ const query = new URLSearchParams({
38
+ accountId: params.accountId,
39
+ region: params.region,
40
+ platform: params.platform,
41
+ }).toString();
42
+ return this.client.request(`/events/download?${query}`, {
43
+ headers: {
44
+ "x-fortnite-token": fortniteToken,
45
+ },
46
+ });
47
+ }
32
48
  /**
33
49
  * Get tournament leaderboard
50
+ * @param params.eventId - Event ID
51
+ * @param params.eventWindowId - Event window ID
52
+ * @param params.page - Page number (default: 0)
53
+ * @param params.leaderboardDef - Optional leaderboard definition
54
+ * @param params.accountId - Optional account ID to highlight
55
+ * @param fortniteToken - Optional user's Fortnite token for personalized view
34
56
  */
35
- async getLeaderboard(params) {
36
- const { eventId, eventWindowId, page = 0, leaderboardDef } = params;
57
+ async getLeaderboard(params, fortniteToken) {
58
+ const { eventId, eventWindowId, page = 0, leaderboardDef, accountId, } = params;
37
59
  const query = new URLSearchParams({
38
60
  eventId,
39
61
  eventWindowId,
40
62
  page: page.toString(),
41
- ...(leaderboardDef && { leaderboardDef }),
42
- }).toString();
43
- return this.client.request(`/events/leaderboard?${query}`);
63
+ });
64
+ if (leaderboardDef) {
65
+ query.append("leaderboardDef", leaderboardDef);
66
+ }
67
+ if (accountId) {
68
+ query.append("accountId", accountId);
69
+ }
70
+ const options = fortniteToken
71
+ ? {
72
+ headers: {
73
+ "x-fortnite-token": fortniteToken,
74
+ },
75
+ }
76
+ : undefined;
77
+ return this.client.request(`/events/leaderboard?${query.toString()}`, options);
44
78
  }
45
79
  /**
46
80
  * Get tournament participation history for a player
47
- * GET /tournament-tracker
81
+ * Requires user's own Fortnite token
48
82
  * @param accountId - Epic Games Account ID
49
83
  * @param fortniteToken - User's Fortnite access token (from OAuth flow)
50
84
  */
@@ -57,10 +91,12 @@ class TournamentsResource {
57
91
  }
58
92
  /**
59
93
  * Check if a player is eligible for major tournaments
60
- * GET /tournament-eligibility
94
+ * Requires user's own Fortnite token
61
95
  * @param accountId - Epic Games Account ID
62
96
  * @param fortniteToken - User's Fortnite access token (from OAuth flow)
63
97
  * @param options - Optional configuration for eligibility check
98
+ * @param options.days - Number of days to check (default: 180, max: 365)
99
+ * @param options.requiredTournaments - Required tournaments for eligibility (default: 14, max: 50)
64
100
  */
65
101
  async checkEligibility(accountId, fortniteToken, options) {
66
102
  const params = new URLSearchParams({ accountId });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yaelouuu/fortnite-api",
3
- "version": "1.3.0",
4
- "description": "SDK for Fortnite Tournaments API by Royal Arena - Author : yaelouuu",
3
+ "version": "2.0.0",
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": "Your Name",
18
+ "author": "Yael BRINKERT",
19
19
  "license": "MIT",
20
20
  "devDependencies": {
21
21
  "@types/node": "^20.0.0",