camstreamerlib 4.0.0-beta.97 → 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.
Files changed (218) hide show
  1. package/README.md +44 -15
  2. package/cjs/CamOverlayAPI.d.ts +147 -109
  3. package/cjs/CamOverlayAPI.js +14 -63
  4. package/cjs/CamScripterAPI.d.ts +5 -8
  5. package/cjs/CamScripterAPI.js +11 -29
  6. package/cjs/CamStreamerAPI.d.ts +2745 -589
  7. package/cjs/CamStreamerAPI.js +68 -76
  8. package/cjs/CamSwitcherAPI.d.ts +23 -22
  9. package/cjs/CamSwitcherAPI.js +30 -88
  10. package/cjs/PlaneTrackerAPI.d.ts +28 -30
  11. package/cjs/PlaneTrackerAPI.js +20 -75
  12. package/cjs/VapixAPI.d.ts +36 -23
  13. package/cjs/VapixAPI.js +227 -106
  14. package/cjs/errors/errors.d.ts +11 -5
  15. package/cjs/errors/errors.js +5 -1
  16. package/cjs/index.d.ts +1 -0
  17. package/cjs/index.js +1 -0
  18. package/cjs/internal/BasicAPI.d.ts +15 -0
  19. package/cjs/internal/BasicAPI.js +93 -0
  20. package/cjs/internal/WsEvents.d.ts +1 -0
  21. package/cjs/internal/WsEvents.js +5 -0
  22. package/cjs/internal/constants.d.ts +1 -0
  23. package/cjs/internal/constants.js +2 -1
  24. package/cjs/internal/convertors.d.ts +6 -0
  25. package/cjs/internal/convertors.js +115 -0
  26. package/cjs/internal/transformers.js +8 -8
  27. package/cjs/internal/types.d.ts +3 -0
  28. package/cjs/internal/versionCompare.d.ts +2 -2
  29. package/cjs/types/CamOverlayAPI/CamOverlayAPI.d.ts +894 -374
  30. package/cjs/types/CamOverlayAPI/CamOverlayAPI.js +54 -11
  31. package/cjs/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
  32. package/cjs/types/CamOverlayAPI/customGraphicsSchema.d.ts +40 -40
  33. package/cjs/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
  34. package/cjs/types/CamOverlayAPI/htmlOverlaySchema.js +21 -0
  35. package/cjs/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
  36. package/cjs/types/CamOverlayAPI/index.d.ts +1 -0
  37. package/cjs/types/CamOverlayAPI/index.js +1 -0
  38. package/cjs/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
  39. package/cjs/types/CamOverlayAPI/pipSchema.d.ts +8 -8
  40. package/cjs/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
  41. package/cjs/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
  42. package/cjs/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
  43. package/cjs/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
  44. package/cjs/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
  45. package/cjs/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
  46. package/cjs/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
  47. package/cjs/types/CamScripterAPI.d.ts +0 -11
  48. package/cjs/types/CamScripterAPI.js +1 -5
  49. package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +19642 -3073
  50. package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +126 -57
  51. package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +434 -52
  52. package/cjs/types/CamStreamerAPI/facebookSchema.js +13 -1
  53. package/cjs/types/CamStreamerAPI/index.d.ts +1 -3
  54. package/cjs/types/CamStreamerAPI/index.js +1 -3
  55. package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
  56. package/cjs/types/CamStreamerAPI/oldStreamSchema.js +1 -1
  57. package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +430 -219
  58. package/cjs/types/CamStreamerAPI/streamCommonTypes.js +116 -58
  59. package/cjs/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
  60. package/cjs/types/CamStreamerAPI/streamsSchema.js +81 -0
  61. package/cjs/types/CamStreamerAPI/windySchema.d.ts +394 -52
  62. package/cjs/types/CamStreamerAPI/windySchema.js +9 -1
  63. package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +402 -52
  64. package/cjs/types/CamStreamerAPI/youtubeSchema.js +12 -1
  65. package/cjs/types/CamSwitcherAPI.d.ts +96 -91
  66. package/cjs/types/CamSwitcherAPI.js +9 -9
  67. package/cjs/types/GenetecAgent.d.ts +2 -2
  68. package/cjs/types/PlaneTrackerAPI.d.ts +60 -47
  69. package/cjs/types/PlaneTrackerAPI.js +5 -2
  70. package/cjs/types/VapixAPI.d.ts +51 -32
  71. package/cjs/types/VapixAPI.js +10 -3
  72. package/cjs/types/common.d.ts +27 -0
  73. package/cjs/types/common.js +13 -1
  74. package/cjs/types/ws/CamStreamerEvents.d.ts +110 -77
  75. package/cjs/types/ws/CamStreamerEvents.js +11 -7
  76. package/cjs/types/ws/CamSwitcherEvents.d.ts +8 -8
  77. package/cjs/types/ws/PlaneTrackerEvents.d.ts +3 -3
  78. package/esm/CamOverlayAPI.js +16 -65
  79. package/esm/CamScripterAPI.js +9 -30
  80. package/esm/CamStreamerAPI.js +70 -78
  81. package/esm/CamSwitcherAPI.js +31 -89
  82. package/esm/PlaneTrackerAPI.js +21 -76
  83. package/esm/VapixAPI.js +228 -107
  84. package/esm/errors/errors.js +5 -1
  85. package/esm/index.js +1 -0
  86. package/esm/internal/BasicAPI.js +89 -0
  87. package/esm/internal/WsEvents.js +5 -0
  88. package/esm/internal/constants.js +1 -0
  89. package/esm/internal/convertors.js +108 -0
  90. package/esm/internal/transformers.js +1 -1
  91. package/esm/types/CamOverlayAPI/CamOverlayAPI.js +47 -10
  92. package/esm/types/CamOverlayAPI/htmlOverlaySchema.js +18 -0
  93. package/esm/types/CamOverlayAPI/index.js +1 -0
  94. package/esm/types/CamOverlayAPI/serviceCommonTypes.js +6 -3
  95. package/esm/types/CamScripterAPI.js +0 -4
  96. package/esm/types/CamStreamerAPI/CamStreamerAPI.js +109 -41
  97. package/esm/types/CamStreamerAPI/facebookSchema.js +13 -1
  98. package/esm/types/CamStreamerAPI/index.js +1 -3
  99. package/esm/types/CamStreamerAPI/oldStreamSchema.js +1 -1
  100. package/esm/types/CamStreamerAPI/streamCommonTypes.js +116 -58
  101. package/esm/types/CamStreamerAPI/streamsSchema.js +75 -0
  102. package/esm/types/CamStreamerAPI/windySchema.js +9 -1
  103. package/esm/types/CamStreamerAPI/youtubeSchema.js +12 -1
  104. package/esm/types/CamSwitcherAPI.js +8 -8
  105. package/esm/types/PlaneTrackerAPI.js +5 -2
  106. package/esm/types/VapixAPI.js +9 -2
  107. package/esm/types/common.js +12 -0
  108. package/esm/types/ws/CamStreamerEvents.js +11 -7
  109. package/package.json +4 -4
  110. package/types/CamOverlayAPI.d.ts +147 -109
  111. package/types/CamScripterAPI.d.ts +5 -8
  112. package/types/CamStreamerAPI.d.ts +2745 -589
  113. package/types/CamSwitcherAPI.d.ts +23 -22
  114. package/types/PlaneTrackerAPI.d.ts +28 -30
  115. package/types/VapixAPI.d.ts +36 -23
  116. package/types/errors/errors.d.ts +11 -5
  117. package/types/index.d.ts +1 -0
  118. package/types/internal/BasicAPI.d.ts +15 -0
  119. package/types/internal/WsEvents.d.ts +1 -0
  120. package/types/internal/constants.d.ts +1 -0
  121. package/types/internal/convertors.d.ts +6 -0
  122. package/types/internal/types.d.ts +3 -0
  123. package/types/internal/versionCompare.d.ts +2 -2
  124. package/types/types/CamOverlayAPI/CamOverlayAPI.d.ts +894 -374
  125. package/types/types/CamOverlayAPI/accuweatherSchema.d.ts +10 -10
  126. package/types/types/CamOverlayAPI/customGraphicsSchema.d.ts +40 -40
  127. package/types/types/CamOverlayAPI/htmlOverlaySchema.d.ts +81 -0
  128. package/types/types/CamOverlayAPI/imagesSchema.d.ts +10 -10
  129. package/types/types/CamOverlayAPI/index.d.ts +1 -0
  130. package/types/types/CamOverlayAPI/infotickerSchema.d.ts +8 -8
  131. package/types/types/CamOverlayAPI/pipSchema.d.ts +8 -8
  132. package/types/types/CamOverlayAPI/ptzCompassSchema.d.ts +10 -10
  133. package/types/types/CamOverlayAPI/ptzSchema.d.ts +13 -13
  134. package/types/types/CamOverlayAPI/scoreBoardSchema.d.ts +18 -18
  135. package/types/types/CamOverlayAPI/screenSharingSchema.d.ts +8 -8
  136. package/types/types/CamOverlayAPI/serviceCommonTypes.d.ts +17 -16
  137. package/types/types/CamOverlayAPI/webCameraSharingSchema.d.ts +8 -8
  138. package/types/types/CamScripterAPI.d.ts +0 -11
  139. package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +19642 -3073
  140. package/types/types/CamStreamerAPI/facebookSchema.d.ts +434 -52
  141. package/types/types/CamStreamerAPI/index.d.ts +1 -3
  142. package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +47 -47
  143. package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +430 -219
  144. package/types/types/CamStreamerAPI/streamsSchema.d.ts +8812 -0
  145. package/types/types/CamStreamerAPI/windySchema.d.ts +394 -52
  146. package/types/types/CamStreamerAPI/youtubeSchema.d.ts +402 -52
  147. package/types/types/CamSwitcherAPI.d.ts +96 -91
  148. package/types/types/GenetecAgent.d.ts +2 -2
  149. package/types/types/PlaneTrackerAPI.d.ts +60 -47
  150. package/types/types/VapixAPI.d.ts +51 -32
  151. package/types/types/common.d.ts +27 -0
  152. package/types/types/ws/CamStreamerEvents.d.ts +110 -77
  153. package/types/types/ws/CamSwitcherEvents.d.ts +8 -8
  154. package/types/types/ws/PlaneTrackerEvents.d.ts +3 -3
  155. package/cjs/types/CamStreamerAPI/churchSchema.d.ts +0 -202
  156. package/cjs/types/CamStreamerAPI/churchSchema.js +0 -11
  157. package/cjs/types/CamStreamerAPI/daCastSchema.d.ts +0 -202
  158. package/cjs/types/CamStreamerAPI/daCastSchema.js +0 -11
  159. package/cjs/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -202
  160. package/cjs/types/CamStreamerAPI/dailymotionSchema.js +0 -11
  161. package/cjs/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -202
  162. package/cjs/types/CamStreamerAPI/gameChangerSchema.js +0 -11
  163. package/cjs/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -202
  164. package/cjs/types/CamStreamerAPI/hlsPullSchema.js +0 -11
  165. package/cjs/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -202
  166. package/cjs/types/CamStreamerAPI/hlsPushSchema.js +0 -11
  167. package/cjs/types/CamStreamerAPI/ibmSchema.d.ts +0 -202
  168. package/cjs/types/CamStreamerAPI/ibmSchema.js +0 -11
  169. package/cjs/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -202
  170. package/cjs/types/CamStreamerAPI/microsoftAzureSchema.js +0 -11
  171. package/cjs/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -202
  172. package/cjs/types/CamStreamerAPI/microsoftStreamSchema.js +0 -11
  173. package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -250
  174. package/cjs/types/CamStreamerAPI/mpegDvbSchema.js +0 -27
  175. package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +0 -211
  176. package/cjs/types/CamStreamerAPI/rtmpSchema.js +0 -14
  177. package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +0 -202
  178. package/cjs/types/CamStreamerAPI/sdCardSchema.js +0 -11
  179. package/cjs/types/CamStreamerAPI/srtSchema.d.ts +0 -202
  180. package/cjs/types/CamStreamerAPI/srtSchema.js +0 -11
  181. package/cjs/types/CamStreamerAPI/twitchSchema.d.ts +0 -202
  182. package/cjs/types/CamStreamerAPI/twitchSchema.js +0 -11
  183. package/cjs/types/CamStreamerAPI/vimeoSchema.d.ts +0 -202
  184. package/cjs/types/CamStreamerAPI/vimeoSchema.js +0 -11
  185. package/cjs/types/CamStreamerAPI/wowzaSchema.d.ts +0 -202
  186. package/cjs/types/CamStreamerAPI/wowzaSchema.js +0 -11
  187. package/esm/types/CamStreamerAPI/churchSchema.js +0 -5
  188. package/esm/types/CamStreamerAPI/daCastSchema.js +0 -5
  189. package/esm/types/CamStreamerAPI/dailymotionSchema.js +0 -5
  190. package/esm/types/CamStreamerAPI/gameChangerSchema.js +0 -5
  191. package/esm/types/CamStreamerAPI/hlsPullSchema.js +0 -5
  192. package/esm/types/CamStreamerAPI/hlsPushSchema.js +0 -5
  193. package/esm/types/CamStreamerAPI/ibmSchema.js +0 -5
  194. package/esm/types/CamStreamerAPI/microsoftAzureSchema.js +0 -5
  195. package/esm/types/CamStreamerAPI/microsoftStreamSchema.js +0 -5
  196. package/esm/types/CamStreamerAPI/mpegDvbSchema.js +0 -21
  197. package/esm/types/CamStreamerAPI/rtmpSchema.js +0 -8
  198. package/esm/types/CamStreamerAPI/sdCardSchema.js +0 -5
  199. package/esm/types/CamStreamerAPI/srtSchema.js +0 -5
  200. package/esm/types/CamStreamerAPI/twitchSchema.js +0 -5
  201. package/esm/types/CamStreamerAPI/vimeoSchema.js +0 -5
  202. package/esm/types/CamStreamerAPI/wowzaSchema.js +0 -5
  203. package/types/types/CamStreamerAPI/churchSchema.d.ts +0 -202
  204. package/types/types/CamStreamerAPI/daCastSchema.d.ts +0 -202
  205. package/types/types/CamStreamerAPI/dailymotionSchema.d.ts +0 -202
  206. package/types/types/CamStreamerAPI/gameChangerSchema.d.ts +0 -202
  207. package/types/types/CamStreamerAPI/hlsPullSchema.d.ts +0 -202
  208. package/types/types/CamStreamerAPI/hlsPushSchema.d.ts +0 -202
  209. package/types/types/CamStreamerAPI/ibmSchema.d.ts +0 -202
  210. package/types/types/CamStreamerAPI/microsoftAzureSchema.d.ts +0 -202
  211. package/types/types/CamStreamerAPI/microsoftStreamSchema.d.ts +0 -202
  212. package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +0 -250
  213. package/types/types/CamStreamerAPI/rtmpSchema.d.ts +0 -211
  214. package/types/types/CamStreamerAPI/sdCardSchema.d.ts +0 -202
  215. package/types/types/CamStreamerAPI/srtSchema.d.ts +0 -202
  216. package/types/types/CamStreamerAPI/twitchSchema.d.ts +0 -202
  217. package/types/types/CamStreamerAPI/vimeoSchema.d.ts +0 -202
  218. package/types/types/CamStreamerAPI/wowzaSchema.d.ts +0 -202
@@ -2,23 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PlaneTrackerAPI = void 0;
4
4
  const zod_1 = require("zod");
5
- const utils_1 = require("./internal/utils");
6
5
  const PlaneTrackerAPI_1 = require("./types/PlaneTrackerAPI");
7
6
  const errors_1 = require("./errors/errors");
8
- const ProxyClient_1 = require("./internal/ProxyClient");
9
7
  const GenetecAgent_1 = require("./types/GenetecAgent");
8
+ const BasicAPI_1 = require("./internal/BasicAPI");
10
9
  const BASE_PATH = '/local/planetracker';
11
- class PlaneTrackerAPI {
12
- client;
10
+ class PlaneTrackerAPI extends BasicAPI_1.BasicAPI {
13
11
  apiUser;
14
12
  constructor(client, apiUser) {
15
- this.client = client;
13
+ super(client);
16
14
  this.apiUser = apiUser;
17
15
  }
18
16
  static getProxyPath = () => `${BASE_PATH}/proxy.cgi`;
19
17
  static getWsEventsPath = () => `${BASE_PATH}/package/ws`;
20
- getClient(proxyParams) {
21
- return proxyParams ? new ProxyClient_1.ProxyClient(this.client, proxyParams) : this.client;
18
+ async checkAPIAvailable(options) {
19
+ await this._getJson(`${BASE_PATH}/api_check.cgi`, undefined, options);
22
20
  }
23
21
  async checkCameraTime(options) {
24
22
  const res = await this._getJson(`${BASE_PATH}/camera_time.cgi`, undefined, options);
@@ -26,7 +24,11 @@ class PlaneTrackerAPI {
26
24
  }
27
25
  async serverRunCheck(options) {
28
26
  const agent = this.getClient(options?.proxyParams);
29
- return await agent.get({ path: `${BASE_PATH}/package/serverRunCheck.cgi`, timeout: options?.timeout });
27
+ const res = await agent.get({
28
+ path: `${BASE_PATH}/package/serverRunCheck.cgi`,
29
+ timeout: options?.timeout,
30
+ });
31
+ return res.status === 200;
30
32
  }
31
33
  async getLiveViewAlias(rtspUrl, options) {
32
34
  const agent = this.getClient(options?.proxyParams);
@@ -64,7 +66,7 @@ class PlaneTrackerAPI {
64
66
  return PlaneTrackerAPI_1.cameraSettingsSchema.parse(res);
65
67
  }
66
68
  async setCameraSettings(settings, options) {
67
- return await this._postJsonEncoded(`${BASE_PATH}/package_camera_settings.cgi`, settings, {
69
+ await this._postJsonEncoded(`${BASE_PATH}/package_camera_settings.cgi`, settings, {
68
70
  action: 'set',
69
71
  }, options);
70
72
  }
@@ -123,28 +125,28 @@ class PlaneTrackerAPI {
123
125
  return PlaneTrackerAPI_1.priorityListSchema.parse(res).priorityList;
124
126
  }
125
127
  async setPriorityList(priorityList, options) {
126
- return await this._postJsonEncoded(`${BASE_PATH}/package/setPriorityList.cgi`, { priorityList }, this.apiUser, options);
128
+ await this._postJsonEncoded(`${BASE_PATH}/package/setPriorityList.cgi`, { priorityList }, this.apiUser, options);
127
129
  }
128
130
  async getTypePriorityList(options) {
129
131
  const res = await this._getJson(`${BASE_PATH}/package/getTypePriorityList.cgi`, undefined, options);
130
132
  return PlaneTrackerAPI_1.typePriorityListSchema.parse(res).typePriorityList;
131
133
  }
132
134
  async setTypePriorityList(typePriorityList, options) {
133
- return await this._postJsonEncoded(`${BASE_PATH}/package/setTypePriorityList.cgi`, { typePriorityList }, this.apiUser, options);
135
+ await this._postJsonEncoded(`${BASE_PATH}/package/setTypePriorityList.cgi`, { typePriorityList }, this.apiUser, options);
134
136
  }
135
137
  async getWhiteList(options) {
136
138
  const res = await this._getJson(`${BASE_PATH}/package/getWhiteList.cgi`, undefined, options);
137
139
  return PlaneTrackerAPI_1.whiteListSchema.parse(res).whiteList;
138
140
  }
139
141
  async setWhiteList(whiteList, options) {
140
- return await this._postJsonEncoded(`${BASE_PATH}/package/setWhiteList.cgi`, { whiteList }, this.apiUser, options);
142
+ await this._postJsonEncoded(`${BASE_PATH}/package/setWhiteList.cgi`, { whiteList }, this.apiUser, options);
141
143
  }
142
144
  async getBlackList(options) {
143
145
  const res = await this._getJson(`${BASE_PATH}/package/getBlackList.cgi`, undefined, options);
144
146
  return PlaneTrackerAPI_1.blackListSchema.parse(res).blackList;
145
147
  }
146
148
  async setBlackList(blackList, options) {
147
- return await this._postJsonEncoded(`${BASE_PATH}/package/setBlackList.cgi`, { blackList }, this.apiUser, options);
149
+ await this._postJsonEncoded(`${BASE_PATH}/package/setBlackList.cgi`, { blackList }, this.apiUser, options);
148
150
  }
149
151
  async fetchMapInfo(options) {
150
152
  const res = await this._getJson(`${BASE_PATH}/package/getMapInfo.cgi`, undefined, options);
@@ -182,73 +184,16 @@ class PlaneTrackerAPI {
182
184
  }
183
185
  }
184
186
  }
187
+ downloadReport(options) {
188
+ return this._getText(`${BASE_PATH}/report.cgi`, undefined, options);
189
+ }
185
190
  async checkGenetecConnection(params, options) {
186
- return await this._postUrlEncoded(`${BASE_PATH}/package/checkGenetecConnection.cgi`, params, options);
191
+ const res = await this._postUrlEncoded(`${BASE_PATH}/package/checkGenetecConnection.cgi`, params, options);
192
+ return res.status === 200;
187
193
  }
188
194
  async getGenetecCameraList(params, options) {
189
195
  const res = await this._postUrlEncoded(`${BASE_PATH}/package/getGenetecCameraList.cgi`, params, options);
190
196
  return GenetecAgent_1.cameraListSchema.parse(await res.json());
191
197
  }
192
- async _getJson(path, parameters, options, headers) {
193
- const agent = this.getClient(options?.proxyParams);
194
- const res = await agent.get({ path, parameters, timeout: options?.timeout, headers });
195
- if (res.ok) {
196
- return await res.json();
197
- }
198
- else {
199
- throw new errors_1.ErrorWithResponse(res);
200
- }
201
- }
202
- async _getBlob(path, parameters, options) {
203
- const agent = this.getClient(options?.proxyParams);
204
- const res = await agent.get({ path, parameters, timeout: options?.timeout });
205
- if (res.ok) {
206
- return await this.parseBlobResponse(res);
207
- }
208
- else {
209
- throw new errors_1.ErrorWithResponse(res);
210
- }
211
- }
212
- async parseBlobResponse(response) {
213
- try {
214
- return (await response.blob());
215
- }
216
- catch (err) {
217
- throw new errors_1.ParsingBlobError(err);
218
- }
219
- }
220
- async _postJsonEncoded(path, data, parameters, options) {
221
- const agent = this.getClient(options?.proxyParams);
222
- const jsonData = JSON.stringify(data);
223
- const res = await agent.post({
224
- path,
225
- data: jsonData,
226
- parameters,
227
- headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
228
- timeout: options?.timeout,
229
- });
230
- if (res.ok) {
231
- return res;
232
- }
233
- else {
234
- throw new errors_1.ErrorWithResponse(res);
235
- }
236
- }
237
- async _postUrlEncoded(path, params, options) {
238
- const data = (0, utils_1.paramToUrl)(params);
239
- const agent = this.getClient(options?.proxyParams);
240
- const res = await agent.post({
241
- path,
242
- data,
243
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
244
- timeout: options?.timeout,
245
- });
246
- if (res.ok) {
247
- return res;
248
- }
249
- else {
250
- throw new errors_1.ErrorWithResponse(res);
251
- }
252
- }
253
198
  }
254
199
  exports.PlaneTrackerAPI = PlaneTrackerAPI;
package/cjs/VapixAPI.d.ts CHANGED
@@ -1,17 +1,15 @@
1
1
  import { IClient, TParameters, TResponse } from './internal/types';
2
2
  import { TAudioDevice, TPortSetSchema, TPortSequenceStateSchema } from './types/VapixAPI';
3
- import { ProxyClient } from './internal/ProxyClient';
4
- import { TCameraImageConfig, THttpRequestOptions, TProxyParams } from './types/common';
5
- export declare class VapixAPI<Client extends IClient<TResponse, any>> {
6
- private client;
3
+ import { TCameraImageConfig, THttpRequestOptions } from './types/common';
4
+ import { BasicAPI } from './internal/BasicAPI';
5
+ export declare class VapixAPI<Client extends IClient<TResponse, any>> extends BasicAPI<Client> {
7
6
  private CustomFormData;
8
7
  constructor(client: Client, CustomFormData?: {
9
8
  new (form?: HTMLFormElement | undefined, submitter?: HTMLElement | null | undefined): FormData;
10
9
  prototype: FormData;
11
10
  });
12
- getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
13
11
  postUrlEncoded(path: string, parameters?: TParameters, headers?: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
14
- postJson(path: string, jsonData: Record<string, any>, headers?: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
12
+ postJson(path: string, data: Record<string, any>, headers?: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
15
13
  getCameraImage(parameters: TCameraImageConfig, options?: THttpRequestOptions): Promise<ReturnType<Client["get"]>>;
16
14
  getEventDeclarations(options?: THttpRequestOptions): Promise<string>;
17
15
  getSupportedAudioSampleRate(options?: THttpRequestOptions): Promise<{
@@ -19,17 +17,8 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> {
19
17
  bitRates: number[];
20
18
  }[]>;
21
19
  performAutofocus(options?: THttpRequestOptions): Promise<void>;
22
- checkSDCard(options?: THttpRequestOptions): Promise<{
23
- status: "OK" | "connected" | "disconnected";
24
- totalSize: number;
25
- freeSize: number;
26
- }>;
27
- mountSDCard(options?: THttpRequestOptions): Promise<number>;
28
- unmountSDCard(options?: THttpRequestOptions): Promise<number>;
29
- private _doSDCardMountAction;
30
- fetchSDCardJobProgress(jobId: number, options?: THttpRequestOptions): Promise<number>;
31
- downloadCameraReport(options?: THttpRequestOptions): Promise<TResponse>;
32
- getSystemLog(options?: THttpRequestOptions): Promise<TResponse>;
20
+ downloadCameraReport(options?: THttpRequestOptions): Promise<string>;
21
+ getSystemLog(options?: THttpRequestOptions): Promise<string>;
33
22
  getMaxFps(channel: number, options?: THttpRequestOptions): Promise<number>;
34
23
  getTimezone(options?: THttpRequestOptions): Promise<string>;
35
24
  getDateTimeInfo(options?: THttpRequestOptions): Promise<{
@@ -44,7 +33,16 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> {
44
33
  getDevicesSettings(options?: THttpRequestOptions): Promise<TAudioDevice[]>;
45
34
  fetchRemoteDeviceInfo<T extends Record<string, any>>(payload: T, options?: THttpRequestOptions): Promise<any>;
46
35
  getHeaders(options?: THttpRequestOptions): Promise<Record<string, string>>;
47
- setHeaders(headers: Record<string, string>, options?: THttpRequestOptions): Promise<TResponse>;
36
+ setHeaders(headers: Record<string, string>, options?: THttpRequestOptions): Promise<void>;
37
+ checkSDCard(options?: THttpRequestOptions): Promise<{
38
+ status: "OK" | "connected" | "disconnected";
39
+ totalSize: number;
40
+ freeSize: number;
41
+ }>;
42
+ mountSDCard(options?: THttpRequestOptions): Promise<number>;
43
+ unmountSDCard(options?: THttpRequestOptions): Promise<number>;
44
+ private _doSDCardMountAction;
45
+ fetchSDCardJobProgress(jobId: number, options?: THttpRequestOptions): Promise<number>;
48
46
  getParameter(paramNames: string | string[], options?: THttpRequestOptions): Promise<Record<string, string>>;
49
47
  setParameter(params: Record<string, string | number | boolean>, options?: THttpRequestOptions): Promise<void>;
50
48
  getGuardTourList(options?: THttpRequestOptions): Promise<{
@@ -52,8 +50,8 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> {
52
50
  id: string;
53
51
  running: string;
54
52
  tour: {
55
- moveSpeed?: unknown;
56
53
  position?: unknown;
54
+ moveSpeed?: unknown;
57
55
  presetNbr?: unknown;
58
56
  waitTime?: unknown;
59
57
  waitTimeViewType?: unknown;
@@ -66,18 +64,18 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> {
66
64
  getPTZPresetList(channel: number, options?: THttpRequestOptions): Promise<string[]>;
67
65
  listPTZ(camera: number, options?: THttpRequestOptions): Promise<{
68
66
  name: string;
69
- id: number;
70
67
  data: {
71
68
  pan?: number | undefined;
72
69
  tilt?: number | undefined;
73
70
  zoom?: number | undefined;
74
71
  };
72
+ id: number;
75
73
  }[]>;
76
74
  listPtzVideoSourceOverview(options?: THttpRequestOptions): Promise<Record<number, {
77
75
  name: string;
78
76
  id: number;
79
77
  }[]>>;
80
- goToPreset(channel: number, presetName: string, options?: THttpRequestOptions): Promise<TResponse>;
78
+ goToPreset(channel: number, presetName: string, options?: THttpRequestOptions): Promise<void>;
81
79
  getPtzPosition(camera: number, options?: THttpRequestOptions): Promise<{
82
80
  pan?: number | undefined;
83
81
  tilt?: number | undefined;
@@ -86,15 +84,27 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> {
86
84
  getPorts(options?: THttpRequestOptions): Promise<{
87
85
  name: string;
88
86
  port: string;
87
+ direction: "output" | "input";
89
88
  state: "open" | "closed";
90
89
  configurable: boolean;
91
90
  usage: string;
92
- direction: "input" | "output";
93
91
  normalState: "open" | "closed";
94
92
  readonly?: boolean | undefined;
95
93
  }[]>;
96
94
  setPorts(ports: TPortSetSchema[], options?: THttpRequestOptions): Promise<void>;
97
95
  setPortStateSequence(port: number, sequence: TPortSequenceStateSchema[], options?: THttpRequestOptions): Promise<void>;
96
+ addCameraUser(username: string, pass: string, sgrp: string, comment?: string, options?: THttpRequestOptions): Promise<void>;
97
+ getCameraUsers(options?: THttpRequestOptions): Promise<string[]>;
98
+ editCameraUser(username: string, pass: string, options?: THttpRequestOptions): Promise<void>;
99
+ getRecordingRuleList(options?: THttpRequestOptions): Promise<{
100
+ options: Record<string, string>;
101
+ diskid: string;
102
+ eventid: string;
103
+ profile: string;
104
+ }[]>;
105
+ addRecordingRule(params: Record<string, string>, options?: THttpRequestOptions): Promise<string | null>;
106
+ removeRecordingRule(profileId: string, options?: THttpRequestOptions): Promise<void>;
107
+ getDiskInfo(diskId?: string, options?: THttpRequestOptions): Promise<boolean>;
98
108
  getApplicationList(options?: THttpRequestOptions): Promise<{
99
109
  Name: string;
100
110
  NiceName: string;
@@ -102,7 +112,7 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> {
102
112
  Version: string;
103
113
  License: string;
104
114
  Status: string;
105
- appId: "CamStreamer" | "CamSwitcher" | "CamOverlay" | "CamScripter" | "PlaneTracker" | "Ndihxplugin" | "SportTracker" | null;
115
+ appId: "CamStreamer" | "CamSwitcher" | "CamOverlay" | "CamScripter" | "PlaneTracker" | "Ndihxplugin" | "SportTracker" | "CamOverlayHtmlplugin" | null;
106
116
  ApplicationID?: string | undefined;
107
117
  ConfigurationPage?: string | undefined;
108
118
  VendorHomePage?: string | undefined;
@@ -112,7 +122,10 @@ export declare class VapixAPI<Client extends IClient<TResponse, any>> {
112
122
  restartApplication(applicationId: string, options?: THttpRequestOptions): Promise<void>;
113
123
  stopApplication(applicationId: string, options?: THttpRequestOptions): Promise<void>;
114
124
  installApplication(data: Parameters<typeof FormData.prototype.append>[1], fileName: string, options?: THttpRequestOptions): Promise<void>;
125
+ private static parseQueryString;
126
+ private static checkTextResponseForError;
115
127
  private static parseParameters;
116
128
  private static parseCameraPtzResponse;
117
129
  private static parsePtz;
130
+ private static parseXmlResponse;
118
131
  }