@yaelouuu/fortnite-api 4.2.0 → 4.4.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
@@ -345,6 +345,127 @@ const psnAuth = await client.account.getExternalAuth('accountId123', 'psn');
345
345
 
346
346
  ---
347
347
 
348
+ ### News - **NEW**
349
+
350
+ Get Fortnite news and announcements for all game modes.
351
+
352
+ ```typescript
353
+ // Get Battle Royale news
354
+ const brNews = await client.news.getBRNews();
355
+ // Returns: MOTDs, platform messages, images, and videos
356
+
357
+ // Get Save The World news
358
+ const stwNews = await client.news.getSTWNews();
359
+
360
+ // Get Creative news
361
+ const creativeNews = await client.news.getCreativeNews();
362
+
363
+ // Get all news at once
364
+ const allNews = await client.news.getAllNews();
365
+ // Returns: { br, stw, creative, lastModified }
366
+ ```
367
+
368
+ ---
369
+
370
+ ### Cosmetics - **NEW**
371
+
372
+ Browse and search the complete Fortnite cosmetics catalog.
373
+
374
+ #### Get All Cosmetics
375
+ ```typescript
376
+ const cosmetics = await client.cosmetics.getAll({
377
+ page: 1,
378
+ pageSize: 50,
379
+ type: 'outfit', // outfit, backpack, pickaxe, glider, emote, wrap, music, etc.
380
+ rarity: 'legendary', // common, uncommon, rare, epic, legendary, mythic
381
+ set: 'Dark Series'
382
+ });
383
+ // Returns: Paginated list with item details
384
+ ```
385
+
386
+ #### Get Cosmetic by ID
387
+ ```typescript
388
+ const item = await client.cosmetics.getById('CID_123_Athena');
389
+ // Returns: Detailed cosmetic information
390
+ ```
391
+
392
+ #### Search Cosmetics
393
+ ```typescript
394
+ const results = await client.cosmetics.search('galaxy', {
395
+ page: 1,
396
+ pageSize: 20,
397
+ type: 'outfit'
398
+ });
399
+ // Search by name or description
400
+ ```
401
+
402
+ #### Get New Cosmetics
403
+ ```typescript
404
+ const newItems = await client.cosmetics.getNew({
405
+ page: 1,
406
+ pageSize: 50
407
+ });
408
+ // Returns: Recently added cosmetics
409
+ ```
410
+
411
+ ---
412
+
413
+ ### Crew - **NEW**
414
+
415
+ Fortnite Crew subscription pack information.
416
+
417
+ ```typescript
418
+ // Get current month's Crew Pack
419
+ const current = await client.crew.getCurrent();
420
+ // Returns: Current crew pack with cosmetics and details
421
+
422
+ // Get Crew Pack history
423
+ const history = await client.crew.getHistory();
424
+ // Returns: All previous crew packs
425
+ ```
426
+
427
+ ---
428
+
429
+ ### Map - **NEW**
430
+
431
+ Current and historical Fortnite map data.
432
+
433
+ ```typescript
434
+ // Get current map with POIs
435
+ const map = await client.map.getCurrent();
436
+ // Returns: Map data with points of interest
437
+
438
+ // Get map image URL
439
+ const mapImage = await client.map.getImage();
440
+ // Returns: Current map image URL
441
+
442
+ // Get historical map data
443
+ const history = await client.map.getHistory();
444
+ // Returns: Previous map versions
445
+ ```
446
+
447
+ ---
448
+
449
+ ### Playlists - **NEW**
450
+
451
+ Fortnite playlists and game modes.
452
+
453
+ ```typescript
454
+ // Get all playlists
455
+ const allPlaylists = await client.playlists.getAll();
456
+ // Returns: All game modes and playlists
457
+
458
+ // Get active playlists only
459
+ const active = await client.playlists.getActive();
460
+ // Returns: Currently available playlists
461
+
462
+ // Get specific playlist
463
+ const playlist = await client.playlists.getById('Playlist_DefaultSolo');
464
+ // Returns: Detailed playlist information
465
+ ```
466
+
467
+ ---
468
+
348
469
  ### FN (Fortnite Game) - **NEW**
349
470
 
350
471
  Fortnite-specific game data including inventory, features, and settings.
@@ -497,6 +618,32 @@ MIT
497
618
 
498
619
  ## 🆕 Changelog
499
620
 
621
+ ### v4.3.0 (2026-01-08)
622
+ - ✨ **NEW** `NewsResource` with 4 methods:
623
+ - Battle Royale news
624
+ - Save The World news
625
+ - Creative news
626
+ - All news in one call
627
+ - ✨ **NEW** `CosmeticsResource` with 4 methods:
628
+ - Browse all cosmetics with filters (type, rarity, set)
629
+ - Search cosmetics by name
630
+ - Get cosmetic by ID
631
+ - Get newly added cosmetics
632
+ - ✨ **NEW** `CrewResource` with 2 methods:
633
+ - Current Crew Pack
634
+ - Crew Pack history
635
+ - ✨ **NEW** `MapResource` with 3 methods:
636
+ - Current map with POIs
637
+ - Map image URL
638
+ - Historical map data
639
+ - ✨ **NEW** `PlaylistsResource` with 3 methods:
640
+ - All playlists/game modes
641
+ - Active playlists only
642
+ - Specific playlist by ID
643
+ - 📝 Comprehensive TypeScript types for all new endpoints
644
+ - 🎯 Complete SDK coverage for all API endpoints
645
+ - ✅ 100% backward compatible
646
+
500
647
  ### v4.2.0 (2026-01-06)
501
648
  - ✨ **NEW** `AccountResource` with 8 methods:
502
649
  - Account lookups by ID, display name, and external platforms
package/dist/client.d.ts CHANGED
@@ -10,6 +10,14 @@ import { BattlePassResource } from "./resources/battlepass";
10
10
  import { QuestsResource } from "./resources/quests";
11
11
  import { AccountResource } from "./resources/account";
12
12
  import { FNResource } from "./resources/fn";
13
+ import { FriendsResource } from "./resources/friends";
14
+ import { StatsResource } from "./resources/stats";
15
+ import { EventsResource } from "./resources/events";
16
+ import { NewsResource } from "./resources/news";
17
+ import { CosmeticsResource } from "./resources/cosmetics";
18
+ import { CrewResource } from "./resources/crew";
19
+ import { MapResource } from "./resources/map";
20
+ import { PlaylistsResource } from "./resources/playlists";
13
21
  export interface ClientOptions {
14
22
  apiKey: string;
15
23
  baseUrl?: string;
@@ -29,6 +37,14 @@ export declare class FortniteAPI {
29
37
  quests: QuestsResource;
30
38
  account: AccountResource;
31
39
  fn: FNResource;
40
+ friends: FriendsResource;
41
+ stats: StatsResource;
42
+ events: EventsResource;
43
+ news: NewsResource;
44
+ cosmetics: CosmeticsResource;
45
+ crew: CrewResource;
46
+ map: MapResource;
47
+ playlists: PlaylistsResource;
32
48
  constructor(options: ClientOptions);
33
49
  /**
34
50
  * Internal method to make HTTP requests
package/dist/client.js CHANGED
@@ -14,6 +14,14 @@ const battlepass_1 = require("./resources/battlepass");
14
14
  const quests_1 = require("./resources/quests");
15
15
  const account_1 = require("./resources/account");
16
16
  const fn_1 = require("./resources/fn");
17
+ const friends_1 = require("./resources/friends");
18
+ const stats_1 = require("./resources/stats");
19
+ const events_1 = require("./resources/events");
20
+ const news_1 = require("./resources/news");
21
+ const cosmetics_1 = require("./resources/cosmetics");
22
+ const crew_1 = require("./resources/crew");
23
+ const map_1 = require("./resources/map");
24
+ const playlists_1 = require("./resources/playlists");
17
25
  class FortniteAPI {
18
26
  constructor(options) {
19
27
  this.apiKey = options.apiKey;
@@ -32,6 +40,14 @@ class FortniteAPI {
32
40
  this.quests = new quests_1.QuestsResource(this);
33
41
  this.account = new account_1.AccountResource(this);
34
42
  this.fn = new fn_1.FNResource(this);
43
+ this.friends = new friends_1.FriendsResource(this);
44
+ this.stats = new stats_1.StatsResource(this);
45
+ this.events = new events_1.EventsResource(this);
46
+ this.news = new news_1.NewsResource(this);
47
+ this.cosmetics = new cosmetics_1.CosmeticsResource(this);
48
+ this.crew = new crew_1.CrewResource(this);
49
+ this.map = new map_1.MapResource(this);
50
+ this.playlists = new playlists_1.PlaylistsResource(this);
35
51
  }
36
52
  /**
37
53
  * Internal method to make HTTP requests
@@ -0,0 +1,25 @@
1
+ import { FortniteAPI } from "../client";
2
+ import { CosmeticsResponse, CosmeticItem, CosmeticsPaginatedResponse, CosmeticsSearchParams } from "../types";
3
+ export declare class CosmeticsResource {
4
+ private client;
5
+ constructor(client: FortniteAPI);
6
+ /**
7
+ * Get all cosmetics with pagination and filters
8
+ */
9
+ getAll(params?: CosmeticsSearchParams): Promise<CosmeticsPaginatedResponse>;
10
+ /**
11
+ * Get a specific cosmetic by ID
12
+ */
13
+ getById(id: string): Promise<CosmeticsResponse<CosmeticItem>>;
14
+ /**
15
+ * Search cosmetics by name or description
16
+ */
17
+ search(query: string, params?: Omit<CosmeticsSearchParams, 'search'>): Promise<CosmeticsPaginatedResponse>;
18
+ /**
19
+ * Get recently added cosmetics
20
+ */
21
+ getNew(params?: {
22
+ page?: number;
23
+ pageSize?: number;
24
+ }): Promise<CosmeticsPaginatedResponse>;
25
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CosmeticsResource = void 0;
4
+ class CosmeticsResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Get all cosmetics with pagination and filters
10
+ */
11
+ async getAll(params) {
12
+ const queryParams = new URLSearchParams();
13
+ if (params?.page)
14
+ queryParams.set("page", params.page.toString());
15
+ if (params?.pageSize)
16
+ queryParams.set("pageSize", params.pageSize.toString());
17
+ if (params?.type)
18
+ queryParams.set("type", params.type);
19
+ if (params?.rarity)
20
+ queryParams.set("rarity", params.rarity);
21
+ if (params?.set)
22
+ queryParams.set("set", params.set);
23
+ if (params?.search)
24
+ queryParams.set("search", params.search);
25
+ const query = queryParams.toString();
26
+ const endpoint = query ? `/cosmetics/all?${query}` : "/cosmetics/all";
27
+ return this.client.request(endpoint);
28
+ }
29
+ /**
30
+ * Get a specific cosmetic by ID
31
+ */
32
+ async getById(id) {
33
+ return this.client.request(`/cosmetics/${id}`);
34
+ }
35
+ /**
36
+ * Search cosmetics by name or description
37
+ */
38
+ async search(query, params) {
39
+ const queryParams = new URLSearchParams();
40
+ queryParams.set("q", query);
41
+ if (params?.page)
42
+ queryParams.set("page", params.page.toString());
43
+ if (params?.pageSize)
44
+ queryParams.set("pageSize", params.pageSize.toString());
45
+ if (params?.type)
46
+ queryParams.set("type", params.type);
47
+ if (params?.rarity)
48
+ queryParams.set("rarity", params.rarity);
49
+ if (params?.set)
50
+ queryParams.set("set", params.set);
51
+ return this.client.request(`/cosmetics/search?${queryParams.toString()}`);
52
+ }
53
+ /**
54
+ * Get recently added cosmetics
55
+ */
56
+ async getNew(params) {
57
+ const queryParams = new URLSearchParams();
58
+ if (params?.page)
59
+ queryParams.set("page", params.page.toString());
60
+ if (params?.pageSize)
61
+ queryParams.set("pageSize", params.pageSize.toString());
62
+ const query = queryParams.toString();
63
+ const endpoint = query ? `/cosmetics/new?${query}` : "/cosmetics/new";
64
+ return this.client.request(endpoint);
65
+ }
66
+ }
67
+ exports.CosmeticsResource = CosmeticsResource;
@@ -0,0 +1,14 @@
1
+ import { FortniteAPI } from "../client";
2
+ import { CrewPackResponse, CrewHistoryResponse } from "../types";
3
+ export declare class CrewResource {
4
+ private client;
5
+ constructor(client: FortniteAPI);
6
+ /**
7
+ * Get current month's Crew Pack
8
+ */
9
+ getCurrent(): Promise<CrewPackResponse>;
10
+ /**
11
+ * Get Crew Pack history
12
+ */
13
+ getHistory(): Promise<CrewHistoryResponse>;
14
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CrewResource = void 0;
4
+ class CrewResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Get current month's Crew Pack
10
+ */
11
+ async getCurrent() {
12
+ return this.client.request("/crew/current");
13
+ }
14
+ /**
15
+ * Get Crew Pack history
16
+ */
17
+ async getHistory() {
18
+ return this.client.request("/crew/history");
19
+ }
20
+ }
21
+ exports.CrewResource = CrewResource;
@@ -0,0 +1,83 @@
1
+ import { FortniteAPI } from "../client";
2
+ import { EventWindows, PlayerEventHistory, TournamentDetails, ScoringRules, EventLeaderboard, PlayerEventData, EligibilityStatus, ArenaHype, EventRewards } from "../types";
3
+ /**
4
+ * Events Resource
5
+ * Handles tournament and competitive events data
6
+ */
7
+ export declare class EventsResource {
8
+ private client;
9
+ constructor(client: FortniteAPI);
10
+ /**
11
+ * Get event windows
12
+ * @param eventId - Event ID
13
+ * @param fortniteToken - Optional user Fortnite token
14
+ * @returns Event windows data
15
+ */
16
+ getEventWindows(eventId: string, fortniteToken?: string): Promise<EventWindows>;
17
+ /**
18
+ * Get player event history
19
+ * @param accountId - Account ID
20
+ * @param fortniteToken - Optional user Fortnite token
21
+ * @returns Array of events player participated in
22
+ */
23
+ getPlayerHistory(accountId: string, fortniteToken?: string): Promise<PlayerEventHistory[]>;
24
+ /**
25
+ * Get tournament details
26
+ * @param eventId - Event ID
27
+ * @param eventWindowId - Event window ID
28
+ * @param fortniteToken - Optional user Fortnite token
29
+ * @returns Tournament details
30
+ */
31
+ getTournamentDetails(eventId: string, eventWindowId: string, fortniteToken?: string): Promise<TournamentDetails>;
32
+ /**
33
+ * Get event scoring rules
34
+ * @param eventId - Event ID
35
+ * @param eventWindowId - Event window ID
36
+ * @param fortniteToken - Optional user Fortnite token
37
+ * @returns Scoring rules
38
+ */
39
+ getScoringRules(eventId: string, eventWindowId: string, fortniteToken?: string): Promise<ScoringRules>;
40
+ /**
41
+ * Get event leaderboard
42
+ * @param eventId - Event ID
43
+ * @param eventWindowId - Event window ID
44
+ * @param options - Query options
45
+ * @param fortniteToken - Optional user Fortnite token
46
+ * @returns Leaderboard data
47
+ */
48
+ getLeaderboard(eventId: string, eventWindowId: string, options?: {
49
+ page?: number;
50
+ }, fortniteToken?: string): Promise<EventLeaderboard>;
51
+ /**
52
+ * Get player event data
53
+ * @param eventId - Event ID
54
+ * @param eventWindowId - Event window ID
55
+ * @param accountId - Account ID
56
+ * @param fortniteToken - Optional user Fortnite token
57
+ * @returns Player's event performance data
58
+ */
59
+ getPlayerEventData(eventId: string, eventWindowId: string, accountId: string, fortniteToken?: string): Promise<PlayerEventData>;
60
+ /**
61
+ * Check tournament eligibility
62
+ * @param accountId - Account ID
63
+ * @param eventId - Event ID
64
+ * @param fortniteToken - User Fortnite token (REQUIRED)
65
+ * @returns Eligibility status
66
+ */
67
+ checkEligibility(accountId: string, eventId: string, fortniteToken: string): Promise<EligibilityStatus>;
68
+ /**
69
+ * Get Arena hype and division
70
+ * @param accountId - Account ID
71
+ * @param fortniteToken - Optional user Fortnite token
72
+ * @returns Arena hype, division, and progress
73
+ */
74
+ getArenaHype(accountId: string, fortniteToken?: string): Promise<ArenaHype>;
75
+ /**
76
+ * Get event rewards/prizes
77
+ * @param eventId - Event ID
78
+ * @param eventWindowId - Event window ID
79
+ * @param fortniteToken - Optional user Fortnite token
80
+ * @returns Event rewards structure
81
+ */
82
+ getEventRewards(eventId: string, eventWindowId: string, fortniteToken?: string): Promise<EventRewards>;
83
+ }
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EventsResource = void 0;
4
+ /**
5
+ * Events Resource
6
+ * Handles tournament and competitive events data
7
+ */
8
+ class EventsResource {
9
+ constructor(client) {
10
+ this.client = client;
11
+ }
12
+ /**
13
+ * Get event windows
14
+ * @param eventId - Event ID
15
+ * @param fortniteToken - Optional user Fortnite token
16
+ * @returns Event windows data
17
+ */
18
+ async getEventWindows(eventId, fortniteToken) {
19
+ const headers = {};
20
+ if (fortniteToken) {
21
+ headers["x-fortnite-token"] = fortniteToken;
22
+ }
23
+ return this.client.request(`/events/${eventId}/windows`, { headers }, "v2");
24
+ }
25
+ /**
26
+ * Get player event history
27
+ * @param accountId - Account ID
28
+ * @param fortniteToken - Optional user Fortnite token
29
+ * @returns Array of events player participated in
30
+ */
31
+ async getPlayerHistory(accountId, fortniteToken) {
32
+ const headers = {};
33
+ if (fortniteToken) {
34
+ headers["x-fortnite-token"] = fortniteToken;
35
+ }
36
+ return this.client.request(`/events/history/${accountId}`, { headers }, "v2");
37
+ }
38
+ /**
39
+ * Get tournament details
40
+ * @param eventId - Event ID
41
+ * @param eventWindowId - Event window ID
42
+ * @param fortniteToken - Optional user Fortnite token
43
+ * @returns Tournament details
44
+ */
45
+ async getTournamentDetails(eventId, eventWindowId, fortniteToken) {
46
+ const headers = {};
47
+ if (fortniteToken) {
48
+ headers["x-fortnite-token"] = fortniteToken;
49
+ }
50
+ return this.client.request(`/events/${eventId}/windows/${eventWindowId}`, { headers }, "v2");
51
+ }
52
+ /**
53
+ * Get event scoring rules
54
+ * @param eventId - Event ID
55
+ * @param eventWindowId - Event window ID
56
+ * @param fortniteToken - Optional user Fortnite token
57
+ * @returns Scoring rules
58
+ */
59
+ async getScoringRules(eventId, eventWindowId, fortniteToken) {
60
+ const headers = {};
61
+ if (fortniteToken) {
62
+ headers["x-fortnite-token"] = fortniteToken;
63
+ }
64
+ return this.client.request(`/events/${eventId}/windows/${eventWindowId}/scoring`, { headers }, "v2");
65
+ }
66
+ /**
67
+ * Get event leaderboard
68
+ * @param eventId - Event ID
69
+ * @param eventWindowId - Event window ID
70
+ * @param options - Query options
71
+ * @param fortniteToken - Optional user Fortnite token
72
+ * @returns Leaderboard data
73
+ */
74
+ async getLeaderboard(eventId, eventWindowId, options, fortniteToken) {
75
+ const headers = {};
76
+ if (fortniteToken) {
77
+ headers["x-fortnite-token"] = fortniteToken;
78
+ }
79
+ const query = options?.page ? `?page=${options.page}` : "";
80
+ return this.client.request(`/events/${eventId}/windows/${eventWindowId}/leaderboard${query}`, { headers }, "v2");
81
+ }
82
+ /**
83
+ * Get player event data
84
+ * @param eventId - Event ID
85
+ * @param eventWindowId - Event window ID
86
+ * @param accountId - Account ID
87
+ * @param fortniteToken - Optional user Fortnite token
88
+ * @returns Player's event performance data
89
+ */
90
+ async getPlayerEventData(eventId, eventWindowId, accountId, fortniteToken) {
91
+ const headers = {};
92
+ if (fortniteToken) {
93
+ headers["x-fortnite-token"] = fortniteToken;
94
+ }
95
+ return this.client.request(`/events/${eventId}/windows/${eventWindowId}/players/${accountId}`, { headers }, "v2");
96
+ }
97
+ /**
98
+ * Check tournament eligibility
99
+ * @param accountId - Account ID
100
+ * @param eventId - Event ID
101
+ * @param fortniteToken - User Fortnite token (REQUIRED)
102
+ * @returns Eligibility status
103
+ */
104
+ async checkEligibility(accountId, eventId, fortniteToken) {
105
+ const headers = {
106
+ "x-fortnite-token": fortniteToken,
107
+ };
108
+ return this.client.request(`/events/${eventId}/eligibility/${accountId}`, { headers }, "v2");
109
+ }
110
+ /**
111
+ * Get Arena hype and division
112
+ * @param accountId - Account ID
113
+ * @param fortniteToken - Optional user Fortnite token
114
+ * @returns Arena hype, division, and progress
115
+ */
116
+ async getArenaHype(accountId, fortniteToken) {
117
+ const headers = {};
118
+ if (fortniteToken) {
119
+ headers["x-fortnite-token"] = fortniteToken;
120
+ }
121
+ return this.client.request(`/events/arena/${accountId}`, { headers }, "v2");
122
+ }
123
+ /**
124
+ * Get event rewards/prizes
125
+ * @param eventId - Event ID
126
+ * @param eventWindowId - Event window ID
127
+ * @param fortniteToken - Optional user Fortnite token
128
+ * @returns Event rewards structure
129
+ */
130
+ async getEventRewards(eventId, eventWindowId, fortniteToken) {
131
+ const headers = {};
132
+ if (fortniteToken) {
133
+ headers["x-fortnite-token"] = fortniteToken;
134
+ }
135
+ return this.client.request(`/events/${eventId}/windows/${eventWindowId}/rewards`, { headers }, "v2");
136
+ }
137
+ }
138
+ exports.EventsResource = EventsResource;
@@ -0,0 +1,68 @@
1
+ import { FortniteAPI } from "../client";
2
+ import { FriendsSummary, Friend, FriendRequest, BlockedUser, FriendshipInfo, SuggestedFriend } from "../types";
3
+ /**
4
+ * Friends Resource
5
+ * Handles all friend-related operations
6
+ */
7
+ export declare class FriendsResource {
8
+ private client;
9
+ constructor(client: FortniteAPI);
10
+ /**
11
+ * Get complete friends summary (most efficient - everything in one call)
12
+ * @param accountId - Account ID
13
+ * @param fortniteToken - Optional user Fortnite token
14
+ * @returns Complete summary with friends, requests, blocklist, settings
15
+ */
16
+ getSummary(accountId: string, fortniteToken?: string): Promise<FriendsSummary>;
17
+ /**
18
+ * Get friends list
19
+ * @param accountId - Account ID
20
+ * @param fortniteToken - Optional user Fortnite token
21
+ * @returns Array of friends with aliases and metadata
22
+ */
23
+ getFriendsList(accountId: string, fortniteToken?: string): Promise<Friend[]>;
24
+ /**
25
+ * Get incoming friend requests
26
+ * @param accountId - Account ID
27
+ * @param fortniteToken - Optional user Fortnite token
28
+ * @returns Array of incoming requests
29
+ */
30
+ getIncomingRequests(accountId: string, fortniteToken?: string): Promise<FriendRequest[]>;
31
+ /**
32
+ * Get outgoing friend requests
33
+ * @param accountId - Account ID
34
+ * @param fortniteToken - Optional user Fortnite token
35
+ * @returns Array of outgoing requests
36
+ */
37
+ getOutgoingRequests(accountId: string, fortniteToken?: string): Promise<FriendRequest[]>;
38
+ /**
39
+ * Get mutual friends between two users
40
+ * @param accountId - Your account ID
41
+ * @param friendId - Friend's account ID
42
+ * @param fortniteToken - Optional user Fortnite token
43
+ * @returns Array of mutual friend account IDs
44
+ */
45
+ getMutualFriends(accountId: string, friendId: string, fortniteToken?: string): Promise<string[]>;
46
+ /**
47
+ * Get block list
48
+ * @param accountId - Account ID
49
+ * @param fortniteToken - Optional user Fortnite token
50
+ * @returns Array of blocked users
51
+ */
52
+ getBlocklist(accountId: string, fortniteToken?: string): Promise<BlockedUser[]>;
53
+ /**
54
+ * Get friendship info for specific friend
55
+ * @param accountId - Your account ID
56
+ * @param friendId - Friend's account ID
57
+ * @param fortniteToken - Optional user Fortnite token
58
+ * @returns Friendship details including mutual count
59
+ */
60
+ getFriendshipInfo(accountId: string, friendId: string, fortniteToken?: string): Promise<FriendshipInfo>;
61
+ /**
62
+ * Get suggested friends
63
+ * @param accountId - Account ID
64
+ * @param fortniteToken - Optional user Fortnite token
65
+ * @returns Array of suggested friends
66
+ */
67
+ getSuggestedFriends(accountId: string, fortniteToken?: string): Promise<SuggestedFriend[]>;
68
+ }
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FriendsResource = void 0;
4
+ /**
5
+ * Friends Resource
6
+ * Handles all friend-related operations
7
+ */
8
+ class FriendsResource {
9
+ constructor(client) {
10
+ this.client = client;
11
+ }
12
+ /**
13
+ * Get complete friends summary (most efficient - everything in one call)
14
+ * @param accountId - Account ID
15
+ * @param fortniteToken - Optional user Fortnite token
16
+ * @returns Complete summary with friends, requests, blocklist, settings
17
+ */
18
+ async getSummary(accountId, fortniteToken) {
19
+ const headers = {};
20
+ if (fortniteToken) {
21
+ headers["x-fortnite-token"] = fortniteToken;
22
+ }
23
+ return this.client.request(`/friends/${accountId}/summary`, { headers }, "v1");
24
+ }
25
+ /**
26
+ * Get friends list
27
+ * @param accountId - Account ID
28
+ * @param fortniteToken - Optional user Fortnite token
29
+ * @returns Array of friends with aliases and metadata
30
+ */
31
+ async getFriendsList(accountId, fortniteToken) {
32
+ const headers = {};
33
+ if (fortniteToken) {
34
+ headers["x-fortnite-token"] = fortniteToken;
35
+ }
36
+ return this.client.request(`/friends/${accountId}/friends`, { headers }, "v1");
37
+ }
38
+ /**
39
+ * Get incoming friend requests
40
+ * @param accountId - Account ID
41
+ * @param fortniteToken - Optional user Fortnite token
42
+ * @returns Array of incoming requests
43
+ */
44
+ async getIncomingRequests(accountId, fortniteToken) {
45
+ const headers = {};
46
+ if (fortniteToken) {
47
+ headers["x-fortnite-token"] = fortniteToken;
48
+ }
49
+ return this.client.request(`/friends/${accountId}/incoming`, { headers }, "v1");
50
+ }
51
+ /**
52
+ * Get outgoing friend requests
53
+ * @param accountId - Account ID
54
+ * @param fortniteToken - Optional user Fortnite token
55
+ * @returns Array of outgoing requests
56
+ */
57
+ async getOutgoingRequests(accountId, fortniteToken) {
58
+ const headers = {};
59
+ if (fortniteToken) {
60
+ headers["x-fortnite-token"] = fortniteToken;
61
+ }
62
+ return this.client.request(`/friends/${accountId}/outgoing`, { headers }, "v1");
63
+ }
64
+ /**
65
+ * Get mutual friends between two users
66
+ * @param accountId - Your account ID
67
+ * @param friendId - Friend's account ID
68
+ * @param fortniteToken - Optional user Fortnite token
69
+ * @returns Array of mutual friend account IDs
70
+ */
71
+ async getMutualFriends(accountId, friendId, fortniteToken) {
72
+ const headers = {};
73
+ if (fortniteToken) {
74
+ headers["x-fortnite-token"] = fortniteToken;
75
+ }
76
+ return this.client.request(`/friends/${accountId}/friends/${friendId}/mutual`, { headers }, "v1");
77
+ }
78
+ /**
79
+ * Get block list
80
+ * @param accountId - Account ID
81
+ * @param fortniteToken - Optional user Fortnite token
82
+ * @returns Array of blocked users
83
+ */
84
+ async getBlocklist(accountId, fortniteToken) {
85
+ const headers = {};
86
+ if (fortniteToken) {
87
+ headers["x-fortnite-token"] = fortniteToken;
88
+ }
89
+ return this.client.request(`/friends/${accountId}/blocklist`, { headers }, "v1");
90
+ }
91
+ /**
92
+ * Get friendship info for specific friend
93
+ * @param accountId - Your account ID
94
+ * @param friendId - Friend's account ID
95
+ * @param fortniteToken - Optional user Fortnite token
96
+ * @returns Friendship details including mutual count
97
+ */
98
+ async getFriendshipInfo(accountId, friendId, fortniteToken) {
99
+ const headers = {};
100
+ if (fortniteToken) {
101
+ headers["x-fortnite-token"] = fortniteToken;
102
+ }
103
+ return this.client.request(`/friends/${accountId}/friends/${friendId}`, { headers }, "v1");
104
+ }
105
+ /**
106
+ * Get suggested friends
107
+ * @param accountId - Account ID
108
+ * @param fortniteToken - Optional user Fortnite token
109
+ * @returns Array of suggested friends
110
+ */
111
+ async getSuggestedFriends(accountId, fortniteToken) {
112
+ const headers = {};
113
+ if (fortniteToken) {
114
+ headers["x-fortnite-token"] = fortniteToken;
115
+ }
116
+ return this.client.request(`/friends/${accountId}/suggested`, { headers }, "v1");
117
+ }
118
+ }
119
+ exports.FriendsResource = FriendsResource;
@@ -0,0 +1,18 @@
1
+ import { FortniteAPI } from "../client";
2
+ import { MapResponse, MapImageResponse, MapHistoryResponse } from "../types";
3
+ export declare class MapResource {
4
+ private client;
5
+ constructor(client: FortniteAPI);
6
+ /**
7
+ * Get current Fortnite map with POIs
8
+ */
9
+ getCurrent(): Promise<MapResponse>;
10
+ /**
11
+ * Get current map image URL
12
+ */
13
+ getImage(): Promise<MapImageResponse>;
14
+ /**
15
+ * Get historical map data
16
+ */
17
+ getHistory(): Promise<MapHistoryResponse>;
18
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MapResource = void 0;
4
+ class MapResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Get current Fortnite map with POIs
10
+ */
11
+ async getCurrent() {
12
+ return this.client.request("/map");
13
+ }
14
+ /**
15
+ * Get current map image URL
16
+ */
17
+ async getImage() {
18
+ return this.client.request("/map/image");
19
+ }
20
+ /**
21
+ * Get historical map data
22
+ */
23
+ async getHistory() {
24
+ return this.client.request("/map/history");
25
+ }
26
+ }
27
+ exports.MapResource = MapResource;
@@ -0,0 +1,22 @@
1
+ import { FortniteAPI } from "../client";
2
+ import { NewsResponse, BRNews, STWNews, CreativeNews, AllNews } from "../types";
3
+ export declare class NewsResource {
4
+ private client;
5
+ constructor(client: FortniteAPI);
6
+ /**
7
+ * Get Battle Royale news
8
+ */
9
+ getBRNews(): Promise<NewsResponse<BRNews>>;
10
+ /**
11
+ * Get Save The World news
12
+ */
13
+ getSTWNews(): Promise<NewsResponse<STWNews>>;
14
+ /**
15
+ * Get Creative news
16
+ */
17
+ getCreativeNews(): Promise<NewsResponse<CreativeNews>>;
18
+ /**
19
+ * Get all news (BR, STW, Creative)
20
+ */
21
+ getAllNews(): Promise<NewsResponse<AllNews>>;
22
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NewsResource = void 0;
4
+ class NewsResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Get Battle Royale news
10
+ */
11
+ async getBRNews() {
12
+ return this.client.request("/news/br");
13
+ }
14
+ /**
15
+ * Get Save The World news
16
+ */
17
+ async getSTWNews() {
18
+ return this.client.request("/news/stw");
19
+ }
20
+ /**
21
+ * Get Creative news
22
+ */
23
+ async getCreativeNews() {
24
+ return this.client.request("/news/creative");
25
+ }
26
+ /**
27
+ * Get all news (BR, STW, Creative)
28
+ */
29
+ async getAllNews() {
30
+ return this.client.request("/news");
31
+ }
32
+ }
33
+ exports.NewsResource = NewsResource;
@@ -0,0 +1,18 @@
1
+ import { FortniteAPI } from "../client";
2
+ import { PlaylistsResponse, ActivePlaylistsResponse, PlaylistResponse } from "../types";
3
+ export declare class PlaylistsResource {
4
+ private client;
5
+ constructor(client: FortniteAPI);
6
+ /**
7
+ * Get all Fortnite playlists/gamemodes
8
+ */
9
+ getAll(): Promise<PlaylistsResponse>;
10
+ /**
11
+ * Get currently active playlists/gamemodes
12
+ */
13
+ getActive(): Promise<ActivePlaylistsResponse>;
14
+ /**
15
+ * Get a specific playlist by ID
16
+ */
17
+ getById(playlistId: string): Promise<PlaylistResponse>;
18
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlaylistsResource = void 0;
4
+ class PlaylistsResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Get all Fortnite playlists/gamemodes
10
+ */
11
+ async getAll() {
12
+ return this.client.request("/playlists", {}, "v2");
13
+ }
14
+ /**
15
+ * Get currently active playlists/gamemodes
16
+ */
17
+ async getActive() {
18
+ return this.client.request("/playlists/active", {}, "v2");
19
+ }
20
+ /**
21
+ * Get a specific playlist by ID
22
+ */
23
+ async getById(playlistId) {
24
+ return this.client.request(`/playlists/${playlistId}`, {}, "v2");
25
+ }
26
+ }
27
+ exports.PlaylistsResource = PlaylistsResource;
@@ -0,0 +1,40 @@
1
+ import { FortniteAPI } from "../client";
2
+ import { PlayerStats, BulkStatsResponse, LeaderboardResponse, LeaderboardOptions } from "../types";
3
+ /**
4
+ * Stats Resource
5
+ * Handles player statistics queries
6
+ */
7
+ export declare class StatsResource {
8
+ private client;
9
+ constructor(client: FortniteAPI);
10
+ /**
11
+ * Get player stats with optional filters
12
+ * @param accountId - Account ID
13
+ * @param options - Query options
14
+ * @param fortniteToken - Optional user Fortnite token
15
+ * @returns Player statistics
16
+ */
17
+ getPlayerStats(accountId: string, options?: {
18
+ startDate?: string;
19
+ endDate?: string;
20
+ stats?: string[];
21
+ }, fortniteToken?: string): Promise<PlayerStats>;
22
+ /**
23
+ * Get bulk stats for multiple players
24
+ * @param accountIds - Array of account IDs (max 100)
25
+ * @param options - Query options
26
+ * @param fortniteToken - Optional user Fortnite token
27
+ * @returns Array of player statistics
28
+ */
29
+ getBulkStats(accountIds: string[], options?: {
30
+ stats?: string[];
31
+ }, fortniteToken?: string): Promise<BulkStatsResponse[]>;
32
+ /**
33
+ * Get leaderboard for specific stat
34
+ * @param stat - Stat name to query
35
+ * @param options - Query options
36
+ * @param fortniteToken - Optional user Fortnite token
37
+ * @returns Leaderboard data
38
+ */
39
+ getLeaderboard(stat: string, options?: LeaderboardOptions, fortniteToken?: string): Promise<LeaderboardResponse>;
40
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StatsResource = void 0;
4
+ /**
5
+ * Stats Resource
6
+ * Handles player statistics queries
7
+ */
8
+ class StatsResource {
9
+ constructor(client) {
10
+ this.client = client;
11
+ }
12
+ /**
13
+ * Get player stats with optional filters
14
+ * @param accountId - Account ID
15
+ * @param options - Query options
16
+ * @param fortniteToken - Optional user Fortnite token
17
+ * @returns Player statistics
18
+ */
19
+ async getPlayerStats(accountId, options, fortniteToken) {
20
+ const headers = {};
21
+ if (fortniteToken) {
22
+ headers["x-fortnite-token"] = fortniteToken;
23
+ }
24
+ const queryParams = new URLSearchParams();
25
+ if (options?.startDate)
26
+ queryParams.append("startDate", options.startDate);
27
+ if (options?.endDate)
28
+ queryParams.append("endDate", options.endDate);
29
+ if (options?.stats)
30
+ queryParams.append("stats", options.stats.join(","));
31
+ const query = queryParams.toString();
32
+ const url = `/stats/${accountId}${query ? `?${query}` : ""}`;
33
+ return this.client.request(url, { headers }, "v2");
34
+ }
35
+ /**
36
+ * Get bulk stats for multiple players
37
+ * @param accountIds - Array of account IDs (max 100)
38
+ * @param options - Query options
39
+ * @param fortniteToken - Optional user Fortnite token
40
+ * @returns Array of player statistics
41
+ */
42
+ async getBulkStats(accountIds, options, fortniteToken) {
43
+ const headers = {
44
+ "Content-Type": "application/json",
45
+ };
46
+ if (fortniteToken) {
47
+ headers["x-fortnite-token"] = fortniteToken;
48
+ }
49
+ const body = {
50
+ accountIds,
51
+ };
52
+ if (options?.stats) {
53
+ body.stats = options.stats;
54
+ }
55
+ return this.client.request("/stats/bulk", {
56
+ method: "POST",
57
+ headers,
58
+ body: JSON.stringify(body),
59
+ }, "v2");
60
+ }
61
+ /**
62
+ * Get leaderboard for specific stat
63
+ * @param stat - Stat name to query
64
+ * @param options - Query options
65
+ * @param fortniteToken - Optional user Fortnite token
66
+ * @returns Leaderboard data
67
+ */
68
+ async getLeaderboard(stat, options, fortniteToken) {
69
+ const headers = {};
70
+ if (fortniteToken) {
71
+ headers["x-fortnite-token"] = fortniteToken;
72
+ }
73
+ const queryParams = new URLSearchParams();
74
+ if (options?.limit)
75
+ queryParams.append("limit", options.limit.toString());
76
+ if (options?.offset)
77
+ queryParams.append("offset", options.offset.toString());
78
+ if (options?.window)
79
+ queryParams.append("window", options.window);
80
+ const query = queryParams.toString();
81
+ const url = `/stats/leaderboard/${stat}${query ? `?${query}` : ""}`;
82
+ return this.client.request(url, { headers }, "v2");
83
+ }
84
+ }
85
+ exports.StatsResource = StatsResource;
@@ -355,3 +355,292 @@ export interface EntitlementCheck {
355
355
  entitlement?: boolean;
356
356
  [key: string]: any;
357
357
  }
358
+ export interface FriendsSummary {
359
+ friends?: Friend[];
360
+ incoming?: FriendRequest[];
361
+ outgoing?: FriendRequest[];
362
+ blocklist?: BlockedUser[];
363
+ settings?: {
364
+ [key: string]: any;
365
+ };
366
+ }
367
+ export interface Friend {
368
+ accountId: string;
369
+ displayName?: string;
370
+ status: "ACCEPTED" | "PENDING";
371
+ direction: "INBOUND" | "OUTBOUND";
372
+ created: string;
373
+ favorite?: boolean;
374
+ mutual?: number;
375
+ }
376
+ export interface FriendRequest {
377
+ accountId: string;
378
+ displayName?: string;
379
+ status: string;
380
+ direction: string;
381
+ created: string;
382
+ }
383
+ export interface BlockedUser {
384
+ accountId: string;
385
+ displayName?: string;
386
+ }
387
+ export interface FriendshipInfo extends Friend {
388
+ mutual: number;
389
+ }
390
+ export interface SuggestedFriend {
391
+ accountId: string;
392
+ displayName?: string;
393
+ mutualFriends?: number;
394
+ }
395
+ export interface PlayerStats {
396
+ accountId: string;
397
+ stats: {
398
+ [key: string]: any;
399
+ };
400
+ }
401
+ export interface BulkStatsRequest {
402
+ accountIds: string[];
403
+ stats?: string[];
404
+ }
405
+ export interface BulkStatsResponse {
406
+ accountId: string;
407
+ stats: {
408
+ [key: string]: any;
409
+ };
410
+ }
411
+ export interface LeaderboardOptions {
412
+ limit?: number;
413
+ offset?: number;
414
+ window?: "alltime" | "season" | "weekly" | "daily";
415
+ }
416
+ export interface LeaderboardResponse {
417
+ stat: string;
418
+ window: string;
419
+ entries: Array<{
420
+ rank: number;
421
+ accountId: string;
422
+ displayName?: string;
423
+ value: number;
424
+ }>;
425
+ pagination?: {
426
+ limit: number;
427
+ offset: number;
428
+ total?: number;
429
+ };
430
+ }
431
+ export interface EventWindows {
432
+ eventId: string;
433
+ displayName?: string;
434
+ windows: Array<{
435
+ eventWindowId: string;
436
+ beginTime: string;
437
+ endTime: string;
438
+ round?: number;
439
+ }>;
440
+ }
441
+ export interface PlayerEventHistory {
442
+ eventId: string;
443
+ eventWindowId: string;
444
+ eventName?: string;
445
+ beginTime: string;
446
+ endTime: string;
447
+ region?: string;
448
+ }
449
+ export interface TournamentDetails {
450
+ eventId: string;
451
+ eventWindowId: string;
452
+ beginTime: string;
453
+ endTime: string;
454
+ round?: number;
455
+ payoutDelay?: number;
456
+ [key: string]: any;
457
+ }
458
+ export interface ScoringRules {
459
+ scoring: Array<{
460
+ eventName: string;
461
+ points: number;
462
+ }>;
463
+ }
464
+ export interface EventLeaderboard {
465
+ entries: Array<{
466
+ rank: number;
467
+ accountId: string;
468
+ teamId?: string;
469
+ pointsEarned: number;
470
+ score: number;
471
+ [key: string]: any;
472
+ }>;
473
+ }
474
+ export interface PlayerEventData {
475
+ accountId: string;
476
+ teamId?: string;
477
+ pointsEarned: number;
478
+ rank?: number;
479
+ percentile?: number;
480
+ sessions?: Array<any>;
481
+ }
482
+ export interface EligibilityStatus {
483
+ eligible: boolean;
484
+ reasons?: string[];
485
+ }
486
+ export interface ArenaHype {
487
+ accountId: string;
488
+ currentHype?: number;
489
+ division?: string;
490
+ divisionNumber?: number;
491
+ progress?: number;
492
+ }
493
+ export interface EventRewards {
494
+ prizes: Array<{
495
+ placement: string;
496
+ amount: number;
497
+ currency?: string;
498
+ }>;
499
+ }
500
+ export interface NewsResponse<T> {
501
+ status: number;
502
+ data: T;
503
+ }
504
+ export interface MOTD {
505
+ id: string;
506
+ title: string;
507
+ body: string;
508
+ image: string;
509
+ tileImage?: string;
510
+ videoURL?: string;
511
+ [key: string]: any;
512
+ }
513
+ export interface BRNews {
514
+ motds: MOTD[];
515
+ platform_motds?: MOTD[];
516
+ [key: string]: any;
517
+ }
518
+ export interface STWNews {
519
+ motds: MOTD[];
520
+ [key: string]: any;
521
+ }
522
+ export interface CreativeNews {
523
+ motds: MOTD[];
524
+ [key: string]: any;
525
+ }
526
+ export interface AllNews {
527
+ br: BRNews;
528
+ stw: STWNews;
529
+ creative: CreativeNews;
530
+ lastModified: string;
531
+ }
532
+ export interface CosmeticsResponse<T> {
533
+ status: number;
534
+ data: T;
535
+ }
536
+ export interface CosmeticsPaginatedResponse {
537
+ status: number;
538
+ data: CosmeticItem[];
539
+ pagination: {
540
+ page: number;
541
+ pageSize: number;
542
+ total: number;
543
+ totalPages: number;
544
+ };
545
+ }
546
+ export interface CosmeticItem {
547
+ id: string;
548
+ name: string;
549
+ description?: string;
550
+ type: string;
551
+ rarity: string;
552
+ series?: string;
553
+ set?: string;
554
+ images?: {
555
+ icon?: string;
556
+ featured?: string;
557
+ [key: string]: any;
558
+ };
559
+ introduction?: {
560
+ season?: number;
561
+ chapter?: number;
562
+ };
563
+ [key: string]: any;
564
+ }
565
+ export interface CosmeticsSearchParams {
566
+ page?: number;
567
+ pageSize?: number;
568
+ type?: string;
569
+ rarity?: string;
570
+ set?: string;
571
+ search?: string;
572
+ }
573
+ export interface CrewPackResponse {
574
+ status: number;
575
+ data: {
576
+ crew: {
577
+ name: string;
578
+ catalogEntries: any[];
579
+ refreshIntervalHrs: number;
580
+ dailyPurchaseHrs: number;
581
+ } | null;
582
+ count: number;
583
+ message: string;
584
+ lastModified: string;
585
+ };
586
+ }
587
+ export interface CrewHistoryResponse {
588
+ status: number;
589
+ data: {
590
+ history: any[];
591
+ count: number;
592
+ message: string;
593
+ lastModified: string;
594
+ };
595
+ }
596
+ export interface MapResponse {
597
+ status: number;
598
+ data: {
599
+ [key: string]: any;
600
+ };
601
+ }
602
+ export interface MapImageResponse {
603
+ status: number;
604
+ data: {
605
+ [key: string]: any;
606
+ };
607
+ }
608
+ export interface MapHistoryResponse {
609
+ status: number;
610
+ data: {
611
+ [key: string]: any;
612
+ };
613
+ }
614
+ export interface PlaylistsResponse {
615
+ status: number;
616
+ data: {
617
+ playlists: {
618
+ [playlistId: string]: Playlist;
619
+ };
620
+ conversion_config: any;
621
+ lastModified: string;
622
+ };
623
+ }
624
+ export interface ActivePlaylistsResponse {
625
+ status: number;
626
+ data: {
627
+ playlists: {
628
+ [playlistId: string]: Playlist;
629
+ };
630
+ count: number;
631
+ lastModified: string;
632
+ };
633
+ }
634
+ export interface PlaylistResponse {
635
+ status: number;
636
+ data: Playlist;
637
+ }
638
+ export interface Playlist {
639
+ id: string;
640
+ image: string;
641
+ playlist_name: string;
642
+ hidden: boolean;
643
+ _type: string;
644
+ lastModified?: string;
645
+ [key: string]: any;
646
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaelouuu/fortnite-api",
3
- "version": "4.2.0",
3
+ "version": "4.4.0",
4
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",