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.
package/dist/Client.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import axios from 'axios';
2
- const LANG = 'en';
3
- const ACCEPT = 'application/json';
4
- const BASE_USER_AGENT = 'speedrun.js';
2
+ const BASE_USER_AGENT = 'speedruncom.js';
3
+ const BASE_URL = 'https://www.speedrun.com/api/v2/';
4
+ const HEADERS = {
5
+ 'Accept-Language': 'en',
6
+ 'Accept': 'application/json'
7
+ };
5
8
  const isBrowser = typeof window !== 'undefined';
6
9
  const objectToBase64 = (obj) => {
7
10
  const jsonString = JSON.stringify(obj).replace(/\s+/g, '');
@@ -15,57 +18,45 @@ class APIError extends Error {
15
18
  }
16
19
  }
17
20
  class Client {
18
- constructor({ PHPSESSID, userAgent }) {
21
+ constructor(config) {
22
+ /**
23
+ * `AxiosInstance` used on instance-called methods (called with `POST`).
24
+ */
19
25
  this.axiosClient = axios.create({
20
- baseURL: 'https://www.speedrun.com/api/v2/',
26
+ baseURL: BASE_URL,
27
+ method: 'POST',
21
28
  withCredentials: true,
22
- headers: {
23
- 'Accept-Language': LANG,
24
- 'Accept': ACCEPT,
25
- }
29
+ headers: HEADERS
26
30
  });
31
+ this.headers = this.axiosClient.defaults.headers.common;
32
+ if (config)
33
+ this.config(config);
34
+ this.axiosClient.interceptors.response.use((response) => response, (error) => {
35
+ const data = error.response.data;
36
+ throw new APIError(data.error || 'Unknown error', error.response.status);
37
+ });
38
+ }
39
+ config(config) {
27
40
  if (!isBrowser)
28
- this.axiosClient.defaults.headers.common['User-Agent'] = BASE_USER_AGENT + (userAgent ? `/${userAgent}` : '');
29
- if (PHPSESSID) {
41
+ this.headers['User-Agent'] = BASE_USER_AGENT + (config.userAgent ? `/${config.userAgent}` : '');
42
+ if (config.PHPSESSID) {
30
43
  if (isBrowser) {
31
44
  console.error('You cannot use a PHPSESSID to authenticate in a browser environment.');
32
45
  }
33
46
  else {
34
- this.axiosClient.defaults.headers.common['Cookie'] = `PHPSESSID=${PHPSESSID}`;
47
+ this.headers['Cookie'] = `PHPSESSID=${config.PHPSESSID}`;
35
48
  }
36
49
  }
37
- this.axiosClient.interceptors.response.use((response) => response, (error) => {
38
- if (error.response) {
39
- const data = error.response?.data;
40
- throw new APIError(data?.error || 'Unknown error', error.response.status);
41
- }
42
- });
43
50
  }
44
- async request(endpoint, params = {}, method = 'post') {
45
- let response;
46
- if (method === 'post') {
47
- response = await this.axiosClient.post(endpoint, params);
48
- }
49
- else {
50
- response = await this.axiosClient.get(`${endpoint}?_r=${objectToBase64(params)}`);
51
- }
51
+ async request(endpoint, params = {}) {
52
+ const response = await this.axiosClient.post(endpoint, params);
52
53
  const cookie = response.headers['set-cookie'];
53
54
  if (cookie && !isBrowser)
54
- this.axiosClient.defaults.headers.common['Cookie'] = `PHPSESSID=${cookie[0].split('=')[1].split(';')[0]}`;
55
+ this.headers['Cookie'] = cookie[0].split(';')[0];
55
56
  return response.data;
56
57
  }
57
- static async request(endpoint, params = {}, method = 'post') {
58
- let response;
59
- if (method === 'post') {
60
- response = await this.axiosClient.post(endpoint, params);
61
- }
62
- else {
63
- response = await this.axiosClient.get(`${endpoint}?_r=${objectToBase64(params)}`);
64
- }
65
- const cookie = response.headers['set-cookie'];
66
- if (cookie && !isBrowser)
67
- this.axiosClient.defaults.headers.common['Cookie'] = `PHPSESSID=${cookie[0].split('=')[1].split(';')[0]}`;
68
- return response.data;
58
+ static async request(endpoint, params = {}) {
59
+ return (await this.axiosClient.get(`${endpoint}?_r=${objectToBase64(params)}`)).data;
69
60
  }
70
61
  //Built-in endpoints for auth
71
62
  /**
@@ -73,8 +64,8 @@ class Client {
73
64
  * If the account has two factor authentication, you have to use `setToken` with the token sent to the account's email address.
74
65
  */
75
66
  async login(username, password) {
76
- this.user = username;
77
- this.pass = password;
67
+ this.username = username;
68
+ this.password = password;
78
69
  return await this.request('PutAuthLogin', {
79
70
  name: username,
80
71
  password
@@ -86,8 +77,8 @@ class Client {
86
77
  */
87
78
  async setToken(token) {
88
79
  return await this.request('PutAuthLogin', {
89
- name: this.user,
90
- password: this.pass,
80
+ name: this.username,
81
+ password: this.password,
91
82
  token
92
83
  });
93
84
  }
@@ -97,567 +88,577 @@ class Client {
97
88
  async logout() {
98
89
  if (isBrowser)
99
90
  return await this.request('PutAuthLogout');
100
- delete this.axiosClient.defaults.headers.common['Cookie'];
91
+ delete this.headers['Cookie'];
101
92
  }
102
93
  // Endpoints (auto-generated with build-client)
103
94
  async GetGameLeaderboard2(params) {
104
- return await this.request('GetGameLeaderboard2', params, 'post');
95
+ return await this.request('GetGameLeaderboard2', params);
105
96
  }
106
97
  static async GetGameLeaderboard2(params) {
107
- return await this.request('GetGameLeaderboard2', params, 'get');
98
+ return await this.request('GetGameLeaderboard2', params);
108
99
  }
109
100
  async GetGameLeaderboard(params) {
110
- return await this.request('GetGameLeaderboard', params, 'post');
101
+ return await this.request('GetGameLeaderboard', params);
111
102
  }
112
103
  static async GetGameLeaderboard(params) {
113
- return await this.request('GetGameLeaderboard', params, 'get');
104
+ return await this.request('GetGameLeaderboard', params);
114
105
  }
115
106
  async GetGameData(params) {
116
- return await this.request('GetGameData', params, 'post');
107
+ return await this.request('GetGameData', params);
117
108
  }
118
109
  static async GetGameData(params) {
119
- return await this.request('GetGameData', params, 'get');
110
+ return await this.request('GetGameData', params);
120
111
  }
121
112
  async GetGameSummary(params) {
122
- return await this.request('GetGameSummary', params, 'post');
113
+ return await this.request('GetGameSummary', params);
123
114
  }
124
115
  static async GetGameSummary(params) {
125
- return await this.request('GetGameSummary', params, 'get');
116
+ return await this.request('GetGameSummary', params);
126
117
  }
127
118
  async GetGameRecordHistory(params) {
128
- return await this.request('GetGameRecordHistory', params, 'post');
119
+ return await this.request('GetGameRecordHistory', params);
129
120
  }
130
121
  static async GetGameRecordHistory(params) {
131
- return await this.request('GetGameRecordHistory', params, 'get');
122
+ return await this.request('GetGameRecordHistory', params);
132
123
  }
133
124
  async GetSearch(params) {
134
- return await this.request('GetSearch', params, 'post');
125
+ return await this.request('GetSearch', params);
135
126
  }
136
127
  static async GetSearch(params) {
137
- return await this.request('GetSearch', params, 'get');
128
+ return await this.request('GetSearch', params);
138
129
  }
139
130
  async GetLatestLeaderboard(params) {
140
- return await this.request('GetLatestLeaderboard', params, 'post');
131
+ return await this.request('GetLatestLeaderboard', params);
141
132
  }
142
133
  static async GetLatestLeaderboard(params) {
143
- return await this.request('GetLatestLeaderboard', params, 'get');
134
+ return await this.request('GetLatestLeaderboard', params);
144
135
  }
145
136
  async GetRun(params) {
146
- return await this.request('GetRun', params, 'post');
137
+ return await this.request('GetRun', params);
147
138
  }
148
139
  static async GetRun(params) {
149
- return await this.request('GetRun', params, 'get');
140
+ return await this.request('GetRun', params);
150
141
  }
151
142
  async GetUserSummary(params) {
152
- return await this.request('GetUserSummary', params, 'post');
143
+ return await this.request('GetUserSummary', params);
153
144
  }
154
145
  static async GetUserSummary(params) {
155
- return await this.request('GetUserSummary', params, 'get');
146
+ return await this.request('GetUserSummary', params);
156
147
  }
157
148
  async GetUserComments(params) {
158
- return await this.request('GetUserComments', params, 'post');
149
+ return await this.request('GetUserComments', params);
159
150
  }
160
151
  static async GetUserComments(params) {
161
- return await this.request('GetUserComments', params, 'get');
152
+ return await this.request('GetUserComments', params);
162
153
  }
163
154
  async GetUserThreads(params) {
164
- return await this.request('GetUserThreads', params, 'post');
155
+ return await this.request('GetUserThreads', params);
165
156
  }
166
157
  static async GetUserThreads(params) {
167
- return await this.request('GetUserThreads', params, 'get');
158
+ return await this.request('GetUserThreads', params);
168
159
  }
169
160
  async GetUserPopoverData(params) {
170
- return await this.request('GetUserPopoverData', params, 'post');
161
+ return await this.request('GetUserPopoverData', params);
171
162
  }
172
163
  static async GetUserPopoverData(params) {
173
- return await this.request('GetUserPopoverData', params, 'get');
164
+ return await this.request('GetUserPopoverData', params);
174
165
  }
175
- async GetTitleList(params) {
176
- return await this.request('GetTitleList', params, 'post');
166
+ async GetTitleList() {
167
+ return await this.request('GetTitleList');
177
168
  }
178
- static async GetTitleList(params) {
179
- return await this.request('GetTitleList', params, 'get');
169
+ static async GetTitleList() {
170
+ return await this.request('GetTitleList');
180
171
  }
181
172
  async GetTitle(params) {
182
- return await this.request('GetTitle', params, 'post');
173
+ return await this.request('GetTitle', params);
183
174
  }
184
175
  static async GetTitle(params) {
185
- return await this.request('GetTitle', params, 'get');
176
+ return await this.request('GetTitle', params);
186
177
  }
187
178
  async GetArticleList(params) {
188
- return await this.request('GetArticleList', params, 'post');
179
+ return await this.request('GetArticleList', params);
189
180
  }
190
181
  static async GetArticleList(params) {
191
- return await this.request('GetArticleList', params, 'get');
182
+ return await this.request('GetArticleList', params);
192
183
  }
193
184
  async GetArticle(params) {
194
- return await this.request('GetArticle', params, 'post');
185
+ return await this.request('GetArticle', params);
195
186
  }
196
187
  static async GetArticle(params) {
197
- return await this.request('GetArticle', params, 'get');
188
+ return await this.request('GetArticle', params);
198
189
  }
199
190
  async GetGameList(params) {
200
- return await this.request('GetGameList', params, 'post');
191
+ return await this.request('GetGameList', params);
201
192
  }
202
193
  static async GetGameList(params) {
203
- return await this.request('GetGameList', params, 'get');
194
+ return await this.request('GetGameList', params);
204
195
  }
205
- async GetHomeSummary(params) {
206
- return await this.request('GetHomeSummary', params, 'post');
196
+ async GetPlatformList() {
197
+ return await this.request('GetPlatformList');
207
198
  }
208
- static async GetHomeSummary(params) {
209
- return await this.request('GetHomeSummary', params, 'get');
199
+ static async GetPlatformList() {
200
+ return await this.request('GetPlatformList');
201
+ }
202
+ async GetHomeSummary() {
203
+ return await this.request('GetHomeSummary');
204
+ }
205
+ static async GetHomeSummary() {
206
+ return await this.request('GetHomeSummary');
210
207
  }
211
208
  async GetSeriesList(params) {
212
- return await this.request('GetSeriesList', params, 'post');
209
+ return await this.request('GetSeriesList', params);
213
210
  }
214
211
  static async GetSeriesList(params) {
215
- return await this.request('GetSeriesList', params, 'get');
212
+ return await this.request('GetSeriesList', params);
216
213
  }
217
214
  async GetSeriesSummary(params) {
218
- return await this.request('GetSeriesSummary', params, 'post');
215
+ return await this.request('GetSeriesSummary', params);
219
216
  }
220
217
  static async GetSeriesSummary(params) {
221
- return await this.request('GetSeriesSummary', params, 'get');
218
+ return await this.request('GetSeriesSummary', params);
222
219
  }
223
220
  async GetGameLevelSummary(params) {
224
- return await this.request('GetGameLevelSummary', params, 'post');
221
+ return await this.request('GetGameLevelSummary', params);
225
222
  }
226
223
  static async GetGameLevelSummary(params) {
227
- return await this.request('GetGameLevelSummary', params, 'get');
224
+ return await this.request('GetGameLevelSummary', params);
228
225
  }
229
- async GetGameRandom(params) {
230
- return await this.request('GetGameRandom', params, 'post');
226
+ async GetGameRandom() {
227
+ return await this.request('GetGameRandom');
231
228
  }
232
- static async GetGameRandom(params) {
233
- return await this.request('GetGameRandom', params, 'get');
229
+ static async GetGameRandom() {
230
+ return await this.request('GetGameRandom');
234
231
  }
235
232
  async GetGuideList(params) {
236
- return await this.request('GetGuideList', params, 'post');
233
+ return await this.request('GetGuideList', params);
237
234
  }
238
235
  static async GetGuideList(params) {
239
- return await this.request('GetGuideList', params, 'get');
236
+ return await this.request('GetGuideList', params);
240
237
  }
241
238
  async GetGuide(params) {
242
- return await this.request('GetGuide', params, 'post');
239
+ return await this.request('GetGuide', params);
243
240
  }
244
241
  static async GetGuide(params) {
245
- return await this.request('GetGuide', params, 'get');
242
+ return await this.request('GetGuide', params);
246
243
  }
247
244
  async GetNewsList(params) {
248
- return await this.request('GetNewsList', params, 'post');
245
+ return await this.request('GetNewsList', params);
249
246
  }
250
247
  static async GetNewsList(params) {
251
- return await this.request('GetNewsList', params, 'get');
248
+ return await this.request('GetNewsList', params);
252
249
  }
253
250
  async GetNews(params) {
254
- return await this.request('GetNews', params, 'post');
251
+ return await this.request('GetNews', params);
255
252
  }
256
253
  static async GetNews(params) {
257
- return await this.request('GetNews', params, 'get');
254
+ return await this.request('GetNews', params);
258
255
  }
259
256
  async GetResourceList(params) {
260
- return await this.request('GetResourceList', params, 'post');
257
+ return await this.request('GetResourceList', params);
261
258
  }
262
259
  static async GetResourceList(params) {
263
- return await this.request('GetResourceList', params, 'get');
260
+ return await this.request('GetResourceList', params);
264
261
  }
265
262
  async GetStreamList(params) {
266
- return await this.request('GetStreamList', params, 'post');
263
+ return await this.request('GetStreamList', params);
267
264
  }
268
265
  static async GetStreamList(params) {
269
- return await this.request('GetStreamList', params, 'get');
266
+ return await this.request('GetStreamList', params);
270
267
  }
271
268
  async GetThreadList(params) {
272
- return await this.request('GetThreadList', params, 'post');
269
+ return await this.request('GetThreadList', params);
273
270
  }
274
271
  static async GetThreadList(params) {
275
- return await this.request('GetThreadList', params, 'get');
272
+ return await this.request('GetThreadList', params);
276
273
  }
277
274
  async GetThreadStateByCommentId(params) {
278
- return await this.request('GetThreadStateByCommentId', params, 'post');
275
+ return await this.request('GetThreadStateByCommentId', params);
279
276
  }
280
277
  static async GetThreadStateByCommentId(params) {
281
- return await this.request('GetThreadStateByCommentId', params, 'get');
278
+ return await this.request('GetThreadStateByCommentId', params);
282
279
  }
283
280
  async GetChallenge(params) {
284
- return await this.request('GetChallenge', params, 'post');
281
+ return await this.request('GetChallenge', params);
285
282
  }
286
283
  static async GetChallenge(params) {
287
- return await this.request('GetChallenge', params, 'get');
284
+ return await this.request('GetChallenge', params);
288
285
  }
289
286
  async GetChallengeLeaderboard(params) {
290
- return await this.request('GetChallengeLeaderboard', params, 'post');
287
+ return await this.request('GetChallengeLeaderboard', params);
291
288
  }
292
289
  static async GetChallengeLeaderboard(params) {
293
- return await this.request('GetChallengeLeaderboard', params, 'get');
290
+ return await this.request('GetChallengeLeaderboard', params);
294
291
  }
295
- async GetChallengeGlobalRankingList(params) {
296
- return await this.request('GetChallengeGlobalRankingList', params, 'post');
292
+ async GetChallengeGlobalRankingList() {
293
+ return await this.request('GetChallengeGlobalRankingList');
297
294
  }
298
- static async GetChallengeGlobalRankingList(params) {
299
- return await this.request('GetChallengeGlobalRankingList', params, 'get');
295
+ static async GetChallengeGlobalRankingList() {
296
+ return await this.request('GetChallengeGlobalRankingList');
300
297
  }
301
298
  async GetChallengeRun(params) {
302
- return await this.request('GetChallengeRun', params, 'post');
299
+ return await this.request('GetChallengeRun', params);
303
300
  }
304
301
  static async GetChallengeRun(params) {
305
- return await this.request('GetChallengeRun', params, 'get');
302
+ return await this.request('GetChallengeRun', params);
306
303
  }
307
304
  async GetUserLeaderboard(params) {
308
- return await this.request('GetUserLeaderboard', params, 'post');
305
+ return await this.request('GetUserLeaderboard', params);
309
306
  }
310
307
  static async GetUserLeaderboard(params) {
311
- return await this.request('GetUserLeaderboard', params, 'get');
308
+ return await this.request('GetUserLeaderboard', params);
312
309
  }
313
310
  async GetUserModeration(params) {
314
- return await this.request('GetUserModeration', params, 'post');
311
+ return await this.request('GetUserModeration', params);
315
312
  }
316
313
  static async GetUserModeration(params) {
317
- return await this.request('GetUserModeration', params, 'get');
314
+ return await this.request('GetUserModeration', params);
318
315
  }
319
316
  async GetCommentList(params) {
320
- return await this.request('GetCommentList', params, 'post');
317
+ return await this.request('GetCommentList', params);
321
318
  }
322
319
  static async GetCommentList(params) {
323
- return await this.request('GetCommentList', params, 'get');
320
+ return await this.request('GetCommentList', params);
324
321
  }
325
322
  async GetThread(params) {
326
- return await this.request('GetThread', params, 'post');
323
+ return await this.request('GetThread', params);
327
324
  }
328
325
  static async GetThread(params) {
329
- return await this.request('GetThread', params, 'get');
326
+ return await this.request('GetThread', params);
330
327
  }
331
- async GetStaticData(params) {
332
- return await this.request('GetStaticData', params, 'post');
328
+ async GetStaticData() {
329
+ return await this.request('GetStaticData');
333
330
  }
334
- static async GetStaticData(params) {
335
- return await this.request('GetStaticData', params, 'get');
331
+ static async GetStaticData() {
332
+ return await this.request('GetStaticData');
336
333
  }
337
- async GetForumList(params) {
338
- return await this.request('GetForumList', params, 'post');
334
+ async GetForumList() {
335
+ return await this.request('GetForumList');
339
336
  }
340
- static async GetForumList(params) {
341
- return await this.request('GetForumList', params, 'get');
337
+ static async GetForumList() {
338
+ return await this.request('GetForumList');
342
339
  }
343
340
  async PutAuthLogin(params) {
344
- return await this.request('PutAuthLogin', params, 'post');
341
+ return await this.request('PutAuthLogin', params);
345
342
  }
346
- async GetSession(params) {
347
- return await this.request('GetSession', params, 'post');
343
+ async GetSession() {
344
+ return await this.request('GetSession');
348
345
  }
349
- async PutSessionPing(params) {
350
- return await this.request('PutSessionPing', params, 'post');
346
+ async PutSessionPing() {
347
+ return await this.request('PutSessionPing');
351
348
  }
352
349
  async GetAuditLogList(params) {
353
- return await this.request('GetAuditLogList', params, 'post');
350
+ return await this.request('GetAuditLogList', params);
354
351
  }
355
352
  async GetGameSettings(params) {
356
- return await this.request('GetGameSettings', params, 'post');
353
+ return await this.request('GetGameSettings', params);
357
354
  }
358
355
  async PutGameSettings(params) {
359
- return await this.request('PutGameSettings', params, 'post');
356
+ return await this.request('PutGameSettings', params);
360
357
  }
361
358
  async PutCategory(params) {
362
- return await this.request('PutCategory', params, 'post');
359
+ return await this.request('PutCategory', params);
363
360
  }
364
361
  async PutCategoryUpdate(params) {
365
- return await this.request('PutCategoryUpdate', params, 'post');
362
+ return await this.request('PutCategoryUpdate', params);
366
363
  }
367
364
  async PutCategoryArchive(params) {
368
- return await this.request('PutCategoryArchive', params, 'post');
365
+ return await this.request('PutCategoryArchive', params);
369
366
  }
370
367
  async PutCategoryRestore(params) {
371
- return await this.request('PutCategoryRestore', params, 'post');
368
+ return await this.request('PutCategoryRestore', params);
372
369
  }
373
370
  async PutCategoryOrder(params) {
374
- return await this.request('PutCategoryOrder', params, 'post');
371
+ return await this.request('PutCategoryOrder', params);
375
372
  }
376
373
  async PutLevel(params) {
377
- return await this.request('PutLevel', params, 'post');
374
+ return await this.request('PutLevel', params);
378
375
  }
379
376
  async PutLevelUpdate(params) {
380
- return await this.request('PutLevelUpdate', params, 'post');
377
+ return await this.request('PutLevelUpdate', params);
381
378
  }
382
379
  async PutLevelArchive(params) {
383
- return await this.request('PutLevelArchive', params, 'post');
380
+ return await this.request('PutLevelArchive', params);
384
381
  }
385
382
  async PutLevelRestore(params) {
386
- return await this.request('PutLevelRestore', params, 'post');
383
+ return await this.request('PutLevelRestore', params);
387
384
  }
388
385
  async PutLevelOrder(params) {
389
- return await this.request('PutLevelOrder', params, 'post');
386
+ return await this.request('PutLevelOrder', params);
390
387
  }
391
388
  async PutVariable(params) {
392
- return await this.request('PutVariable', params, 'post');
389
+ return await this.request('PutVariable', params);
393
390
  }
394
391
  async PutVariableUpdate(params) {
395
- return await this.request('PutVariableUpdate', params, 'post');
392
+ return await this.request('PutVariableUpdate', params);
396
393
  }
397
394
  async PutVariableArchive(params) {
398
- return await this.request('PutVariableArchive', params, 'post');
395
+ return await this.request('PutVariableArchive', params);
399
396
  }
400
397
  async PutVariableRestore(params) {
401
- return await this.request('PutVariableRestore', params, 'post');
398
+ return await this.request('PutVariableRestore', params);
402
399
  }
403
400
  async PutVariableOrder(params) {
404
- return await this.request('PutVariableOrder', params, 'post');
401
+ return await this.request('PutVariableOrder', params);
405
402
  }
406
403
  async PutVariableApplyDefault(params) {
407
- return await this.request('PutVariableApplyDefault', params, 'post');
404
+ return await this.request('PutVariableApplyDefault', params);
408
405
  }
409
406
  async PutNews(params) {
410
- return await this.request('PutNews', params, 'post');
407
+ return await this.request('PutNews', params);
411
408
  }
412
409
  async PutNewsUpdate(params) {
413
- return await this.request('PutNewsUpdate', params, 'post');
410
+ return await this.request('PutNewsUpdate', params);
414
411
  }
415
412
  async PutNewsDelete(params) {
416
- return await this.request('PutNewsDelete', params, 'post');
413
+ return await this.request('PutNewsDelete', params);
417
414
  }
418
415
  async PutGuide(params) {
419
- return await this.request('PutGuide', params, 'post');
416
+ return await this.request('PutGuide', params);
420
417
  }
421
418
  async PutGuideUpdate(params) {
422
- return await this.request('PutGuideUpdate', params, 'post');
419
+ return await this.request('PutGuideUpdate', params);
423
420
  }
424
421
  async PutGuideDelete(params) {
425
- return await this.request('PutGuideDelete', params, 'post');
422
+ return await this.request('PutGuideDelete', params);
426
423
  }
427
424
  async PutResource(params) {
428
- return await this.request('PutResource', params, 'post');
425
+ return await this.request('PutResource', params);
429
426
  }
430
427
  async PutResourceUpdate(params) {
431
- return await this.request('PutResourceUpdate', params, 'post');
428
+ return await this.request('PutResourceUpdate', params);
432
429
  }
433
430
  async PutResourceDelete(params) {
434
- return await this.request('PutResourceDelete', params, 'post');
431
+ return await this.request('PutResourceDelete', params);
435
432
  }
436
- async GetModerationGames(params) {
437
- return await this.request('GetModerationGames', params, 'post');
433
+ async GetModerationGames() {
434
+ return await this.request('GetModerationGames');
438
435
  }
439
436
  async GetModerationRuns(params) {
440
- return await this.request('GetModerationRuns', params, 'post');
437
+ return await this.request('GetModerationRuns', params);
441
438
  }
442
439
  async PutRunAssignee(params) {
443
- return await this.request('PutRunAssignee', params, 'post');
440
+ return await this.request('PutRunAssignee', params);
444
441
  }
445
442
  async PutRunDelete(params) {
446
- return await this.request('PutRunDelete', params, 'post');
443
+ return await this.request('PutRunDelete', params);
447
444
  }
448
445
  async PutRunVerification(params) {
449
- return await this.request('PutRunVerification', params, 'post');
446
+ return await this.request('PutRunVerification', params);
450
447
  }
451
448
  async PutRunVideoState(params) {
452
- return await this.request('PutRunVideoState', params, 'post');
449
+ return await this.request('PutRunVideoState', params);
453
450
  }
454
451
  async GetRunSettings(params) {
455
- return await this.request('GetRunSettings', params, 'post');
452
+ return await this.request('GetRunSettings', params);
456
453
  }
457
454
  async PutRunSettings(params) {
458
- return await this.request('PutRunSettings', params, 'post');
455
+ return await this.request('PutRunSettings', params);
459
456
  }
460
- async GetConversations(params) {
461
- return await this.request('GetConversations', params, 'post');
457
+ async GetConversations() {
458
+ return await this.request('GetConversations');
462
459
  }
463
460
  async GetConversationMessages(params) {
464
- return await this.request('GetConversationMessages', params, 'post');
461
+ return await this.request('GetConversationMessages', params);
465
462
  }
466
463
  async PutConversation(params) {
467
- return await this.request('PutConversation', params, 'post');
464
+ return await this.request('PutConversation', params);
468
465
  }
469
466
  async PutConversationMessage(params) {
470
- return await this.request('PutConversationMessage', params, 'post');
467
+ return await this.request('PutConversationMessage', params);
471
468
  }
472
469
  async PutConversationLeave(params) {
473
- return await this.request('PutConversationLeave', params, 'post');
470
+ return await this.request('PutConversationLeave', params);
474
471
  }
475
472
  async PutConversationReport(params) {
476
- return await this.request('PutConversationReport', params, 'post');
473
+ return await this.request('PutConversationReport', params);
477
474
  }
478
- async GetNotifications(params) {
479
- return await this.request('GetNotifications', params, 'post');
475
+ async GetNotifications() {
476
+ return await this.request('GetNotifications');
480
477
  }
481
- async PutNotificationsRead(params) {
482
- return await this.request('PutNotificationsRead', params, 'post');
478
+ async PutNotificationsRead() {
479
+ return await this.request('PutNotificationsRead');
483
480
  }
484
481
  async PutGameFollower(params) {
485
- return await this.request('PutGameFollower', params, 'post');
482
+ return await this.request('PutGameFollower', params);
486
483
  }
487
484
  async PutGameFollowerDelete(params) {
488
- return await this.request('PutGameFollowerDelete', params, 'post');
485
+ return await this.request('PutGameFollowerDelete', params);
489
486
  }
490
487
  async PutUserFollower(params) {
491
- return await this.request('PutUserFollower', params, 'post');
488
+ return await this.request('PutUserFollower', params);
492
489
  }
493
490
  async PutUserFollowerDelete(params) {
494
- return await this.request('PutUserFollowerDelete', params, 'post');
491
+ return await this.request('PutUserFollowerDelete', params);
495
492
  }
496
493
  async GetUserSettings(params) {
497
- return await this.request('GetUserSettings', params, 'post');
494
+ return await this.request('GetUserSettings', params);
498
495
  }
499
496
  async PutUserSettings(params) {
500
- return await this.request('PutUserSettings', params, 'post');
497
+ return await this.request('PutUserSettings', params);
501
498
  }
502
499
  async PutUserUpdateFeaturedRun(params) {
503
- return await this.request('PutUserUpdateFeaturedRun', params, 'post');
500
+ return await this.request('PutUserUpdateFeaturedRun', params);
504
501
  }
505
502
  async PutUserUpdateGameOrdering(params) {
506
- return await this.request('PutUserUpdateGameOrdering', params, 'post');
503
+ return await this.request('PutUserUpdateGameOrdering', params);
507
504
  }
508
505
  async GetUserApiKey(params) {
509
- return await this.request('GetUserApiKey', params, 'post');
506
+ return await this.request('GetUserApiKey', params);
510
507
  }
511
508
  async GetUserFollowers(params) {
512
- return await this.request('GetUserFollowers', params, 'post');
509
+ return await this.request('GetUserFollowers', params);
513
510
  }
514
511
  async GetUserFollowingGames(params) {
515
- return await this.request('GetUserFollowingGames', params, 'post');
512
+ return await this.request('GetUserFollowingGames', params);
516
513
  }
517
514
  async GetUserFollowingUsers(params) {
518
- return await this.request('GetUserFollowingUsers', params, 'post');
515
+ return await this.request('GetUserFollowingUsers', params);
519
516
  }
520
517
  async GetUserGameBoostData(params) {
521
- return await this.request('GetUserGameBoostData', params, 'post');
518
+ return await this.request('GetUserGameBoostData', params);
522
519
  }
523
520
  async GetUserDataExport(params) {
524
- return await this.request('GetUserDataExport', params, 'post');
521
+ return await this.request('GetUserDataExport', params);
525
522
  }
526
523
  async PutGameFollowerOrder(params) {
527
- return await this.request('PutGameFollowerOrder', params, 'post');
524
+ return await this.request('PutGameFollowerOrder', params);
528
525
  }
529
526
  async PutArticleSubmission(params) {
530
- return await this.request('PutArticleSubmission', params, 'post');
527
+ return await this.request('PutArticleSubmission', params);
531
528
  }
532
529
  async GetCommentable(params) {
533
- return await this.request('GetCommentable', params, 'post');
530
+ return await this.request('GetCommentable', params);
534
531
  }
535
532
  async PutComment(params) {
536
- return await this.request('PutComment', params, 'post');
533
+ return await this.request('PutComment', params);
537
534
  }
538
535
  async PutLike(params) {
539
- return await this.request('PutLike', params, 'post');
536
+ return await this.request('PutLike', params);
540
537
  }
541
538
  async PutCommentableSettings(params) {
542
- return await this.request('PutCommentableSettings', params, 'post');
539
+ return await this.request('PutCommentableSettings', params);
543
540
  }
544
541
  async GetThreadReadStatus(params) {
545
- return await this.request('GetThreadReadStatus', params, 'post');
542
+ return await this.request('GetThreadReadStatus', params);
546
543
  }
547
544
  async PutThreadRead(params) {
548
- return await this.request('PutThreadRead', params, 'post');
545
+ return await this.request('PutThreadRead', params);
549
546
  }
550
547
  async GetForumReadStatus(params) {
551
- return await this.request('GetForumReadStatus', params, 'post');
548
+ return await this.request('GetForumReadStatus', params);
552
549
  }
553
550
  async GetThemeSettings(params) {
554
- return await this.request('GetThemeSettings', params, 'post');
551
+ return await this.request('GetThemeSettings', params);
555
552
  }
556
553
  async PutThemeSettings(params) {
557
- return await this.request('PutThemeSettings', params, 'post');
554
+ return await this.request('PutThemeSettings', params);
558
555
  }
559
556
  async GetUserSupporterData(params) {
560
- return await this.request('GetUserSupporterData', params, 'post');
557
+ return await this.request('GetUserSupporterData', params);
561
558
  }
562
559
  async PutUserSupporterNewSubscription(params) {
563
- return await this.request('PutUserSupporterNewSubscription', params, 'post');
560
+ return await this.request('PutUserSupporterNewSubscription', params);
564
561
  }
565
562
  async PutGameBoostGrant(params) {
566
- return await this.request('PutGameBoostGrant', params, 'post');
563
+ return await this.request('PutGameBoostGrant', params);
567
564
  }
568
565
  async PutAdvertiseContact(params) {
569
- return await this.request('PutAdvertiseContact', params, 'post');
566
+ return await this.request('PutAdvertiseContact', params);
570
567
  }
571
568
  async GetTickets(params) {
572
- return await this.request('GetTickets', params, 'post');
569
+ return await this.request('GetTickets', params);
573
570
  }
574
571
  async GetSeriesSettings(params) {
575
- return await this.request('GetSeriesSettings', params, 'post');
572
+ return await this.request('GetSeriesSettings', params);
576
573
  }
577
- async GetUserBlocks(params) {
578
- return await this.request('GetUserBlocks', params, 'post');
574
+ async GetUserBlocks() {
575
+ return await this.request('GetUserBlocks');
579
576
  }
580
577
  async PutUserBlock(params) {
581
- return await this.request('PutUserBlock', params, 'post');
578
+ return await this.request('PutUserBlock', params);
582
579
  }
583
580
  async PutGame(params) {
584
- return await this.request('PutGame', params, 'post');
581
+ return await this.request('PutGame', params);
585
582
  }
586
- async PutGameModerator(params) {
587
- return await this.request('PutGameModerator', params, 'post');
583
+ async PutGameModerator() {
584
+ return await this.request('PutGameModerator');
588
585
  }
589
586
  async PutGameModeratorDelete(params) {
590
- return await this.request('PutGameModeratorDelete', params, 'post');
587
+ return await this.request('PutGameModeratorDelete', params);
591
588
  }
592
589
  async PutSeriesGame(params) {
593
- return await this.request('PutSeriesGame', params, 'post');
590
+ return await this.request('PutSeriesGame', params);
594
591
  }
595
592
  async PutSeriesGameDelete(params) {
596
- return await this.request('PutSeriesGameDelete', params, 'post');
593
+ return await this.request('PutSeriesGameDelete', params);
597
594
  }
598
- async PutSeriesModerator(params) {
599
- return await this.request('PutSeriesModerator', params, 'post');
595
+ async PutSeriesModerator() {
596
+ return await this.request('PutSeriesModerator');
600
597
  }
601
- async PutSeriesModeratorUpdate(params) {
602
- return await this.request('PutSeriesModeratorUpdate', params, 'post');
598
+ async PutSeriesModeratorUpdate() {
599
+ return await this.request('PutSeriesModeratorUpdate');
603
600
  }
604
- async PutSeriesModeratorDelete(params) {
605
- return await this.request('PutSeriesModeratorDelete', params, 'post');
601
+ async PutSeriesModeratorDelete() {
602
+ return await this.request('PutSeriesModeratorDelete');
606
603
  }
607
604
  async PutSeriesSettings(params) {
608
- return await this.request('PutSeriesSettings', params, 'post');
605
+ return await this.request('PutSeriesSettings', params);
609
606
  }
610
607
  async PutTicket(params) {
611
- return await this.request('PutTicket', params, 'post');
608
+ return await this.request('PutTicket', params);
612
609
  }
613
610
  async PutTicketNote(params) {
614
- return await this.request('PutTicketNote', params, 'post');
611
+ return await this.request('PutTicketNote', params);
615
612
  }
616
613
  async PutUserSocialConnection(params) {
617
- return await this.request('PutUserSocialConnection', params, 'post');
614
+ return await this.request('PutUserSocialConnection', params);
618
615
  }
619
616
  async PutUserSocialConnectionDelete(params) {
620
- return await this.request('PutUserSocialConnectionDelete', params, 'post');
617
+ return await this.request('PutUserSocialConnectionDelete', params);
621
618
  }
622
619
  async PutUserSocialConnectionSsoExchange(params) {
623
- return await this.request('PutUserSocialConnectionSsoExchange', params, 'post');
620
+ return await this.request('PutUserSocialConnectionSsoExchange', params);
624
621
  }
625
622
  async PutUserUpdatePassword(params) {
626
- return await this.request('PutUserUpdatePassword', params, 'post');
623
+ return await this.request('PutUserUpdatePassword', params);
627
624
  }
628
625
  async PutUserUpdateEmail(params) {
629
- return await this.request('PutUserUpdateEmail', params, 'post');
626
+ return await this.request('PutUserUpdateEmail', params);
630
627
  }
631
628
  async PutUserUpdateName(params) {
632
- return await this.request('PutUserUpdateName', params, 'post');
629
+ return await this.request('PutUserUpdateName', params);
633
630
  }
634
631
  async PutUserDelete(params) {
635
- return await this.request('PutUserDelete', params, 'post');
632
+ return await this.request('PutUserDelete', params);
633
+ }
634
+ async PutCommentUpdate(params) {
635
+ return await this.request('PutCommentUpdate', params);
636
636
  }
637
637
  async PutCommentDelete(params) {
638
- return await this.request('PutCommentDelete', params, 'post');
638
+ return await this.request('PutCommentDelete', params);
639
639
  }
640
640
  async PutCommentRestore(params) {
641
- return await this.request('PutCommentRestore', params, 'post');
641
+ return await this.request('PutCommentRestore', params);
642
642
  }
643
643
  async PutThread(params) {
644
- return await this.request('PutThread', params, 'post');
644
+ return await this.request('PutThread', params);
645
645
  }
646
646
  async PutThreadLocked(params) {
647
- return await this.request('PutThreadLocked', params, 'post');
647
+ return await this.request('PutThreadLocked', params);
648
648
  }
649
649
  async PutThreadSticky(params) {
650
- return await this.request('PutThreadSticky', params, 'post');
650
+ return await this.request('PutThreadSticky', params);
651
651
  }
652
652
  async PutThreadDelete(params) {
653
- return await this.request('PutThreadDelete', params, 'post');
653
+ return await this.request('PutThreadDelete', params);
654
654
  }
655
655
  }
656
+ /**
657
+ * `AxiosInstance` used on Client-called methods (called with `GET`).
658
+ */
656
659
  Client.axiosClient = axios.create({
657
- baseURL: 'https://www.speedrun.com/api/v2/',
658
- headers: {
659
- 'Accept-Language': LANG,
660
- 'Accept': ACCEPT,
661
- }
660
+ baseURL: BASE_URL,
661
+ method: 'GET',
662
+ headers: HEADERS
662
663
  });
663
664
  export default Client;