@yaelouuu/fortnite-api 1.3.1 → 3.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FortniteAPI } from "../client";
|
|
2
|
-
import { TournamentsBundle,
|
|
2
|
+
import { TournamentsBundle, Shop } from "../types";
|
|
3
3
|
export declare class BundlesResource {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: FortniteAPI);
|
|
@@ -10,5 +10,5 @@ export declare class BundlesResource {
|
|
|
10
10
|
/**
|
|
11
11
|
* Get current season information
|
|
12
12
|
*/
|
|
13
|
-
getBundlesShop(): Promise<
|
|
13
|
+
getBundlesShop(): Promise<Shop>;
|
|
14
14
|
}
|
|
@@ -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(
|
|
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(
|
|
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
|
-
|
|
47
|
+
accountId?: string;
|
|
48
|
+
}, fortniteToken?: string): Promise<Leaderboard>;
|
|
31
49
|
/**
|
|
32
50
|
* Get tournament participation history for a player
|
|
33
|
-
*
|
|
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
|
-
*
|
|
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(
|
|
12
|
-
|
|
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(
|
|
21
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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/dist/types/index.d.ts
CHANGED
|
@@ -1,12 +1,64 @@
|
|
|
1
1
|
export interface Shop {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
refreshIntervalHrs: number;
|
|
3
|
+
dailyPurchaseHrs: number;
|
|
4
|
+
expiration: string;
|
|
5
|
+
storefronts: Storefront[];
|
|
4
6
|
}
|
|
5
|
-
export interface
|
|
6
|
-
id: string;
|
|
7
|
+
export interface Storefront {
|
|
7
8
|
name: string;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
catalogEntries: CatalogEntry[];
|
|
10
|
+
}
|
|
11
|
+
export interface CatalogEntry {
|
|
12
|
+
offerId: string;
|
|
13
|
+
devName: string;
|
|
14
|
+
offerType: string;
|
|
15
|
+
prices: Price[];
|
|
16
|
+
categories: string[];
|
|
17
|
+
dailyLimit: number;
|
|
18
|
+
weeklyLimit: number;
|
|
19
|
+
monthlyLimit: number;
|
|
20
|
+
refundable: boolean;
|
|
21
|
+
appStoreId: string[];
|
|
22
|
+
requirements: Requirement[];
|
|
23
|
+
metaInfo: MetaInfo[];
|
|
24
|
+
catalogGroup: string;
|
|
25
|
+
catalogGroupPriority: number;
|
|
26
|
+
sortPriority: number;
|
|
27
|
+
title: string;
|
|
28
|
+
shortDescription: string;
|
|
29
|
+
description: string;
|
|
30
|
+
displayAssetPath: string;
|
|
31
|
+
itemGrants: ItemGrant[];
|
|
32
|
+
giftInfo?: GiftInfo;
|
|
33
|
+
}
|
|
34
|
+
export interface Price {
|
|
35
|
+
currencyType: string;
|
|
36
|
+
currencySubType: string;
|
|
37
|
+
regularPrice: number;
|
|
38
|
+
dynamicRegularPrice: number;
|
|
39
|
+
finalPrice: number;
|
|
40
|
+
saleExpiration: string;
|
|
41
|
+
basePrice: number;
|
|
42
|
+
saleType?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface Requirement {
|
|
45
|
+
requirementType: string;
|
|
46
|
+
requiredId: string;
|
|
47
|
+
minQuantity: number;
|
|
48
|
+
}
|
|
49
|
+
export interface MetaInfo {
|
|
50
|
+
key: string;
|
|
51
|
+
value: string;
|
|
52
|
+
}
|
|
53
|
+
export interface ItemGrant {
|
|
54
|
+
templateId: string;
|
|
55
|
+
quantity: number;
|
|
56
|
+
attributes: Record<string, any>;
|
|
57
|
+
}
|
|
58
|
+
export interface GiftInfo {
|
|
59
|
+
bIsEnabled: boolean;
|
|
60
|
+
forcedGiftBoxTemplateId: string;
|
|
61
|
+
purchaseRequirements: any[];
|
|
10
62
|
}
|
|
11
63
|
export interface TournamentsBundle {
|
|
12
64
|
}
|