Skip to content

Commit 4747144

Browse files
committed
add responseFlags, update structs, update dependencies
1 parent 490b8a4 commit 4747144

File tree

6 files changed

+97
-80
lines changed

6 files changed

+97
-80
lines changed

package-lock.json

+13-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fnapicom",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"description": "JavaScript / TypeScript wrapper for Fortnite-API.com",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -47,7 +47,7 @@
4747
"webpack-cli": "^4.10.0"
4848
},
4949
"dependencies": {
50-
"axios": "^1.7.7",
50+
"axios": "^1.7.9",
5151
"axios-rate-limit": "^1.4.0",
5252
"tslib": "^2.8.1"
5353
}

resources/enums.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-bitwise */
12
/* eslint-disable no-unused-vars, import/prefer-default-export, no-shadow */
23
export enum Language {
34
Arabic = 'ar',
@@ -16,3 +17,10 @@ export enum Language {
1617
Chinese = 'zh-CN',
1718
MandarinChinese = 'zh-Hant'
1819
}
20+
21+
export enum ResponseFlags {
22+
None = 0,
23+
IncludePaths = 1 << 0,
24+
IncludeGameplayTags = 1 << 1,
25+
IncludeShopHistory = 1 << 2,
26+
}

src/client/Client.ts

+27-27
Original file line numberDiff line numberDiff line change
@@ -38,199 +38,199 @@ class Client {
3838
* Returns the current aes key
3939
* @param options Options for this endpoint
4040
*/
41-
public async aesKeys(options: AESKeysRequestParams): Promise<AESKeysResponseData> {
41+
public async aesKeys(options?: AESKeysRequestParams): Promise<AESKeysResponseData> {
4242
return this.http.fetch('/v2/aes', options);
4343
}
4444

4545
/**
4646
* Returns an array of all banners
4747
* @param options Options for this endpoint
4848
*/
49-
public async banners(options: BannersRequestParams): Promise<BannersResponseData> {
49+
public async banners(options?: BannersRequestParams): Promise<BannersResponseData> {
5050
return this.http.fetch('/v1/banners', options);
5151
}
5252

5353
/**
5454
* Returns an array of all banner colors
5555
* @param options Options for this endpoint
5656
*/
57-
public async bannerColors(options: BannerColorsRequestParams): Promise<BannerColorsResponseData> {
57+
public async bannerColors(options?: BannerColorsRequestParams): Promise<BannerColorsResponseData> {
5858
return this.http.fetch('/v1/banners/colors', options);
5959
}
6060

6161
/**
6262
* Returns data of all cosmetics
6363
* @param options Options for this endpoint
6464
*/
65-
public async allCosmetics(options: AllCosmeticsRequestParams): Promise<AllCosmeticsResponseData> {
65+
public async allCosmetics(options?: AllCosmeticsRequestParams): Promise<AllCosmeticsResponseData> {
6666
return this.http.fetch('/v2/cosmetics', options);
6767
}
6868

6969
/**
7070
* Returns data of the latest added cosmetics
7171
* @param options Options for this endpoint
7272
*/
73-
public async newCosmetics(options: NewCosmeticsRequestParams): Promise<NewCosmeticsResponseData> {
73+
public async newCosmetics(options?: NewCosmeticsRequestParams): Promise<NewCosmeticsResponseData> {
7474
return this.http.fetch('/v2/cosmetics/new', options);
7575
}
7676

7777
/**
7878
* Returns data of all battle royale cosmetics
7979
* @param options Options for this endpoint
8080
*/
81-
public async brCosmeticsList(options: BRCosmeticsListRequestParams): Promise<BRCosmeticsListResponseData> {
81+
public async brCosmeticsList(options?: BRCosmeticsListRequestParams): Promise<BRCosmeticsListResponseData> {
8282
return this.http.fetch('/v2/cosmetics/br', options);
8383
}
8484

8585
/**
8686
* Returns data of all track cosmetics
8787
* @param options Options for this endpoint
8888
*/
89-
public async trackCosmeticsList(options: TrackCosmeticsListRequestParams): Promise<TrackCosmeticsListResponseData> {
89+
public async trackCosmeticsList(options?: TrackCosmeticsListRequestParams): Promise<TrackCosmeticsListResponseData> {
9090
return this.http.fetch('/v2/cosmetics/tracks', options);
9191
}
9292

9393
/**
9494
* Returns data of all instrument cosmetics
9595
* @param options Options for this endpoint
9696
*/
97-
public async instrumentCosmeticsList(options: InstrumentCosmeticsListRequestParams): Promise<InstrumentCosmeticsListResponseData> {
97+
public async instrumentCosmeticsList(options?: InstrumentCosmeticsListRequestParams): Promise<InstrumentCosmeticsListResponseData> {
9898
return this.http.fetch('/v2/cosmetics/instruments', options);
9999
}
100100

101101
/**
102102
* Returns data of all car cosmetics
103103
* @param options Options for this endpoint
104104
*/
105-
public async carCosmeticsList(options: CarCosmeticsListRequestParams): Promise<CarCosmeticsListResponseData> {
105+
public async carCosmeticsList(options?: CarCosmeticsListRequestParams): Promise<CarCosmeticsListResponseData> {
106106
return this.http.fetch('/v2/cosmetics/cars', options);
107107
}
108108

109109
/**
110110
* Returns data of all lego cosmetics
111111
* @param options Options for this endpoint
112112
*/
113-
public async legoCosmeticsList(options: LegoCosmeticsListRequestParams): Promise<LegoCosmeticsListResponseData> {
113+
public async legoCosmeticsList(options?: LegoCosmeticsListRequestParams): Promise<LegoCosmeticsListResponseData> {
114114
return this.http.fetch('/v2/cosmetics/lego', options);
115115
}
116116

117117
/**
118118
* Returns data of all lego kit cosmetics
119119
* @param options Options for this endpoint
120120
*/
121-
public async legoKitCosmeticsList(options: LegoKitCosmeticsListRequestParams): Promise<LegoKitCosmeticsListResponseData> {
121+
public async legoKitCosmeticsList(options?: LegoKitCosmeticsListRequestParams): Promise<LegoKitCosmeticsListResponseData> {
122122
return this.http.fetch('/v2/cosmetics/lego/kits', options);
123123
}
124124

125125
/**
126126
* Returns data of all bean aka fall guys cosmetics
127127
* @param options Options for this endpoint
128128
*/
129-
public async beanCosmeticsList(options: BeanCosmeticsListRequestParams): Promise<BeanCosmeticsListResponseData> {
129+
public async beanCosmeticsList(options?: BeanCosmeticsListRequestParams): Promise<BeanCosmeticsListResponseData> {
130130
return this.http.fetch('/v2/cosmetics/beans', options);
131131
}
132132

133133
/**
134134
* Returns data of the requested battle royale cosmetic-id
135135
* @param options Options for this endpoint
136136
*/
137-
public async brCosmeticByID(cosmeticId: string, options: BRCosmeticByIDRequestParams): Promise<BRCosmeticByIDResponseData> {
137+
public async brCosmeticByID(cosmeticId: string, options?: BRCosmeticByIDRequestParams): Promise<BRCosmeticByIDResponseData> {
138138
return this.http.fetch(`/v2/cosmetics/br/${cosmeticId}`, options);
139139
}
140140

141141
/**
142142
* Returns data of the first battle royale cosmetic which matches the search parameter(s)
143143
* @param options Options for this endpoint
144144
*/
145-
public async brCosmeticSearch(options: BRCosmeticSearchRequestParams): Promise<BRCosmeticSearchResponseData> {
145+
public async brCosmeticSearch(options?: BRCosmeticSearchRequestParams): Promise<BRCosmeticSearchResponseData> {
146146
return this.http.fetch('/v2/cosmetics/br/search', options);
147147
}
148148

149149
/**
150150
* Returns an array of all battle royale cosmetics which match the search parameter(s)
151151
* @param options Options for this endpoint
152152
*/
153-
public async brCosmeticsSearch(options: BRCosmeticsSearchRequestParams): Promise<BRCosmeticsSearchResponseData> {
153+
public async brCosmeticsSearch(options?: BRCosmeticsSearchRequestParams): Promise<BRCosmeticsSearchResponseData> {
154154
return this.http.fetch('/v2/cosmetics/br/search/all', options);
155155
}
156156

157157
/**
158158
* Returns an array of the requested battle royale cosmetic ids
159159
* @param options Options for this endpoint
160160
*/
161-
public async brCosmeticsSearchByIDs(options: BRCosmeticsSearchByIDsRequestParams): Promise<BRCosmeticsSearchByIDsResponseData> {
161+
public async brCosmeticsSearchByIDs(options?: BRCosmeticsSearchByIDsRequestParams): Promise<BRCosmeticsSearchByIDsResponseData> {
162162
return this.http.fetch('/v2/cosmetics/br/search/ids', options);
163163
}
164164

165165
/**
166166
* Returns data of a creator code by its name
167167
* @param options Options for this endpoint
168168
*/
169-
public async creatorCode(options: CreatorCodeRequestParams): Promise<CreatorCodeResponseData> {
169+
public async creatorCode(options?: CreatorCodeRequestParams): Promise<CreatorCodeResponseData> {
170170
return this.http.fetch('/v2/creatorcode', options);
171171
}
172172

173173
/**
174174
* Returns data & images of the BR map & POIs
175175
* @param options Options for this endpoint
176176
*/
177-
public async brMap(options: BRMapRequestParams): Promise<BRMapResponseData> {
177+
public async brMap(options?: BRMapRequestParams): Promise<BRMapResponseData> {
178178
return this.http.fetch('/v1/map', options);
179179
}
180180

181181
/**
182182
* Returns data of the current battle royale, save the world & creative news
183183
* @param options Options for this endpoint
184184
*/
185-
public async news(options: NewsRequestParams): Promise<NewsResponseData> {
185+
public async news(options?: NewsRequestParams): Promise<NewsResponseData> {
186186
return this.http.fetch('/v2/news', options);
187187
}
188188

189189
/**
190190
* Returns data of the current battle royale news
191191
* @param options Options for this endpoint
192192
*/
193-
public async brNews(options: BRNewsRequestParams): Promise<BRNewsResponseData> {
193+
public async brNews(options?: BRNewsRequestParams): Promise<BRNewsResponseData> {
194194
return this.http.fetch('/v2/news/br', options);
195195
}
196196

197197
/**
198198
* Returns data of the current save the world news
199199
* @param options Options for this endpoint
200200
*/
201-
public async stwNews(options: STWNewsRequestParams): Promise<STWNewsResponseData> {
201+
public async stwNews(options?: STWNewsRequestParams): Promise<STWNewsResponseData> {
202202
return this.http.fetch('/v2/news/stw', options);
203203
}
204204

205205
/**
206206
* Returns data of the current creative news
207207
* @param options Options for this endpoint
208208
*/
209-
public async creativeNews(options: CreativeNewsRequestParams): Promise<CreativeNewsResponseData> {
209+
public async creativeNews(options?: CreativeNewsRequestParams): Promise<CreativeNewsResponseData> {
210210
return this.http.fetch('/v2/news/creative', options);
211211
}
212212

213213
/**
214214
* Returns an array of all playlists
215215
* @param options Options for this endpoint
216216
*/
217-
public async playlists(options: PlaylistsRequestParams): Promise<PlaylistsResponseData> {
217+
public async playlists(options?: PlaylistsRequestParams): Promise<PlaylistsResponseData> {
218218
return this.http.fetch('/v1/playlists', options);
219219
}
220220

221221
/**
222222
* Returns data of the requested playlist-id
223223
* @param options Options for this endpoint
224224
*/
225-
public async playlistByID(playlistId: string, options: PlaylistByIDRequestParams): Promise<PlaylistByIDResponseData> {
225+
public async playlistByID(playlistId: string, options?: PlaylistByIDRequestParams): Promise<PlaylistByIDResponseData> {
226226
return this.http.fetch(`/v1/playlists/${playlistId}`, options);
227227
}
228228

229229
/**
230230
* Returns data of the current shop
231231
* @param options Options for this endpoint
232232
*/
233-
public async shop(options: ShopRequestParams): Promise<ShopResponseData> {
233+
public async shop(options?: ShopRequestParams): Promise<ShopResponseData> {
234234
return this.http.fetch('/v2/shop', options);
235235
}
236236

@@ -239,7 +239,7 @@ class Client {
239239
* Note: trios stats will always be null
240240
* @param options Options for this endpoint
241241
*/
242-
public async brStats(options: BRStatsRequestParams): Promise<BRStatsResponseData> {
242+
public async brStats(options?: BRStatsRequestParams): Promise<BRStatsResponseData> {
243243
return this.http.fetchStats('/v2/stats/br/v2', options);
244244
}
245245

@@ -248,7 +248,7 @@ class Client {
248248
* Note: trios stats will always be null
249249
* @param options Options for this endpoint
250250
*/
251-
public async brStatsByAccountID(accountId: string, options: BRStatsByAccountIDRequestParams): Promise<BRStatsByAccountIDResponseData> {
251+
public async brStatsByAccountID(accountId: string, options?: BRStatsByAccountIDRequestParams): Promise<BRStatsByAccountIDResponseData> {
252252
return this.http.fetchStats(`/v2/stats/br/v2/${accountId}`, options);
253253
}
254254
}

0 commit comments

Comments
 (0)