speedruncom.js 2.0.2 → 2.0.3
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 +5 -5
- package/lib/endpoints/endpoints.get.d.ts +2 -2
- package/lib/endpoints/endpoints.post.d.ts +3 -3
- package/lib/index.d.ts +3 -3
- package/lib/index.js +3 -3
- package/lib/interfaces.d.ts +1 -1
- package/lib/responses.d.ts +1 -1
- package/package.json +1 -1
- package/src/Client.ts +7 -7
- package/src/endpoints/endpoints.get.ts +2 -2
- package/src/endpoints/endpoints.post.ts +3 -3
- package/src/index.ts +3 -3
- package/src/interfaces.ts +1 -1
- package/src/responses.ts +1 -1
package/lib/Client.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import GETEndpoints from './endpoints/endpoints.get';
|
|
3
|
-
import POSTEndpoints from './endpoints/endpoints.post';
|
|
4
|
-
import Responses from './responses';
|
|
2
|
+
import GETEndpoints from './endpoints/endpoints.get.js';
|
|
3
|
+
import POSTEndpoints from './endpoints/endpoints.post.js';
|
|
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<
|
|
9
|
-
post<
|
|
8
|
+
get<E extends keyof GETEndpoints, P extends GETEndpoints[E]>(endpoint: E, params: P, axiosConfig?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<Responses[E], any>>;
|
|
9
|
+
post<E extends keyof Endpoints, P extends Endpoints[E]>(endpoint: E, params: P, axiosConfig?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<E extends keyof Responses ? Responses[E] : void, any>>;
|
|
10
10
|
}
|
|
11
11
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as Enums from '../enums';
|
|
2
|
-
import * as Interfaces from '../interfaces';
|
|
3
|
-
import { AtLeastOne } from '../types';
|
|
1
|
+
import * as Enums from '../enums.js';
|
|
2
|
+
import * as Interfaces from '../interfaces.js';
|
|
3
|
+
import { AtLeastOne } from '../types.js';
|
|
4
4
|
export default interface POSTEndpoints {
|
|
5
5
|
/**
|
|
6
6
|
* Logs in by giving a `set-cookie` header in a response with a `PHPSESSID` cookie.
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './enums';
|
|
2
|
-
export * from './interfaces';
|
|
3
|
-
import Client from './Client';
|
|
1
|
+
export * from './enums.js';
|
|
2
|
+
export * from './interfaces.js';
|
|
3
|
+
import Client from './Client.js';
|
|
4
4
|
export default Client;
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './enums';
|
|
2
|
-
export * from './interfaces';
|
|
3
|
-
import Client from './Client';
|
|
1
|
+
export * from './enums.js';
|
|
2
|
+
export * from './interfaces.js';
|
|
3
|
+
import Client from './Client.js';
|
|
4
4
|
export default Client;
|
package/lib/interfaces.d.ts
CHANGED
package/lib/responses.d.ts
CHANGED
package/package.json
CHANGED
package/src/Client.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios, { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import GETEndpoints from './endpoints/endpoints.get';
|
|
3
|
-
import POSTEndpoints from './endpoints/endpoints.post'
|
|
4
|
-
import Responses from './responses';
|
|
2
|
+
import GETEndpoints from './endpoints/endpoints.get.js';
|
|
3
|
+
import POSTEndpoints from './endpoints/endpoints.post.js'
|
|
4
|
+
import Responses from './responses.js';
|
|
5
5
|
|
|
6
6
|
type Endpoints = GETEndpoints & POSTEndpoints;
|
|
7
7
|
|
|
@@ -20,11 +20,11 @@ export default class Client {
|
|
|
20
20
|
withCredentials: true
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
async get<
|
|
24
|
-
return await this.axiosClient.get<Responses[
|
|
23
|
+
async get<E extends keyof GETEndpoints, P extends GETEndpoints[E]>(endpoint: E, params: P, axiosConfig?: AxiosRequestConfig) {
|
|
24
|
+
return await this.axiosClient.get<Responses[E]>(`${endpoint}?_r=${objectToBase64(params)}`, axiosConfig);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
async post<
|
|
28
|
-
return await this.axiosClient.post<
|
|
27
|
+
async post<E extends keyof Endpoints, P extends Endpoints[E]>(endpoint: E, params: P, axiosConfig?: AxiosRequestConfig) {
|
|
28
|
+
return await this.axiosClient.post<E extends keyof Responses ? Responses[E] : void>(endpoint, params, axiosConfig);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//Endpoints that don't give the "Method Not Allowed" error when called with `GET`.
|
|
2
2
|
|
|
3
|
-
import * as Enums from '../enums';
|
|
4
|
-
import * as Interfaces from '../interfaces';
|
|
3
|
+
import * as Enums from '../enums.js';
|
|
4
|
+
import * as Interfaces from '../interfaces.js';
|
|
5
5
|
|
|
6
6
|
export default interface GETEndpoints {
|
|
7
7
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
//Endpoints that would give the "Method Not Allowed" error when called with GET.
|
|
2
2
|
|
|
3
|
-
import * as Enums from '../enums';
|
|
4
|
-
import * as Interfaces from '../interfaces';
|
|
5
|
-
import { AtLeastOne } from '../types';
|
|
3
|
+
import * as Enums from '../enums.js';
|
|
4
|
+
import * as Interfaces from '../interfaces.js';
|
|
5
|
+
import { AtLeastOne } from '../types.js';
|
|
6
6
|
|
|
7
7
|
export default interface POSTEndpoints {
|
|
8
8
|
|
package/src/index.ts
CHANGED
package/src/interfaces.ts
CHANGED
package/src/responses.ts
CHANGED