speedruncom.js 1.1.0 → 1.2.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.
@@ -1,16 +1,26 @@
1
1
  import * as Enums from '../enums.js';
2
2
  import * as Interfaces from '../interfaces.js';
3
+ import { AtLeastOne } from '../types.js';
3
4
  /**
4
- * Logs in. If 2FA is enabled first provide `name` & `password` then check `tokenChallengeSent` and repeat w/ token.
5
- * Recommended to use `login(username password)` and `setToken(token)` for automatic Client authentication.
5
+ * Logs in by giving a `set-cookie` header in a response with a `PHPSESSID` cookie.
6
+ *
7
+ * The first (or only) call only must have only the `name` and `password` params.
8
+ *
9
+ * If the account has 2 factor authentication (indicated by `loggedIn = false` and `tokenChallengeSent = true`), a 5-digit code will be sent to the account's email. Then a second call with `name`, `password`, and `token` (the token provided in the email) will authenticate.
6
10
  */
7
11
  export interface PutAuthLogin {
12
+ /**
13
+ * The username of the account.
14
+ */
8
15
  name: string;
16
+ /**
17
+ * The password of the account.
18
+ */
9
19
  password: string;
10
20
  /**
11
- * On second attempt if 2FA is enabled.
21
+ * Five-digit token sent to the account's email after a call to an account that has 2 factor authentication.
12
22
  */
13
- token: string;
23
+ token?: string;
14
24
  }
15
25
  /**
16
26
  * Gets information about the current user's session.
@@ -25,116 +35,233 @@ export interface PutSessionPing {
25
35
  }
26
36
  /**
27
37
  * Gets a game, series, or your account's audit log.
38
+ *
28
39
  * If getting a game or series audit log, you must be a Super Moderator for it.
29
- * If getting your account's audit log, you cannot be banned.
40
+ *
41
+ * If getting your account's audit log, your account must not be banned.
42
+ *
43
+ * If multiple item ID parameters are called, it will fetch events concurrent to the items (ex. getting added as a moderator to the game).
30
44
  */
31
- export interface GetAuditLogList {
45
+ interface GetAuditLogList_Base {
32
46
  /**
33
- * A single `EventType` string enum to filter by.
47
+ * An `EventType` of an event.
34
48
  */
35
49
  eventType?: Enums.EventType;
36
- page?: number;
50
+ /**
51
+ * ID of a game.
52
+ */
37
53
  gameId?: string;
54
+ /**
55
+ * ID of a series.
56
+ */
38
57
  seriesId?: string;
39
58
  /**
40
- * Every change that has happened to this user's account.
59
+ * ID of the user.
41
60
  */
42
61
  userId?: string;
62
+ /**
63
+ * The maximum amount of `AuditLogEntry`s to fetch.
64
+ */
65
+ limit?: number;
66
+ /**
67
+ * The audit log page, in relation to `limit`.
68
+ */
69
+ page?: number;
43
70
  }
71
+ export type GetAuditLogList = AtLeastOne<GetAuditLogList_Base, 'gameId' | 'seriesId' | 'userId'>;
44
72
  /**
45
- * Get a game's settings. Must be at least a verifier on the game.
73
+ * Gets a game's settings.
74
+ *
75
+ * You must be a verifier, moderator, or super moderator in the game.
46
76
  */
47
77
  export interface GetGameSettings {
78
+ /**
79
+ * ID of the game.
80
+ */
48
81
  gameId: string;
49
82
  }
50
83
  /**
51
- * Set a game's settings. Must be at least a moderator on the game.
84
+ * Set a game's settings.
85
+ *
86
+ * You must be a moderator or super moderator in a game.
52
87
  */
53
88
  export interface PutGameSettings {
54
89
  /**
55
- * Must be provided even though `settings` contains `id`.
90
+ * ID of the game.
56
91
  */
57
92
  gameId: string;
93
+ /**
94
+ * New game settings.
95
+ */
58
96
  settings: Interfaces.GameSettings;
59
97
  }
60
98
  /**
61
99
  * Creates a new category.
62
100
  */
63
101
  export interface PutCategory {
102
+ /**
103
+ * ID of the game.
104
+ */
64
105
  gameId: string;
106
+ /**
107
+ * Settings for the new category.
108
+ */
65
109
  category: Interfaces.Category;
66
110
  }
67
111
  /**
68
112
  * Updates an existing category.
69
113
  */
70
114
  export interface PutCategoryUpdate {
115
+ /**
116
+ * ID of the game the category is on.
117
+ */
71
118
  gameId: string;
119
+ /**
120
+ * ID of the category.
121
+ */
72
122
  categoryId: string;
123
+ /**
124
+ * New settings for the category.
125
+ */
73
126
  category: Interfaces.Category;
74
127
  }
75
128
  /**
76
129
  * Archives a category.
77
130
  */
78
131
  export interface PutCategoryArchive {
132
+ /**
133
+ * ID of the game the category is on.
134
+ */
79
135
  gameId: string;
136
+ /**
137
+ * ID of the category to archive.
138
+ */
80
139
  categoryId: string;
81
140
  }
82
141
  /**
83
142
  * Restores an archived category.
84
143
  */
85
144
  export interface PutCategoryRestore {
145
+ /**
146
+ * ID of the game that the category to restore is on.
147
+ */
86
148
  gameId: string;
149
+ /**
150
+ * ID of the category to restore.
151
+ */
87
152
  categoryId: string;
88
153
  }
89
154
  /**
90
- * Re-orders categories.
155
+ * Re-orders game categories.
156
+ *
157
+ * You must be a moderator or super moderator of the game.
91
158
  */
92
159
  export interface PutCategoryOrder {
160
+ /**
161
+ * ID of the game to order categories on.
162
+ */
93
163
  gameId: string;
94
- categoryId: string;
164
+ /**
165
+ * The new order of categories.
166
+ */
167
+ categoryIds: string[];
95
168
  }
96
169
  /**
97
- * Creates a new level.
170
+ * Creates a new game Level.
171
+ *
172
+ * You must be a moderator or super moderator of the game.
98
173
  */
99
174
  export interface PutLevel {
175
+ /**
176
+ * ID of the game to put the level on.
177
+ */
100
178
  gameId: string;
101
- level: Interfaces.Level;
179
+ /**
180
+ * Settings for the new level.
181
+ */
182
+ level: Interfaces.NewLevel;
102
183
  }
103
184
  /**
104
185
  * Updates an existing level.
186
+ *
187
+ * You must be a moderator or super moderator of the level's game.
105
188
  */
106
189
  export interface PutLevelUpdate {
190
+ /**
191
+ * ID of the game that the level to update is on.
192
+ */
107
193
  gameId: string;
194
+ /**
195
+ * ID of the level to update.
196
+ */
108
197
  levelId: string;
198
+ /**
199
+ * New settings for the level.
200
+ */
109
201
  level: Interfaces.Level;
110
202
  }
111
203
  /**
112
204
  * Archives a level.
205
+ *
206
+ * You must be a moderator or super moderator of the level's game.
113
207
  */
114
208
  export interface PutLevelArchive {
209
+ /**
210
+ * ID of the game that the level to archive is on.
211
+ */
115
212
  gameId: string;
213
+ /**
214
+ * ID of the level to archive.
215
+ */
116
216
  levelId: string;
117
217
  }
118
218
  /**
119
219
  * Restores an archived level.
120
220
  */
121
221
  export interface PutLevelRestore {
222
+ /**
223
+ * ID of the game that the level to restore is on.
224
+ *
225
+ * You must be a moderator or super moderator of the level's game.
226
+ */
122
227
  gameId: string;
228
+ /**
229
+ * ID of the level to restore.
230
+ */
123
231
  levelId: string;
124
232
  }
125
233
  /**
126
- * Re-orders levels.
234
+ * Re-orders levels in a game.
235
+ *
236
+ * You must be a moderator or super moderator of the level's game.
127
237
  */
128
238
  export interface PutLevelOrder {
239
+ /**
240
+ * ID of the game to order levels on.
241
+ */
129
242
  gameId: string;
130
- levelId: string;
243
+ /**
244
+ * The new order of levels.
245
+ */
246
+ levelIds: string[];
131
247
  }
132
248
  /**
133
249
  * Creates a new variable.
250
+ *
251
+ * You must be a moderator or super moderator of the variables's game.
134
252
  */
135
253
  export interface PutVariable {
254
+ /**
255
+ * ID of the game that the variable to create is on.
256
+ */
136
257
  gameId: string;
258
+ /**
259
+ * Settings for the new variable.
260
+ */
137
261
  variable: Interfaces.Variable;
262
+ /**
263
+ * Values for the new variable.
264
+ */
138
265
  values: Interfaces.Value[];
139
266
  }
140
267
  /**
@@ -752,10 +879,7 @@ export interface PutGame {
752
879
  /**
753
880
  * Add a moderator to a game.
754
881
  */
755
- export interface PutGameModerator {
756
- gameId: string;
757
- userId: string;
758
- level: Enums.GamePowerLevel;
882
+ export interface PutGameModerator extends Interfaces.GameModerator {
759
883
  }
760
884
  /**
761
885
  * Remove a moderator from a game.
@@ -882,7 +1006,20 @@ export interface PutUserDelete {
882
1006
  password: string;
883
1007
  }
884
1008
  /**
885
- * Delete a comment.
1009
+ * Updates a comment.
1010
+ */
1011
+ export interface PutCommentUpdate {
1012
+ /**
1013
+ * ID of the comment to update.
1014
+ */
1015
+ commentId: string;
1016
+ /**
1017
+ * New text of the comment.
1018
+ */
1019
+ text: string;
1020
+ }
1021
+ /**
1022
+ * Deletes a comment.
886
1023
  */
887
1024
  export interface PutCommentDelete {
888
1025
  commentId: string;
@@ -921,3 +1058,4 @@ export interface PutThreadSticky {
921
1058
  export interface PutThreadDelete {
922
1059
  threadId: string;
923
1060
  }
1061
+ export {};