@aracna/telegram-bot 1.9.3 → 1.9.4
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/declarations/modules/api.d.ts +1 -1
- package/modules/api.js +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { API as CoreAPI,
|
|
1
|
+
import { APIConfig, API as CoreAPI, FetchError, RequestMethod } from '@aracna/core';
|
|
2
2
|
export declare class API extends CoreAPI {
|
|
3
3
|
post<V, W, X = undefined>(path: string, body?: W, config?: APIConfig<void>): Promise<V | FetchError<X>>;
|
|
4
4
|
transformBody<V>(method: RequestMethod, path: string, body: V, config: APIConfig<void>): Promise<FormData>;
|
package/modules/api.js
CHANGED
|
@@ -5,15 +5,15 @@ const core_1 = require("@aracna/core");
|
|
|
5
5
|
class API extends core_1.API {
|
|
6
6
|
async post(path, body, config) {
|
|
7
7
|
let response;
|
|
8
|
-
response = await this.handle(
|
|
8
|
+
response = await this.handle('POST', path, body, config);
|
|
9
9
|
if (response instanceof Error)
|
|
10
10
|
return response;
|
|
11
11
|
return response.data.result;
|
|
12
12
|
}
|
|
13
13
|
async transformBody(method, path, body, config) {
|
|
14
14
|
switch (method) {
|
|
15
|
-
case
|
|
16
|
-
case
|
|
15
|
+
case 'GET':
|
|
16
|
+
case 'POST':
|
|
17
17
|
await core_1.Polyfill.blob();
|
|
18
18
|
await core_1.Polyfill.file();
|
|
19
19
|
await core_1.Polyfill.formData();
|
package/package.json
CHANGED