├── .editorconfig
├── .eslintrc.js
├── .gitattributes
├── .github
├── dependabot.yml
└── workflows
│ ├── ci.yml
│ ├── formatter.js
│ └── web.yml
├── .gitignore
├── LICENSE
├── README.md
├── fetchEndpointStructs.js
├── index.ts
├── jest.config.js
├── package-lock.json
├── package.json
├── resources
├── enums.ts
└── structs.ts
├── src
├── client
│ └── Client.ts
├── exceptions
│ ├── FortniteAPIError.ts
│ ├── InvalidAPIKeyError.ts
│ └── MissingAPIKeyError.ts
├── http
│ ├── HTTP.ts
│ ├── autogeneratedEndpointStructs.ts
│ └── httpStructs.ts
└── util
│ └── util.ts
├── tests
└── client.test.js
├── tsconfig.json
└── webpack.config.js
/.editorconfig:
--------------------------------------------------------------------------------
1 | ; Top-most .editorcofing file
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | end_of_line = lf
7 | indent_size = 2
8 | quote_type = single
9 | indent_style = space
10 | insert_final_newline = true
11 | trim_trailing_whitespace = true
12 |
13 | [*.{yml,yaml}]
14 | indent_size = 2
15 |
16 | [*.md]
17 | trim_trailing_whitespace = false
18 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | es2021: true,
4 | node: true,
5 | },
6 | extends: [
7 | 'airbnb-base',
8 | ],
9 | parser: '@typescript-eslint/parser',
10 | parserOptions: {
11 | ecmaVersion: 'latest',
12 | sourceType: 'module',
13 | },
14 | plugins: [
15 | '@typescript-eslint',
16 | ],
17 | rules: {
18 | 'import/extensions': 'off',
19 | 'lines-between-class-members': [
20 | 'error',
21 | 'always',
22 | { exceptAfterSingleLine: true },
23 | ],
24 | 'default-case': 'off',
25 | 'max-len': 'off',
26 | },
27 | settings: {
28 | 'import/resolver': {
29 | node: {
30 | extensions: ['.js', '.jsx', '.ts', '.tsx'],
31 | },
32 | },
33 | },
34 | };
35 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text eol=lf
2 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "npm"
4 | allow:
5 | - dependency-type: "production"
6 | directory: "/"
7 | commit-message:
8 | prefix: "⬆️ "
9 | include: "scope"
10 | schedule:
11 | interval: "daily"
12 | time: "07:00"
13 | timezone: "Europe/Berlin"
14 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: "CI"
2 | on: ["push", "pull_request"]
3 | jobs:
4 | Test:
5 | name: "Test Code (Node ${{ matrix.node }})"
6 | runs-on: "ubuntu-latest"
7 |
8 | strategy:
9 | matrix:
10 | node: ["18", "22"]
11 | fail-fast: false
12 |
13 | steps:
14 | - name: "Checkout Repository"
15 | uses: "actions/checkout@v2"
16 |
17 | - name: "Set Up NodeJS"
18 | uses: "actions/setup-node@v2"
19 | with:
20 | node-version: ${{ matrix.node }}
21 |
22 | - name: "Install Dependencies"
23 | run: "npm ci"
24 |
25 | - name: "Lint Code"
26 | if: ${{ matrix.node == '18' }}
27 | run: "npx eslint -f .github/workflows/formatter.js src/**/*.ts || :"
28 |
29 | - name: "Compile Code"
30 | run: "npx tsc"
31 |
32 | - name: "Run Tests"
33 | run: "npm run test"
34 |
--------------------------------------------------------------------------------
/.github/workflows/formatter.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 |
3 | /**
4 | * Takes ESLint output and makes it GitHub-friendly
5 | * i.e. errors & warnings show up in GUIs
6 | */
7 | module.exports = (results) => {
8 | for (const result of results) {
9 | for (const data of result.messages) {
10 | // Different parameters GitHub can show
11 | const severity = data.severity === 1 ? 'warning' : 'error';
12 | const file = path.relative(process.cwd(), result.filePath);
13 | const { line, column, message } = data;
14 |
15 | console.log(`::${severity} file=${file},line=${line},col=${column}::${message}`);
16 | }
17 | }
18 | };
19 |
--------------------------------------------------------------------------------
/.github/workflows/web.yml:
--------------------------------------------------------------------------------
1 | name: "WEB"
2 | on:
3 | push:
4 | branches:
5 | - 'master'
6 | jobs:
7 | docgen:
8 | name: Web
9 | runs-on: ubuntu-latest
10 | steps:
11 | - name: Setup git
12 | run: |
13 | git config --global user.name "FNAPIcomBot"
14 | git config --global user.email 110248282+FNAPIcomBot@users.noreply.github.com
15 |
16 | - name: Set Up NodeJS
17 | uses: actions/setup-node@v2
18 | with:
19 | node-version: 22
20 |
21 | - name: Checkout Master Branch
22 | uses: actions/checkout@v2
23 | with:
24 | path: master
25 |
26 | - name: Checkout Web Branch
27 | uses: actions/checkout@v2
28 | with:
29 | path: web
30 | ref: web
31 |
32 | - name: Install Master Branch Dependencies
33 | working-directory: ./master
34 | run: npm ci
35 |
36 | - name: Build Web Version
37 | working-directory: ./master
38 | run: npm run buildWeb
39 |
40 | - uses: actions-ecosystem/action-regex-match@v2
41 | id: current_branch
42 | with:
43 | text: ${{ github.ref }}
44 | regex: '(?<=\/)(\w|\d|\.)+$'
45 |
46 | - name: Commit And Push Web Version
47 | working-directory: ./web
48 | shell: bash
49 | env:
50 | CURRENT_BRANCH: ${{ steps.current_branch.outputs.match }}
51 | run: |
52 | git pull
53 | mv ../master/FNAPIcom.js ./FNAPIcom.js
54 | git add . -A
55 | git diff-index --quiet HEAD || git commit -m "Built for ${CURRENT_BRANCH}: ${GITHUB_SHA}"
56 | git push https://FNAPIcomBot:${{ secrets.BOT_PAT }}@github.com/Fortnite-API/nodejs-wrapper web
57 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependencies
2 | node_modules/
3 |
4 | # TypeScript cache
5 | *.tsbuildinfo
6 |
7 | # Build artifacts
8 | dist/
9 | FNAPIcom.js
10 |
11 | # Code editors
12 | .vscode/
13 | .nova/
14 | .idea/
15 |
16 | # Testing scripts
17 | test.js
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Nils S.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [](https://github.com/Fortnite-API/nodejs-wrapper/actions/workflows/ci.yml)
4 | [](https://npmjs.com/package/fnapicom)
5 | [](https://npmjs.com/package/fnapicom)
6 | [](https://github.com/Fortnite-API/nodejs-wrapper/blob/master/LICENSE)
7 | [](https://discord.gg/hGzW8gSMCa)
8 |
9 | A JavaScript / TypeScript wrapper for [Fortnite-API.com](https://fortnite-api.com/)
10 |
11 | Note: This is the NodeJS version. You can find the browser version [here](https://github.com/Fortnite-API/nodejs-wrapper/tree/web)
12 |
13 |
14 |
15 |
16 | Installation
17 |
18 | ```
19 | npm install fnapicom
20 | ```
21 |
22 | Usage example
23 |
24 | ```javascript
25 | const { Client, Language } = require('fnapicom');
26 |
27 | const client = new Client({
28 | language: Language.English,
29 | apiKey: 'your-api-key',
30 | });
31 |
32 | client.aesKeys()
33 | .then(console.log);
34 | ```
35 |
36 | Links
37 |
38 | - [NPM](https://npmjs.com/package/fnapicom)
39 | - [Docs](https://dash.fortnite-api.com/)
40 | - [Discord](https://discord.gg/hGzW8gSMCa)
41 |
42 | License
43 | MIT License
44 |
45 | Copyright (c) 2022 Nils S.
46 |
47 | Permission is hereby granted, free of charge, to any person obtaining a copy
48 | of this software and associated documentation files (the "Software"), to deal
49 | in the Software without restriction, including without limitation the rights
50 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
51 | copies of the Software, and to permit persons to whom the Software is
52 | furnished to do so, subject to the following conditions:
53 |
54 | The above copyright notice and this permission notice shall be included in all
55 | copies or substantial portions of the Software.
56 |
57 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
61 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
62 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
63 | SOFTWARE.
64 |
--------------------------------------------------------------------------------
/fetchEndpointStructs.js:
--------------------------------------------------------------------------------
1 | const axios = require('axios').default;
2 | const fs = require('fs').promises;
3 | const { version } = require('./package.json');
4 |
5 | (async () => {
6 | const endpointStructs = await axios({
7 | method: 'GET',
8 | url: 'https://cdn.thisnils.de/fnapicom/autogeneratedEndpointStructs.ts',
9 | headers: {
10 | 'User-Agent': `fnapicom/${version}`,
11 | },
12 | });
13 |
14 | await fs.writeFile('./src/http/autogeneratedEndpointStructs.ts', endpointStructs.data);
15 | })();
16 |
--------------------------------------------------------------------------------
/index.ts:
--------------------------------------------------------------------------------
1 | // client
2 | export { default as Client } from './src/client/Client';
3 |
4 | // exceptions
5 | export { default as InvalidAPIKeyError } from './src/exceptions/InvalidAPIKeyError';
6 | export { default as MissingAPIKeyError } from './src/exceptions/MissingAPIKeyError';
7 | export { default as FortniteAPIError } from './src/exceptions/FortniteAPIError';
8 |
9 | // structs
10 | export * from './resources/structs';
11 | export * from './src/http/httpStructs';
12 | export * from './src/http/autogeneratedEndpointStructs';
13 |
14 | // enums
15 | export * from './resources/enums';
16 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | const config = {
2 | modulePathIgnorePatterns: ['/dist'],
3 | };
4 |
5 | module.exports = config;
6 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fnapicom",
3 | "version": "2.1.0",
4 | "description": "JavaScript / TypeScript wrapper for Fortnite-API.com",
5 | "main": "dist/index.js",
6 | "types": "dist/index.d.ts",
7 | "scripts": {
8 | "build": "npx tsc",
9 | "lint": "eslint src/**/*.ts",
10 | "prepare": "npm run build",
11 | "test": "jest --no-cache ./tests/",
12 | "fetchEndpoints": "node ./fetchEndpointStructs.js",
13 | "refreshEndpoints": "npm run fetchEndpoints && npm run build",
14 | "buildWeb": "webpack"
15 | },
16 | "files": [
17 | "dist/**/*"
18 | ],
19 | "repository": {
20 | "type": "git",
21 | "url": "git+https://github.com/Fortnite-API/nodejs-wrapper.git"
22 | },
23 | "keywords": [
24 | "fortnite",
25 | "javascript",
26 | "typescript",
27 | "nodejs",
28 | "fortnite-api.com"
29 | ],
30 | "author": "ThisNils",
31 | "license": "MIT",
32 | "bugs": {
33 | "url": "https://github.com/Fortnite-API/nodejs-wrapper/issues"
34 | },
35 | "homepage": "https://fortnite-api.com",
36 | "devDependencies": {
37 | "@types/jest": "^28.1.6",
38 | "@typescript-eslint/eslint-plugin": "^5.31.0",
39 | "@typescript-eslint/parser": "^5.31.0",
40 | "eslint": "^8.20.0",
41 | "eslint-config-airbnb-base": "^15.0.0",
42 | "eslint-plugin-import": "^2.26.0",
43 | "jest": "^28.1.3",
44 | "ts-loader": "^9.3.1",
45 | "typescript": "^4.7.4",
46 | "webpack": "^5.74.0",
47 | "webpack-cli": "^4.10.0"
48 | },
49 | "dependencies": {
50 | "axios": "^1.7.9",
51 | "axios-rate-limit": "^1.4.0",
52 | "tslib": "^2.8.1"
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/resources/enums.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-bitwise */
2 | /* eslint-disable no-unused-vars, import/prefer-default-export, no-shadow */
3 | export enum Language {
4 | Arabic = 'ar',
5 | German = 'de',
6 | English = 'en',
7 | Spanish = 'es',
8 | Spanish419 = 'es-419',
9 | French = 'fr',
10 | Italian = 'it',
11 | Japanese = 'ja',
12 | Korean = 'ko',
13 | Polish = 'pl',
14 | BrazilianPortuguese = 'pt-BR',
15 | Russian = 'ru',
16 | Turkish = 'tr',
17 | Chinese = 'zh-CN',
18 | MandarinChinese = 'zh-Hant'
19 | }
20 |
21 | export enum ResponseFlags {
22 | None = 0,
23 | IncludePaths = 1 << 0,
24 | IncludeGameplayTags = 1 << 1,
25 | IncludeShopHistory = 1 << 2,
26 | }
27 |
--------------------------------------------------------------------------------
/resources/structs.ts:
--------------------------------------------------------------------------------
1 | import { Language } from './enums';
2 |
3 | export type RequestQueryParams = Record;
4 |
5 | export interface ClientConfig {
6 | /**
7 | * Your Fortnite-API.com API key. An API key is required to fetch battle royale stats
8 | *
9 | * Can be obtained at https://dash.fortnite-api.com/account
10 | */
11 | apiKey?: string;
12 |
13 | /**
14 | * The default language for all endpoints. Defaults to `en`
15 | */
16 | language: Language;
17 |
18 | /**
19 | * Extra timeout for stats ratelimits. Defaults to `0`.
20 | *
21 | * Normally the client will send 3 stats requests per 1100 milliseconds.
22 | * Setting this option to `100` increases the rate to 3 per 1200 milliseconds.
23 | *
24 | * You should increase this option if you're getting 429 responses
25 | */
26 | rateLimitExtraTimeout: number;
27 | }
28 |
29 | export interface ClientOptions extends Partial {}
30 |
--------------------------------------------------------------------------------
/src/client/Client.ts:
--------------------------------------------------------------------------------
1 | import HTTP from '../http/HTTP';
2 | import { Language } from '../../resources/enums';
3 | import { ClientConfig, ClientOptions } from '../../resources/structs';
4 | import {
5 | AESKeysRequestParams, AESKeysResponseData, AllCosmeticsRequestParams, AllCosmeticsResponseData,
6 | BannerColorsRequestParams, BannerColorsResponseData, BannersRequestParams, BannersResponseData,
7 | BeanCosmeticsListRequestParams, BeanCosmeticsListResponseData, BRCosmeticByIDRequestParams,
8 | BRCosmeticByIDResponseData, BRCosmeticSearchRequestParams, BRCosmeticSearchResponseData,
9 | BRCosmeticsListRequestParams, BRCosmeticsListResponseData, BRCosmeticsSearchByIDsRequestParams,
10 | BRCosmeticsSearchByIDsResponseData, BRCosmeticsSearchRequestParams, BRCosmeticsSearchResponseData,
11 | BRMapRequestParams, BRMapResponseData, BRNewsRequestParams, BRNewsResponseData,
12 | BRStatsByAccountIDRequestParams, BRStatsByAccountIDResponseData, BRStatsRequestParams,
13 | BRStatsResponseData, CarCosmeticsListRequestParams, CarCosmeticsListResponseData,
14 | CreativeNewsRequestParams, CreativeNewsResponseData, CreatorCodeRequestParams,
15 | CreatorCodeResponseData, InstrumentCosmeticsListRequestParams, InstrumentCosmeticsListResponseData,
16 | LegoCosmeticsListRequestParams, LegoCosmeticsListResponseData, LegoKitCosmeticsListRequestParams,
17 | LegoKitCosmeticsListResponseData, NewCosmeticsRequestParams, NewCosmeticsResponseData,
18 | NewsRequestParams, NewsResponseData, PlaylistByIDRequestParams, PlaylistByIDResponseData,
19 | PlaylistsRequestParams, PlaylistsResponseData, ShopRequestParams, ShopResponseData,
20 | STWNewsRequestParams, STWNewsResponseData, TrackCosmeticsListRequestParams,
21 | TrackCosmeticsListResponseData,
22 | } from '../http/autogeneratedEndpointStructs';
23 |
24 | class Client {
25 | public http: HTTP;
26 | public config: ClientConfig;
27 | constructor(config?: ClientOptions) {
28 | this.config = {
29 | language: Language.English,
30 | rateLimitExtraTimeout: 0,
31 | ...config,
32 | };
33 |
34 | this.http = new HTTP(this);
35 | }
36 |
37 | /**
38 | * Returns the current aes key
39 | * @param options Options for this endpoint
40 | */
41 | public async aesKeys(options?: AESKeysRequestParams): Promise {
42 | return this.http.fetch('/v2/aes', options);
43 | }
44 |
45 | /**
46 | * Returns an array of all banners
47 | * @param options Options for this endpoint
48 | */
49 | public async banners(options?: BannersRequestParams): Promise {
50 | return this.http.fetch('/v1/banners', options);
51 | }
52 |
53 | /**
54 | * Returns an array of all banner colors
55 | * @param options Options for this endpoint
56 | */
57 | public async bannerColors(options?: BannerColorsRequestParams): Promise {
58 | return this.http.fetch('/v1/banners/colors', options);
59 | }
60 |
61 | /**
62 | * Returns data of all cosmetics
63 | * @param options Options for this endpoint
64 | */
65 | public async allCosmetics(options?: AllCosmeticsRequestParams): Promise {
66 | return this.http.fetch('/v2/cosmetics', options);
67 | }
68 |
69 | /**
70 | * Returns data of the latest added cosmetics
71 | * @param options Options for this endpoint
72 | */
73 | public async newCosmetics(options?: NewCosmeticsRequestParams): Promise {
74 | return this.http.fetch('/v2/cosmetics/new', options);
75 | }
76 |
77 | /**
78 | * Returns data of all battle royale cosmetics
79 | * @param options Options for this endpoint
80 | */
81 | public async brCosmeticsList(options?: BRCosmeticsListRequestParams): Promise {
82 | return this.http.fetch('/v2/cosmetics/br', options);
83 | }
84 |
85 | /**
86 | * Returns data of all track cosmetics
87 | * @param options Options for this endpoint
88 | */
89 | public async trackCosmeticsList(options?: TrackCosmeticsListRequestParams): Promise {
90 | return this.http.fetch('/v2/cosmetics/tracks', options);
91 | }
92 |
93 | /**
94 | * Returns data of all instrument cosmetics
95 | * @param options Options for this endpoint
96 | */
97 | public async instrumentCosmeticsList(options?: InstrumentCosmeticsListRequestParams): Promise {
98 | return this.http.fetch('/v2/cosmetics/instruments', options);
99 | }
100 |
101 | /**
102 | * Returns data of all car cosmetics
103 | * @param options Options for this endpoint
104 | */
105 | public async carCosmeticsList(options?: CarCosmeticsListRequestParams): Promise {
106 | return this.http.fetch('/v2/cosmetics/cars', options);
107 | }
108 |
109 | /**
110 | * Returns data of all lego cosmetics
111 | * @param options Options for this endpoint
112 | */
113 | public async legoCosmeticsList(options?: LegoCosmeticsListRequestParams): Promise {
114 | return this.http.fetch('/v2/cosmetics/lego', options);
115 | }
116 |
117 | /**
118 | * Returns data of all lego kit cosmetics
119 | * @param options Options for this endpoint
120 | */
121 | public async legoKitCosmeticsList(options?: LegoKitCosmeticsListRequestParams): Promise {
122 | return this.http.fetch('/v2/cosmetics/lego/kits', options);
123 | }
124 |
125 | /**
126 | * Returns data of all bean aka fall guys cosmetics
127 | * @param options Options for this endpoint
128 | */
129 | public async beanCosmeticsList(options?: BeanCosmeticsListRequestParams): Promise {
130 | return this.http.fetch('/v2/cosmetics/beans', options);
131 | }
132 |
133 | /**
134 | * Returns data of the requested battle royale cosmetic-id
135 | * @param options Options for this endpoint
136 | */
137 | public async brCosmeticByID(cosmeticId: string, options?: BRCosmeticByIDRequestParams): Promise {
138 | return this.http.fetch(`/v2/cosmetics/br/${cosmeticId}`, options);
139 | }
140 |
141 | /**
142 | * Returns data of the first battle royale cosmetic which matches the search parameter(s)
143 | * @param options Options for this endpoint
144 | */
145 | public async brCosmeticSearch(options?: BRCosmeticSearchRequestParams): Promise {
146 | return this.http.fetch('/v2/cosmetics/br/search', options);
147 | }
148 |
149 | /**
150 | * Returns an array of all battle royale cosmetics which match the search parameter(s)
151 | * @param options Options for this endpoint
152 | */
153 | public async brCosmeticsSearch(options?: BRCosmeticsSearchRequestParams): Promise {
154 | return this.http.fetch('/v2/cosmetics/br/search/all', options);
155 | }
156 |
157 | /**
158 | * Returns an array of the requested battle royale cosmetic ids
159 | * @param options Options for this endpoint
160 | */
161 | public async brCosmeticsSearchByIDs(options?: BRCosmeticsSearchByIDsRequestParams): Promise {
162 | return this.http.fetch('/v2/cosmetics/br/search/ids', options);
163 | }
164 |
165 | /**
166 | * Returns data of a creator code by its name
167 | * @param options Options for this endpoint
168 | */
169 | public async creatorCode(options?: CreatorCodeRequestParams): Promise {
170 | return this.http.fetch('/v2/creatorcode', options);
171 | }
172 |
173 | /**
174 | * Returns data & images of the BR map & POIs
175 | * @param options Options for this endpoint
176 | */
177 | public async brMap(options?: BRMapRequestParams): Promise {
178 | return this.http.fetch('/v1/map', options);
179 | }
180 |
181 | /**
182 | * Returns data of the current battle royale, save the world & creative news
183 | * @param options Options for this endpoint
184 | */
185 | public async news(options?: NewsRequestParams): Promise {
186 | return this.http.fetch('/v2/news', options);
187 | }
188 |
189 | /**
190 | * Returns data of the current battle royale news
191 | * @param options Options for this endpoint
192 | */
193 | public async brNews(options?: BRNewsRequestParams): Promise {
194 | return this.http.fetch('/v2/news/br', options);
195 | }
196 |
197 | /**
198 | * Returns data of the current save the world news
199 | * @param options Options for this endpoint
200 | */
201 | public async stwNews(options?: STWNewsRequestParams): Promise {
202 | return this.http.fetch('/v2/news/stw', options);
203 | }
204 |
205 | /**
206 | * Returns data of the current creative news
207 | * @param options Options for this endpoint
208 | */
209 | public async creativeNews(options?: CreativeNewsRequestParams): Promise {
210 | return this.http.fetch('/v2/news/creative', options);
211 | }
212 |
213 | /**
214 | * Returns an array of all playlists
215 | * @param options Options for this endpoint
216 | */
217 | public async playlists(options?: PlaylistsRequestParams): Promise {
218 | return this.http.fetch('/v1/playlists', options);
219 | }
220 |
221 | /**
222 | * Returns data of the requested playlist-id
223 | * @param options Options for this endpoint
224 | */
225 | public async playlistByID(playlistId: string, options?: PlaylistByIDRequestParams): Promise {
226 | return this.http.fetch(`/v1/playlists/${playlistId}`, options);
227 | }
228 |
229 | /**
230 | * Returns data of the current shop
231 | * @param options Options for this endpoint
232 | */
233 | public async shop(options?: ShopRequestParams): Promise {
234 | return this.http.fetch('/v2/shop', options);
235 | }
236 |
237 | /**
238 | * Returns stats of the requested player account
239 | * Note: trios stats will always be null
240 | * @param options Options for this endpoint
241 | */
242 | public async brStats(options?: BRStatsRequestParams): Promise {
243 | return this.http.fetchStats('/v2/stats/br/v2', options);
244 | }
245 |
246 | /**
247 | * Returns stats of the requested player account
248 | * Note: trios stats will always be null
249 | * @param options Options for this endpoint
250 | */
251 | public async brStatsByAccountID(accountId: string, options?: BRStatsByAccountIDRequestParams): Promise {
252 | return this.http.fetchStats(`/v2/stats/br/v2/${accountId}`, options);
253 | }
254 | }
255 |
256 | export default Client;
257 |
--------------------------------------------------------------------------------
/src/exceptions/FortniteAPIError.ts:
--------------------------------------------------------------------------------
1 | import { AxiosRequestConfig } from 'axios';
2 | import { FortniteAPIErrorData } from '../http/httpStructs';
3 |
4 | /**
5 | * Represets a Fortnite-API HTTP error
6 | */
7 | class FortniteAPIError extends Error {
8 | /**
9 | * The HTTP method
10 | */
11 | public method: string;
12 |
13 | /**
14 | * The URL of the requested API endpoint
15 | */
16 | public url: string;
17 |
18 | /**
19 | * The HTTP status code
20 | */
21 | public httpStatus: number;
22 |
23 | /**
24 | * The request url query params sent by the client
25 | */
26 | public requestParams?: any;
27 |
28 | /**
29 | * @param error The raw Fortnite-API error data
30 | * @param request The client's request
31 | * @param status The response's HTTP status
32 | */
33 | constructor(error: FortniteAPIErrorData, request: AxiosRequestConfig, status: number) {
34 | super();
35 | this.name = 'FortniteAPIError';
36 | this.message = error.error;
37 |
38 | this.method = request.method!.toUpperCase();
39 | this.url = request.url!;
40 | this.httpStatus = status;
41 | this.requestParams = request.params;
42 | }
43 | }
44 |
45 | export default FortniteAPIError;
46 |
--------------------------------------------------------------------------------
/src/exceptions/InvalidAPIKeyError.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Represets an error thrown because an endpoint that requires an API key was called with an invalid one
3 | */
4 | class InvalidAPIKeyError extends Error {
5 | /**
6 | * The url of the requested API endpoint
7 | */
8 | public url: string;
9 |
10 | /**
11 | * @param url The url of the requested API endpoint
12 | */
13 | constructor(url: string) {
14 | super();
15 | this.name = 'InvalidAPIKeyError';
16 | this.message = `The endpoint "${url}" might require an API key. The API key provided is invalid`;
17 |
18 | this.url = url;
19 | }
20 | }
21 |
22 | export default InvalidAPIKeyError;
23 |
--------------------------------------------------------------------------------
/src/exceptions/MissingAPIKeyError.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Represets an error thrown because an endpoint that requires an API key was called without one
3 | */
4 | class MissingAPIKeyError extends Error {
5 | /**
6 | * The url of the requested API endpoint
7 | */
8 | public url: string;
9 |
10 | /**
11 | * @param url The url of the requested API endpoint
12 | */
13 | constructor(url: string) {
14 | super();
15 | this.name = 'MissingAPIKeyError';
16 | this.message = `The endpoint "${url}" requires an API key. Please provide one in the client config`;
17 |
18 | this.url = url;
19 | }
20 | }
21 |
22 | export default MissingAPIKeyError;
23 |
--------------------------------------------------------------------------------
/src/http/HTTP.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-restricted-syntax */
2 | import axios, { AxiosError, AxiosInstance, AxiosRequestConfig } from 'axios';
3 | import rateLimit, { RateLimitedAxiosInstance } from 'axios-rate-limit';
4 | import { version } from '../../package.json';
5 | import Client from '../client/Client';
6 | import FortniteAPIError from '../exceptions/FortniteAPIError';
7 | import InvalidAPIKeyError from '../exceptions/InvalidAPIKeyError';
8 | import MissingAPIKeyError from '../exceptions/MissingAPIKeyError';
9 | import { serializeParams } from '../util/util';
10 | import { FortniteAPIResponseData } from './httpStructs';
11 |
12 | class HTTP {
13 | public client: Client;
14 | public axios: AxiosInstance;
15 | public statsAxios: RateLimitedAxiosInstance;
16 | constructor(client: Client) {
17 | this.client = client;
18 |
19 | this.axios = axios.create({
20 | method: 'GET',
21 | baseURL: 'https://fortnite-api.com',
22 | headers: {
23 | ...process.env.IS_BROWSER !== 'true' ? {
24 | 'User-Agent': `fnapicom/${version}`,
25 | } : {},
26 | ...typeof this.client.config.apiKey === 'string' ? {
27 | Authorization: this.client.config.apiKey,
28 | } : {},
29 | },
30 | });
31 |
32 | this.statsAxios = rateLimit(this.axios, {
33 | maxRequests: 3,
34 | perMilliseconds: 1100 + this.client.config.rateLimitExtraTimeout,
35 | });
36 | }
37 |
38 | private async fetchWithInstance(instance: AxiosInstance, url: string, params?: any): Promise {
39 | const config: AxiosRequestConfig = {
40 | url,
41 | params,
42 | paramsSerializer: serializeParams,
43 | };
44 |
45 | try {
46 | const response = await this.axios(config);
47 |
48 | return response.data;
49 | } catch (e) {
50 | if (e instanceof AxiosError && e.response?.data?.error) {
51 | if (e.response.status === 401) {
52 | if (this.client.config.apiKey) {
53 | throw new InvalidAPIKeyError(url);
54 | } else {
55 | throw new MissingAPIKeyError(url);
56 | }
57 | }
58 |
59 | throw new FortniteAPIError(e.response.data, config, e.response.status);
60 | }
61 |
62 | throw e;
63 | }
64 | }
65 |
66 | public async fetch(url: string, params?: any): Promise {
67 | return this.fetchWithInstance(this.axios, url, params);
68 | }
69 |
70 | public async fetchStats(url: string, params?: any): Promise {
71 | return this.fetchWithInstance(this.statsAxios, url, params);
72 | }
73 | }
74 |
75 | export default HTTP;
76 |
--------------------------------------------------------------------------------
/src/http/autogeneratedEndpointStructs.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-unused-vars, no-shadow */
2 | import { FortniteAPIResponseData, FortniteAPIRequestParams } from './httpStructs';
3 |
4 | // Auto-generated at 2025-02-08T18:31:38.942Z
5 |
6 | /* -----------------------------------------------------
7 | AES Keys
8 | GET https://fortnite-api.com/v2/aes
9 | ----------------------------------------------------- */
10 |
11 | export interface AESKeysResponseData extends FortniteAPIResponseData {
12 | data: {
13 | build: string;
14 | mainKey: string;
15 | dynamicKeys: {
16 | pakFilename: string;
17 | pakGuid: string;
18 | key: string;
19 | }[];
20 | updated: string;
21 | };
22 | }
23 |
24 | export interface AESKeysRequestParams extends FortniteAPIRequestParams {
25 | /**
26 | * Sets the aes key format. Defaults to `hex`
27 | */
28 | keyFormat?: 'hex' | 'base64';
29 | }
30 |
31 | /* -----------------------------------------------------
32 | Banners
33 | GET https://fortnite-api.com/v1/banners
34 | ----------------------------------------------------- */
35 |
36 | export interface BannersResponseData extends FortniteAPIResponseData {
37 | data: {
38 | id: string;
39 | devName: string;
40 | name: string;
41 | description: string;
42 | category: string;
43 | fullUsageRights: boolean;
44 | images: {
45 | smallIcon: string;
46 | icon: string;
47 | };
48 | }[];
49 | }
50 |
51 | export interface BannersRequestParams extends FortniteAPIRequestParams {
52 | /**
53 | * Sets the output language. Defaults to `en`
54 | */
55 | language?: string;
56 | }
57 |
58 | /* -----------------------------------------------------
59 | Banner Colors
60 | GET https://fortnite-api.com/v1/banners/colors
61 | ----------------------------------------------------- */
62 |
63 | export interface BannerColorsResponseData extends FortniteAPIResponseData {
64 | data: {
65 | id: string;
66 | color: string;
67 | category: string;
68 | subCategoryGroup: number;
69 | }[];
70 | }
71 |
72 | export interface BannerColorsRequestParams extends FortniteAPIRequestParams {}
73 |
74 | /* -----------------------------------------------------
75 | All Cosmetics
76 | GET https://fortnite-api.com/v2/cosmetics
77 | ----------------------------------------------------- */
78 |
79 | export interface AllCosmeticsResponseData extends FortniteAPIResponseData {
80 | data: {
81 | br: {
82 | id: string;
83 | name: string;
84 | description: string;
85 | exclusiveDescription: string;
86 | unlockRequirements: string;
87 | customExclusiveCallout: string;
88 | type: {
89 | value: string;
90 | displayValue: string;
91 | backendValue: string;
92 | };
93 | rarity: {
94 | value: string;
95 | displayValue: string;
96 | backendValue: string;
97 | };
98 | series: {
99 | value: string;
100 | image: string;
101 | colors: string[];
102 | backendValue: string;
103 | };
104 | set: {
105 | value: string;
106 | text: string;
107 | backendValue: string;
108 | };
109 | introduction: {
110 | chapter: string;
111 | season: string;
112 | text: string;
113 | backendValue: number;
114 | };
115 | images: {
116 | smallIcon: string;
117 | icon: string;
118 | featured: string;
119 | lego: {
120 | small: string;
121 | large: string;
122 | wide: string;
123 | };
124 | bean: {
125 | small: string;
126 | large: string;
127 | };
128 | Other: any;
129 | };
130 | variants: {
131 | channel: string;
132 | type: string;
133 | options: {
134 | tag: string;
135 | name: string;
136 | unlockRequirements: string;
137 | image: string;
138 | }[];
139 | }[];
140 | builtInEmoteIds: string[];
141 | searchTags: string[];
142 | gameplayTags: string[];
143 | metaTags: string[];
144 | showcaseVideo: string;
145 | dynamicPakId: string;
146 | itemPreviewHeroPath: string;
147 | displayAssetPath: string;
148 | definitionPath: string;
149 | path: string;
150 | added: string;
151 | shopHistory: string[];
152 | }[];
153 | tracks: {
154 | id: string;
155 | devName: string;
156 | title: string;
157 | artist: string;
158 | album: string;
159 | releaseYear: number;
160 | bpm: number;
161 | duration: number;
162 | difficulty: {
163 | vocals: number;
164 | guitar: number;
165 | bass: number;
166 | plasticBass: number;
167 | drums: number;
168 | plasticDrums: number;
169 | };
170 | gameplayTags: string[];
171 | genres: string[];
172 | albumArt: string;
173 | added: string;
174 | shopHistory: string[];
175 | }[];
176 | instruments: {
177 | id: string;
178 | name: string;
179 | description: string;
180 | type: {
181 | value: string;
182 | displayValue: string;
183 | backendValue: string;
184 | };
185 | rarity: {
186 | value: string;
187 | displayValue: string;
188 | backendValue: string;
189 | };
190 | images: {
191 | small: string;
192 | large: string;
193 | };
194 | series: {
195 | value: string;
196 | image: string;
197 | colors: string[];
198 | backendValue: string;
199 | };
200 | gameplayTags: string[];
201 | path: string;
202 | showcaseVideo: string;
203 | added: string;
204 | shopHistory: string[];
205 | }[];
206 | cars: {
207 | id: string;
208 | vehicleId: string;
209 | name: string;
210 | description: string;
211 | type: {
212 | value: string;
213 | displayValue: string;
214 | backendValue: string;
215 | };
216 | rarity: {
217 | value: string;
218 | displayValue: string;
219 | backendValue: string;
220 | };
221 | images: {
222 | small: string;
223 | large: string;
224 | };
225 | series: {
226 | value: string;
227 | image: string;
228 | colors: string[];
229 | backendValue: string;
230 | };
231 | gameplayTags: string[];
232 | path: string;
233 | showcaseVideo: string;
234 | added: string;
235 | shopHistory: string[];
236 | }[];
237 | lego: {
238 | id: string;
239 | cosmeticId: string;
240 | soundLibraryTags: string[];
241 | images: {
242 | small: string;
243 | large: string;
244 | wide: string;
245 | };
246 | path: string;
247 | added: string;
248 | }[];
249 | legoKits: {
250 | id: string;
251 | name: string;
252 | type: {
253 | value: string;
254 | displayValue: string;
255 | backendValue: string;
256 | };
257 | series: {
258 | value: string;
259 | image: string;
260 | colors: string[];
261 | backendValue: string;
262 | };
263 | gameplayTags: string[];
264 | images: {
265 | small: string;
266 | large: string;
267 | wide: string;
268 | };
269 | path: string;
270 | added: string;
271 | shopHistory: string[];
272 | }[];
273 | beans: {
274 | id: string;
275 | cosmeticId: string;
276 | name: string;
277 | gender: string;
278 | gameplayTags: string[];
279 | images: {
280 | small: string;
281 | large: string;
282 | };
283 | path: string;
284 | added: string;
285 | }[];
286 | };
287 | }
288 |
289 | export interface AllCosmeticsRequestParams extends FortniteAPIRequestParams {
290 | /**
291 | * Sets the output language. Defaults to `en`
292 | */
293 | language?: string;
294 | }
295 |
296 | /* -----------------------------------------------------
297 | New Cosmetics
298 | GET https://fortnite-api.com/v2/cosmetics/new
299 | ----------------------------------------------------- */
300 |
301 | export interface NewCosmeticsResponseData extends FortniteAPIResponseData {
302 | data: {
303 | date: string;
304 | build: string;
305 | previousBuild: string;
306 | hashes: {
307 | all: string;
308 | br: string;
309 | tracks: string;
310 | instruments: string;
311 | cars: string;
312 | lego: string;
313 | legoKits: string;
314 | beans: string;
315 | };
316 | lastAdditions: {
317 | all: string;
318 | br: string;
319 | tracks: string;
320 | instruments: string;
321 | cars: string;
322 | lego: string;
323 | legoKits: string;
324 | beans: string;
325 | };
326 | items: {
327 | br: {
328 | id: string;
329 | name: string;
330 | description: string;
331 | exclusiveDescription: string;
332 | unlockRequirements: string;
333 | customExclusiveCallout: string;
334 | type: {
335 | value: string;
336 | displayValue: string;
337 | backendValue: string;
338 | };
339 | rarity: {
340 | value: string;
341 | displayValue: string;
342 | backendValue: string;
343 | };
344 | series: {
345 | value: string;
346 | image: string;
347 | colors: string[];
348 | backendValue: string;
349 | };
350 | set: {
351 | value: string;
352 | text: string;
353 | backendValue: string;
354 | };
355 | introduction: {
356 | chapter: string;
357 | season: string;
358 | text: string;
359 | backendValue: number;
360 | };
361 | images: {
362 | smallIcon: string;
363 | icon: string;
364 | featured: string;
365 | lego: {
366 | small: string;
367 | large: string;
368 | wide: string;
369 | };
370 | bean: {
371 | small: string;
372 | large: string;
373 | };
374 | Other: any;
375 | };
376 | variants: {
377 | channel: string;
378 | type: string;
379 | options: {
380 | tag: string;
381 | name: string;
382 | unlockRequirements: string;
383 | image: string;
384 | }[];
385 | }[];
386 | builtInEmoteIds: string[];
387 | searchTags: string[];
388 | gameplayTags: string[];
389 | metaTags: string[];
390 | showcaseVideo: string;
391 | dynamicPakId: string;
392 | itemPreviewHeroPath: string;
393 | displayAssetPath: string;
394 | definitionPath: string;
395 | path: string;
396 | added: string;
397 | shopHistory: string[];
398 | }[];
399 | tracks: {
400 | id: string;
401 | devName: string;
402 | title: string;
403 | artist: string;
404 | album: string;
405 | releaseYear: number;
406 | bpm: number;
407 | duration: number;
408 | difficulty: {
409 | vocals: number;
410 | guitar: number;
411 | bass: number;
412 | plasticBass: number;
413 | drums: number;
414 | plasticDrums: number;
415 | };
416 | gameplayTags: string[];
417 | genres: string[];
418 | albumArt: string;
419 | added: string;
420 | shopHistory: string[];
421 | }[];
422 | instruments: {
423 | id: string;
424 | name: string;
425 | description: string;
426 | type: {
427 | value: string;
428 | displayValue: string;
429 | backendValue: string;
430 | };
431 | rarity: {
432 | value: string;
433 | displayValue: string;
434 | backendValue: string;
435 | };
436 | images: {
437 | small: string;
438 | large: string;
439 | };
440 | series: {
441 | value: string;
442 | image: string;
443 | colors: string[];
444 | backendValue: string;
445 | };
446 | gameplayTags: string[];
447 | path: string;
448 | showcaseVideo: string;
449 | added: string;
450 | shopHistory: string[];
451 | }[];
452 | cars: {
453 | id: string;
454 | vehicleId: string;
455 | name: string;
456 | description: string;
457 | type: {
458 | value: string;
459 | displayValue: string;
460 | backendValue: string;
461 | };
462 | rarity: {
463 | value: string;
464 | displayValue: string;
465 | backendValue: string;
466 | };
467 | images: {
468 | small: string;
469 | large: string;
470 | };
471 | series: {
472 | value: string;
473 | image: string;
474 | colors: string[];
475 | backendValue: string;
476 | };
477 | gameplayTags: string[];
478 | path: string;
479 | showcaseVideo: string;
480 | added: string;
481 | shopHistory: string[];
482 | }[];
483 | lego: {
484 | id: string;
485 | cosmeticId: string;
486 | soundLibraryTags: string[];
487 | images: {
488 | small: string;
489 | large: string;
490 | wide: string;
491 | };
492 | path: string;
493 | added: string;
494 | }[];
495 | legoKits: {
496 | id: string;
497 | name: string;
498 | type: {
499 | value: string;
500 | displayValue: string;
501 | backendValue: string;
502 | };
503 | series: {
504 | value: string;
505 | image: string;
506 | colors: string[];
507 | backendValue: string;
508 | };
509 | gameplayTags: string[];
510 | images: {
511 | small: string;
512 | large: string;
513 | wide: string;
514 | };
515 | path: string;
516 | added: string;
517 | shopHistory: string[];
518 | }[];
519 | beans: {
520 | id: string;
521 | cosmeticId: string;
522 | name: string;
523 | gender: string;
524 | gameplayTags: string[];
525 | images: {
526 | small: string;
527 | large: string;
528 | };
529 | path: string;
530 | added: string;
531 | }[];
532 | };
533 | };
534 | }
535 |
536 | export interface NewCosmeticsRequestParams extends FortniteAPIRequestParams {
537 | /**
538 | * Sets the output language. Defaults to `en`
539 | */
540 | language?: string;
541 | }
542 |
543 | /* -----------------------------------------------------
544 | BR Cosmetics List
545 | GET https://fortnite-api.com/v2/cosmetics/br
546 | ----------------------------------------------------- */
547 |
548 | export interface BRCosmeticsListResponseData extends FortniteAPIResponseData {
549 | data: {
550 | id: string;
551 | name: string;
552 | description: string;
553 | exclusiveDescription: string;
554 | unlockRequirements: string;
555 | customExclusiveCallout: string;
556 | type: {
557 | value: string;
558 | displayValue: string;
559 | backendValue: string;
560 | };
561 | rarity: {
562 | value: string;
563 | displayValue: string;
564 | backendValue: string;
565 | };
566 | series: {
567 | value: string;
568 | image: string;
569 | colors: string[];
570 | backendValue: string;
571 | };
572 | set: {
573 | value: string;
574 | text: string;
575 | backendValue: string;
576 | };
577 | introduction: {
578 | chapter: string;
579 | season: string;
580 | text: string;
581 | backendValue: number;
582 | };
583 | images: {
584 | smallIcon: string;
585 | icon: string;
586 | featured: string;
587 | lego: {
588 | small: string;
589 | large: string;
590 | wide: string;
591 | };
592 | bean: {
593 | small: string;
594 | large: string;
595 | };
596 | Other: any;
597 | };
598 | variants: {
599 | channel: string;
600 | type: string;
601 | options: {
602 | tag: string;
603 | name: string;
604 | unlockRequirements: string;
605 | image: string;
606 | }[];
607 | }[];
608 | builtInEmoteIds: string[];
609 | searchTags: string[];
610 | gameplayTags: string[];
611 | metaTags: string[];
612 | showcaseVideo: string;
613 | dynamicPakId: string;
614 | itemPreviewHeroPath: string;
615 | displayAssetPath: string;
616 | definitionPath: string;
617 | path: string;
618 | added: string;
619 | shopHistory: string[];
620 | }[];
621 | }
622 |
623 | export interface BRCosmeticsListRequestParams extends FortniteAPIRequestParams {
624 | /**
625 | * Sets the output language. Defaults to `en`
626 | */
627 | language?: string;
628 | }
629 |
630 | /* -----------------------------------------------------
631 | Track Cosmetics List
632 | GET https://fortnite-api.com/v2/cosmetics/tracks
633 | ----------------------------------------------------- */
634 |
635 | export interface TrackCosmeticsListResponseData extends FortniteAPIResponseData {
636 | data: {
637 | id: string;
638 | devName: string;
639 | title: string;
640 | artist: string;
641 | album: string;
642 | releaseYear: number;
643 | bpm: number;
644 | duration: number;
645 | difficulty: {
646 | vocals: number;
647 | guitar: number;
648 | bass: number;
649 | plasticBass: number;
650 | drums: number;
651 | plasticDrums: number;
652 | };
653 | gameplayTags: string[];
654 | genres: string[];
655 | albumArt: string;
656 | added: string;
657 | shopHistory: string[];
658 | }[];
659 | }
660 |
661 | export interface TrackCosmeticsListRequestParams extends FortniteAPIRequestParams {}
662 |
663 | /* -----------------------------------------------------
664 | Instrument Cosmetics List
665 | GET https://fortnite-api.com/v2/cosmetics/instruments
666 | ----------------------------------------------------- */
667 |
668 | export interface InstrumentCosmeticsListResponseData extends FortniteAPIResponseData {
669 | data: {
670 | id: string;
671 | name: string;
672 | description: string;
673 | type: {
674 | value: string;
675 | displayValue: string;
676 | backendValue: string;
677 | };
678 | rarity: {
679 | value: string;
680 | displayValue: string;
681 | backendValue: string;
682 | };
683 | images: {
684 | small: string;
685 | large: string;
686 | };
687 | series: {
688 | value: string;
689 | image: string;
690 | colors: string[];
691 | backendValue: string;
692 | };
693 | gameplayTags: string[];
694 | path: string;
695 | showcaseVideo: string;
696 | added: string;
697 | shopHistory: string[];
698 | }[];
699 | }
700 |
701 | export interface InstrumentCosmeticsListRequestParams extends FortniteAPIRequestParams {
702 | /**
703 | * Sets the output language. Defaults to `en`
704 | */
705 | language?: string;
706 | }
707 |
708 | /* -----------------------------------------------------
709 | Car Cosmetics List
710 | GET https://fortnite-api.com/v2/cosmetics/cars
711 | ----------------------------------------------------- */
712 |
713 | export interface CarCosmeticsListResponseData extends FortniteAPIResponseData {
714 | data: {
715 | id: string;
716 | vehicleId: string;
717 | name: string;
718 | description: string;
719 | type: {
720 | value: string;
721 | displayValue: string;
722 | backendValue: string;
723 | };
724 | rarity: {
725 | value: string;
726 | displayValue: string;
727 | backendValue: string;
728 | };
729 | images: {
730 | small: string;
731 | large: string;
732 | };
733 | series: {
734 | value: string;
735 | image: string;
736 | colors: string[];
737 | backendValue: string;
738 | };
739 | gameplayTags: string[];
740 | path: string;
741 | showcaseVideo: string;
742 | added: string;
743 | shopHistory: string[];
744 | }[];
745 | }
746 |
747 | export interface CarCosmeticsListRequestParams extends FortniteAPIRequestParams {
748 | /**
749 | * Sets the output language. Defaults to `en`
750 | */
751 | language?: string;
752 | }
753 |
754 | /* -----------------------------------------------------
755 | Lego Cosmetics List
756 | GET https://fortnite-api.com/v2/cosmetics/lego
757 | ----------------------------------------------------- */
758 |
759 | export interface LegoCosmeticsListResponseData extends FortniteAPIResponseData {
760 | data: {
761 | id: string;
762 | cosmeticId: string;
763 | soundLibraryTags: string[];
764 | images: {
765 | small: string;
766 | large: string;
767 | wide: string;
768 | };
769 | path: string;
770 | added: string;
771 | }[];
772 | }
773 |
774 | export interface LegoCosmeticsListRequestParams extends FortniteAPIRequestParams {}
775 |
776 | /* -----------------------------------------------------
777 | Lego Kit Cosmetics List
778 | GET https://fortnite-api.com/v2/cosmetics/lego/kits
779 | ----------------------------------------------------- */
780 |
781 | export interface LegoKitCosmeticsListResponseData extends FortniteAPIResponseData {
782 | data: {
783 | id: string;
784 | name: string;
785 | type: {
786 | value: string;
787 | displayValue: string;
788 | backendValue: string;
789 | };
790 | series: {
791 | value: string;
792 | image: string;
793 | colors: string[];
794 | backendValue: string;
795 | };
796 | gameplayTags: string[];
797 | images: {
798 | small: string;
799 | large: string;
800 | wide: string;
801 | };
802 | path: string;
803 | added: string;
804 | shopHistory: string[];
805 | }[];
806 | }
807 |
808 | export interface LegoKitCosmeticsListRequestParams extends FortniteAPIRequestParams {
809 | /**
810 | * Sets the output language. Defaults to `en`
811 | */
812 | language?: string;
813 | }
814 |
815 | /* -----------------------------------------------------
816 | Bean Cosmetics List
817 | GET https://fortnite-api.com/v2/cosmetics/beans
818 | ----------------------------------------------------- */
819 |
820 | export interface BeanCosmeticsListResponseData extends FortniteAPIResponseData {
821 | data: {
822 | id: string;
823 | cosmeticId: string;
824 | name: string;
825 | gender: string;
826 | gameplayTags: string[];
827 | images: {
828 | small: string;
829 | large: string;
830 | };
831 | path: string;
832 | added: string;
833 | }[];
834 | }
835 |
836 | export interface BeanCosmeticsListRequestParams extends FortniteAPIRequestParams {
837 | /**
838 | * Sets the output language. Defaults to `en`
839 | */
840 | language?: string;
841 | }
842 |
843 | /* -----------------------------------------------------
844 | BR Cosmetic by ID
845 | GET https://fortnite-api.com/v2/cosmetics/br/{cosmetic-id}
846 | ----------------------------------------------------- */
847 |
848 | export interface BRCosmeticByIDResponseData extends FortniteAPIResponseData {
849 | data: {
850 | id: string;
851 | name: string;
852 | description: string;
853 | exclusiveDescription: string;
854 | unlockRequirements: string;
855 | customExclusiveCallout: string;
856 | type: {
857 | value: string;
858 | displayValue: string;
859 | backendValue: string;
860 | };
861 | rarity: {
862 | value: string;
863 | displayValue: string;
864 | backendValue: string;
865 | };
866 | series: {
867 | value: string;
868 | image: string;
869 | colors: string[];
870 | backendValue: string;
871 | };
872 | set: {
873 | value: string;
874 | text: string;
875 | backendValue: string;
876 | };
877 | introduction: {
878 | chapter: string;
879 | season: string;
880 | text: string;
881 | backendValue: number;
882 | };
883 | images: {
884 | smallIcon: string;
885 | icon: string;
886 | featured: string;
887 | lego: {
888 | small: string;
889 | large: string;
890 | wide: string;
891 | };
892 | bean: {
893 | small: string;
894 | large: string;
895 | };
896 | Other: any;
897 | };
898 | variants: {
899 | channel: string;
900 | type: string;
901 | options: {
902 | tag: string;
903 | name: string;
904 | unlockRequirements: string;
905 | image: string;
906 | }[];
907 | }[];
908 | builtInEmoteIds: string[];
909 | searchTags: string[];
910 | gameplayTags: string[];
911 | metaTags: string[];
912 | showcaseVideo: string;
913 | dynamicPakId: string;
914 | itemPreviewHeroPath: string;
915 | displayAssetPath: string;
916 | definitionPath: string;
917 | path: string;
918 | added: string;
919 | shopHistory: string[];
920 | };
921 | }
922 |
923 | export interface BRCosmeticByIDRequestParams extends FortniteAPIRequestParams {
924 | /**
925 | * Sets the output language. Defaults to `en`
926 | */
927 | language?: string;
928 | }
929 |
930 | /* -----------------------------------------------------
931 | BR Cosmetic Search
932 | GET https://fortnite-api.com/v2/cosmetics/br/search
933 | ----------------------------------------------------- */
934 |
935 | export interface BRCosmeticSearchResponseData extends FortniteAPIResponseData {
936 | data: {
937 | id: string;
938 | name: string;
939 | description: string;
940 | exclusiveDescription: string;
941 | unlockRequirements: string;
942 | customExclusiveCallout: string;
943 | type: {
944 | value: string;
945 | displayValue: string;
946 | backendValue: string;
947 | };
948 | rarity: {
949 | value: string;
950 | displayValue: string;
951 | backendValue: string;
952 | };
953 | series: {
954 | value: string;
955 | image: string;
956 | colors: string[];
957 | backendValue: string;
958 | };
959 | set: {
960 | value: string;
961 | text: string;
962 | backendValue: string;
963 | };
964 | introduction: {
965 | chapter: string;
966 | season: string;
967 | text: string;
968 | backendValue: number;
969 | };
970 | images: {
971 | smallIcon: string;
972 | icon: string;
973 | featured: string;
974 | lego: {
975 | small: string;
976 | large: string;
977 | wide: string;
978 | };
979 | bean: {
980 | small: string;
981 | large: string;
982 | };
983 | Other: any;
984 | };
985 | variants: {
986 | channel: string;
987 | type: string;
988 | options: {
989 | tag: string;
990 | name: string;
991 | unlockRequirements: string;
992 | image: string;
993 | }[];
994 | }[];
995 | builtInEmoteIds: string[];
996 | searchTags: string[];
997 | gameplayTags: string[];
998 | metaTags: string[];
999 | showcaseVideo: string;
1000 | dynamicPakId: string;
1001 | itemPreviewHeroPath: string;
1002 | displayAssetPath: string;
1003 | definitionPath: string;
1004 | path: string;
1005 | added: string;
1006 | shopHistory: string[];
1007 | };
1008 | }
1009 |
1010 | export interface BRCosmeticSearchRequestParams extends FortniteAPIRequestParams {
1011 | /**
1012 | * Sets the output language. Defaults to `en`
1013 | */
1014 | language?: string;
1015 | /**
1016 | * Sets the search language. Defaults to `en`
1017 | */
1018 | searchLanguage?: string;
1019 | /**
1020 | * Sets the match method for strings. Defaults to `full`
1021 | */
1022 | matchMethod?: 'full' | 'contains' | 'starts' | 'ends';
1023 | /**
1024 | * Sets the id. Defaults to `none`
1025 | */
1026 | id: string;
1027 | /**
1028 | * Sets the name. Defaults to `none`
1029 | */
1030 | name: string;
1031 | /**
1032 | * Sets the description. Defaults to `none`
1033 | */
1034 | description: string;
1035 | /**
1036 | * Sets the type. Defaults to `none`
1037 | */
1038 | type: string;
1039 | /**
1040 | * Sets the display type. Defaults to `none`
1041 | */
1042 | displayType: string;
1043 | /**
1044 | * Sets the backend type. Defaults to `none`
1045 | */
1046 | backendType: string;
1047 | /**
1048 | * Sets the rarity. Defaults to `none`
1049 | */
1050 | rarity: string;
1051 | /**
1052 | * Sets the display rarity. Defaults to `none`
1053 | */
1054 | displayRarity: string;
1055 | /**
1056 | * Sets the backend rarity. Defaults to `none`
1057 | */
1058 | backendRarity: string;
1059 | /**
1060 | * Sets whether there is a series. Defaults to `none`
1061 | */
1062 | hasSeries: boolean;
1063 | /**
1064 | * Sets the series. Defaults to `none`
1065 | */
1066 | series: string;
1067 | /**
1068 | * Sets the backend series. Defaults to `none`
1069 | */
1070 | backendSeries: string;
1071 | /**
1072 | * Sets whether there is a set. Defaults to `none`
1073 | */
1074 | hasSet: boolean;
1075 | /**
1076 | * Sets the set. Defaults to `none`
1077 | */
1078 | set: string;
1079 | /**
1080 | * Sets the set text. Defaults to `none`
1081 | */
1082 | setText: string;
1083 | /**
1084 | * Sets the backend set. Defaults to `none`
1085 | */
1086 | backendSet: string;
1087 | /**
1088 | * Sets whether there is an introduction. Defaults to `none`
1089 | */
1090 | hasIntroduction: boolean;
1091 | /**
1092 | * Sets the introduction backend value. Defaults to `none`
1093 | */
1094 | backendIntroduction: number;
1095 | /**
1096 | * Sets the introduction chapter. Defaults to `none`
1097 | */
1098 | introductionChapter: string;
1099 | /**
1100 | * Sets the introduction season. Defaults to `none`
1101 | */
1102 | introductionSeason: string;
1103 | /**
1104 | * Sets whether there is a featuredImage. Defaults to `none`
1105 | */
1106 | hasFeaturedImage: boolean;
1107 | /**
1108 | * Sets whether there are variants. Defaults to `none`
1109 | */
1110 | hasVariants: boolean;
1111 | /**
1112 | * Sets whether there are gameplay tags. Defaults to `none`
1113 | */
1114 | hasGameplayTags: boolean;
1115 | /**
1116 | * Sets the gameplay tag. Defaults to `none`
1117 | */
1118 | gameplayTag: string;
1119 | /**
1120 | * Sets whether there are meta tags. Defaults to `none`
1121 | */
1122 | hasMetaTags: boolean;
1123 | /**
1124 | * Sets the meta tag. Defaults to `none`
1125 | */
1126 | metaTag: string;
1127 | /**
1128 | * Sets whether a dynamic pak id is set. Defaults to `none`
1129 | */
1130 | hasDynamicPakId: boolean;
1131 | /**
1132 | * Sets the dynamic pak id. Defaults to `none`
1133 | */
1134 | dynamicPakId: string;
1135 | /**
1136 | * Sets the added date. Defaults to `none`
1137 | */
1138 | added: number;
1139 | /**
1140 | * Sets the date since it was added. Defaults to `none`
1141 | */
1142 | addedSince: number;
1143 | /**
1144 | * Sets for how long its unseen. Defaults to `none`
1145 | */
1146 | unseenFor: number;
1147 | /**
1148 | * Sets the last appearance date. Defaults to `none`
1149 | */
1150 | lastAppearance: number;
1151 | }
1152 |
1153 | /* -----------------------------------------------------
1154 | BR Cosmetics Search
1155 | GET https://fortnite-api.com/v2/cosmetics/br/search/all
1156 | ----------------------------------------------------- */
1157 |
1158 | export interface BRCosmeticsSearchResponseData extends FortniteAPIResponseData {
1159 | data: {
1160 | id: string;
1161 | name: string;
1162 | description: string;
1163 | exclusiveDescription: string;
1164 | unlockRequirements: string;
1165 | customExclusiveCallout: string;
1166 | type: {
1167 | value: string;
1168 | displayValue: string;
1169 | backendValue: string;
1170 | };
1171 | rarity: {
1172 | value: string;
1173 | displayValue: string;
1174 | backendValue: string;
1175 | };
1176 | series: {
1177 | value: string;
1178 | image: string;
1179 | colors: string[];
1180 | backendValue: string;
1181 | };
1182 | set: {
1183 | value: string;
1184 | text: string;
1185 | backendValue: string;
1186 | };
1187 | introduction: {
1188 | chapter: string;
1189 | season: string;
1190 | text: string;
1191 | backendValue: number;
1192 | };
1193 | images: {
1194 | smallIcon: string;
1195 | icon: string;
1196 | featured: string;
1197 | lego: {
1198 | small: string;
1199 | large: string;
1200 | wide: string;
1201 | };
1202 | bean: {
1203 | small: string;
1204 | large: string;
1205 | };
1206 | Other: any;
1207 | };
1208 | variants: {
1209 | channel: string;
1210 | type: string;
1211 | options: {
1212 | tag: string;
1213 | name: string;
1214 | unlockRequirements: string;
1215 | image: string;
1216 | }[];
1217 | }[];
1218 | builtInEmoteIds: string[];
1219 | searchTags: string[];
1220 | gameplayTags: string[];
1221 | metaTags: string[];
1222 | showcaseVideo: string;
1223 | dynamicPakId: string;
1224 | itemPreviewHeroPath: string;
1225 | displayAssetPath: string;
1226 | definitionPath: string;
1227 | path: string;
1228 | added: string;
1229 | shopHistory: string[];
1230 | }[];
1231 | }
1232 |
1233 | export interface BRCosmeticsSearchRequestParams extends FortniteAPIRequestParams {
1234 | /**
1235 | * Sets the output language. Defaults to `en`
1236 | */
1237 | language?: string;
1238 | /**
1239 | * Sets the search language. Defaults to `en`
1240 | */
1241 | searchLanguage?: string;
1242 | /**
1243 | * Sets the match method for strings. Defaults to `full`
1244 | */
1245 | matchMethod?: 'full' | 'contains' | 'starts' | 'ends';
1246 | /**
1247 | * Sets the id. Defaults to `none`
1248 | */
1249 | id: string;
1250 | /**
1251 | * Sets the name. Defaults to `none`
1252 | */
1253 | name: string;
1254 | /**
1255 | * Sets the description. Defaults to `none`
1256 | */
1257 | description: string;
1258 | /**
1259 | * Sets the type. Defaults to `none`
1260 | */
1261 | type: string;
1262 | /**
1263 | * Sets the display type. Defaults to `none`
1264 | */
1265 | displayType: string;
1266 | /**
1267 | * Sets the backend type. Defaults to `none`
1268 | */
1269 | backendType: string;
1270 | /**
1271 | * Sets the rarity. Defaults to `none`
1272 | */
1273 | rarity: string;
1274 | /**
1275 | * Sets the display rarity. Defaults to `none`
1276 | */
1277 | displayRarity: string;
1278 | /**
1279 | * Sets the backend rarity. Defaults to `none`
1280 | */
1281 | backendRarity: string;
1282 | /**
1283 | * Sets whether there is a series. Defaults to `none`
1284 | */
1285 | hasSeries: boolean;
1286 | /**
1287 | * Sets the series. Defaults to `none`
1288 | */
1289 | series: string;
1290 | /**
1291 | * Sets the backend series. Defaults to `none`
1292 | */
1293 | backendSeries: string;
1294 | /**
1295 | * Sets whether there is a set. Defaults to `none`
1296 | */
1297 | hasSet: boolean;
1298 | /**
1299 | * Sets the set. Defaults to `none`
1300 | */
1301 | set: string;
1302 | /**
1303 | * Sets the set text. Defaults to `none`
1304 | */
1305 | setText: string;
1306 | /**
1307 | * Sets the backend set. Defaults to `none`
1308 | */
1309 | backendSet: string;
1310 | /**
1311 | * Sets whether there is an introduction. Defaults to `none`
1312 | */
1313 | hasIntroduction: boolean;
1314 | /**
1315 | * Sets the introduction backend value. Defaults to `none`
1316 | */
1317 | backendIntroduction: number;
1318 | /**
1319 | * Sets the introduction chapter. Defaults to `none`
1320 | */
1321 | introductionChapter: string;
1322 | /**
1323 | * Sets the introduction season. Defaults to `none`
1324 | */
1325 | introductionSeason: string;
1326 | /**
1327 | * Sets whether there is a featuredImage. Defaults to `none`
1328 | */
1329 | hasFeaturedImage: boolean;
1330 | /**
1331 | * Sets whether there are variants. Defaults to `none`
1332 | */
1333 | hasVariants: boolean;
1334 | /**
1335 | * Sets whether there are gameplay tags. Defaults to `none`
1336 | */
1337 | hasGameplayTags: boolean;
1338 | /**
1339 | * Sets the gameplay tag. Defaults to `none`
1340 | */
1341 | gameplayTag: string;
1342 | /**
1343 | * Sets whether there are meta tags. Defaults to `none`
1344 | */
1345 | hasMetaTags: boolean;
1346 | /**
1347 | * Sets the meta tag. Defaults to `none`
1348 | */
1349 | metaTag: string;
1350 | /**
1351 | * Sets whether a dynamic pak id is set. Defaults to `none`
1352 | */
1353 | hasDynamicPakId: boolean;
1354 | /**
1355 | * Sets the dynamic pak id. Defaults to `none`
1356 | */
1357 | dynamicPakId: string;
1358 | /**
1359 | * Sets the added date. Defaults to `none`
1360 | */
1361 | added: number;
1362 | /**
1363 | * Sets the date since it was added. Defaults to `none`
1364 | */
1365 | addedSince: number;
1366 | /**
1367 | * Sets for how long its unseen. Defaults to `none`
1368 | */
1369 | unseenFor: number;
1370 | /**
1371 | * Sets the last appearance date. Defaults to `none`
1372 | */
1373 | lastAppearance: number;
1374 | }
1375 |
1376 | /* -----------------------------------------------------
1377 | BR Cosmetics Search by IDs
1378 | GET https://fortnite-api.com/v2/cosmetics/br/search/ids
1379 | ----------------------------------------------------- */
1380 |
1381 | export interface BRCosmeticsSearchByIDsResponseData extends FortniteAPIResponseData {
1382 | data: {
1383 | id: string;
1384 | name: string;
1385 | description: string;
1386 | exclusiveDescription: string;
1387 | unlockRequirements: string;
1388 | customExclusiveCallout: string;
1389 | type: {
1390 | value: string;
1391 | displayValue: string;
1392 | backendValue: string;
1393 | };
1394 | rarity: {
1395 | value: string;
1396 | displayValue: string;
1397 | backendValue: string;
1398 | };
1399 | series: {
1400 | value: string;
1401 | image: string;
1402 | colors: string[];
1403 | backendValue: string;
1404 | };
1405 | set: {
1406 | value: string;
1407 | text: string;
1408 | backendValue: string;
1409 | };
1410 | introduction: {
1411 | chapter: string;
1412 | season: string;
1413 | text: string;
1414 | backendValue: number;
1415 | };
1416 | images: {
1417 | smallIcon: string;
1418 | icon: string;
1419 | featured: string;
1420 | lego: {
1421 | small: string;
1422 | large: string;
1423 | wide: string;
1424 | };
1425 | bean: {
1426 | small: string;
1427 | large: string;
1428 | };
1429 | Other: any;
1430 | };
1431 | variants: {
1432 | channel: string;
1433 | type: string;
1434 | options: {
1435 | tag: string;
1436 | name: string;
1437 | unlockRequirements: string;
1438 | image: string;
1439 | }[];
1440 | }[];
1441 | builtInEmoteIds: string[];
1442 | searchTags: string[];
1443 | gameplayTags: string[];
1444 | metaTags: string[];
1445 | showcaseVideo: string;
1446 | dynamicPakId: string;
1447 | itemPreviewHeroPath: string;
1448 | displayAssetPath: string;
1449 | definitionPath: string;
1450 | path: string;
1451 | added: string;
1452 | shopHistory: string[];
1453 | }[];
1454 | }
1455 |
1456 | export interface BRCosmeticsSearchByIDsRequestParams extends FortniteAPIRequestParams {
1457 | /**
1458 | * Sets the output language. Defaults to `en`
1459 | */
1460 | language?: string;
1461 | /**
1462 | * Sets the cosmetic id
1463 | (can be multiple). Defaults to `none`
1464 | */
1465 | id: string;
1466 | }
1467 |
1468 | /* -----------------------------------------------------
1469 | Creator Code
1470 | GET https://fortnite-api.com/v2/creatorcode
1471 | ----------------------------------------------------- */
1472 |
1473 | export interface CreatorCodeResponseData extends FortniteAPIResponseData {
1474 | data: {
1475 | code: string;
1476 | account: {
1477 | id: string;
1478 | name: string;
1479 | };
1480 | status: string;
1481 | verified: boolean;
1482 | };
1483 | }
1484 |
1485 | export interface CreatorCodeRequestParams extends FortniteAPIRequestParams {
1486 | /**
1487 | * Sets the creator code. Defaults to `none`
1488 | */
1489 | name: string;
1490 | }
1491 |
1492 | /* -----------------------------------------------------
1493 | BR Map
1494 | GET https://fortnite-api.com/v1/map
1495 | ----------------------------------------------------- */
1496 |
1497 | export interface BRMapResponseData extends FortniteAPIResponseData {
1498 | data: {
1499 | images: {
1500 | blank: string;
1501 | pois: string;
1502 | };
1503 | pois: {
1504 | id: string;
1505 | name: string;
1506 | location: {
1507 | x: number;
1508 | y: number;
1509 | z: number;
1510 | };
1511 | }[];
1512 | };
1513 | }
1514 |
1515 | export interface BRMapRequestParams extends FortniteAPIRequestParams {
1516 | /**
1517 | * Sets the output language. Defaults to `en`
1518 | */
1519 | language?: string;
1520 | }
1521 |
1522 | /* -----------------------------------------------------
1523 | News
1524 | GET https://fortnite-api.com/v2/news
1525 | ----------------------------------------------------- */
1526 |
1527 | export interface NewsResponseData extends FortniteAPIResponseData {
1528 | data: {
1529 | br: {
1530 | hash: string;
1531 | date: string;
1532 | image: string;
1533 | motds: {
1534 | id: string;
1535 | title: string;
1536 | tabTitle: string;
1537 | body: string;
1538 | image: string;
1539 | tileImage: string;
1540 | sortingPriority: number;
1541 | hidden: boolean;
1542 | websiteUrl: string;
1543 | videoString: string;
1544 | videoId: string;
1545 | }[];
1546 | messages: {
1547 | title: string;
1548 | body: string;
1549 | image: string;
1550 | adspace: string;
1551 | }[];
1552 | };
1553 | stw: {
1554 | hash: string;
1555 | date: string;
1556 | image: string;
1557 | motds: {
1558 | id: string;
1559 | title: string;
1560 | tabTitle: string;
1561 | body: string;
1562 | image: string;
1563 | tileImage: string;
1564 | sortingPriority: number;
1565 | hidden: boolean;
1566 | websiteUrl: string;
1567 | videoString: string;
1568 | videoId: string;
1569 | }[];
1570 | messages: {
1571 | title: string;
1572 | body: string;
1573 | image: string;
1574 | adspace: string;
1575 | }[];
1576 | };
1577 | creative: {
1578 | hash: string;
1579 | date: string;
1580 | image: string;
1581 | motds: {
1582 | id: string;
1583 | title: string;
1584 | tabTitle: string;
1585 | body: string;
1586 | image: string;
1587 | tileImage: string;
1588 | sortingPriority: number;
1589 | hidden: boolean;
1590 | websiteUrl: string;
1591 | videoString: string;
1592 | videoId: string;
1593 | }[];
1594 | messages: {
1595 | title: string;
1596 | body: string;
1597 | image: string;
1598 | adspace: string;
1599 | }[];
1600 | };
1601 | };
1602 | }
1603 |
1604 | export interface NewsRequestParams extends FortniteAPIRequestParams {
1605 | /**
1606 | * Sets the output language. Defaults to `en`
1607 | */
1608 | language?: string;
1609 | }
1610 |
1611 | /* -----------------------------------------------------
1612 | BR News
1613 | GET https://fortnite-api.com/v2/news/br
1614 | ----------------------------------------------------- */
1615 |
1616 | export interface BRNewsResponseData extends FortniteAPIResponseData {
1617 | data: {
1618 | hash: string;
1619 | date: string;
1620 | image: string;
1621 | motds: {
1622 | id: string;
1623 | title: string;
1624 | tabTitle: string;
1625 | body: string;
1626 | image: string;
1627 | tileImage: string;
1628 | sortingPriority: number;
1629 | hidden: boolean;
1630 | websiteUrl: string;
1631 | videoString: string;
1632 | videoId: string;
1633 | }[];
1634 | messages: {
1635 | title: string;
1636 | body: string;
1637 | image: string;
1638 | adspace: string;
1639 | }[];
1640 | };
1641 | }
1642 |
1643 | export interface BRNewsRequestParams extends FortniteAPIRequestParams {
1644 | /**
1645 | * Sets the output language. Defaults to `en`
1646 | */
1647 | language?: string;
1648 | }
1649 |
1650 | /* -----------------------------------------------------
1651 | STW News
1652 | GET https://fortnite-api.com/v2/news/stw
1653 | ----------------------------------------------------- */
1654 |
1655 | export interface STWNewsResponseData extends FortniteAPIResponseData {
1656 | data: {
1657 | hash: string;
1658 | date: string;
1659 | image: string;
1660 | motds: {
1661 | id: string;
1662 | title: string;
1663 | tabTitle: string;
1664 | body: string;
1665 | image: string;
1666 | tileImage: string;
1667 | sortingPriority: number;
1668 | hidden: boolean;
1669 | websiteUrl: string;
1670 | videoString: string;
1671 | videoId: string;
1672 | }[];
1673 | messages: {
1674 | title: string;
1675 | body: string;
1676 | image: string;
1677 | adspace: string;
1678 | }[];
1679 | };
1680 | }
1681 |
1682 | export interface STWNewsRequestParams extends FortniteAPIRequestParams {
1683 | /**
1684 | * Sets the output language. Defaults to `en`
1685 | */
1686 | language?: string;
1687 | }
1688 |
1689 | /* -----------------------------------------------------
1690 | Creative News
1691 | GET https://fortnite-api.com/v2/news/creative
1692 | ----------------------------------------------------- */
1693 |
1694 | export interface CreativeNewsResponseData extends FortniteAPIResponseData {
1695 | data: {
1696 | hash: string;
1697 | date: string;
1698 | image: string;
1699 | motds: {
1700 | id: string;
1701 | title: string;
1702 | tabTitle: string;
1703 | body: string;
1704 | image: string;
1705 | tileImage: string;
1706 | sortingPriority: number;
1707 | hidden: boolean;
1708 | websiteUrl: string;
1709 | videoString: string;
1710 | videoId: string;
1711 | }[];
1712 | messages: {
1713 | title: string;
1714 | body: string;
1715 | image: string;
1716 | adspace: string;
1717 | }[];
1718 | };
1719 | }
1720 |
1721 | export interface CreativeNewsRequestParams extends FortniteAPIRequestParams {
1722 | /**
1723 | * Sets the output language. Defaults to `en`
1724 | */
1725 | language?: string;
1726 | }
1727 |
1728 | /* -----------------------------------------------------
1729 | Playlists
1730 | GET https://fortnite-api.com/v1/playlists
1731 | ----------------------------------------------------- */
1732 |
1733 | export interface PlaylistsResponseData extends FortniteAPIResponseData {
1734 | data: {
1735 | id: string;
1736 | name: string;
1737 | subName: string;
1738 | description: string;
1739 | gameType: string;
1740 | ratingType: string;
1741 | minPlayers: number;
1742 | maxPlayers: number;
1743 | maxTeams: number;
1744 | maxTeamSize: number;
1745 | maxSquads: number;
1746 | maxSquadSize: number;
1747 | isDefault: boolean;
1748 | isTournament: boolean;
1749 | isLimitedTimeMode: boolean;
1750 | isLargeTeamGame: boolean;
1751 | accumulateToProfileStats: boolean;
1752 | images: {
1753 | showcase: string;
1754 | missionIcon: string;
1755 | };
1756 | gameplayTags: string[];
1757 | path: string;
1758 | added: string;
1759 | }[];
1760 | }
1761 |
1762 | export interface PlaylistsRequestParams extends FortniteAPIRequestParams {
1763 | /**
1764 | * Sets the output language. Defaults to `en`
1765 | */
1766 | language?: string;
1767 | }
1768 |
1769 | /* -----------------------------------------------------
1770 | Playlist by ID
1771 | GET https://fortnite-api.com/v1/playlists/{playlist-id}
1772 | ----------------------------------------------------- */
1773 |
1774 | export interface PlaylistByIDResponseData extends FortniteAPIResponseData {
1775 | data: {
1776 | id: string;
1777 | name: string;
1778 | subName: string;
1779 | description: string;
1780 | gameType: string;
1781 | ratingType: string;
1782 | minPlayers: number;
1783 | maxPlayers: number;
1784 | maxTeams: number;
1785 | maxTeamSize: number;
1786 | maxSquads: number;
1787 | maxSquadSize: number;
1788 | isDefault: boolean;
1789 | isTournament: boolean;
1790 | isLimitedTimeMode: boolean;
1791 | isLargeTeamGame: boolean;
1792 | accumulateToProfileStats: boolean;
1793 | images: {
1794 | showcase: string;
1795 | missionIcon: string;
1796 | };
1797 | gameplayTags: string[];
1798 | path: string;
1799 | added: string;
1800 | };
1801 | }
1802 |
1803 | export interface PlaylistByIDRequestParams extends FortniteAPIRequestParams {
1804 | /**
1805 | * Sets the output language. Defaults to `en`
1806 | */
1807 | language?: string;
1808 | }
1809 |
1810 | /* -----------------------------------------------------
1811 | Shop
1812 | GET https://fortnite-api.com/v2/shop
1813 | ----------------------------------------------------- */
1814 |
1815 | export interface ShopResponseData extends FortniteAPIResponseData {
1816 | data: {
1817 | hash: string;
1818 | date: string;
1819 | vbuckIcon: string;
1820 | entries: {
1821 | regularPrice: number;
1822 | finalPrice: number;
1823 | devName: string;
1824 | offerId: string;
1825 | inDate: string;
1826 | outDate: string;
1827 | bundle: {
1828 | name: string;
1829 | info: string;
1830 | image: string;
1831 | };
1832 | banner: {
1833 | value: string;
1834 | intensity: string;
1835 | backendValue: string;
1836 | };
1837 | offerTag: {
1838 | id: string;
1839 | text: string;
1840 | };
1841 | giftable: boolean;
1842 | refundable: boolean;
1843 | sortPriority: number;
1844 | layoutId: string;
1845 | layout: {
1846 | id: string;
1847 | name: string;
1848 | category: string;
1849 | index: number;
1850 | rank: number;
1851 | showIneligibleOffers: string;
1852 | background: string;
1853 | useWidePreview: boolean;
1854 | displayType: string;
1855 | textureMetadata: {
1856 | key: string;
1857 | value: string;
1858 | }[];
1859 | stringMetadata: {
1860 | key: string;
1861 | value: string;
1862 | }[];
1863 | textMetadata: {
1864 | key: string;
1865 | value: string;
1866 | }[];
1867 | };
1868 | colors: {
1869 | color1: string;
1870 | color2: string;
1871 | color3: string;
1872 | textBackgroundColor: string;
1873 | };
1874 | tileSize: string;
1875 | displayAssetPath: string;
1876 | newDisplayAssetPath: string;
1877 | newDisplayAsset: {
1878 | id: string;
1879 | cosmeticId: string;
1880 | materialInstances: {
1881 | id: string;
1882 | primaryMode: string;
1883 | productTag: string;
1884 | Images: any;
1885 | Colors: any;
1886 | Scalings: any;
1887 | Flags: any;
1888 | }[];
1889 | renderImages: {
1890 | productTag: string;
1891 | fileName: string;
1892 | image: string;
1893 | }[];
1894 | };
1895 | brItems: {
1896 | id: string;
1897 | name: string;
1898 | description: string;
1899 | exclusiveDescription: string;
1900 | unlockRequirements: string;
1901 | customExclusiveCallout: string;
1902 | type: {
1903 | value: string;
1904 | displayValue: string;
1905 | backendValue: string;
1906 | };
1907 | rarity: {
1908 | value: string;
1909 | displayValue: string;
1910 | backendValue: string;
1911 | };
1912 | series: {
1913 | value: string;
1914 | image: string;
1915 | colors: string[];
1916 | backendValue: string;
1917 | };
1918 | set: {
1919 | value: string;
1920 | text: string;
1921 | backendValue: string;
1922 | };
1923 | introduction: {
1924 | chapter: string;
1925 | season: string;
1926 | text: string;
1927 | backendValue: number;
1928 | };
1929 | images: {
1930 | smallIcon: string;
1931 | icon: string;
1932 | featured: string;
1933 | lego: {
1934 | small: string;
1935 | large: string;
1936 | wide: string;
1937 | };
1938 | bean: {
1939 | small: string;
1940 | large: string;
1941 | };
1942 | Other: any;
1943 | };
1944 | variants: {
1945 | channel: string;
1946 | type: string;
1947 | options: {
1948 | tag: string;
1949 | name: string;
1950 | unlockRequirements: string;
1951 | image: string;
1952 | }[];
1953 | }[];
1954 | builtInEmoteIds: string[];
1955 | searchTags: string[];
1956 | gameplayTags: string[];
1957 | metaTags: string[];
1958 | showcaseVideo: string;
1959 | dynamicPakId: string;
1960 | itemPreviewHeroPath: string;
1961 | displayAssetPath: string;
1962 | definitionPath: string;
1963 | path: string;
1964 | added: string;
1965 | shopHistory: string[];
1966 | }[];
1967 | tracks: {
1968 | id: string;
1969 | devName: string;
1970 | title: string;
1971 | artist: string;
1972 | album: string;
1973 | releaseYear: number;
1974 | bpm: number;
1975 | duration: number;
1976 | difficulty: {
1977 | vocals: number;
1978 | guitar: number;
1979 | bass: number;
1980 | plasticBass: number;
1981 | drums: number;
1982 | plasticDrums: number;
1983 | };
1984 | gameplayTags: string[];
1985 | genres: string[];
1986 | albumArt: string;
1987 | added: string;
1988 | shopHistory: string[];
1989 | }[];
1990 | instruments: {
1991 | id: string;
1992 | name: string;
1993 | description: string;
1994 | type: {
1995 | value: string;
1996 | displayValue: string;
1997 | backendValue: string;
1998 | };
1999 | rarity: {
2000 | value: string;
2001 | displayValue: string;
2002 | backendValue: string;
2003 | };
2004 | images: {
2005 | small: string;
2006 | large: string;
2007 | };
2008 | series: {
2009 | value: string;
2010 | image: string;
2011 | colors: string[];
2012 | backendValue: string;
2013 | };
2014 | gameplayTags: string[];
2015 | path: string;
2016 | showcaseVideo: string;
2017 | added: string;
2018 | shopHistory: string[];
2019 | }[];
2020 | cars: {
2021 | id: string;
2022 | vehicleId: string;
2023 | name: string;
2024 | description: string;
2025 | type: {
2026 | value: string;
2027 | displayValue: string;
2028 | backendValue: string;
2029 | };
2030 | rarity: {
2031 | value: string;
2032 | displayValue: string;
2033 | backendValue: string;
2034 | };
2035 | images: {
2036 | small: string;
2037 | large: string;
2038 | };
2039 | series: {
2040 | value: string;
2041 | image: string;
2042 | colors: string[];
2043 | backendValue: string;
2044 | };
2045 | gameplayTags: string[];
2046 | path: string;
2047 | showcaseVideo: string;
2048 | added: string;
2049 | shopHistory: string[];
2050 | }[];
2051 | legoKits: {
2052 | id: string;
2053 | name: string;
2054 | type: {
2055 | value: string;
2056 | displayValue: string;
2057 | backendValue: string;
2058 | };
2059 | series: {
2060 | value: string;
2061 | image: string;
2062 | colors: string[];
2063 | backendValue: string;
2064 | };
2065 | gameplayTags: string[];
2066 | images: {
2067 | small: string;
2068 | large: string;
2069 | wide: string;
2070 | };
2071 | path: string;
2072 | added: string;
2073 | shopHistory: string[];
2074 | }[];
2075 | }[];
2076 | };
2077 | }
2078 |
2079 | export interface ShopRequestParams extends FortniteAPIRequestParams {
2080 | /**
2081 | * Sets the output language. Defaults to `en`
2082 | */
2083 | language?: string;
2084 | }
2085 |
2086 | /* -----------------------------------------------------
2087 | BR Stats
2088 | GET https://fortnite-api.com/v2/stats/br/v2
2089 | ----------------------------------------------------- */
2090 |
2091 | export interface BRStatsResponseData extends FortniteAPIResponseData {
2092 | data: {
2093 | account: {
2094 | id: string;
2095 | name: string;
2096 | };
2097 | battlePass: {
2098 | level: number;
2099 | progress: number;
2100 | };
2101 | image: string;
2102 | stats: {
2103 | all: {
2104 | overall: {
2105 | score: number;
2106 | scorePerMin: number;
2107 | scorePerMatch: number;
2108 | wins: number;
2109 | top3: number;
2110 | top5: number;
2111 | top6: number;
2112 | top10: number;
2113 | top12: number;
2114 | top25: number;
2115 | kills: number;
2116 | killsPerMin: number;
2117 | killsPerMatch: number;
2118 | deaths: number;
2119 | kd: number;
2120 | matches: number;
2121 | winRate: number;
2122 | minutesPlayed: number;
2123 | playersOutlived: number;
2124 | lastModified: string;
2125 | };
2126 | solo: {
2127 | score: number;
2128 | scorePerMin: number;
2129 | scorePerMatch: number;
2130 | wins: number;
2131 | top10: number;
2132 | top25: number;
2133 | kills: number;
2134 | killsPerMin: number;
2135 | killsPerMatch: number;
2136 | deaths: number;
2137 | kd: number;
2138 | matches: number;
2139 | winRate: number;
2140 | minutesPlayed: number;
2141 | playersOutlived: number;
2142 | lastModified: string;
2143 | };
2144 | duo: {
2145 | score: number;
2146 | scorePerMin: number;
2147 | scorePerMatch: number;
2148 | wins: number;
2149 | top5: number;
2150 | top12: number;
2151 | kills: number;
2152 | killsPerMin: number;
2153 | killsPerMatch: number;
2154 | deaths: number;
2155 | kd: number;
2156 | matches: number;
2157 | winRate: number;
2158 | minutesPlayed: number;
2159 | playersOutlived: number;
2160 | lastModified: string;
2161 | };
2162 | trio: {
2163 | score: number;
2164 | scorePerMin: number;
2165 | scorePerMatch: number;
2166 | wins: number;
2167 | top3: number;
2168 | top6: number;
2169 | kills: number;
2170 | killsPerMin: number;
2171 | killsPerMatch: number;
2172 | deaths: number;
2173 | kd: number;
2174 | matches: number;
2175 | winRate: number;
2176 | minutesPlayed: number;
2177 | playersOutlived: number;
2178 | lastModified: string;
2179 | };
2180 | squad: {
2181 | score: number;
2182 | scorePerMin: number;
2183 | scorePerMatch: number;
2184 | wins: number;
2185 | top3: number;
2186 | top6: number;
2187 | kills: number;
2188 | killsPerMin: number;
2189 | killsPerMatch: number;
2190 | deaths: number;
2191 | kd: number;
2192 | matches: number;
2193 | winRate: number;
2194 | minutesPlayed: number;
2195 | playersOutlived: number;
2196 | lastModified: string;
2197 | };
2198 | ltm: {
2199 | score: number;
2200 | scorePerMin: number;
2201 | scorePerMatch: number;
2202 | wins: number;
2203 | kills: number;
2204 | killsPerMin: number;
2205 | killsPerMatch: number;
2206 | deaths: number;
2207 | kd: number;
2208 | matches: number;
2209 | winRate: number;
2210 | minutesPlayed: number;
2211 | playersOutlived: number;
2212 | lastModified: string;
2213 | };
2214 | };
2215 | keyboardMouse: {
2216 | overall: {
2217 | score: number;
2218 | scorePerMin: number;
2219 | scorePerMatch: number;
2220 | wins: number;
2221 | top3: number;
2222 | top5: number;
2223 | top6: number;
2224 | top10: number;
2225 | top12: number;
2226 | top25: number;
2227 | kills: number;
2228 | killsPerMin: number;
2229 | killsPerMatch: number;
2230 | deaths: number;
2231 | kd: number;
2232 | matches: number;
2233 | winRate: number;
2234 | minutesPlayed: number;
2235 | playersOutlived: number;
2236 | lastModified: string;
2237 | };
2238 | solo: {
2239 | score: number;
2240 | scorePerMin: number;
2241 | scorePerMatch: number;
2242 | wins: number;
2243 | top10: number;
2244 | top25: number;
2245 | kills: number;
2246 | killsPerMin: number;
2247 | killsPerMatch: number;
2248 | deaths: number;
2249 | kd: number;
2250 | matches: number;
2251 | winRate: number;
2252 | minutesPlayed: number;
2253 | playersOutlived: number;
2254 | lastModified: string;
2255 | };
2256 | duo: {
2257 | score: number;
2258 | scorePerMin: number;
2259 | scorePerMatch: number;
2260 | wins: number;
2261 | top5: number;
2262 | top12: number;
2263 | kills: number;
2264 | killsPerMin: number;
2265 | killsPerMatch: number;
2266 | deaths: number;
2267 | kd: number;
2268 | matches: number;
2269 | winRate: number;
2270 | minutesPlayed: number;
2271 | playersOutlived: number;
2272 | lastModified: string;
2273 | };
2274 | trio: {
2275 | score: number;
2276 | scorePerMin: number;
2277 | scorePerMatch: number;
2278 | wins: number;
2279 | top3: number;
2280 | top6: number;
2281 | kills: number;
2282 | killsPerMin: number;
2283 | killsPerMatch: number;
2284 | deaths: number;
2285 | kd: number;
2286 | matches: number;
2287 | winRate: number;
2288 | minutesPlayed: number;
2289 | playersOutlived: number;
2290 | lastModified: string;
2291 | };
2292 | squad: {
2293 | score: number;
2294 | scorePerMin: number;
2295 | scorePerMatch: number;
2296 | wins: number;
2297 | top3: number;
2298 | top6: number;
2299 | kills: number;
2300 | killsPerMin: number;
2301 | killsPerMatch: number;
2302 | deaths: number;
2303 | kd: number;
2304 | matches: number;
2305 | winRate: number;
2306 | minutesPlayed: number;
2307 | playersOutlived: number;
2308 | lastModified: string;
2309 | };
2310 | ltm: {
2311 | score: number;
2312 | scorePerMin: number;
2313 | scorePerMatch: number;
2314 | wins: number;
2315 | kills: number;
2316 | killsPerMin: number;
2317 | killsPerMatch: number;
2318 | deaths: number;
2319 | kd: number;
2320 | matches: number;
2321 | winRate: number;
2322 | minutesPlayed: number;
2323 | playersOutlived: number;
2324 | lastModified: string;
2325 | };
2326 | };
2327 | gamepad: {
2328 | overall: {
2329 | score: number;
2330 | scorePerMin: number;
2331 | scorePerMatch: number;
2332 | wins: number;
2333 | top3: number;
2334 | top5: number;
2335 | top6: number;
2336 | top10: number;
2337 | top12: number;
2338 | top25: number;
2339 | kills: number;
2340 | killsPerMin: number;
2341 | killsPerMatch: number;
2342 | deaths: number;
2343 | kd: number;
2344 | matches: number;
2345 | winRate: number;
2346 | minutesPlayed: number;
2347 | playersOutlived: number;
2348 | lastModified: string;
2349 | };
2350 | solo: {
2351 | score: number;
2352 | scorePerMin: number;
2353 | scorePerMatch: number;
2354 | wins: number;
2355 | top10: number;
2356 | top25: number;
2357 | kills: number;
2358 | killsPerMin: number;
2359 | killsPerMatch: number;
2360 | deaths: number;
2361 | kd: number;
2362 | matches: number;
2363 | winRate: number;
2364 | minutesPlayed: number;
2365 | playersOutlived: number;
2366 | lastModified: string;
2367 | };
2368 | duo: {
2369 | score: number;
2370 | scorePerMin: number;
2371 | scorePerMatch: number;
2372 | wins: number;
2373 | top5: number;
2374 | top12: number;
2375 | kills: number;
2376 | killsPerMin: number;
2377 | killsPerMatch: number;
2378 | deaths: number;
2379 | kd: number;
2380 | matches: number;
2381 | winRate: number;
2382 | minutesPlayed: number;
2383 | playersOutlived: number;
2384 | lastModified: string;
2385 | };
2386 | trio: {
2387 | score: number;
2388 | scorePerMin: number;
2389 | scorePerMatch: number;
2390 | wins: number;
2391 | top3: number;
2392 | top6: number;
2393 | kills: number;
2394 | killsPerMin: number;
2395 | killsPerMatch: number;
2396 | deaths: number;
2397 | kd: number;
2398 | matches: number;
2399 | winRate: number;
2400 | minutesPlayed: number;
2401 | playersOutlived: number;
2402 | lastModified: string;
2403 | };
2404 | squad: {
2405 | score: number;
2406 | scorePerMin: number;
2407 | scorePerMatch: number;
2408 | wins: number;
2409 | top3: number;
2410 | top6: number;
2411 | kills: number;
2412 | killsPerMin: number;
2413 | killsPerMatch: number;
2414 | deaths: number;
2415 | kd: number;
2416 | matches: number;
2417 | winRate: number;
2418 | minutesPlayed: number;
2419 | playersOutlived: number;
2420 | lastModified: string;
2421 | };
2422 | ltm: {
2423 | score: number;
2424 | scorePerMin: number;
2425 | scorePerMatch: number;
2426 | wins: number;
2427 | kills: number;
2428 | killsPerMin: number;
2429 | killsPerMatch: number;
2430 | deaths: number;
2431 | kd: number;
2432 | matches: number;
2433 | winRate: number;
2434 | minutesPlayed: number;
2435 | playersOutlived: number;
2436 | lastModified: string;
2437 | };
2438 | };
2439 | touch: {
2440 | overall: {
2441 | score: number;
2442 | scorePerMin: number;
2443 | scorePerMatch: number;
2444 | wins: number;
2445 | top3: number;
2446 | top5: number;
2447 | top6: number;
2448 | top10: number;
2449 | top12: number;
2450 | top25: number;
2451 | kills: number;
2452 | killsPerMin: number;
2453 | killsPerMatch: number;
2454 | deaths: number;
2455 | kd: number;
2456 | matches: number;
2457 | winRate: number;
2458 | minutesPlayed: number;
2459 | playersOutlived: number;
2460 | lastModified: string;
2461 | };
2462 | solo: {
2463 | score: number;
2464 | scorePerMin: number;
2465 | scorePerMatch: number;
2466 | wins: number;
2467 | top10: number;
2468 | top25: number;
2469 | kills: number;
2470 | killsPerMin: number;
2471 | killsPerMatch: number;
2472 | deaths: number;
2473 | kd: number;
2474 | matches: number;
2475 | winRate: number;
2476 | minutesPlayed: number;
2477 | playersOutlived: number;
2478 | lastModified: string;
2479 | };
2480 | duo: {
2481 | score: number;
2482 | scorePerMin: number;
2483 | scorePerMatch: number;
2484 | wins: number;
2485 | top5: number;
2486 | top12: number;
2487 | kills: number;
2488 | killsPerMin: number;
2489 | killsPerMatch: number;
2490 | deaths: number;
2491 | kd: number;
2492 | matches: number;
2493 | winRate: number;
2494 | minutesPlayed: number;
2495 | playersOutlived: number;
2496 | lastModified: string;
2497 | };
2498 | trio: {
2499 | score: number;
2500 | scorePerMin: number;
2501 | scorePerMatch: number;
2502 | wins: number;
2503 | top3: number;
2504 | top6: number;
2505 | kills: number;
2506 | killsPerMin: number;
2507 | killsPerMatch: number;
2508 | deaths: number;
2509 | kd: number;
2510 | matches: number;
2511 | winRate: number;
2512 | minutesPlayed: number;
2513 | playersOutlived: number;
2514 | lastModified: string;
2515 | };
2516 | squad: {
2517 | score: number;
2518 | scorePerMin: number;
2519 | scorePerMatch: number;
2520 | wins: number;
2521 | top3: number;
2522 | top6: number;
2523 | kills: number;
2524 | killsPerMin: number;
2525 | killsPerMatch: number;
2526 | deaths: number;
2527 | kd: number;
2528 | matches: number;
2529 | winRate: number;
2530 | minutesPlayed: number;
2531 | playersOutlived: number;
2532 | lastModified: string;
2533 | };
2534 | ltm: {
2535 | score: number;
2536 | scorePerMin: number;
2537 | scorePerMatch: number;
2538 | wins: number;
2539 | kills: number;
2540 | killsPerMin: number;
2541 | killsPerMatch: number;
2542 | deaths: number;
2543 | kd: number;
2544 | matches: number;
2545 | winRate: number;
2546 | minutesPlayed: number;
2547 | playersOutlived: number;
2548 | lastModified: string;
2549 | };
2550 | };
2551 | };
2552 | };
2553 | }
2554 |
2555 | export interface BRStatsRequestParams extends FortniteAPIRequestParams {
2556 | /**
2557 | * Sets the account name. Defaults to `none`
2558 | */
2559 | name: string;
2560 | /**
2561 | * Sets the account type. Defaults to `epic`
2562 | */
2563 | accountType?: 'epic' | 'psn' | 'xbl';
2564 | /**
2565 | * Sets the time window. Defaults to `lifetime`
2566 | */
2567 | timeWindow?: 'season' | 'lifetime';
2568 | /**
2569 | * Sets the platform for the generated image (example). Defaults to `none`
2570 | */
2571 | image?: 'all' | 'keyboardMouse' | 'gamepad' | 'touch' | 'none';
2572 | }
2573 |
2574 | /* -----------------------------------------------------
2575 | BR Stats by account ID
2576 | GET https://fortnite-api.com/v2/stats/br/v2/{accountId}
2577 | ----------------------------------------------------- */
2578 |
2579 | export interface BRStatsByAccountIDResponseData extends FortniteAPIResponseData {
2580 | data: {
2581 | account: {
2582 | id: string;
2583 | name: string;
2584 | };
2585 | battlePass: {
2586 | level: number;
2587 | progress: number;
2588 | };
2589 | image: string;
2590 | stats: {
2591 | all: {
2592 | overall: {
2593 | score: number;
2594 | scorePerMin: number;
2595 | scorePerMatch: number;
2596 | wins: number;
2597 | top3: number;
2598 | top5: number;
2599 | top6: number;
2600 | top10: number;
2601 | top12: number;
2602 | top25: number;
2603 | kills: number;
2604 | killsPerMin: number;
2605 | killsPerMatch: number;
2606 | deaths: number;
2607 | kd: number;
2608 | matches: number;
2609 | winRate: number;
2610 | minutesPlayed: number;
2611 | playersOutlived: number;
2612 | lastModified: string;
2613 | };
2614 | solo: {
2615 | score: number;
2616 | scorePerMin: number;
2617 | scorePerMatch: number;
2618 | wins: number;
2619 | top10: number;
2620 | top25: number;
2621 | kills: number;
2622 | killsPerMin: number;
2623 | killsPerMatch: number;
2624 | deaths: number;
2625 | kd: number;
2626 | matches: number;
2627 | winRate: number;
2628 | minutesPlayed: number;
2629 | playersOutlived: number;
2630 | lastModified: string;
2631 | };
2632 | duo: {
2633 | score: number;
2634 | scorePerMin: number;
2635 | scorePerMatch: number;
2636 | wins: number;
2637 | top5: number;
2638 | top12: number;
2639 | kills: number;
2640 | killsPerMin: number;
2641 | killsPerMatch: number;
2642 | deaths: number;
2643 | kd: number;
2644 | matches: number;
2645 | winRate: number;
2646 | minutesPlayed: number;
2647 | playersOutlived: number;
2648 | lastModified: string;
2649 | };
2650 | trio: {
2651 | score: number;
2652 | scorePerMin: number;
2653 | scorePerMatch: number;
2654 | wins: number;
2655 | top3: number;
2656 | top6: number;
2657 | kills: number;
2658 | killsPerMin: number;
2659 | killsPerMatch: number;
2660 | deaths: number;
2661 | kd: number;
2662 | matches: number;
2663 | winRate: number;
2664 | minutesPlayed: number;
2665 | playersOutlived: number;
2666 | lastModified: string;
2667 | };
2668 | squad: {
2669 | score: number;
2670 | scorePerMin: number;
2671 | scorePerMatch: number;
2672 | wins: number;
2673 | top3: number;
2674 | top6: number;
2675 | kills: number;
2676 | killsPerMin: number;
2677 | killsPerMatch: number;
2678 | deaths: number;
2679 | kd: number;
2680 | matches: number;
2681 | winRate: number;
2682 | minutesPlayed: number;
2683 | playersOutlived: number;
2684 | lastModified: string;
2685 | };
2686 | ltm: {
2687 | score: number;
2688 | scorePerMin: number;
2689 | scorePerMatch: number;
2690 | wins: number;
2691 | kills: number;
2692 | killsPerMin: number;
2693 | killsPerMatch: number;
2694 | deaths: number;
2695 | kd: number;
2696 | matches: number;
2697 | winRate: number;
2698 | minutesPlayed: number;
2699 | playersOutlived: number;
2700 | lastModified: string;
2701 | };
2702 | };
2703 | keyboardMouse: {
2704 | overall: {
2705 | score: number;
2706 | scorePerMin: number;
2707 | scorePerMatch: number;
2708 | wins: number;
2709 | top3: number;
2710 | top5: number;
2711 | top6: number;
2712 | top10: number;
2713 | top12: number;
2714 | top25: number;
2715 | kills: number;
2716 | killsPerMin: number;
2717 | killsPerMatch: number;
2718 | deaths: number;
2719 | kd: number;
2720 | matches: number;
2721 | winRate: number;
2722 | minutesPlayed: number;
2723 | playersOutlived: number;
2724 | lastModified: string;
2725 | };
2726 | solo: {
2727 | score: number;
2728 | scorePerMin: number;
2729 | scorePerMatch: number;
2730 | wins: number;
2731 | top10: number;
2732 | top25: number;
2733 | kills: number;
2734 | killsPerMin: number;
2735 | killsPerMatch: number;
2736 | deaths: number;
2737 | kd: number;
2738 | matches: number;
2739 | winRate: number;
2740 | minutesPlayed: number;
2741 | playersOutlived: number;
2742 | lastModified: string;
2743 | };
2744 | duo: {
2745 | score: number;
2746 | scorePerMin: number;
2747 | scorePerMatch: number;
2748 | wins: number;
2749 | top5: number;
2750 | top12: number;
2751 | kills: number;
2752 | killsPerMin: number;
2753 | killsPerMatch: number;
2754 | deaths: number;
2755 | kd: number;
2756 | matches: number;
2757 | winRate: number;
2758 | minutesPlayed: number;
2759 | playersOutlived: number;
2760 | lastModified: string;
2761 | };
2762 | trio: {
2763 | score: number;
2764 | scorePerMin: number;
2765 | scorePerMatch: number;
2766 | wins: number;
2767 | top3: number;
2768 | top6: number;
2769 | kills: number;
2770 | killsPerMin: number;
2771 | killsPerMatch: number;
2772 | deaths: number;
2773 | kd: number;
2774 | matches: number;
2775 | winRate: number;
2776 | minutesPlayed: number;
2777 | playersOutlived: number;
2778 | lastModified: string;
2779 | };
2780 | squad: {
2781 | score: number;
2782 | scorePerMin: number;
2783 | scorePerMatch: number;
2784 | wins: number;
2785 | top3: number;
2786 | top6: number;
2787 | kills: number;
2788 | killsPerMin: number;
2789 | killsPerMatch: number;
2790 | deaths: number;
2791 | kd: number;
2792 | matches: number;
2793 | winRate: number;
2794 | minutesPlayed: number;
2795 | playersOutlived: number;
2796 | lastModified: string;
2797 | };
2798 | ltm: {
2799 | score: number;
2800 | scorePerMin: number;
2801 | scorePerMatch: number;
2802 | wins: number;
2803 | kills: number;
2804 | killsPerMin: number;
2805 | killsPerMatch: number;
2806 | deaths: number;
2807 | kd: number;
2808 | matches: number;
2809 | winRate: number;
2810 | minutesPlayed: number;
2811 | playersOutlived: number;
2812 | lastModified: string;
2813 | };
2814 | };
2815 | gamepad: {
2816 | overall: {
2817 | score: number;
2818 | scorePerMin: number;
2819 | scorePerMatch: number;
2820 | wins: number;
2821 | top3: number;
2822 | top5: number;
2823 | top6: number;
2824 | top10: number;
2825 | top12: number;
2826 | top25: number;
2827 | kills: number;
2828 | killsPerMin: number;
2829 | killsPerMatch: number;
2830 | deaths: number;
2831 | kd: number;
2832 | matches: number;
2833 | winRate: number;
2834 | minutesPlayed: number;
2835 | playersOutlived: number;
2836 | lastModified: string;
2837 | };
2838 | solo: {
2839 | score: number;
2840 | scorePerMin: number;
2841 | scorePerMatch: number;
2842 | wins: number;
2843 | top10: number;
2844 | top25: number;
2845 | kills: number;
2846 | killsPerMin: number;
2847 | killsPerMatch: number;
2848 | deaths: number;
2849 | kd: number;
2850 | matches: number;
2851 | winRate: number;
2852 | minutesPlayed: number;
2853 | playersOutlived: number;
2854 | lastModified: string;
2855 | };
2856 | duo: {
2857 | score: number;
2858 | scorePerMin: number;
2859 | scorePerMatch: number;
2860 | wins: number;
2861 | top5: number;
2862 | top12: number;
2863 | kills: number;
2864 | killsPerMin: number;
2865 | killsPerMatch: number;
2866 | deaths: number;
2867 | kd: number;
2868 | matches: number;
2869 | winRate: number;
2870 | minutesPlayed: number;
2871 | playersOutlived: number;
2872 | lastModified: string;
2873 | };
2874 | trio: {
2875 | score: number;
2876 | scorePerMin: number;
2877 | scorePerMatch: number;
2878 | wins: number;
2879 | top3: number;
2880 | top6: number;
2881 | kills: number;
2882 | killsPerMin: number;
2883 | killsPerMatch: number;
2884 | deaths: number;
2885 | kd: number;
2886 | matches: number;
2887 | winRate: number;
2888 | minutesPlayed: number;
2889 | playersOutlived: number;
2890 | lastModified: string;
2891 | };
2892 | squad: {
2893 | score: number;
2894 | scorePerMin: number;
2895 | scorePerMatch: number;
2896 | wins: number;
2897 | top3: number;
2898 | top6: number;
2899 | kills: number;
2900 | killsPerMin: number;
2901 | killsPerMatch: number;
2902 | deaths: number;
2903 | kd: number;
2904 | matches: number;
2905 | winRate: number;
2906 | minutesPlayed: number;
2907 | playersOutlived: number;
2908 | lastModified: string;
2909 | };
2910 | ltm: {
2911 | score: number;
2912 | scorePerMin: number;
2913 | scorePerMatch: number;
2914 | wins: number;
2915 | kills: number;
2916 | killsPerMin: number;
2917 | killsPerMatch: number;
2918 | deaths: number;
2919 | kd: number;
2920 | matches: number;
2921 | winRate: number;
2922 | minutesPlayed: number;
2923 | playersOutlived: number;
2924 | lastModified: string;
2925 | };
2926 | };
2927 | touch: {
2928 | overall: {
2929 | score: number;
2930 | scorePerMin: number;
2931 | scorePerMatch: number;
2932 | wins: number;
2933 | top3: number;
2934 | top5: number;
2935 | top6: number;
2936 | top10: number;
2937 | top12: number;
2938 | top25: number;
2939 | kills: number;
2940 | killsPerMin: number;
2941 | killsPerMatch: number;
2942 | deaths: number;
2943 | kd: number;
2944 | matches: number;
2945 | winRate: number;
2946 | minutesPlayed: number;
2947 | playersOutlived: number;
2948 | lastModified: string;
2949 | };
2950 | solo: {
2951 | score: number;
2952 | scorePerMin: number;
2953 | scorePerMatch: number;
2954 | wins: number;
2955 | top10: number;
2956 | top25: number;
2957 | kills: number;
2958 | killsPerMin: number;
2959 | killsPerMatch: number;
2960 | deaths: number;
2961 | kd: number;
2962 | matches: number;
2963 | winRate: number;
2964 | minutesPlayed: number;
2965 | playersOutlived: number;
2966 | lastModified: string;
2967 | };
2968 | duo: {
2969 | score: number;
2970 | scorePerMin: number;
2971 | scorePerMatch: number;
2972 | wins: number;
2973 | top5: number;
2974 | top12: number;
2975 | kills: number;
2976 | killsPerMin: number;
2977 | killsPerMatch: number;
2978 | deaths: number;
2979 | kd: number;
2980 | matches: number;
2981 | winRate: number;
2982 | minutesPlayed: number;
2983 | playersOutlived: number;
2984 | lastModified: string;
2985 | };
2986 | trio: {
2987 | score: number;
2988 | scorePerMin: number;
2989 | scorePerMatch: number;
2990 | wins: number;
2991 | top3: number;
2992 | top6: number;
2993 | kills: number;
2994 | killsPerMin: number;
2995 | killsPerMatch: number;
2996 | deaths: number;
2997 | kd: number;
2998 | matches: number;
2999 | winRate: number;
3000 | minutesPlayed: number;
3001 | playersOutlived: number;
3002 | lastModified: string;
3003 | };
3004 | squad: {
3005 | score: number;
3006 | scorePerMin: number;
3007 | scorePerMatch: number;
3008 | wins: number;
3009 | top3: number;
3010 | top6: number;
3011 | kills: number;
3012 | killsPerMin: number;
3013 | killsPerMatch: number;
3014 | deaths: number;
3015 | kd: number;
3016 | matches: number;
3017 | winRate: number;
3018 | minutesPlayed: number;
3019 | playersOutlived: number;
3020 | lastModified: string;
3021 | };
3022 | ltm: {
3023 | score: number;
3024 | scorePerMin: number;
3025 | scorePerMatch: number;
3026 | wins: number;
3027 | kills: number;
3028 | killsPerMin: number;
3029 | killsPerMatch: number;
3030 | deaths: number;
3031 | kd: number;
3032 | matches: number;
3033 | winRate: number;
3034 | minutesPlayed: number;
3035 | playersOutlived: number;
3036 | lastModified: string;
3037 | };
3038 | };
3039 | };
3040 | };
3041 | }
3042 |
3043 | export interface BRStatsByAccountIDRequestParams extends FortniteAPIRequestParams {
3044 | /**
3045 | * Sets the time window. Defaults to `lifetime`
3046 | */
3047 | timeWindow?: 'season' | 'lifetime';
3048 | /**
3049 | * Sets the platform for the generated image (example). Defaults to `none`
3050 | */
3051 | image?: 'all' | 'keyboardMouse' | 'gamepad' | 'touch' | 'none';
3052 | }
3053 |
--------------------------------------------------------------------------------
/src/http/httpStructs.ts:
--------------------------------------------------------------------------------
1 | import { ResponseFlags } from '../../resources/enums';
2 |
3 | export interface FortniteAPIErrorData {
4 | status: number;
5 | error: string;
6 | }
7 |
8 | export interface FortniteAPIResponseData {
9 | status: number;
10 | data: any;
11 | }
12 |
13 | export interface FortniteAPIRequestParams {
14 | responseFlags?: ResponseFlags;
15 | }
16 |
--------------------------------------------------------------------------------
/src/util/util.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-restricted-syntax */
2 | /* eslint-disable import/prefer-default-export */
3 | import { URLSearchParams } from 'url';
4 |
5 | export const serializeParams = (params: any) => {
6 | const searchParams = new URLSearchParams();
7 |
8 | for (const [key, value] of Object.entries(params)) {
9 | if (Array.isArray(value)) {
10 | for (const singleValue of value) searchParams.append(key, singleValue);
11 | } else {
12 | searchParams.append(key, (value as any));
13 | }
14 | }
15 |
16 | return searchParams.toString();
17 | };
18 |
--------------------------------------------------------------------------------
/tests/client.test.js:
--------------------------------------------------------------------------------
1 | /* eslint-env jest */
2 | const { Client, Language } = require('../dist');
3 |
4 | describe('Client Initialization', () => {
5 | it('Successfully initializes without a config', () => {
6 | const client = new Client();
7 |
8 | expect(client).toBeInstanceOf(Client);
9 |
10 | expect(client.http).toBeDefined();
11 |
12 | expect(client.config).toBeDefined();
13 | expect(client.config.apiKey).toBeUndefined();
14 | expect(client.config.language).toBe('en');
15 | });
16 |
17 | it('Successfully initializes with a config', () => {
18 | const client = new Client({
19 | apiKey: 'example-key',
20 | language: Language.German,
21 | });
22 |
23 | expect(client).toBeInstanceOf(Client);
24 |
25 | expect(client.http).toBeDefined();
26 |
27 | expect(client.config).toBeDefined();
28 | expect(client.config.apiKey).toBe('example-key');
29 | expect(client.config.language).toBe(Language.German);
30 | });
31 | });
32 |
33 | describe('Client Methods (Without API Key)', () => {
34 | const client = new Client();
35 |
36 | it('Runs Client#aesKeys()', async () => {
37 | const response = await client.aesKeys();
38 |
39 | expect(response.status).toBe(200);
40 | expect(response.data).toBeDefined();
41 | });
42 |
43 | it('Runs Client#banners()', async () => {
44 | const response = await client.banners();
45 |
46 | expect(response.status).toBe(200);
47 | expect(response.data).toBeDefined();
48 | });
49 |
50 | it('Runs Client#bannerColors()', async () => {
51 | const response = await client.bannerColors();
52 |
53 | expect(response.status).toBe(200);
54 | expect(response.data).toBeDefined();
55 | });
56 |
57 | it('Runs Client#allCosmetics()', async () => {
58 | const response = await client.allCosmetics();
59 |
60 | expect(response.status).toBe(200);
61 | expect(response.data).toBeDefined();
62 | });
63 |
64 | it('Runs Client#brCosmeticsList()', async () => {
65 | const response = await client.brCosmeticsList();
66 |
67 | expect(response.status).toBe(200);
68 | expect(response.data).toBeDefined();
69 | });
70 |
71 | it('Runs Client#trackCosmeticsList()', async () => {
72 | const response = await client.trackCosmeticsList();
73 |
74 | expect(response.status).toBe(200);
75 | expect(response.data).toBeDefined();
76 | });
77 |
78 | it('Runs Client#instrumentCosmeticsList()', async () => {
79 | const response = await client.instrumentCosmeticsList();
80 |
81 | expect(response.status).toBe(200);
82 | expect(response.data).toBeDefined();
83 | });
84 |
85 | it('Runs Client#carCosmeticsList()', async () => {
86 | const response = await client.carCosmeticsList();
87 |
88 | expect(response.status).toBe(200);
89 | expect(response.data).toBeDefined();
90 | });
91 |
92 | it('Runs Client#legoCosmeticsList()', async () => {
93 | const response = await client.legoCosmeticsList();
94 |
95 | expect(response.status).toBe(200);
96 | expect(response.data).toBeDefined();
97 | });
98 |
99 | it('Runs Client#legoKitCosmeticsList()', async () => {
100 | const response = await client.legoKitCosmeticsList();
101 |
102 | expect(response.status).toBe(200);
103 | expect(response.data).toBeDefined();
104 | });
105 |
106 | it('Runs Client#beanCosmeticsList()', async () => {
107 | const response = await client.beanCosmeticsList();
108 |
109 | expect(response.status).toBe(200);
110 | expect(response.data).toBeDefined();
111 | });
112 |
113 | it('Runs Client#brCosmeticByID()', async () => {
114 | const response = await client.brCosmeticByID('CID_022_Athena_Commando_F');
115 |
116 | expect(response.status).toBe(200);
117 | expect(response.data).toBeDefined();
118 | });
119 |
120 | it('Runs Client#brCosmeticSearch()', async () => {
121 | const response = await client.brCosmeticSearch({ name: 'Recon', matchMethod: 'starts' });
122 |
123 | expect(response.status).toBe(200);
124 | expect(response.data).toBeDefined();
125 | });
126 |
127 | it('Runs Client#brCosmeticsSearch()', async () => {
128 | const response = await client.brCosmeticsSearch({ name: 'Recon', matchMethod: 'starts' });
129 |
130 | expect(response.status).toBe(200);
131 | expect(response.data).toBeDefined();
132 | });
133 |
134 | it('Runs Client#brCosmeticsSearchByIDs()', async () => {
135 | const response = await client.brCosmeticsSearchByIDs({ id: ['CID_022_Athena_Commando_F', 'CID_242_Athena_Commando_F_Bullseye'] });
136 |
137 | expect(response.status).toBe(200);
138 | expect(response.data).toBeDefined();
139 | });
140 |
141 | it('Runs Client#creatorCode()', async () => {
142 | const response = await client.creatorCode({ name: 'Ninja' });
143 |
144 | expect(response.status).toBe(200);
145 | expect(response.data).toBeDefined();
146 | });
147 |
148 | it('Runs Client#brMap()', async () => {
149 | const response = await client.brMap();
150 |
151 | expect(response.status).toBe(200);
152 | expect(response.data).toBeDefined();
153 | });
154 |
155 | it('Runs Client#news()', async () => {
156 | const response = await client.news();
157 |
158 | expect(response.status).toBe(200);
159 | expect(response.data).toBeDefined();
160 | });
161 |
162 | it('Runs Client#playlists()', async () => {
163 | const response = await client.playlists();
164 |
165 | expect(response.status).toBe(200);
166 | expect(response.data).toBeDefined();
167 | });
168 |
169 | it('Runs Client#playlistById()', async () => {
170 | const response = await client.playlistByID('Playlist_DefaultSolo');
171 |
172 | expect(response.status).toBe(200);
173 | expect(response.data).toBeDefined();
174 | });
175 |
176 | it('Runs Client#shop()', async () => {
177 | const response = await client.shop();
178 |
179 | expect(response.status).toBe(200);
180 | expect(response.data).toBeDefined();
181 | });
182 | });
183 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "strict": true,
4 | "moduleResolution": "node",
5 | "module": "commonjs",
6 | "target": "es2019",
7 | "lib": [
8 | "esnext",
9 | "esnext.array",
10 | "esnext.asynciterable",
11 | "esnext.intl",
12 | "esnext.symbol"
13 | ],
14 | "declaration": true,
15 | "sourceMap": true,
16 | "removeComments": false,
17 | "alwaysStrict": true,
18 | "pretty": true,
19 | "outDir": "dist",
20 | "incremental": true,
21 | "noEmitHelpers": true,
22 | "importHelpers": true,
23 | "skipLibCheck": true,
24 | "esModuleInterop": true,
25 | "resolveJsonModule": true
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const { EnvironmentPlugin } = require('webpack');
3 |
4 | module.exports = {
5 | entry: './index.ts',
6 | // devtool: 'inline-source-map',
7 | mode: 'production',
8 | module: {
9 | rules: [
10 | {
11 | test: /\.tsx?$/,
12 | use: 'ts-loader',
13 | exclude: /node_modules/,
14 | },
15 | ],
16 | },
17 | resolve: {
18 | extensions: ['.tsx', '.ts', '.js'],
19 | fallback: {
20 | url: false,
21 | },
22 | },
23 | output: {
24 | library: 'FNAPIcom',
25 | filename: 'FNAPIcom.js',
26 | path: path.resolve(__dirname),
27 | },
28 | plugins: [
29 | new EnvironmentPlugin({
30 | IS_BROWSER: 'true',
31 | }),
32 | ],
33 | };
34 |
--------------------------------------------------------------------------------