@yaelouuu/fortnite-api 4.1.0 → 4.3.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.
Files changed (40) hide show
  1. package/README.md +491 -16
  2. package/dist/client.d.ts +10 -0
  3. package/dist/client.js +10 -0
  4. package/dist/errors.d.ts +0 -0
  5. package/dist/errors.js +0 -0
  6. package/dist/index.d.ts +0 -0
  7. package/dist/index.js +0 -0
  8. package/dist/resources/account.d.ts +54 -0
  9. package/dist/resources/account.js +103 -0
  10. package/dist/resources/battlepass.d.ts +0 -0
  11. package/dist/resources/battlepass.js +0 -0
  12. package/dist/resources/bundles.d.ts +0 -0
  13. package/dist/resources/bundles.js +0 -0
  14. package/dist/resources/calendar.d.ts +0 -0
  15. package/dist/resources/calendar.js +0 -0
  16. package/dist/resources/events.d.ts +83 -0
  17. package/dist/resources/events.js +138 -0
  18. package/dist/resources/fn.d.ts +56 -0
  19. package/dist/resources/fn.js +104 -0
  20. package/dist/resources/friends.d.ts +68 -0
  21. package/dist/resources/friends.js +119 -0
  22. package/dist/resources/oauth.d.ts +0 -0
  23. package/dist/resources/oauth.js +0 -0
  24. package/dist/resources/parsing.d.ts +0 -0
  25. package/dist/resources/parsing.js +0 -0
  26. package/dist/resources/profiles.d.ts +0 -0
  27. package/dist/resources/profiles.js +0 -0
  28. package/dist/resources/quests.d.ts +43 -4
  29. package/dist/resources/quests.js +43 -4
  30. package/dist/resources/shop.d.ts +0 -0
  31. package/dist/resources/shop.js +0 -0
  32. package/dist/resources/stats.d.ts +40 -0
  33. package/dist/resources/stats.js +85 -0
  34. package/dist/resources/tournaments.d.ts +67 -5
  35. package/dist/resources/tournaments.js +67 -5
  36. package/dist/resources/weapons.d.ts +0 -0
  37. package/dist/resources/weapons.js +0 -0
  38. package/dist/types/index.d.ts +205 -0
  39. package/dist/types/index.js +0 -0
  40. package/package.json +1 -1
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccountResource = void 0;
4
+ class AccountResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Lookup account by Account ID
10
+ * @param accountId - Epic Games account ID
11
+ * @param fortniteToken - Optional user Fortnite token
12
+ */
13
+ async getById(accountId, fortniteToken) {
14
+ const headers = {};
15
+ if (fortniteToken) {
16
+ headers["x-fortnite-token"] = fortniteToken;
17
+ }
18
+ return this.client.request(`/account/${accountId}`, { headers }, "v1");
19
+ }
20
+ /**
21
+ * Bulk account lookup by Account IDs
22
+ * @param accountIds - Array of Epic Games account IDs (max 100)
23
+ */
24
+ async getBulk(accountIds) {
25
+ const queryString = accountIds
26
+ .map((id) => `accountId=${encodeURIComponent(id)}`)
27
+ .join("&");
28
+ return this.client.request(`/account/bulk?${queryString}`, {}, "v1");
29
+ }
30
+ /**
31
+ * Lookup account by Epic display name
32
+ * @param displayName - Epic Games display name
33
+ * @param fortniteToken - Optional user Fortnite token
34
+ */
35
+ async getByDisplayName(displayName, fortniteToken) {
36
+ const headers = {};
37
+ if (fortniteToken) {
38
+ headers["x-fortnite-token"] = fortniteToken;
39
+ }
40
+ return this.client.request(`/account/displayName/${encodeURIComponent(displayName)}`, { headers }, "v1");
41
+ }
42
+ /**
43
+ * Cross-platform account lookup by external display name
44
+ * @param platform - Platform type (psn, xbl, steam, nintendo, twitch, github)
45
+ * @param displayName - Platform display name
46
+ * @param caseInsensitive - Case-insensitive search (default: false)
47
+ * @param fortniteToken - Optional user Fortnite token
48
+ */
49
+ async getByExternalDisplayName(platform, displayName, caseInsensitive = false, fortniteToken) {
50
+ const headers = {};
51
+ if (fortniteToken) {
52
+ headers["x-fortnite-token"] = fortniteToken;
53
+ }
54
+ const query = caseInsensitive ? "?caseInsensitive=true" : "";
55
+ return this.client.request(`/account/external/${platform}/displayName/${encodeURIComponent(displayName)}${query}`, { headers }, "v1");
56
+ }
57
+ /**
58
+ * Bulk external display name lookup
59
+ * @param payload - Array of platform/displayName pairs (max 100)
60
+ */
61
+ async getBulkExternalDisplayNames(payload) {
62
+ return this.client.request(`/account/external/displayNames/bulk`, {
63
+ method: "POST",
64
+ body: JSON.stringify(payload),
65
+ }, "v1");
66
+ }
67
+ /**
68
+ * Bulk external ID lookup
69
+ * @param payload - Array of platform/externalId pairs (max 100)
70
+ */
71
+ async getBulkExternalIds(payload) {
72
+ return this.client.request(`/account/external/ids/bulk`, {
73
+ method: "POST",
74
+ body: JSON.stringify(payload),
75
+ }, "v1");
76
+ }
77
+ /**
78
+ * Get all external authentications for an account
79
+ * @param accountId - Epic Games account ID
80
+ * @param fortniteToken - Optional user Fortnite token
81
+ */
82
+ async getExternalAuths(accountId, fortniteToken) {
83
+ const headers = {};
84
+ if (fortniteToken) {
85
+ headers["x-fortnite-token"] = fortniteToken;
86
+ }
87
+ return this.client.request(`/account/${accountId}/externalAuths`, { headers }, "v1");
88
+ }
89
+ /**
90
+ * Get specific external authentication for an account
91
+ * @param accountId - Epic Games account ID
92
+ * @param platform - Platform type (psn, xbl, steam, nintendo, twitch, github)
93
+ * @param fortniteToken - Optional user Fortnite token
94
+ */
95
+ async getExternalAuth(accountId, platform, fortniteToken) {
96
+ const headers = {};
97
+ if (fortniteToken) {
98
+ headers["x-fortnite-token"] = fortniteToken;
99
+ }
100
+ return this.client.request(`/account/${accountId}/externalAuths/${platform}`, { headers }, "v1");
101
+ }
102
+ }
103
+ exports.AccountResource = AccountResource;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -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,56 @@
1
+ import { FortniteAPI } from "../client";
2
+ import { BRInventory, Keychain, Receipt, EnabledFeatures, VersionCheck, PrivacySettings, EntitlementCheck } from "../types";
3
+ export declare class FNResource {
4
+ private client;
5
+ constructor(client: FortniteAPI);
6
+ /**
7
+ * Get Battle Royale inventory (V-Bucks and currency)
8
+ * @param accountId - Epic Games account ID
9
+ * @param fortniteToken - Optional user Fortnite token
10
+ */
11
+ getBRInventory(accountId: string, fortniteToken?: string): Promise<BRInventory>;
12
+ /**
13
+ * Get storefront encryption keychain
14
+ */
15
+ getKeychain(): Promise<Keychain>;
16
+ /**
17
+ * Get purchase receipts for an account
18
+ * @param accountId - Epic Games account ID
19
+ * @param fortniteToken - Optional user Fortnite token
20
+ */
21
+ getReceipts(accountId: string, fortniteToken?: string): Promise<Receipt[]>;
22
+ /**
23
+ * Get currently enabled game features
24
+ */
25
+ getEnabledFeatures(): Promise<EnabledFeatures>;
26
+ /**
27
+ * Check game version
28
+ * @param platform - Platform name (Windows, Mac, etc.)
29
+ * @param version - Version string to check
30
+ */
31
+ checkVersion(platform: string, version: string): Promise<VersionCheck>;
32
+ /**
33
+ * Get privacy settings for an account (requires user token)
34
+ * @param accountId - Epic Games account ID
35
+ * @param fortniteToken - User Fortnite token (required)
36
+ */
37
+ getPrivacySettings(accountId: string, fortniteToken: string): Promise<PrivacySettings>;
38
+ /**
39
+ * Update privacy settings for an account (requires user token)
40
+ * @param accountId - Epic Games account ID
41
+ * @param settings - Privacy settings to update
42
+ * @param fortniteToken - User Fortnite token (required)
43
+ */
44
+ updatePrivacySettings(accountId: string, settings: Partial<PrivacySettings>, fortniteToken: string): Promise<PrivacySettings>;
45
+ /**
46
+ * Check Fortnite entitlement (requires user token)
47
+ * @param fortniteToken - User Fortnite token (required)
48
+ */
49
+ checkEntitlement(fortniteToken: string): Promise<EntitlementCheck>;
50
+ /**
51
+ * Request Fortnite entitlement access (requires user token)
52
+ * @param accountId - Epic Games account ID
53
+ * @param fortniteToken - User Fortnite token (required)
54
+ */
55
+ requestEntitlement(accountId: string, fortniteToken: string): Promise<void>;
56
+ }
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FNResource = void 0;
4
+ class FNResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Get Battle Royale inventory (V-Bucks and currency)
10
+ * @param accountId - Epic Games account ID
11
+ * @param fortniteToken - Optional user Fortnite token
12
+ */
13
+ async getBRInventory(accountId, fortniteToken) {
14
+ const headers = {};
15
+ if (fortniteToken) {
16
+ headers["x-fortnite-token"] = fortniteToken;
17
+ }
18
+ return this.client.request(`/fn/br-inventory/${accountId}`, { headers }, "v2");
19
+ }
20
+ /**
21
+ * Get storefront encryption keychain
22
+ */
23
+ async getKeychain() {
24
+ return this.client.request("/fn/keychain", {}, "v2");
25
+ }
26
+ /**
27
+ * Get purchase receipts for an account
28
+ * @param accountId - Epic Games account ID
29
+ * @param fortniteToken - Optional user Fortnite token
30
+ */
31
+ async getReceipts(accountId, fortniteToken) {
32
+ const headers = {};
33
+ if (fortniteToken) {
34
+ headers["x-fortnite-token"] = fortniteToken;
35
+ }
36
+ return this.client.request(`/fn/receipts/${accountId}`, { headers }, "v2");
37
+ }
38
+ /**
39
+ * Get currently enabled game features
40
+ */
41
+ async getEnabledFeatures() {
42
+ return this.client.request("/fn/enabled-features", {}, "v2");
43
+ }
44
+ /**
45
+ * Check game version
46
+ * @param platform - Platform name (Windows, Mac, etc.)
47
+ * @param version - Version string to check
48
+ */
49
+ async checkVersion(platform, version) {
50
+ return this.client.request(`/fn/version/${platform}?version=${encodeURIComponent(version)}`, {}, "v2");
51
+ }
52
+ /**
53
+ * Get privacy settings for an account (requires user token)
54
+ * @param accountId - Epic Games account ID
55
+ * @param fortniteToken - User Fortnite token (required)
56
+ */
57
+ async getPrivacySettings(accountId, fortniteToken) {
58
+ return this.client.request(`/fn/privacy/${accountId}`, {
59
+ headers: {
60
+ "x-fortnite-token": fortniteToken,
61
+ },
62
+ }, "v2");
63
+ }
64
+ /**
65
+ * Update privacy settings for an account (requires user token)
66
+ * @param accountId - Epic Games account ID
67
+ * @param settings - Privacy settings to update
68
+ * @param fortniteToken - User Fortnite token (required)
69
+ */
70
+ async updatePrivacySettings(accountId, settings, fortniteToken) {
71
+ return this.client.request(`/fn/privacy/${accountId}`, {
72
+ method: "POST",
73
+ headers: {
74
+ "x-fortnite-token": fortniteToken,
75
+ },
76
+ body: JSON.stringify(settings),
77
+ }, "v2");
78
+ }
79
+ /**
80
+ * Check Fortnite entitlement (requires user token)
81
+ * @param fortniteToken - User Fortnite token (required)
82
+ */
83
+ async checkEntitlement(fortniteToken) {
84
+ return this.client.request("/fn/entitlement", {
85
+ headers: {
86
+ "x-fortnite-token": fortniteToken,
87
+ },
88
+ }, "v2");
89
+ }
90
+ /**
91
+ * Request Fortnite entitlement access (requires user token)
92
+ * @param accountId - Epic Games account ID
93
+ * @param fortniteToken - User Fortnite token (required)
94
+ */
95
+ async requestEntitlement(accountId, fortniteToken) {
96
+ await this.client.request(`/fn/entitlement/${accountId}`, {
97
+ method: "POST",
98
+ headers: {
99
+ "x-fortnite-token": fortniteToken,
100
+ },
101
+ }, "v2");
102
+ }
103
+ }
104
+ exports.FNResource = FNResource;
@@ -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;