speedruncom.js 2.0.3 → 2.0.5
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/lib/Client.d.ts +3 -3
- package/lib/endpoints/endpoints.get.d.ts +22 -0
- package/package.json +1 -1
- package/src/Client.ts +1 -1
- package/src/endpoints/endpoints.get.ts +27 -0
- package/src/responses.ts +1 -0
package/lib/Client.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
2
|
import GETEndpoints from './endpoints/endpoints.get.js';
|
|
3
3
|
import POSTEndpoints from './endpoints/endpoints.post.js';
|
|
4
4
|
import Responses from './responses.js';
|
|
5
5
|
type Endpoints = GETEndpoints & POSTEndpoints;
|
|
6
6
|
export default class Client {
|
|
7
7
|
axiosClient: import("axios").AxiosInstance;
|
|
8
|
-
get<E extends keyof GETEndpoints, P extends GETEndpoints[E]>(endpoint: E, params: P, axiosConfig?: AxiosRequestConfig): Promise<
|
|
9
|
-
post<E extends keyof Endpoints, P extends Endpoints[E]>(endpoint: E, params: P, axiosConfig?: AxiosRequestConfig): Promise<
|
|
8
|
+
get<E extends keyof GETEndpoints, P extends GETEndpoints[E]>(endpoint: E, params: P, axiosConfig?: AxiosRequestConfig): Promise<AxiosResponse<Responses[E], any>>;
|
|
9
|
+
post<E extends keyof Endpoints, P extends Endpoints[E]>(endpoint: E, params: P, axiosConfig?: AxiosRequestConfig): Promise<AxiosResponse<E extends keyof Responses ? Responses[E] : void, any>>;
|
|
10
10
|
}
|
|
11
11
|
export {};
|
|
@@ -23,6 +23,17 @@ export default interface GETEndpoints {
|
|
|
23
23
|
*/
|
|
24
24
|
page?: number;
|
|
25
25
|
};
|
|
26
|
+
GetGameData: {
|
|
27
|
+
/**
|
|
28
|
+
* ID of the game.
|
|
29
|
+
*/
|
|
30
|
+
gameId: string;
|
|
31
|
+
} | {
|
|
32
|
+
/**
|
|
33
|
+
* Game page URL.
|
|
34
|
+
*/
|
|
35
|
+
gameUrl: string;
|
|
36
|
+
};
|
|
26
37
|
/**
|
|
27
38
|
* Gets a specific site article.
|
|
28
39
|
*/
|
|
@@ -508,6 +519,17 @@ export default interface GETEndpoints {
|
|
|
508
519
|
* ID of the forum.
|
|
509
520
|
*/
|
|
510
521
|
forumId: string;
|
|
522
|
+
/**
|
|
523
|
+
* The thread page, in relation to `limit`.
|
|
524
|
+
*/
|
|
525
|
+
page: number;
|
|
526
|
+
/**
|
|
527
|
+
* The maximum amount of `Thread`s to fetch.
|
|
528
|
+
*
|
|
529
|
+
* @default 30
|
|
530
|
+
* @max 100
|
|
531
|
+
*/
|
|
532
|
+
limit: number;
|
|
511
533
|
};
|
|
512
534
|
/**
|
|
513
535
|
* Gets a comment post's Thread and Forum by `commentId`.
|
package/package.json
CHANGED
package/src/Client.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import axios, { AxiosRequestConfig } from 'axios';
|
|
1
|
+
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
2
|
import GETEndpoints from './endpoints/endpoints.get.js';
|
|
3
3
|
import POSTEndpoints from './endpoints/endpoints.post.js'
|
|
4
4
|
import Responses from './responses.js';
|
|
@@ -31,6 +31,20 @@ export default interface GETEndpoints {
|
|
|
31
31
|
page?: number;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
GetGameData: {
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* ID of the game.
|
|
38
|
+
*/
|
|
39
|
+
gameId: string;
|
|
40
|
+
} | {
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Game page URL.
|
|
44
|
+
*/
|
|
45
|
+
gameUrl: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
34
48
|
/**
|
|
35
49
|
* Gets a specific site article.
|
|
36
50
|
*/
|
|
@@ -617,6 +631,19 @@ export default interface GETEndpoints {
|
|
|
617
631
|
* ID of the forum.
|
|
618
632
|
*/
|
|
619
633
|
forumId: string;
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* The thread page, in relation to `limit`.
|
|
637
|
+
*/
|
|
638
|
+
page: number;
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* The maximum amount of `Thread`s to fetch.
|
|
642
|
+
*
|
|
643
|
+
* @default 30
|
|
644
|
+
* @max 100
|
|
645
|
+
*/
|
|
646
|
+
limit: number;
|
|
620
647
|
};
|
|
621
648
|
|
|
622
649
|
/**
|