@yaelouuu/fortnite-api 3.1.0 → 4.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/dist/client.d.ts CHANGED
@@ -6,6 +6,7 @@ import { BundlesResource } from "./resources/bundles";
6
6
  import { OauthResource } from "./resources/oauth";
7
7
  import { ParsingResource } from "./resources/parsing";
8
8
  import { WeaponsResource } from "./resources/weapons";
9
+ import { BattlePassResource } from "./resources/battlepass";
9
10
  export interface ClientOptions {
10
11
  apiKey: string;
11
12
  baseUrl?: string;
@@ -21,13 +22,14 @@ export declare class FortniteAPI {
21
22
  oauth: OauthResource;
22
23
  parsing: ParsingResource;
23
24
  weapons: WeaponsResource;
25
+ batttlepass: BattlePassResource;
24
26
  constructor(options: ClientOptions);
25
27
  /**
26
28
  * Internal method to make HTTP requests
27
29
  */
28
- request<T>(endpoint: string, options?: RequestInit): Promise<T>;
30
+ request<T>(endpoint: string, options?: RequestInit, version?: "v1" | "v2" | "v3"): Promise<T>;
29
31
  /**
30
32
  * Internal method for multipart/form-data requests (file uploads)
31
33
  */
32
- requestMultipart<T>(endpoint: string, formData: FormData): Promise<T>;
34
+ requestMultipart<T>(endpoint: string, formData: FormData, version?: "v1" | "v2" | "v3"): Promise<T>;
33
35
  }
package/dist/client.js CHANGED
@@ -10,10 +10,11 @@ const bundles_1 = require("./resources/bundles");
10
10
  const oauth_1 = require("./resources/oauth");
11
11
  const parsing_1 = require("./resources/parsing");
12
12
  const weapons_1 = require("./resources/weapons");
13
+ const battlepass_1 = require("./resources/battlepass");
13
14
  class FortniteAPI {
14
15
  constructor(options) {
15
16
  this.apiKey = options.apiKey;
16
- this.baseUrl = options.baseUrl || "https://prod.api-fortnite.com/api/v1";
17
+ this.baseUrl = options.baseUrl || "https://prod.api-fortnite.com/api";
17
18
  // this.baseUrl = options.baseUrl || "http://localhost:4321/api/v1";
18
19
  // Initialize resources
19
20
  this.shop = new shop_1.ShopResource(this);
@@ -24,12 +25,13 @@ class FortniteAPI {
24
25
  this.oauth = new oauth_1.OauthResource(this);
25
26
  this.parsing = new parsing_1.ParsingResource(this);
26
27
  this.weapons = new weapons_1.WeaponsResource(this);
28
+ this.batttlepass = new battlepass_1.BattlePassResource(this);
27
29
  }
28
30
  /**
29
31
  * Internal method to make HTTP requests
30
32
  */
31
- async request(endpoint, options = {}) {
32
- const url = `${this.baseUrl}${endpoint}`;
33
+ async request(endpoint, options = {}, version = "v1") {
34
+ const url = `${this.baseUrl}/${version}${endpoint}`;
33
35
  const response = await fetch(url, {
34
36
  ...options,
35
37
  headers: {
@@ -54,8 +56,8 @@ class FortniteAPI {
54
56
  /**
55
57
  * Internal method for multipart/form-data requests (file uploads)
56
58
  */
57
- async requestMultipart(endpoint, formData) {
58
- const url = `${this.baseUrl}${endpoint}`;
59
+ async requestMultipart(endpoint, formData, version = "v1") {
60
+ const url = `${this.baseUrl}/${version}${endpoint}`;
59
61
  const response = await fetch(url, {
60
62
  method: "POST",
61
63
  headers: {
@@ -0,0 +1,10 @@
1
+ import { FortniteAPI } from "../client";
2
+ import { BattlePass } from "../types";
3
+ export declare class BattlePassResource {
4
+ private client;
5
+ constructor(client: FortniteAPI);
6
+ /**
7
+ * Get current battle pass items
8
+ */
9
+ getBattlePass(): Promise<BattlePass>;
10
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BattlePassResource = void 0;
4
+ class BattlePassResource {
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Get current battle pass items
10
+ */
11
+ async getBattlePass() {
12
+ return this.client.request("/battlepass");
13
+ }
14
+ }
15
+ exports.BattlePassResource = BattlePassResource;
@@ -9,7 +9,7 @@ class WeaponsResource {
9
9
  * Get weapons and infos
10
10
  */
11
11
  async getWeapons() {
12
- return this.client.request("/weapons");
12
+ return this.client.request("/weapons", {}, "v2");
13
13
  }
14
14
  }
15
15
  exports.WeaponsResource = WeaponsResource;
@@ -217,3 +217,75 @@ export interface WeaponsStats {
217
217
  overheatedCooldownDelay: number;
218
218
  maxDamagePerCartridge: number;
219
219
  }
220
+ export interface BattlePass {
221
+ battlePassContent: BattlePassContent;
222
+ battlePassOffers: Array<BattlePassOffers>;
223
+ }
224
+ export interface MessagesBP {
225
+ layout: string;
226
+ image: string;
227
+ hidden?: boolean;
228
+ _type: string;
229
+ title: string;
230
+ body: string;
231
+ spotlight: boolean;
232
+ }
233
+ export interface BattlePassContent {
234
+ news: {
235
+ _type: string;
236
+ messages: Array<MessagesBP>;
237
+ };
238
+ _title: string;
239
+ _noIndex: boolean;
240
+ _activeDate: string;
241
+ lastModified: string;
242
+ _locale: string;
243
+ _templateName: string;
244
+ _suggestedPrefetch: Array<any>;
245
+ }
246
+ export interface PricesBP {
247
+ currencyType: string;
248
+ currencySubType: string;
249
+ regularPrice: number;
250
+ dynamicRegularPrice: number;
251
+ finalPrice: number;
252
+ saleExpiration: string;
253
+ basePrice: number;
254
+ }
255
+ export interface RequirementsBP {
256
+ requirementType: string;
257
+ requiredId: string;
258
+ minQuantity: number;
259
+ }
260
+ export interface MetaInfoBP {
261
+ key: string;
262
+ value: string;
263
+ }
264
+ export interface BattlePassOffers {
265
+ offerId: string;
266
+ devName: string;
267
+ offerType: string;
268
+ prices: Array<PricesBP>;
269
+ categories: Array<any>;
270
+ dailyLimit: number;
271
+ weeklyLimit: number;
272
+ monthlyLimit: number;
273
+ refundable: boolean;
274
+ appStoreId: Array<string>;
275
+ requirements: Array<RequirementsBP>;
276
+ metaInfo: Array<MetaInfoBP>;
277
+ catalogGroup: string;
278
+ catalogGroupPriority: number;
279
+ sortPriority: number;
280
+ title: string;
281
+ shortDescription: string;
282
+ description: string;
283
+ displayAssetPath: string;
284
+ itemGrants: Array<any>;
285
+ sectionId: string | null;
286
+ sectionDisplayName: string | null;
287
+ sectionPriority: number | null;
288
+ sectionBackground: null | null;
289
+ offerVisual: string | null;
290
+ tileSize: string;
291
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaelouuu/fortnite-api",
3
- "version": "3.1.0",
3
+ "version": "4.0.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",