speedruncom.js 1.2.5 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Client.d.ts +4 -4
- package/dist/Client.js +8 -8
- package/dist/build-client.js +6 -5
- package/dist/endpoints/endpoints.get.d.ts +4 -46
- package/package.json +3 -2
- package/src/build-client.ts +8 -5
- package/src/endpoints/endpoints.get.ts +5 -56
package/dist/Client.d.ts
CHANGED
|
@@ -193,13 +193,13 @@ export default class Client {
|
|
|
193
193
|
GetUserBlocks(): Promise<Readonly<Responses.GetUserBlocks>>;
|
|
194
194
|
PutUserBlock(params: PostEndpoints.PutUserBlock): Promise<void>;
|
|
195
195
|
PutGame(params: PostEndpoints.PutGame): Promise<Readonly<Responses.PutGame>>;
|
|
196
|
-
PutGameModerator(): Promise<void>;
|
|
196
|
+
PutGameModerator(params: PostEndpoints.PutGameModerator): Promise<void>;
|
|
197
197
|
PutGameModeratorDelete(params: PostEndpoints.PutGameModeratorDelete): Promise<void>;
|
|
198
198
|
PutSeriesGame(params: PostEndpoints.PutSeriesGame): Promise<void>;
|
|
199
199
|
PutSeriesGameDelete(params: PostEndpoints.PutSeriesGameDelete): Promise<void>;
|
|
200
|
-
PutSeriesModerator(): Promise<void>;
|
|
201
|
-
PutSeriesModeratorUpdate(): Promise<void>;
|
|
202
|
-
PutSeriesModeratorDelete(): Promise<void>;
|
|
200
|
+
PutSeriesModerator(params: PostEndpoints.PutSeriesModerator): Promise<void>;
|
|
201
|
+
PutSeriesModeratorUpdate(params: PostEndpoints.PutSeriesModeratorUpdate): Promise<void>;
|
|
202
|
+
PutSeriesModeratorDelete(params: PostEndpoints.PutSeriesModeratorDelete): Promise<void>;
|
|
203
203
|
PutSeriesSettings(params: PostEndpoints.PutSeriesSettings): Promise<void>;
|
|
204
204
|
PutTicket(params: PostEndpoints.PutTicket): Promise<Readonly<Responses.PutTicket>>;
|
|
205
205
|
PutTicketNote(params: PostEndpoints.PutTicketNote): Promise<void>;
|
package/dist/Client.js
CHANGED
|
@@ -556,8 +556,8 @@ class Client {
|
|
|
556
556
|
async PutGame(params) {
|
|
557
557
|
return await this.request('PutGame', params);
|
|
558
558
|
}
|
|
559
|
-
async PutGameModerator() {
|
|
560
|
-
return await this.request('PutGameModerator');
|
|
559
|
+
async PutGameModerator(params) {
|
|
560
|
+
return await this.request('PutGameModerator', params);
|
|
561
561
|
}
|
|
562
562
|
async PutGameModeratorDelete(params) {
|
|
563
563
|
return await this.request('PutGameModeratorDelete', params);
|
|
@@ -568,14 +568,14 @@ class Client {
|
|
|
568
568
|
async PutSeriesGameDelete(params) {
|
|
569
569
|
return await this.request('PutSeriesGameDelete', params);
|
|
570
570
|
}
|
|
571
|
-
async PutSeriesModerator() {
|
|
572
|
-
return await this.request('PutSeriesModerator');
|
|
571
|
+
async PutSeriesModerator(params) {
|
|
572
|
+
return await this.request('PutSeriesModerator', params);
|
|
573
573
|
}
|
|
574
|
-
async PutSeriesModeratorUpdate() {
|
|
575
|
-
return await this.request('PutSeriesModeratorUpdate');
|
|
574
|
+
async PutSeriesModeratorUpdate(params) {
|
|
575
|
+
return await this.request('PutSeriesModeratorUpdate', params);
|
|
576
576
|
}
|
|
577
|
-
async PutSeriesModeratorDelete() {
|
|
578
|
-
return await this.request('PutSeriesModeratorDelete');
|
|
577
|
+
async PutSeriesModeratorDelete(params) {
|
|
578
|
+
return await this.request('PutSeriesModeratorDelete', params);
|
|
579
579
|
}
|
|
580
580
|
async PutSeriesSettings(params) {
|
|
581
581
|
return await this.request('PutSeriesSettings', params);
|
package/dist/build-client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Project } from 'ts-morph';
|
|
1
|
+
import { Project, Node } from 'ts-morph';
|
|
2
2
|
const project = new Project({
|
|
3
3
|
tsConfigFilePath: "tsconfig.json",
|
|
4
4
|
});
|
|
@@ -7,15 +7,16 @@ const isInterfaceEmpty = (interfaceName, sourceFile) => {
|
|
|
7
7
|
if (!declarations || declarations.length === 0)
|
|
8
8
|
return false;
|
|
9
9
|
const decl = declarations[0];
|
|
10
|
-
if (!
|
|
10
|
+
if (!Node.isInterfaceDeclaration(decl))
|
|
11
11
|
return false;
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const type = decl.getType();
|
|
13
|
+
const allProperties = type.getProperties();
|
|
14
|
+
return allProperties.length === 0;
|
|
14
15
|
};
|
|
15
16
|
const isInterfaceAllOptional = (name, sourceFile) => {
|
|
16
17
|
const iface = sourceFile.getInterface(name);
|
|
17
18
|
if (iface) {
|
|
18
|
-
return iface.getProperties().every(p => p.
|
|
19
|
+
return iface.getType().getProperties().every(p => p.isOptional());
|
|
19
20
|
}
|
|
20
21
|
const typeNode = sourceFile.getTypeAliasOrThrow(name).getType();
|
|
21
22
|
return typeNode
|
|
@@ -81,52 +81,10 @@ export type GetGameSummary = AtLeastOne<GetGameSummary_Base, 'gameId' | 'gameUrl
|
|
|
81
81
|
* Gets the world record history of a game leaderboard.
|
|
82
82
|
*/
|
|
83
83
|
export interface GetGameRecordHistory {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
categoryId?: string;
|
|
89
|
-
/**
|
|
90
|
-
* `EmulatorFilter` to filter the leaderboard by.
|
|
91
|
-
*/
|
|
92
|
-
emulator?: Enums.EmulatorFilter;
|
|
93
|
-
/**
|
|
94
|
-
* ID of the game. When exempted, the lists will be empty arrays.
|
|
95
|
-
*/
|
|
96
|
-
gameId?: string;
|
|
97
|
-
/**
|
|
98
|
-
* `ObsoleteFilter` to filter the leaderboard by.
|
|
99
|
-
*/
|
|
100
|
-
obsolete?: Enums.ObsoleteFilter;
|
|
101
|
-
/**
|
|
102
|
-
* IDs of platforms to filter the leaderboard by.
|
|
103
|
-
*
|
|
104
|
-
* All Platforms can be fetched with `GetPlatformList`.
|
|
105
|
-
*/
|
|
106
|
-
platformIds?: string[];
|
|
107
|
-
/**
|
|
108
|
-
* IDs of regions to filter the leaderboard by.
|
|
109
|
-
*
|
|
110
|
-
* All Regions can be fetched with `GetStaticData.regionList`.
|
|
111
|
-
*/
|
|
112
|
-
regionIds?: string[];
|
|
113
|
-
/**
|
|
114
|
-
* `TimingMethod` to filter the leaderboard by.
|
|
115
|
-
*/
|
|
116
|
-
timer?: Enums.TimingMethod;
|
|
117
|
-
/**
|
|
118
|
-
* `RunStatus` to filter the leaderboard by.
|
|
119
|
-
*/
|
|
120
|
-
verified?: Enums.RunStatus;
|
|
121
|
-
/**
|
|
122
|
-
* `VariableValues` to filter the leaderboard by.
|
|
123
|
-
*/
|
|
124
|
-
values?: Interfaces.VariableValues[];
|
|
125
|
-
/**
|
|
126
|
-
* `VideoState` of runs to filter the leaderboard by.
|
|
127
|
-
*/
|
|
128
|
-
video?: Enums.VideoState;
|
|
129
|
-
};
|
|
84
|
+
/**
|
|
85
|
+
* Leaderboard to fetch record history of.
|
|
86
|
+
*/
|
|
87
|
+
params?: Interfaces.LeaderboardParams;
|
|
130
88
|
/**
|
|
131
89
|
* The limit of Runs per page.
|
|
132
90
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "speedruncom.js",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "WIP NodeJS module for Speedrun's version 2 API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"clean": "rimraf dist src/Client.ts",
|
|
19
19
|
"build": "tsc",
|
|
20
|
-
"
|
|
20
|
+
"render": "tsx src/build-client.ts",
|
|
21
|
+
"prepare": "npm run render && npm run build"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/node": "^22.15.24",
|
package/src/build-client.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Project, SourceFile,
|
|
1
|
+
import { Project, SourceFile, Node, OptionalKind, MethodDeclarationStructure } from 'ts-morph';
|
|
2
2
|
|
|
3
3
|
const project = new Project({
|
|
4
4
|
tsConfigFilePath: "tsconfig.json",
|
|
@@ -9,16 +9,19 @@ const isInterfaceEmpty = (interfaceName: string, sourceFile: SourceFile) => {
|
|
|
9
9
|
if (!declarations || declarations.length === 0) return false;
|
|
10
10
|
|
|
11
11
|
const decl = declarations[0];
|
|
12
|
-
if (!
|
|
12
|
+
if (!Node.isInterfaceDeclaration(decl)) return false;
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const type = decl.getType();
|
|
15
|
+
const allProperties = type.getProperties();
|
|
16
|
+
|
|
17
|
+
return allProperties.length === 0;
|
|
16
18
|
};
|
|
17
19
|
|
|
20
|
+
|
|
18
21
|
const isInterfaceAllOptional = (name: string, sourceFile: SourceFile) => {
|
|
19
22
|
const iface = sourceFile.getInterface(name);
|
|
20
23
|
if (iface) {
|
|
21
|
-
return iface.getProperties().every(p => p.
|
|
24
|
+
return iface.getType().getProperties().every(p => p.isOptional());
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
const typeNode = sourceFile.getTypeAliasOrThrow(name).getType();
|
|
@@ -101,62 +101,11 @@ export type GetGameSummary = AtLeastOne<GetGameSummary_Base, 'gameId' | 'gameUrl
|
|
|
101
101
|
* Gets the world record history of a game leaderboard.
|
|
102
102
|
*/
|
|
103
103
|
export interface GetGameRecordHistory {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
categoryId?: string;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* `EmulatorFilter` to filter the leaderboard by.
|
|
113
|
-
*/
|
|
114
|
-
emulator?: Enums.EmulatorFilter;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* ID of the game. When exempted, the lists will be empty arrays.
|
|
118
|
-
*/
|
|
119
|
-
gameId?: string;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* `ObsoleteFilter` to filter the leaderboard by.
|
|
123
|
-
*/
|
|
124
|
-
obsolete?: Enums.ObsoleteFilter;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* IDs of platforms to filter the leaderboard by.
|
|
128
|
-
*
|
|
129
|
-
* All Platforms can be fetched with `GetPlatformList`.
|
|
130
|
-
*/
|
|
131
|
-
platformIds?: string[];
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* IDs of regions to filter the leaderboard by.
|
|
135
|
-
*
|
|
136
|
-
* All Regions can be fetched with `GetStaticData.regionList`.
|
|
137
|
-
*/
|
|
138
|
-
regionIds?: string[];
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* `TimingMethod` to filter the leaderboard by.
|
|
142
|
-
*/
|
|
143
|
-
timer?: Enums.TimingMethod;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* `RunStatus` to filter the leaderboard by.
|
|
147
|
-
*/
|
|
148
|
-
verified?: Enums.RunStatus,
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* `VariableValues` to filter the leaderboard by.
|
|
152
|
-
*/
|
|
153
|
-
values?: Interfaces.VariableValues[];
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* `VideoState` of runs to filter the leaderboard by.
|
|
157
|
-
*/
|
|
158
|
-
video?: Enums.VideoState;
|
|
159
|
-
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Leaderboard to fetch record history of.
|
|
107
|
+
*/
|
|
108
|
+
params?: Interfaces.LeaderboardParams;
|
|
160
109
|
|
|
161
110
|
/**
|
|
162
111
|
* The limit of Runs per page.
|