speedruncom.js 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/BaseClient.ts +2 -2
- package/src/build-client.ts +12 -5
- package/src/endpoints/endpoints.post.ts +17 -1
- package/dist/BaseClient.d.ts +0 -27
- package/dist/BaseClient.js +0 -110
- package/dist/Client.d.ts +0 -214
- package/dist/Client.js +0 -663
- package/dist/build-client.d.ts +0 -1
- package/dist/build-client.js +0 -42
- package/dist/endpoints/endpoints.get.d.ts +0 -410
- package/dist/endpoints/endpoints.get.js +0 -2
- package/dist/endpoints/endpoints.post.d.ts +0 -923
- package/dist/endpoints/endpoints.post.js +0 -2
- package/dist/enums.d.ts +0 -363
- package/dist/enums.js +0 -404
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -4
- package/dist/interfaces.d.ts +0 -1267
- package/dist/interfaces.js +0 -1
- package/dist/responses.d.ts +0 -633
- package/dist/responses.js +0 -1
- package/dist/types.d.ts +0 -3
- package/dist/types.js +0 -1
- package/src/Client.ts +0 -880
package/dist/build-client.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Project } from 'ts-morph';
|
|
2
|
-
const project = new Project({
|
|
3
|
-
tsConfigFilePath: "tsconfig.json",
|
|
4
|
-
});
|
|
5
|
-
const baseClient = project.getSourceFileOrThrow('src/BaseClient.ts');
|
|
6
|
-
const clientFile = project.createSourceFile('src/Client.ts', baseClient.getFullText(), { overwrite: true });
|
|
7
|
-
const clientClass = clientFile.getClasses()[1];
|
|
8
|
-
const getEndpointsFile = project.getSourceFileOrThrow('src/endpoints/endpoints.get.ts');
|
|
9
|
-
const postEndpointsFile = project.getSourceFileOrThrow('src/endpoints/endpoints.post.ts');
|
|
10
|
-
const responsesFile = project.getSourceFileOrThrow('src/responses.ts');
|
|
11
|
-
const getEndpointNames = Array.from(getEndpointsFile.getExportedDeclarations().keys());
|
|
12
|
-
const postEndpointNames = Array.from(postEndpointsFile.getExportedDeclarations().keys());
|
|
13
|
-
const responseNames = new Set(Array.from(responsesFile.getExportedDeclarations().keys()));
|
|
14
|
-
for (const endpointName of getEndpointNames) {
|
|
15
|
-
const returnType = responseNames.has(endpointName) ? `Promise<Responses.${endpointName}>` : 'Promise<void>';
|
|
16
|
-
clientClass.addMethod({
|
|
17
|
-
name: endpointName,
|
|
18
|
-
isAsync: true,
|
|
19
|
-
parameters: [{ name: 'params', type: `GetEndpoints.${endpointName}` }],
|
|
20
|
-
returnType,
|
|
21
|
-
statements: [`return await this.request('${endpointName}', params, 'post');`]
|
|
22
|
-
});
|
|
23
|
-
clientClass.addMethod({
|
|
24
|
-
name: endpointName,
|
|
25
|
-
isStatic: true,
|
|
26
|
-
isAsync: true,
|
|
27
|
-
parameters: [{ name: 'params', type: `GetEndpoints.${endpointName}` }],
|
|
28
|
-
returnType,
|
|
29
|
-
statements: [`return await this.request('${endpointName}', params, 'get');`]
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
for (const endpointName of postEndpointNames) {
|
|
33
|
-
const returnType = responseNames.has(endpointName) ? `Promise<Responses.${endpointName}>` : 'Promise<void>';
|
|
34
|
-
clientClass.addMethod({
|
|
35
|
-
name: endpointName,
|
|
36
|
-
isAsync: true,
|
|
37
|
-
parameters: [{ name: 'params', type: `PostEndpoints.${endpointName}` }],
|
|
38
|
-
returnType,
|
|
39
|
-
statements: [`return await this.request('${endpointName}', params, 'post');`]
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
clientFile.saveSync();
|
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
import * as Enums from '../enums.js';
|
|
2
|
-
import * as Interfaces from '../interfaces.js';
|
|
3
|
-
import { AtLeastOne } from '../types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Gets a leaderboard, with Players included.
|
|
6
|
-
* `GetGameLeaderboard` can fetch twice as many runs, and also fetches Games, Platforms, Regions, Values, and Variables.
|
|
7
|
-
*/
|
|
8
|
-
export interface GetGameLeaderboard2 {
|
|
9
|
-
/**
|
|
10
|
-
* Filtering parameters.
|
|
11
|
-
*/
|
|
12
|
-
params: Interfaces.LeaderboardParams;
|
|
13
|
-
/**
|
|
14
|
-
* The leaderboard page, in relation to `limit`.
|
|
15
|
-
*/
|
|
16
|
-
page?: number;
|
|
17
|
-
/**
|
|
18
|
-
* The limit of Runs per page.
|
|
19
|
-
* Max: 100
|
|
20
|
-
* @default 100
|
|
21
|
-
*/
|
|
22
|
-
limit?: number;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Gets a leaderboard, with all relevant items included.
|
|
26
|
-
* `GetGameLeaderboard2` only includes Runs and Players, and has half the maximum `limit`.
|
|
27
|
-
*/
|
|
28
|
-
export interface GetGameLeaderboard {
|
|
29
|
-
/**
|
|
30
|
-
* Filtering parameters.
|
|
31
|
-
*/
|
|
32
|
-
params: Interfaces.LeaderboardParams;
|
|
33
|
-
/**
|
|
34
|
-
* The leaderboard page, in relation to `limit`.
|
|
35
|
-
*/
|
|
36
|
-
page?: number;
|
|
37
|
-
/**
|
|
38
|
-
* The limit of Runs per page.
|
|
39
|
-
* Max: 200
|
|
40
|
-
* @default 100
|
|
41
|
-
*/
|
|
42
|
-
limit?: number;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Gets mostly leaderboard-related data of a game.
|
|
46
|
-
* Both parameters function the same. If both are included, `gameId` will override.
|
|
47
|
-
*/
|
|
48
|
-
interface GetGameData_Base {
|
|
49
|
-
/**
|
|
50
|
-
* ID of the game.
|
|
51
|
-
*/
|
|
52
|
-
gameId?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Game page URL.
|
|
55
|
-
*/
|
|
56
|
-
gameUrl?: string;
|
|
57
|
-
}
|
|
58
|
-
export type GetGameData = AtLeastOne<GetGameData_Base, 'gameId' | 'gameUrl'>;
|
|
59
|
-
/**
|
|
60
|
-
* Gets miscellaneous data of a game.
|
|
61
|
-
* Both parameters function the same. If both are included, `gameId` will override.
|
|
62
|
-
*/
|
|
63
|
-
interface GetGameSummary_Base {
|
|
64
|
-
/**
|
|
65
|
-
* ID of the game.
|
|
66
|
-
*/
|
|
67
|
-
gameId?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Game page URL.
|
|
70
|
-
*/
|
|
71
|
-
gameUrl?: string;
|
|
72
|
-
}
|
|
73
|
-
export type GetGameSummary = AtLeastOne<GetGameSummary_Base, 'gameId' | 'gameUrl'>;
|
|
74
|
-
/**
|
|
75
|
-
* Gets the world record history of a game leaderboard.
|
|
76
|
-
*/
|
|
77
|
-
export interface GetGameRecordHistory {
|
|
78
|
-
/**
|
|
79
|
-
* ID of the game. When exempted, both properties will be empty arrays.
|
|
80
|
-
*/
|
|
81
|
-
gameId?: string;
|
|
82
|
-
categoryId?: string;
|
|
83
|
-
values?: Interfaces.VariableValues[];
|
|
84
|
-
emulator?: Enums.EmulatorFilter;
|
|
85
|
-
obsolete?: Enums.ObsoleteFilter;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Searches for site items with a query.
|
|
89
|
-
*/
|
|
90
|
-
export interface GetSearch {
|
|
91
|
-
/**
|
|
92
|
-
* The text you are searching.
|
|
93
|
-
*/
|
|
94
|
-
query?: string;
|
|
95
|
-
/**
|
|
96
|
-
* todo
|
|
97
|
-
*/
|
|
98
|
-
favorExactMatches?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Whether or not you are searching for games.
|
|
101
|
-
*/
|
|
102
|
-
includeGames?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Whether or not you are searching for news.
|
|
105
|
-
*/
|
|
106
|
-
includeNews?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Whether or not you are searching for pages.
|
|
109
|
-
*/
|
|
110
|
-
includePages?: boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Whether or not you are searching for series.
|
|
113
|
-
*/
|
|
114
|
-
includeSeries?: boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Whether or not you are searching for users.
|
|
117
|
-
*/
|
|
118
|
-
includeUsers?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Whether or not you are searching for challenges.
|
|
121
|
-
*/
|
|
122
|
-
includeChallenges?: boolean;
|
|
123
|
-
/**
|
|
124
|
-
* The maximum amount of elements in each array.
|
|
125
|
-
* @default 100
|
|
126
|
-
* Max: 100
|
|
127
|
-
*/
|
|
128
|
-
limit?: number;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Gets non-obsolete latest runs.
|
|
132
|
-
*/
|
|
133
|
-
export interface GetLatestLeaderboard {
|
|
134
|
-
gameId?: string;
|
|
135
|
-
seriesId?: string;
|
|
136
|
-
/**
|
|
137
|
-
* The maximum amount of `runs` there will be in the response.
|
|
138
|
-
*
|
|
139
|
-
* Warning: Obsolete runs are not included, but still count to the limit.
|
|
140
|
-
*
|
|
141
|
-
* If this is `20` and 5 out of the 20 latest runs are obsolete, it will only return the 15 non-obsolete runs.
|
|
142
|
-
*
|
|
143
|
-
* @default 25
|
|
144
|
-
* Max: 99999
|
|
145
|
-
*/
|
|
146
|
-
limit?: number;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Gets a run.
|
|
150
|
-
*/
|
|
151
|
-
export interface GetRun {
|
|
152
|
-
/**
|
|
153
|
-
* ID of the run.
|
|
154
|
-
*/
|
|
155
|
-
runId: string;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Gets non-run related data of a user.
|
|
159
|
-
*/
|
|
160
|
-
export interface GetUserSummary {
|
|
161
|
-
/**
|
|
162
|
-
* Page URL of the user.
|
|
163
|
-
*/
|
|
164
|
-
url: string;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Gets comments posted by a user.
|
|
168
|
-
*/
|
|
169
|
-
export interface GetUserComments {
|
|
170
|
-
/**
|
|
171
|
-
* ID of the user.
|
|
172
|
-
*/
|
|
173
|
-
userId: string;
|
|
174
|
-
}
|
|
175
|
-
export interface GetUserThreads {
|
|
176
|
-
userId: string;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Gets data for user popovers (when you hover over a username).
|
|
180
|
-
*/
|
|
181
|
-
export interface GetUserPopoverData {
|
|
182
|
-
/**
|
|
183
|
-
* ID of the user.
|
|
184
|
-
*/
|
|
185
|
-
userId: string;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Gets all Titles in the site.
|
|
189
|
-
*/
|
|
190
|
-
export interface GetTitleList {
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Gets a Title.
|
|
194
|
-
*/
|
|
195
|
-
export interface GetTitle {
|
|
196
|
-
/**
|
|
197
|
-
* ID of the title.
|
|
198
|
-
*/
|
|
199
|
-
titleId: string;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Gets articles on the site.
|
|
203
|
-
*/
|
|
204
|
-
export interface GetArticleList {
|
|
205
|
-
/**
|
|
206
|
-
* Whether or not the article is published (verified by admin).
|
|
207
|
-
*/
|
|
208
|
-
published?: boolean;
|
|
209
|
-
/**
|
|
210
|
-
* Whether or not the article is rejected.
|
|
211
|
-
*/
|
|
212
|
-
rejected?: boolean;
|
|
213
|
-
/**
|
|
214
|
-
* A query to search for articles.
|
|
215
|
-
*/
|
|
216
|
-
search?: string;
|
|
217
|
-
/**
|
|
218
|
-
* Tags an article has.
|
|
219
|
-
*/
|
|
220
|
-
tags?: string[];
|
|
221
|
-
/**
|
|
222
|
-
* The target of an article, either being `news` or a page URL for site information articles.
|
|
223
|
-
*/
|
|
224
|
-
target?: string;
|
|
225
|
-
/**
|
|
226
|
-
* The maximum amount of articles included in the response.
|
|
227
|
-
*
|
|
228
|
-
* @default 500
|
|
229
|
-
* Max: 500
|
|
230
|
-
*/
|
|
231
|
-
limit?: number;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Gets a specific article from the site.
|
|
235
|
-
*/
|
|
236
|
-
export interface GetArticle {
|
|
237
|
-
id?: string;
|
|
238
|
-
slug?: string;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Gets a list of all games on the site.
|
|
242
|
-
*/
|
|
243
|
-
export interface GetGameList {
|
|
244
|
-
seriesId?: string;
|
|
245
|
-
platformId?: string;
|
|
246
|
-
search?: string;
|
|
247
|
-
orderType?: 1;
|
|
248
|
-
limit?: number;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Gets information for the home page. Often empty.
|
|
252
|
-
*/
|
|
253
|
-
export interface GetHomeSummary {
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Gets a list of series on the site.
|
|
257
|
-
*/
|
|
258
|
-
export interface GetSeriesList {
|
|
259
|
-
search?: string;
|
|
260
|
-
orderType?: 1;
|
|
261
|
-
limit?: number;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Gets most information pertinent to a series.
|
|
265
|
-
*/
|
|
266
|
-
export interface GetSeriesSummary {
|
|
267
|
-
seriesUrl?: string;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Gets the top 3 runs from all levels under a level category.
|
|
271
|
-
*/
|
|
272
|
-
export interface GetGameLevelSummary {
|
|
273
|
-
gameId: string;
|
|
274
|
-
categoryId: string;
|
|
275
|
-
dateFrom?: string;
|
|
276
|
-
dateTo?: string;
|
|
277
|
-
emulator?: Enums.EmulatorFilter;
|
|
278
|
-
/**
|
|
279
|
-
* If `categoryId: string` refers to a level category.
|
|
280
|
-
*/
|
|
281
|
-
levelId?: string;
|
|
282
|
-
obsolete?: Enums.ObsoleteFilter;
|
|
283
|
-
platformId?: string;
|
|
284
|
-
regionId?: string;
|
|
285
|
-
timer?: Enums.TimingMethod;
|
|
286
|
-
/**
|
|
287
|
-
* If runs other than verified should be included.
|
|
288
|
-
*/
|
|
289
|
-
verified?: Enums.RunStatus;
|
|
290
|
-
values?: Interfaces.VariableValues[];
|
|
291
|
-
video?: Enums.VideoFilter;
|
|
292
|
-
page?: number;
|
|
293
|
-
limit?: number;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Gets a random Game.
|
|
297
|
-
*/
|
|
298
|
-
export interface GetGameRandom {
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Gets all guides on a game.
|
|
302
|
-
*/
|
|
303
|
-
export interface GetGuideList {
|
|
304
|
-
gameId: string;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Get a specific guide by id.
|
|
308
|
-
*/
|
|
309
|
-
export interface GetGuide {
|
|
310
|
-
id: string;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Get a list of game news articles.
|
|
314
|
-
*/
|
|
315
|
-
export interface GetNewsList {
|
|
316
|
-
gameId: string;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Get a game news article.
|
|
320
|
-
*/
|
|
321
|
-
export interface GetNews {
|
|
322
|
-
id: string;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Get a list of a game's resources.
|
|
326
|
-
*/
|
|
327
|
-
export interface GetResourceList {
|
|
328
|
-
gameId: string;
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Gets a list of live runners.
|
|
332
|
-
*/
|
|
333
|
-
export interface GetStreamList {
|
|
334
|
-
seriesId?: string;
|
|
335
|
-
gameId?: string;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Get threads on a forum.
|
|
339
|
-
*/
|
|
340
|
-
export interface GetThreadList {
|
|
341
|
-
forumId: string;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Gets a comment post's Thread and Forum.
|
|
345
|
-
*/
|
|
346
|
-
export interface GetThreadStateByCommentId {
|
|
347
|
-
commentId: string;
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Get a specific Challenge.
|
|
351
|
-
*/
|
|
352
|
-
export interface GetChallenge {
|
|
353
|
-
id: string;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Get runs from a Challenge board.
|
|
357
|
-
*/
|
|
358
|
-
export interface GetChallengeLeaderboard {
|
|
359
|
-
challengeId: string;
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Get a sitewide leaderboard for users who have won the most in Challenges.
|
|
363
|
-
*/
|
|
364
|
-
export interface GetChallengeGlobalRankingList {
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Get a specific Challenge run (not the same as a normal run!)
|
|
368
|
-
*/
|
|
369
|
-
export interface GetChallengeRun {
|
|
370
|
-
id: string;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Get a user's runs for display on their profile.
|
|
374
|
-
*/
|
|
375
|
-
export interface GetUserLeaderboard {
|
|
376
|
-
userId: string;
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Gets game and series moderation stats for any user.
|
|
380
|
-
*/
|
|
381
|
-
export interface GetUserModeration {
|
|
382
|
-
userId: string;
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* Get a list of comments on an item.
|
|
386
|
-
*/
|
|
387
|
-
export interface GetCommentList {
|
|
388
|
-
itemId: string;
|
|
389
|
-
/**
|
|
390
|
-
* ItemType of the above `itemId: string;`
|
|
391
|
-
*/
|
|
392
|
-
itemType: Enums.ItemType;
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Get a specific thread.
|
|
396
|
-
*/
|
|
397
|
-
export interface GetThread {
|
|
398
|
-
id: string;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Get static data for the site. Including all areas, colors, gameTypes, platforms, etc.
|
|
402
|
-
*/
|
|
403
|
-
export interface GetStaticData {
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Get a list of site-wide forums. When logged in, may include forums of followed games.
|
|
407
|
-
*/
|
|
408
|
-
export interface GetForumList {
|
|
409
|
-
}
|
|
410
|
-
export {};
|