camstreamerlib 4.0.0-beta.99 → 4.0.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/README.md +44 -15
- package/cjs/CamOverlayAPI.d.ts +145 -107
- package/cjs/CamOverlayAPI.js +14 -63
- package/cjs/CamScripterAPI.d.ts +5 -8
- package/cjs/CamScripterAPI.js +11 -29
- package/cjs/CamStreamerAPI.d.ts +2362 -806
- package/cjs/CamStreamerAPI.js +68 -76
- package/cjs/CamSwitcherAPI.d.ts +23 -22
- package/cjs/CamSwitcherAPI.js +30 -88
- package/cjs/PlaneTrackerAPI.d.ts +28 -30
- package/cjs/PlaneTrackerAPI.js +20 -75
- package/cjs/VapixAPI.d.ts +36 -23
- package/cjs/VapixAPI.js +227 -106
- package/cjs/errors/errors.d.ts +11 -5
- package/cjs/errors/errors.js +5 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +1 -0
- package/cjs/internal/BasicAPI.d.ts +15 -0
- package/cjs/internal/BasicAPI.js +93 -0
- package/cjs/internal/WsEvents.d.ts +1 -0
- package/cjs/internal/WsEvents.js +5 -0
- package/cjs/internal/constants.d.ts +1 -0
- package/cjs/internal/constants.js +2 -1
- package/cjs/internal/convertors.d.ts +6 -0
- package/cjs/internal/convertors.js +115 -0
- package/cjs/internal/transformers.js +8 -8
- package/cjs/internal/types.d.ts +3 -0
- package/cjs/internal/versionCompare.d.ts +2 -2
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +878 -358
- package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +54 -11
- package/cjs/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +28 -28
- package/cjs/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
- package/cjs/types/CamOverlayAPI/htmlOverlaySchema.js +21 -0
- package/cjs/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/index.d.ts +1 -0
- package/cjs/types/CamOverlayAPI/index.js +1 -0
- package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/pipSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
- package/cjs/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
- package/cjs/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
- package/cjs/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
- package/cjs/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
- package/cjs/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
- package/cjs/types/CamScripterAPI.d.ts +0 -11
- package/cjs/types/CamScripterAPI.js +1 -5
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +17745 -4940
- package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +126 -57
- package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +395 -86
- package/cjs/types/CamStreamerAPI/facebookSchema.js +13 -1
- package/cjs/types/CamStreamerAPI/index.d.ts +1 -3
- package/cjs/types/CamStreamerAPI/index.js +1 -3
- package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
- package/cjs/types/CamStreamerAPI/oldStreamSchema.js +1 -1
- package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +392 -304
- package/cjs/types/CamStreamerAPI/streamCommonTypes.js +116 -76
- package/cjs/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
- package/cjs/types/CamStreamerAPI/streamsSchema.js +81 -0
- package/cjs/types/CamStreamerAPI/windySchema.d.ts +356 -87
- package/cjs/types/CamStreamerAPI/windySchema.js +9 -1
- package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +351 -119
- package/cjs/types/CamStreamerAPI/youtubeSchema.js +5 -9
- package/cjs/types/CamSwitcherAPI.d.ts +96 -91
- package/cjs/types/CamSwitcherAPI.js +9 -9
- package/cjs/types/GenetecAgent.d.ts +2 -2
- package/cjs/types/PlaneTrackerAPI.d.ts +60 -47
- package/cjs/types/PlaneTrackerAPI.js +5 -2
- package/cjs/types/VapixAPI.d.ts +51 -32
- package/cjs/types/VapixAPI.js +10 -3
- package/cjs/types/common.d.ts +27 -0
- package/cjs/types/common.js +13 -1
- package/cjs/types/ws/CamStreamerEvents.d.ts +110 -77
- package/cjs/types/ws/CamStreamerEvents.js +11 -7
- package/cjs/types/ws/CamSwitcherEvents.d.ts +8 -8
- package/cjs/types/ws/PlaneTrackerEvents.d.ts +3 -3
- package/esm/CamOverlayAPI.js +16 -65
- package/esm/CamScripterAPI.js +9 -30
- package/esm/CamStreamerAPI.js +70 -78
- package/esm/CamSwitcherAPI.js +31 -89
- package/esm/PlaneTrackerAPI.js +21 -76
- package/esm/VapixAPI.js +228 -107
- package/esm/errors/errors.js +5 -1
- package/esm/index.js +1 -0
- package/esm/internal/BasicAPI.js +89 -0
- package/esm/internal/WsEvents.js +5 -0
- package/esm/internal/constants.js +1 -0
- package/esm/internal/convertors.js +108 -0
- package/esm/internal/transformers.js +1 -1
- package/esm/types/CamOverlayAPI/CamOverlayAPI.js +47 -10
- package/esm/types/CamOverlayAPI/htmlOverlaySchema.js +18 -0
- package/esm/types/CamOverlayAPI/index.js +1 -0
- package/esm/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
- package/esm/types/CamScripterAPI.js +0 -4
- package/esm/types/CamStreamerAPI/CamStreamerAPI.js +109 -41
- package/esm/types/CamStreamerAPI/facebookSchema.js +13 -1
- package/esm/types/CamStreamerAPI/index.js +1 -3
- package/esm/types/CamStreamerAPI/oldStreamSchema.js +1 -1
- package/esm/types/CamStreamerAPI/streamCommonTypes.js +116 -76
- package/esm/types/CamStreamerAPI/streamsSchema.js +75 -0
- package/esm/types/CamStreamerAPI/windySchema.js +9 -1
- package/esm/types/CamStreamerAPI/youtubeSchema.js +5 -9
- package/esm/types/CamSwitcherAPI.js +8 -8
- package/esm/types/PlaneTrackerAPI.js +5 -2
- package/esm/types/VapixAPI.js +9 -2
- package/esm/types/common.js +12 -0
- package/esm/types/ws/CamStreamerEvents.js +11 -7
- package/package.json +4 -4
- package/types/CamOverlayAPI.d.ts +145 -107
- package/types/CamScripterAPI.d.ts +5 -8
- package/types/CamStreamerAPI.d.ts +2362 -806
- package/types/CamSwitcherAPI.d.ts +23 -22
- package/types/PlaneTrackerAPI.d.ts +28 -30
- package/types/VapixAPI.d.ts +36 -23
- package/types/errors/errors.d.ts +11 -5
- package/types/index.d.ts +1 -0
- package/types/internal/BasicAPI.d.ts +15 -0
- package/types/internal/WsEvents.d.ts +1 -0
- package/types/internal/constants.d.ts +1 -0
- package/types/internal/convertors.d.ts +6 -0
- package/types/internal/types.d.ts +3 -0
- package/types/internal/versionCompare.d.ts +2 -2
- package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +878 -358
- package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +28 -28
- package/types/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
- package/types/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/index.d.ts +1 -0
- package/types/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/pipSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
- package/types/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
- package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
- package/types/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
- package/types/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
- package/types/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
- package/types/types/CamScripterAPI.d.ts +0 -11
- package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +17745 -4940
- package/types/types/CamStreamerAPI/facebookSchema.d.ts +395 -86
- package/types/types/CamStreamerAPI/index.d.ts +1 -3
- package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
- package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +392 -304
- package/types/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
- package/types/types/CamStreamerAPI/windySchema.d.ts +356 -87
- package/types/types/CamStreamerAPI/youtubeSchema.d.ts +351 -119
- package/types/types/CamSwitcherAPI.d.ts +96 -91
- package/types/types/GenetecAgent.d.ts +2 -2
- package/types/types/PlaneTrackerAPI.d.ts +60 -47
- package/types/types/VapixAPI.d.ts +51 -32
- package/types/types/common.d.ts +27 -0
- package/types/types/ws/CamStreamerEvents.d.ts +110 -77
- package/types/types/ws/CamSwitcherEvents.d.ts +8 -8
- package/types/types/ws/PlaneTrackerEvents.d.ts +3 -3
- package/cjs/types/CamStreamerAPI/churchSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/churchSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/daCastSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/daCastSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/dailymotionSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/gameChangerSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/hlsPullSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/hlsPushSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/ibmSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/ibmSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/microsoftAzureSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/microsoftStreamSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -323
- package/cjs/types/CamStreamerAPI/mpegDvbSchema.js +0 -27
- package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +0 -284
- package/cjs/types/CamStreamerAPI/rtmpSchema.js +0 -14
- package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/sdCardSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/srtSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/srtSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/twitchSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/twitchSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/vimeoSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/vimeoSchema.js +0 -11
- package/cjs/types/CamStreamerAPI/wowzaSchema.d.ts +0 -275
- package/cjs/types/CamStreamerAPI/wowzaSchema.js +0 -11
- package/esm/types/CamStreamerAPI/churchSchema.js +0 -5
- package/esm/types/CamStreamerAPI/daCastSchema.js +0 -5
- package/esm/types/CamStreamerAPI/dailymotionSchema.js +0 -5
- package/esm/types/CamStreamerAPI/gameChangerSchema.js +0 -5
- package/esm/types/CamStreamerAPI/hlsPullSchema.js +0 -5
- package/esm/types/CamStreamerAPI/hlsPushSchema.js +0 -5
- package/esm/types/CamStreamerAPI/ibmSchema.js +0 -5
- package/esm/types/CamStreamerAPI/microsoftAzureSchema.js +0 -5
- package/esm/types/CamStreamerAPI/microsoftStreamSchema.js +0 -5
- package/esm/types/CamStreamerAPI/mpegDvbSchema.js +0 -21
- package/esm/types/CamStreamerAPI/rtmpSchema.js +0 -8
- package/esm/types/CamStreamerAPI/sdCardSchema.js +0 -5
- package/esm/types/CamStreamerAPI/srtSchema.js +0 -5
- package/esm/types/CamStreamerAPI/twitchSchema.js +0 -5
- package/esm/types/CamStreamerAPI/vimeoSchema.js +0 -5
- package/esm/types/CamStreamerAPI/wowzaSchema.js +0 -5
- package/types/types/CamStreamerAPI/churchSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/daCastSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/ibmSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -323
- package/types/types/CamStreamerAPI/rtmpSchema.d.ts +0 -284
- package/types/types/CamStreamerAPI/sdCardSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/srtSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/twitchSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/vimeoSchema.d.ts +0 -275
- package/types/types/CamStreamerAPI/wowzaSchema.d.ts +0 -275
package/cjs/VapixAPI.js
CHANGED
|
@@ -4,19 +4,15 @@ exports.VapixAPI = void 0;
|
|
|
4
4
|
const utils_1 = require("./internal/utils");
|
|
5
5
|
const VapixAPI_1 = require("./types/VapixAPI");
|
|
6
6
|
const errors_1 = require("./errors/errors");
|
|
7
|
-
const ProxyClient_1 = require("./internal/ProxyClient");
|
|
8
7
|
const zod_1 = require("zod");
|
|
9
8
|
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const BasicAPI_1 = require("./internal/BasicAPI");
|
|
10
|
+
class VapixAPI extends BasicAPI_1.BasicAPI {
|
|
12
11
|
CustomFormData;
|
|
13
12
|
constructor(client, CustomFormData = FormData) {
|
|
14
|
-
|
|
13
|
+
super(client);
|
|
15
14
|
this.CustomFormData = CustomFormData;
|
|
16
15
|
}
|
|
17
|
-
getClient(proxyParams) {
|
|
18
|
-
return proxyParams ? new ProxyClient_1.ProxyClient(this.client, proxyParams) : this.client;
|
|
19
|
-
}
|
|
20
16
|
async postUrlEncoded(path, parameters, headers, options) {
|
|
21
17
|
const data = (0, utils_1.paramToUrl)(parameters);
|
|
22
18
|
const head = { ...headers, 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
@@ -27,11 +23,15 @@ class VapixAPI {
|
|
|
27
23
|
}
|
|
28
24
|
return res;
|
|
29
25
|
}
|
|
30
|
-
async postJson(path,
|
|
31
|
-
const data = JSON.stringify(jsonData);
|
|
32
|
-
const head = { ...headers, 'Content-Type': 'application/json' };
|
|
26
|
+
async postJson(path, data, headers, options) {
|
|
33
27
|
const agent = this.getClient(options?.proxyParams);
|
|
34
|
-
const
|
|
28
|
+
const jsonData = JSON.stringify(data);
|
|
29
|
+
const res = await agent.post({
|
|
30
|
+
path,
|
|
31
|
+
data: jsonData,
|
|
32
|
+
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
33
|
+
timeout: options?.timeout,
|
|
34
|
+
});
|
|
35
35
|
if (!res.ok) {
|
|
36
36
|
throw new errors_1.ErrorWithResponse(res);
|
|
37
37
|
}
|
|
@@ -39,11 +39,18 @@ class VapixAPI {
|
|
|
39
39
|
}
|
|
40
40
|
async getCameraImage(parameters, options) {
|
|
41
41
|
const agent = this.getClient(options?.proxyParams);
|
|
42
|
-
|
|
42
|
+
const res = await agent.get({
|
|
43
43
|
path: '/axis-cgi/jpg/image.cgi',
|
|
44
44
|
parameters,
|
|
45
45
|
timeout: options?.timeout,
|
|
46
|
-
})
|
|
46
|
+
});
|
|
47
|
+
if (!res.ok) {
|
|
48
|
+
throw new errors_1.ErrorWithResponse(res);
|
|
49
|
+
}
|
|
50
|
+
if (res.headers.get('content-type') !== 'image/jpeg') {
|
|
51
|
+
throw new Error(`Unexpected content-type: ${res.headers.get('content-type')}`);
|
|
52
|
+
}
|
|
53
|
+
return res;
|
|
47
54
|
}
|
|
48
55
|
async getEventDeclarations(options) {
|
|
49
56
|
const data = '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">' +
|
|
@@ -66,7 +73,7 @@ class VapixAPI {
|
|
|
66
73
|
async getSupportedAudioSampleRate(options) {
|
|
67
74
|
const path = '/axis-cgi/audio/streamingcapabilities.cgi';
|
|
68
75
|
const jsonData = { apiVersion: '1.0', method: 'list' };
|
|
69
|
-
const res = await this.
|
|
76
|
+
const res = await this._postJsonEncoded(path, jsonData, undefined, options);
|
|
70
77
|
const encoders = VapixAPI_1.audioSampleRatesResponseSchema.parse(await res.json()).data.encoders;
|
|
71
78
|
const data = encoders.aac ?? encoders.AAC ?? [];
|
|
72
79
|
return data.map((item) => {
|
|
@@ -89,83 +96,25 @@ class VapixAPI {
|
|
|
89
96
|
],
|
|
90
97
|
},
|
|
91
98
|
};
|
|
92
|
-
await this.
|
|
99
|
+
await this._postJsonEncoded('/axis-cgi/opticscontrol.cgi', data, undefined, options);
|
|
93
100
|
}
|
|
94
101
|
catch (err) {
|
|
95
|
-
await this.
|
|
102
|
+
await this._postUrlEncoded('/axis-cgi/opticssetup.cgi', {
|
|
96
103
|
autofocus: 'perform',
|
|
97
104
|
source: '1',
|
|
98
|
-
},
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
async checkSDCard(options) {
|
|
102
|
-
const res = await this.postUrlEncoded('/axis-cgi/disks/list.cgi', {
|
|
103
|
-
diskid: 'SD_DISK',
|
|
104
|
-
}, undefined, options);
|
|
105
|
-
const xmlText = await res.text();
|
|
106
|
-
const parser = new fast_xml_parser_1.XMLParser({
|
|
107
|
-
ignoreAttributes: false,
|
|
108
|
-
attributeNamePrefix: '',
|
|
109
|
-
allowBooleanAttributes: true,
|
|
110
|
-
});
|
|
111
|
-
const result = parser.parse(xmlText);
|
|
112
|
-
const data = result.root.disks.disk;
|
|
113
|
-
return VapixAPI_1.sdCardInfoSchema.parse({
|
|
114
|
-
totalSize: parseInt(data.totalsize),
|
|
115
|
-
freeSize: parseInt(data.freesize),
|
|
116
|
-
status: VapixAPI_1.sdCardWatchedStatuses.includes(data.status) ? data.status : 'disconnected',
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
mountSDCard(options) {
|
|
120
|
-
return this._doSDCardMountAction('MOUNT', options);
|
|
121
|
-
}
|
|
122
|
-
unmountSDCard(options) {
|
|
123
|
-
return this._doSDCardMountAction('UNMOUNT', options);
|
|
124
|
-
}
|
|
125
|
-
async _doSDCardMountAction(action, options) {
|
|
126
|
-
const res = await this.postUrlEncoded('/axis-cgi/disks/mount.cgi', {
|
|
127
|
-
action: action,
|
|
128
|
-
diskid: 'SD_DISK',
|
|
129
|
-
}, undefined, options);
|
|
130
|
-
const textXml = await res.text();
|
|
131
|
-
const parser = new fast_xml_parser_1.XMLParser({
|
|
132
|
-
ignoreAttributes: false,
|
|
133
|
-
attributeNamePrefix: '',
|
|
134
|
-
allowBooleanAttributes: true,
|
|
135
|
-
});
|
|
136
|
-
const result = parser.parse(textXml);
|
|
137
|
-
const job = result.root.job;
|
|
138
|
-
if (job.result !== 'OK') {
|
|
139
|
-
throw new errors_1.SDCardActionError(action, job.description);
|
|
105
|
+
}, options);
|
|
140
106
|
}
|
|
141
|
-
return Number(job.jobid);
|
|
142
|
-
}
|
|
143
|
-
async fetchSDCardJobProgress(jobId, options) {
|
|
144
|
-
const res = await this.postUrlEncoded('/disks/job.cgi', {
|
|
145
|
-
jobid: String(jobId),
|
|
146
|
-
diskid: 'SD_DISK',
|
|
147
|
-
}, undefined, options);
|
|
148
|
-
const textXml = await res.text();
|
|
149
|
-
const parser = new fast_xml_parser_1.XMLParser({
|
|
150
|
-
ignoreAttributes: false,
|
|
151
|
-
attributeNamePrefix: '',
|
|
152
|
-
allowBooleanAttributes: true,
|
|
153
|
-
});
|
|
154
|
-
const job = parser.parse(textXml).root.job;
|
|
155
|
-
if (job.result !== 'OK') {
|
|
156
|
-
throw new errors_1.SDCardJobError(job.description);
|
|
157
|
-
}
|
|
158
|
-
return Number(job.progress);
|
|
159
107
|
}
|
|
160
108
|
downloadCameraReport(options) {
|
|
161
|
-
return this.
|
|
109
|
+
return this._getText('/axis-cgi/serverreport.cgi', { mode: 'text' }, options);
|
|
162
110
|
}
|
|
163
|
-
getSystemLog(options) {
|
|
164
|
-
|
|
111
|
+
async getSystemLog(options) {
|
|
112
|
+
const res = await this._postUrlEncoded('/axis-cgi/admin/systemlog.cgi', {}, options);
|
|
113
|
+
return res.text();
|
|
165
114
|
}
|
|
166
115
|
async getMaxFps(channel, options) {
|
|
167
116
|
const data = { apiVersion: '1.0', method: 'getCaptureModes' };
|
|
168
|
-
const res = await this.
|
|
117
|
+
const res = await this._postJsonEncoded('/axis-cgi/capturemode.cgi', data, undefined, options);
|
|
169
118
|
const response = VapixAPI_1.maxFpsResponseSchema.parse(await res.json());
|
|
170
119
|
const channels = response.data;
|
|
171
120
|
if (channels === undefined) {
|
|
@@ -211,12 +160,12 @@ class VapixAPI {
|
|
|
211
160
|
}
|
|
212
161
|
async getDateTimeInfo(options) {
|
|
213
162
|
const data = { apiVersion: '1.0', method: 'getDateTimeInfo' };
|
|
214
|
-
const res = await this.
|
|
163
|
+
const res = await this._postJsonEncoded('/axis-cgi/time.cgi', data, undefined, options);
|
|
215
164
|
return VapixAPI_1.dateTimeinfoSchema.parse(await res.json());
|
|
216
165
|
}
|
|
217
166
|
async getDevicesSettings(options) {
|
|
218
167
|
const data = { apiVersion: '1.0', method: 'getDevicesSettings' };
|
|
219
|
-
const res = await this.
|
|
168
|
+
const res = await this._postJsonEncoded('/axis-cgi/audiodevicecontrol.cgi', data, undefined, options);
|
|
220
169
|
const result = VapixAPI_1.audioDeviceRequestSchema.parse(await res.json());
|
|
221
170
|
return result.data.devices.map((device) => ({
|
|
222
171
|
...device,
|
|
@@ -225,7 +174,7 @@ class VapixAPI {
|
|
|
225
174
|
}));
|
|
226
175
|
}
|
|
227
176
|
async fetchRemoteDeviceInfo(payload, options) {
|
|
228
|
-
const res = await this.
|
|
177
|
+
const res = await this._postJsonEncoded('/axis-cgi/basicdeviceinfo.cgi', payload, undefined, options);
|
|
229
178
|
const json = await res.json();
|
|
230
179
|
if ((0, utils_1.isNullish)(json.data)) {
|
|
231
180
|
throw new errors_1.NoDeviceInfoError();
|
|
@@ -234,25 +183,84 @@ class VapixAPI {
|
|
|
234
183
|
}
|
|
235
184
|
async getHeaders(options) {
|
|
236
185
|
const data = { apiVersion: '1.0', method: 'list' };
|
|
237
|
-
const res = await this.
|
|
186
|
+
const res = await this._postJsonEncoded('/axis-cgi/customhttpheader.cgi', data, undefined, options);
|
|
238
187
|
return zod_1.z.object({ data: zod_1.z.record(zod_1.z.string()) }).parse(await res.json()).data;
|
|
239
188
|
}
|
|
240
189
|
async setHeaders(headers, options) {
|
|
241
190
|
const data = { apiVersion: '1.0', method: 'set', params: headers };
|
|
242
|
-
|
|
191
|
+
await this._postJsonEncoded('/axis-cgi/customhttpheader.cgi', data, undefined, options);
|
|
192
|
+
}
|
|
193
|
+
async checkSDCard(options) {
|
|
194
|
+
const res = await this._postUrlEncoded('/axis-cgi/disks/list.cgi', {
|
|
195
|
+
diskid: 'SD_DISK',
|
|
196
|
+
}, options);
|
|
197
|
+
const xmlText = await res.text();
|
|
198
|
+
const parser = new fast_xml_parser_1.XMLParser({
|
|
199
|
+
ignoreAttributes: false,
|
|
200
|
+
attributeNamePrefix: '',
|
|
201
|
+
allowBooleanAttributes: true,
|
|
202
|
+
});
|
|
203
|
+
const result = parser.parse(xmlText);
|
|
204
|
+
const data = result.root.disks.disk;
|
|
205
|
+
return VapixAPI_1.sdCardInfoSchema.parse({
|
|
206
|
+
totalSize: parseInt(data.totalsize),
|
|
207
|
+
freeSize: parseInt(data.freesize),
|
|
208
|
+
status: VapixAPI_1.sdCardWatchedStatuses.includes(data.status) ? data.status : 'disconnected',
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
mountSDCard(options) {
|
|
212
|
+
return this._doSDCardMountAction('MOUNT', options);
|
|
213
|
+
}
|
|
214
|
+
unmountSDCard(options) {
|
|
215
|
+
return this._doSDCardMountAction('UNMOUNT', options);
|
|
216
|
+
}
|
|
217
|
+
async _doSDCardMountAction(action, options) {
|
|
218
|
+
const res = await this._postUrlEncoded('/axis-cgi/disks/mount.cgi', {
|
|
219
|
+
action: action,
|
|
220
|
+
diskid: 'SD_DISK',
|
|
221
|
+
}, options);
|
|
222
|
+
const textXml = await res.text();
|
|
223
|
+
const parser = new fast_xml_parser_1.XMLParser({
|
|
224
|
+
ignoreAttributes: false,
|
|
225
|
+
attributeNamePrefix: '',
|
|
226
|
+
allowBooleanAttributes: true,
|
|
227
|
+
});
|
|
228
|
+
const result = parser.parse(textXml);
|
|
229
|
+
const job = result.root.job;
|
|
230
|
+
if (job.result !== 'OK') {
|
|
231
|
+
throw new errors_1.SDCardActionError(action, job.description);
|
|
232
|
+
}
|
|
233
|
+
return Number(job.jobid);
|
|
234
|
+
}
|
|
235
|
+
async fetchSDCardJobProgress(jobId, options) {
|
|
236
|
+
const res = await this._postUrlEncoded('/disks/job.cgi', {
|
|
237
|
+
jobid: String(jobId),
|
|
238
|
+
diskid: 'SD_DISK',
|
|
239
|
+
}, options);
|
|
240
|
+
const textXml = await res.text();
|
|
241
|
+
const parser = new fast_xml_parser_1.XMLParser({
|
|
242
|
+
ignoreAttributes: false,
|
|
243
|
+
attributeNamePrefix: '',
|
|
244
|
+
allowBooleanAttributes: true,
|
|
245
|
+
});
|
|
246
|
+
const job = parser.parse(textXml).root.job;
|
|
247
|
+
if (job.result !== 'OK') {
|
|
248
|
+
throw new errors_1.SDCardJobError(job.description);
|
|
249
|
+
}
|
|
250
|
+
return Number(job.progress);
|
|
243
251
|
}
|
|
244
252
|
async getParameter(paramNames, options) {
|
|
245
|
-
const response = await this.
|
|
253
|
+
const response = await this._postUrlEncoded('/axis-cgi/param.cgi', {
|
|
246
254
|
action: 'list',
|
|
247
255
|
group: (0, utils_1.arrayToUrl)(paramNames),
|
|
248
|
-
},
|
|
256
|
+
}, options);
|
|
249
257
|
return VapixAPI.parseParameters(await response.text());
|
|
250
258
|
}
|
|
251
259
|
async setParameter(params, options) {
|
|
252
|
-
const res = await this.
|
|
260
|
+
const res = await this._postUrlEncoded('/axis-cgi/param.cgi', {
|
|
253
261
|
...params,
|
|
254
262
|
action: 'update',
|
|
255
|
-
},
|
|
263
|
+
}, options);
|
|
256
264
|
const responseText = await res.text();
|
|
257
265
|
if (responseText.startsWith('# Error')) {
|
|
258
266
|
throw new errors_1.SettingParameterError(responseText);
|
|
@@ -300,10 +308,10 @@ class VapixAPI {
|
|
|
300
308
|
return this.setParameter(params, options);
|
|
301
309
|
}
|
|
302
310
|
async getPTZPresetList(channel, options) {
|
|
303
|
-
const res = await this.
|
|
311
|
+
const res = await this._postUrlEncoded('/axis-cgi/com/ptz.cgi', {
|
|
304
312
|
query: 'presetposcam',
|
|
305
313
|
camera: channel,
|
|
306
|
-
},
|
|
314
|
+
}, options);
|
|
307
315
|
const text = await res.text();
|
|
308
316
|
const lines = text.split(/[\r\n]/);
|
|
309
317
|
const positions = [];
|
|
@@ -320,11 +328,11 @@ class VapixAPI {
|
|
|
320
328
|
}
|
|
321
329
|
async listPTZ(camera, options) {
|
|
322
330
|
const url = `/axis-cgi/com/ptz.cgi`;
|
|
323
|
-
const response = await this.
|
|
331
|
+
const response = await this._postUrlEncoded(url, {
|
|
324
332
|
camera,
|
|
325
333
|
query: 'presetposcamdata',
|
|
326
334
|
format: 'json',
|
|
327
|
-
},
|
|
335
|
+
}, options);
|
|
328
336
|
const text = await response.text();
|
|
329
337
|
if (text === '') {
|
|
330
338
|
throw new errors_1.PtzNotSupportedError();
|
|
@@ -332,10 +340,10 @@ class VapixAPI {
|
|
|
332
340
|
return VapixAPI.parseCameraPtzResponse(text)[camera] ?? [];
|
|
333
341
|
}
|
|
334
342
|
async listPtzVideoSourceOverview(options) {
|
|
335
|
-
const response = await this.
|
|
343
|
+
const response = await this._postUrlEncoded('/axis-cgi/com/ptz.cgi', {
|
|
336
344
|
query: 'presetposall',
|
|
337
345
|
format: 'json',
|
|
338
|
-
},
|
|
346
|
+
}, options);
|
|
339
347
|
const text = await response.text();
|
|
340
348
|
if (text === '') {
|
|
341
349
|
throw new errors_1.PtzNotSupportedError();
|
|
@@ -352,17 +360,17 @@ class VapixAPI {
|
|
|
352
360
|
});
|
|
353
361
|
return VapixAPI_1.ptzOverviewSchema.parse(res);
|
|
354
362
|
}
|
|
355
|
-
goToPreset(channel, presetName, options) {
|
|
356
|
-
|
|
363
|
+
async goToPreset(channel, presetName, options) {
|
|
364
|
+
await this._postUrlEncoded('/axis-cgi/com/ptz.cgi', {
|
|
357
365
|
camera: channel.toString(),
|
|
358
366
|
gotoserverpresetname: presetName,
|
|
359
|
-
},
|
|
367
|
+
}, options);
|
|
360
368
|
}
|
|
361
369
|
async getPtzPosition(camera, options) {
|
|
362
|
-
const res = await this.
|
|
370
|
+
const res = await this._postUrlEncoded('/axis-cgi/com/ptz.cgi', {
|
|
363
371
|
query: 'position',
|
|
364
372
|
camera: camera.toString(),
|
|
365
|
-
},
|
|
373
|
+
}, options);
|
|
366
374
|
const params = VapixAPI.parseParameters(await res.text());
|
|
367
375
|
return VapixAPI_1.cameraPTZItemDataSchema.parse({
|
|
368
376
|
pan: Number(params.pan),
|
|
@@ -371,16 +379,16 @@ class VapixAPI {
|
|
|
371
379
|
});
|
|
372
380
|
}
|
|
373
381
|
async getPorts(options) {
|
|
374
|
-
const res = await this.
|
|
382
|
+
const res = await this._postJsonEncoded('/axis-cgi/io/portmanagement.cgi', {
|
|
375
383
|
apiVersion: '1.0',
|
|
376
384
|
context: '',
|
|
377
385
|
method: 'getPorts',
|
|
378
386
|
}, undefined, options);
|
|
379
387
|
const portResponseParsed = VapixAPI_1.getPortsResponseSchema.parse(await res.json());
|
|
380
|
-
return portResponseParsed.data.items;
|
|
388
|
+
return portResponseParsed.data.items ?? [];
|
|
381
389
|
}
|
|
382
390
|
async setPorts(ports, options) {
|
|
383
|
-
await this.
|
|
391
|
+
await this._postJsonEncoded('/axis-cgi/io/portmanagement.cgi', {
|
|
384
392
|
apiVersion: '1.0',
|
|
385
393
|
context: '',
|
|
386
394
|
method: 'setPorts',
|
|
@@ -388,13 +396,103 @@ class VapixAPI {
|
|
|
388
396
|
}, undefined, options);
|
|
389
397
|
}
|
|
390
398
|
async setPortStateSequence(port, sequence, options) {
|
|
391
|
-
await this.
|
|
399
|
+
await this._postJsonEncoded('/axis-cgi/io/portmanagement.cgi', {
|
|
392
400
|
apiVersion: '1.0',
|
|
393
401
|
context: '',
|
|
394
402
|
method: 'setStateSequence',
|
|
395
403
|
params: { port, sequence },
|
|
396
404
|
}, undefined, options);
|
|
397
405
|
}
|
|
406
|
+
async addCameraUser(username, pass, sgrp, comment, options) {
|
|
407
|
+
const res = await this._postUrlEncoded('/axis-cgi/pwdgrp.cgi', {
|
|
408
|
+
action: 'add',
|
|
409
|
+
user: username,
|
|
410
|
+
pwd: pass,
|
|
411
|
+
grp: 'users',
|
|
412
|
+
sgrp,
|
|
413
|
+
comment,
|
|
414
|
+
}, options);
|
|
415
|
+
await VapixAPI.checkTextResponseForError(res);
|
|
416
|
+
}
|
|
417
|
+
async getCameraUsers(options) {
|
|
418
|
+
const res = await this._postUrlEncoded('/axis-cgi/pwdgrp.cgi', {
|
|
419
|
+
action: 'get',
|
|
420
|
+
}, options);
|
|
421
|
+
const responseText = await VapixAPI.checkTextResponseForError(res);
|
|
422
|
+
const viewersString = responseText.match(/^viewer="([a-z0-9,]*)"/im)?.[1] ?? '';
|
|
423
|
+
return viewersString.split(',');
|
|
424
|
+
}
|
|
425
|
+
async editCameraUser(username, pass, options) {
|
|
426
|
+
const res = await this._postUrlEncoded('/axis-cgi/pwdgrp.cgi', {
|
|
427
|
+
action: 'update',
|
|
428
|
+
user: username,
|
|
429
|
+
pwd: pass,
|
|
430
|
+
}, options);
|
|
431
|
+
await VapixAPI.checkTextResponseForError(res);
|
|
432
|
+
}
|
|
433
|
+
async getRecordingRuleList(options) {
|
|
434
|
+
const res = await this._getText('/axis-cgi/record/continuous/listconfiguration.cgi', undefined, options);
|
|
435
|
+
const resultNode = VapixAPI.parseXmlResponse(res, 'continuousrecordingconfigurations');
|
|
436
|
+
const configurationNodes = resultNode.getElementsByTagName('continuousrecordingconfiguration');
|
|
437
|
+
const configs = [];
|
|
438
|
+
for (const node of configurationNodes) {
|
|
439
|
+
if ((0, utils_1.isNullish)(node)) {
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
configs.push({
|
|
443
|
+
profile: node.getAttribute('profile') ?? '',
|
|
444
|
+
diskid: node.getAttribute('diskid') ?? '',
|
|
445
|
+
options: VapixAPI.parseQueryString(node.getAttribute('options')),
|
|
446
|
+
eventid: node.getAttribute('eventid') ?? '',
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
return configs;
|
|
450
|
+
}
|
|
451
|
+
async addRecordingRule(params, options) {
|
|
452
|
+
const res = await this._getText('/axis-cgi/record/continuous/addconfiguration.cgi', params, options);
|
|
453
|
+
const resultNode = VapixAPI.parseXmlResponse(res, 'configure');
|
|
454
|
+
const result = resultNode.getAttribute('result');
|
|
455
|
+
if (result !== 'OK') {
|
|
456
|
+
throw new Error(resultNode.getAttribute('errormsg') ?? result ?? 'Unknown error');
|
|
457
|
+
}
|
|
458
|
+
return resultNode.getAttribute('profile');
|
|
459
|
+
}
|
|
460
|
+
async removeRecordingRule(profileId, options) {
|
|
461
|
+
const res = await this._getText('/axis-cgi/record/continuous/removeconfiguration.cgi', {
|
|
462
|
+
profile: profileId,
|
|
463
|
+
}, options);
|
|
464
|
+
const resultNode = VapixAPI.parseXmlResponse(res, 'remove');
|
|
465
|
+
const result = resultNode.getAttribute('result');
|
|
466
|
+
if (result !== 'OK') {
|
|
467
|
+
throw new Error(resultNode.getAttribute('errormsg') ?? result ?? 'Unknown error');
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
async getDiskInfo(diskId = 'all', options) {
|
|
471
|
+
const res = await this._getText('/axis-cgi/disks/list.cgi', {
|
|
472
|
+
diskid: diskId,
|
|
473
|
+
}, options);
|
|
474
|
+
const resultNode = VapixAPI.parseXmlResponse(res, 'disks');
|
|
475
|
+
const disks = resultNode.getElementsByTagName('disk');
|
|
476
|
+
if ((0, utils_1.isNullish)(disks) || disks.length === 0) {
|
|
477
|
+
return false;
|
|
478
|
+
}
|
|
479
|
+
const requiredReadyProps = {
|
|
480
|
+
status: 'OK',
|
|
481
|
+
locked: 'no',
|
|
482
|
+
readonly: 'no',
|
|
483
|
+
};
|
|
484
|
+
for (const disk of disks) {
|
|
485
|
+
let isReady = true;
|
|
486
|
+
for (const name in requiredReadyProps) {
|
|
487
|
+
const value = disk.getAttribute(name);
|
|
488
|
+
isReady = isReady && requiredReadyProps[name] === value;
|
|
489
|
+
}
|
|
490
|
+
if (isReady) {
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
398
496
|
async getApplicationList(options) {
|
|
399
497
|
const agent = this.getClient(options?.proxyParams);
|
|
400
498
|
const res = await agent.get({ path: '/axis-cgi/applications/list.cgi', timeout: options?.timeout });
|
|
@@ -412,7 +510,7 @@ class VapixAPI {
|
|
|
412
510
|
const appList = apps.map((app) => {
|
|
413
511
|
return {
|
|
414
512
|
...app,
|
|
415
|
-
appId: VapixAPI_1.
|
|
513
|
+
appId: VapixAPI_1.ALL_APP_IDS.find((id) => id.toLowerCase() === app.Name.toLowerCase()) ?? null,
|
|
416
514
|
};
|
|
417
515
|
});
|
|
418
516
|
return VapixAPI_1.applicationListSchema.parse(appList);
|
|
@@ -472,7 +570,7 @@ class VapixAPI {
|
|
|
472
570
|
headers: {
|
|
473
571
|
contentType: 'application/octet-stream',
|
|
474
572
|
},
|
|
475
|
-
timeout: options?.timeout ??
|
|
573
|
+
timeout: options?.timeout ?? 300000,
|
|
476
574
|
});
|
|
477
575
|
if (!res.ok) {
|
|
478
576
|
throw new errors_1.ErrorWithResponse(res);
|
|
@@ -482,6 +580,21 @@ class VapixAPI {
|
|
|
482
580
|
throw new errors_1.ApplicationAPIError('INSTALL', text);
|
|
483
581
|
}
|
|
484
582
|
}
|
|
583
|
+
static parseQueryString = (queryString) => {
|
|
584
|
+
const entries = queryString
|
|
585
|
+
?.split('&')
|
|
586
|
+
.filter((x) => x !== '')
|
|
587
|
+
.map((x) => x.split('=', 2));
|
|
588
|
+
return !(0, utils_1.isNullish)(entries) ? Object.fromEntries(entries) : {};
|
|
589
|
+
};
|
|
590
|
+
static checkTextResponseForError = async (response) => {
|
|
591
|
+
const responseText = await response.text();
|
|
592
|
+
const isError = responseText.match(/Error:([^<]*)/);
|
|
593
|
+
if (!(0, utils_1.isNullish)(isError)) {
|
|
594
|
+
throw new errors_1.ErrorWithResponse(response);
|
|
595
|
+
}
|
|
596
|
+
return responseText;
|
|
597
|
+
};
|
|
485
598
|
static parseParameters = (response) => {
|
|
486
599
|
const params = {};
|
|
487
600
|
const lines = response.split(/[\r\n]/);
|
|
@@ -548,5 +661,13 @@ class VapixAPI {
|
|
|
548
661
|
});
|
|
549
662
|
return res;
|
|
550
663
|
};
|
|
664
|
+
static parseXmlResponse = (xml, nodeName) => {
|
|
665
|
+
const doc = new DOMParser().parseFromString(xml, 'text/xml');
|
|
666
|
+
const node = doc.getElementsByTagName(nodeName);
|
|
667
|
+
if (node.length !== 1 || (0, utils_1.isNullish)(node[0])) {
|
|
668
|
+
throw new Error('Invalid XML from camera');
|
|
669
|
+
}
|
|
670
|
+
return node[0];
|
|
671
|
+
};
|
|
551
672
|
}
|
|
552
673
|
exports.VapixAPI = VapixAPI;
|
package/cjs/errors/errors.d.ts
CHANGED
|
@@ -92,11 +92,17 @@ export declare class BadRequestError<T extends TResponse> extends ErrorWithRespo
|
|
|
92
92
|
}
|
|
93
93
|
export declare class MigrationError extends Error {
|
|
94
94
|
readonly valid: TStream[];
|
|
95
|
-
readonly
|
|
96
|
-
|
|
95
|
+
readonly old: (TOldStream & {
|
|
96
|
+
streamId: string;
|
|
97
97
|
})[];
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
readonly invalid: any[];
|
|
99
|
+
readonly unknown: {
|
|
100
|
+
platform: string;
|
|
101
|
+
}[];
|
|
102
|
+
constructor(valid: TStream[], old: (TOldStream & {
|
|
103
|
+
streamId: string;
|
|
104
|
+
})[], invalid?: any[], unknown?: {
|
|
105
|
+
platform: string;
|
|
106
|
+
}[]);
|
|
101
107
|
}
|
|
102
108
|
export {};
|
package/cjs/errors/errors.js
CHANGED
|
@@ -206,12 +206,16 @@ class BadRequestError extends ErrorWithResponse {
|
|
|
206
206
|
exports.BadRequestError = BadRequestError;
|
|
207
207
|
class MigrationError extends Error {
|
|
208
208
|
valid;
|
|
209
|
+
old;
|
|
209
210
|
invalid;
|
|
210
|
-
|
|
211
|
+
unknown;
|
|
212
|
+
constructor(valid, old, invalid = [], unknown = []) {
|
|
211
213
|
super('Migration to newer version is needed: some stream entries failed to parse.');
|
|
212
214
|
this.name = 'MigrationError';
|
|
213
215
|
this.valid = valid;
|
|
216
|
+
this.old = old;
|
|
214
217
|
this.invalid = invalid;
|
|
218
|
+
this.unknown = unknown;
|
|
215
219
|
}
|
|
216
220
|
}
|
|
217
221
|
exports.MigrationError = MigrationError;
|
package/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './errors/errors';
|
|
2
2
|
export * from './internal/types';
|
|
3
3
|
export * from './internal/constants';
|
|
4
|
+
export * from './internal/convertors';
|
|
4
5
|
export * from './internal/utils';
|
|
5
6
|
export * from './internal/versionCompare';
|
|
6
7
|
export * from './internal/ProxyClient';
|
package/cjs/index.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.VapixAPI = exports.CamScripterAPI = exports.PlaneTrackerEvents = exports
|
|
|
18
18
|
__exportStar(require("./errors/errors"), exports);
|
|
19
19
|
__exportStar(require("./internal/types"), exports);
|
|
20
20
|
__exportStar(require("./internal/constants"), exports);
|
|
21
|
+
__exportStar(require("./internal/convertors"), exports);
|
|
21
22
|
__exportStar(require("./internal/utils"), exports);
|
|
22
23
|
__exportStar(require("./internal/versionCompare"), exports);
|
|
23
24
|
__exportStar(require("./internal/ProxyClient"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { THttpRequestOptions, TProxyParams } from '../types/common';
|
|
2
|
+
import { ProxyClient } from './ProxyClient';
|
|
3
|
+
import { IClient, TBlobResponse, TParameters, TResponse } from './types';
|
|
4
|
+
export declare class BasicAPI<Client extends IClient<TResponse, any>> {
|
|
5
|
+
protected client: Client;
|
|
6
|
+
constructor(client: Client);
|
|
7
|
+
getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
|
|
8
|
+
protected _getJson(path: string, parameters?: TParameters, options?: THttpRequestOptions): Promise<any>;
|
|
9
|
+
protected _getText(path: string, parameters?: TParameters, options?: THttpRequestOptions): Promise<string>;
|
|
10
|
+
protected _getBlob(path: string, parameters?: TParameters, options?: THttpRequestOptions): Promise<TBlobResponse<Client>>;
|
|
11
|
+
private parseBlobResponse;
|
|
12
|
+
protected _post(path: string, data: string | Parameters<Client['post']>[0]['data'], parameters?: TParameters, options?: THttpRequestOptions, headers?: Record<string, string>): Promise<any>;
|
|
13
|
+
protected _postJsonEncoded(path: string, data: string | Parameters<Client['post']>[0]['data'], parameters?: TParameters, options?: THttpRequestOptions): Promise<TResponse>;
|
|
14
|
+
protected _postUrlEncoded(path: string, data: TParameters, options?: THttpRequestOptions): Promise<TResponse>;
|
|
15
|
+
}
|