camstreamerlib 4.0.0-beta.29 → 4.0.0-beta.30

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 (161) hide show
  1. package/README.md +6 -2
  2. package/cjs/CamOverlayAPI.d.ts +38 -615
  3. package/cjs/CamOverlayAPI.js +128 -104
  4. package/cjs/CamOverlayDrawingAPI.d.ts +2 -47
  5. package/cjs/CamOverlayPainter/Frame.d.ts +8 -37
  6. package/cjs/CamOverlayPainter/Frame.js +33 -0
  7. package/cjs/CamOverlayPainter/Painter.d.ts +5 -10
  8. package/cjs/CamOverlayPainter/Painter.js +2 -4
  9. package/cjs/CamOverlayPainter/ResourceManager.d.ts +3 -2
  10. package/cjs/CamOverlayPainter/ResourceManager.js +2 -1
  11. package/cjs/CamScripterAPI.d.ts +12 -12
  12. package/cjs/CamScripterAPI.js +33 -27
  13. package/cjs/CamStreamerAPI.d.ts +11 -9
  14. package/cjs/CamStreamerAPI.js +28 -22
  15. package/cjs/CamSwitcherAPI.d.ts +35 -34
  16. package/cjs/CamSwitcherAPI.js +94 -82
  17. package/cjs/PlaneTrackerAPI.d.ts +30 -36
  18. package/cjs/PlaneTrackerAPI.js +132 -71
  19. package/cjs/VapixAPI.d.ts +43 -40
  20. package/cjs/VapixAPI.js +205 -183
  21. package/cjs/events/AxisCameraStationEvents.d.ts +5 -5
  22. package/cjs/events/AxisCameraStationEvents.js +17 -12
  23. package/cjs/events/GenetecAgent.d.ts +2 -0
  24. package/cjs/events/GenetecAgent.js +15 -4
  25. package/cjs/index.d.ts +7 -1
  26. package/cjs/index.js +12 -2
  27. package/cjs/internal/ProxyClient.d.ts +7 -8
  28. package/cjs/internal/ProxyClient.js +25 -31
  29. package/cjs/internal/types.d.ts +16 -9
  30. package/cjs/internal/utils.d.ts +1 -2
  31. package/cjs/internal/utils.js +1 -5
  32. package/cjs/node/DefaultClient.d.ts +3 -5
  33. package/cjs/node/DefaultClient.js +10 -14
  34. package/cjs/node/HttpRequestSender.d.ts +1 -0
  35. package/cjs/node/HttpRequestSender.js +13 -3
  36. package/cjs/node/WsClient.d.ts +1 -0
  37. package/cjs/node/index.d.ts +2 -0
  38. package/cjs/node/index.js +18 -1
  39. package/cjs/{models/CamOverlayAPI/widgetsSchema.d.ts → types/CamOverlayAPI/CamOverlayAPI.d.ts} +625 -375
  40. package/cjs/{models/CamOverlayAPI/widgetCommonSchema.js → types/CamOverlayAPI/CamOverlayAPI.js} +65 -14
  41. package/cjs/{models → types}/CamOverlayAPI/accuweatherSchema.d.ts +40 -10
  42. package/cjs/{models → types}/CamOverlayAPI/accuweatherSchema.js +11 -9
  43. package/cjs/{models → types}/CamOverlayAPI/customGraphicsSchema.d.ts +89 -5
  44. package/cjs/{models → types}/CamOverlayAPI/customGraphicsSchema.js +9 -7
  45. package/{esm/models → cjs/types}/CamOverlayAPI/imagesSchema.d.ts +40 -13
  46. package/cjs/types/CamOverlayAPI/imagesSchema.js +12 -0
  47. package/cjs/{models → types}/CamOverlayAPI/index.d.ts +0 -4
  48. package/cjs/{models → types}/CamOverlayAPI/index.js +0 -4
  49. package/{esm/models → cjs/types}/CamOverlayAPI/infotickerSchema.d.ts +43 -9
  50. package/cjs/{models → types}/CamOverlayAPI/infotickerSchema.js +10 -8
  51. package/{esm/models → cjs/types}/CamOverlayAPI/pipSchema.d.ts +48 -7
  52. package/cjs/{models → types}/CamOverlayAPI/pipSchema.js +8 -6
  53. package/{esm/models → cjs/types}/CamOverlayAPI/ptzCompassSchema.d.ts +40 -7
  54. package/cjs/{models → types}/CamOverlayAPI/ptzCompassSchema.js +8 -6
  55. package/cjs/{models → types}/CamOverlayAPI/ptzSchema.d.ts +42 -14
  56. package/cjs/types/CamOverlayAPI/ptzSchema.js +15 -0
  57. package/{esm/models → cjs/types}/CamOverlayAPI/screenSharingSchema.d.ts +26 -5
  58. package/cjs/types/CamOverlayAPI/screenSharingSchema.js +11 -0
  59. package/cjs/{models → types}/CamOverlayAPI/webCameraSharingSchema.d.ts +26 -5
  60. package/cjs/types/CamOverlayAPI/webCameraSharingSchema.js +11 -0
  61. package/cjs/types/CamOverlayDrawingAPI.d.ts +58 -0
  62. package/cjs/types/CamOverlayDrawingAPI.js +2 -0
  63. package/cjs/types/CamOverlayPainter.d.ts +74 -0
  64. package/cjs/types/CamOverlayPainter.js +2 -0
  65. package/cjs/types/CamStreamerAPI.d.ts +4 -4
  66. package/cjs/types/PlaneTrackerAPI.d.ts +6 -0
  67. package/cjs/types/common.d.ts +12 -3
  68. package/cjs/web/DefaultClient.d.ts +4 -4
  69. package/cjs/web/DefaultClient.js +21 -11
  70. package/esm/CamOverlayAPI.d.ts +38 -615
  71. package/esm/CamOverlayAPI.js +127 -103
  72. package/esm/CamOverlayDrawingAPI.d.ts +2 -47
  73. package/esm/CamOverlayPainter/Frame.d.ts +8 -37
  74. package/esm/CamOverlayPainter/Frame.js +33 -0
  75. package/esm/CamOverlayPainter/Painter.d.ts +5 -10
  76. package/esm/CamOverlayPainter/Painter.js +1 -2
  77. package/esm/CamOverlayPainter/ResourceManager.d.ts +3 -2
  78. package/esm/CamOverlayPainter/ResourceManager.js +1 -1
  79. package/esm/CamScripterAPI.d.ts +12 -12
  80. package/esm/CamScripterAPI.js +32 -26
  81. package/esm/CamStreamerAPI.d.ts +11 -9
  82. package/esm/CamStreamerAPI.js +28 -22
  83. package/esm/CamSwitcherAPI.d.ts +35 -34
  84. package/esm/CamSwitcherAPI.js +95 -83
  85. package/esm/PlaneTrackerAPI.d.ts +30 -36
  86. package/esm/PlaneTrackerAPI.js +131 -70
  87. package/esm/VapixAPI.d.ts +43 -40
  88. package/esm/VapixAPI.js +204 -182
  89. package/esm/events/AxisCameraStationEvents.d.ts +5 -5
  90. package/esm/events/AxisCameraStationEvents.js +18 -13
  91. package/esm/events/GenetecAgent.d.ts +2 -0
  92. package/esm/events/GenetecAgent.js +15 -4
  93. package/esm/index.d.ts +7 -1
  94. package/esm/index.js +7 -1
  95. package/esm/internal/ProxyClient.d.ts +7 -8
  96. package/esm/internal/ProxyClient.js +25 -31
  97. package/esm/internal/types.d.ts +16 -9
  98. package/esm/internal/utils.d.ts +1 -2
  99. package/esm/internal/utils.js +0 -3
  100. package/esm/node/DefaultClient.d.ts +3 -5
  101. package/esm/node/DefaultClient.js +10 -14
  102. package/esm/node/HttpRequestSender.d.ts +1 -0
  103. package/esm/node/HttpRequestSender.js +13 -3
  104. package/esm/node/WsClient.d.ts +1 -0
  105. package/esm/node/index.d.ts +2 -0
  106. package/esm/node/index.js +2 -0
  107. package/esm/{models/CamOverlayAPI/widgetsSchema.d.ts → types/CamOverlayAPI/CamOverlayAPI.d.ts} +625 -375
  108. package/esm/{models/CamOverlayAPI/widgetCommonSchema.js → types/CamOverlayAPI/CamOverlayAPI.js} +64 -13
  109. package/esm/{models → types}/CamOverlayAPI/accuweatherSchema.d.ts +40 -10
  110. package/esm/{models → types}/CamOverlayAPI/accuweatherSchema.js +3 -2
  111. package/esm/{models → types}/CamOverlayAPI/customGraphicsSchema.d.ts +89 -5
  112. package/esm/{models → types}/CamOverlayAPI/customGraphicsSchema.js +3 -2
  113. package/{cjs/models → esm/types}/CamOverlayAPI/imagesSchema.d.ts +40 -13
  114. package/esm/types/CamOverlayAPI/imagesSchema.js +8 -0
  115. package/esm/{models → types}/CamOverlayAPI/index.d.ts +0 -4
  116. package/esm/{models → types}/CamOverlayAPI/index.js +0 -4
  117. package/{cjs/models → esm/types}/CamOverlayAPI/infotickerSchema.d.ts +43 -9
  118. package/esm/{models → types}/CamOverlayAPI/infotickerSchema.js +3 -2
  119. package/{cjs/models → esm/types}/CamOverlayAPI/pipSchema.d.ts +48 -7
  120. package/esm/{models → types}/CamOverlayAPI/pipSchema.js +3 -2
  121. package/{cjs/models → esm/types}/CamOverlayAPI/ptzCompassSchema.d.ts +40 -7
  122. package/esm/{models → types}/CamOverlayAPI/ptzCompassSchema.js +3 -2
  123. package/esm/{models → types}/CamOverlayAPI/ptzSchema.d.ts +42 -14
  124. package/esm/{models → types}/CamOverlayAPI/ptzSchema.js +3 -2
  125. package/{cjs/models → esm/types}/CamOverlayAPI/screenSharingSchema.d.ts +26 -5
  126. package/esm/types/CamOverlayAPI/screenSharingSchema.js +7 -0
  127. package/esm/{models → types}/CamOverlayAPI/webCameraSharingSchema.d.ts +26 -5
  128. package/esm/types/CamOverlayAPI/webCameraSharingSchema.js +7 -0
  129. package/esm/types/CamOverlayDrawingAPI.d.ts +58 -0
  130. package/esm/types/CamOverlayDrawingAPI.js +1 -0
  131. package/esm/types/CamOverlayPainter.d.ts +74 -0
  132. package/esm/types/CamOverlayPainter.js +1 -0
  133. package/esm/types/CamStreamerAPI.d.ts +4 -4
  134. package/esm/types/PlaneTrackerAPI.d.ts +6 -0
  135. package/esm/types/common.d.ts +12 -3
  136. package/esm/web/DefaultClient.d.ts +4 -4
  137. package/esm/web/DefaultClient.js +21 -11
  138. package/package.json +2 -2
  139. package/cjs/models/CamOverlayAPI/constants.d.ts +0 -11
  140. package/cjs/models/CamOverlayAPI/constants.js +0 -14
  141. package/cjs/models/CamOverlayAPI/fileSchema.d.ts +0 -28
  142. package/cjs/models/CamOverlayAPI/fileSchema.js +0 -17
  143. package/cjs/models/CamOverlayAPI/imagesSchema.js +0 -10
  144. package/cjs/models/CamOverlayAPI/ptzSchema.js +0 -13
  145. package/cjs/models/CamOverlayAPI/screenSharingSchema.js +0 -9
  146. package/cjs/models/CamOverlayAPI/webCameraSharingSchema.js +0 -9
  147. package/cjs/models/CamOverlayAPI/widgetCommonSchema.d.ts +0 -126
  148. package/cjs/models/CamOverlayAPI/widgetsSchema.js +0 -27
  149. package/cjs/types/CamOverlayAPI.d.ts +0 -328
  150. package/cjs/types/CamOverlayAPI.js +0 -26
  151. package/esm/models/CamOverlayAPI/constants.d.ts +0 -11
  152. package/esm/models/CamOverlayAPI/constants.js +0 -11
  153. package/esm/models/CamOverlayAPI/fileSchema.d.ts +0 -28
  154. package/esm/models/CamOverlayAPI/fileSchema.js +0 -14
  155. package/esm/models/CamOverlayAPI/imagesSchema.js +0 -7
  156. package/esm/models/CamOverlayAPI/screenSharingSchema.js +0 -6
  157. package/esm/models/CamOverlayAPI/webCameraSharingSchema.js +0 -6
  158. package/esm/models/CamOverlayAPI/widgetCommonSchema.d.ts +0 -126
  159. package/esm/models/CamOverlayAPI/widgetsSchema.js +0 -24
  160. package/esm/types/CamOverlayAPI.d.ts +0 -328
  161. package/esm/types/CamOverlayAPI.js +0 -14
@@ -1,55 +1,57 @@
1
+ import { ProxyClient } from './internal/ProxyClient';
1
2
  import { responseStringify } from './internal/utils';
2
3
  import { cameraTimeResponseSchema, camscripterApiResponseSchema, nodeStateSchema, packageInfoListSchema, storageSchema, } from './types/CamScripterAPI';
3
4
  import { networkCameraListSchema } from './types/common';
4
- export const BASE_URL = '/local/camscripter';
5
+ const BASE_PATH = '/local/camscripter';
5
6
  export class CamScripterAPI {
6
7
  client;
7
8
  constructor(client) {
8
9
  this.client = client;
9
10
  }
10
- static getProxyUrlPath = () => `${BASE_URL}/proxy.cgi`;
11
- async checkCameraTime() {
12
- const data = await this.get(`${BASE_URL}/camera_time.cgi`);
11
+ static getProxyUrlPath = () => `${BASE_PATH}/proxy.cgi`;
12
+ async checkCameraTime(options) {
13
+ const data = await this.get(`${BASE_PATH}/camera_time.cgi`, undefined, options);
13
14
  return cameraTimeResponseSchema.parse(data).state;
14
15
  }
15
- async getNetworkCameraList() {
16
- const data = await this.get(`${BASE_URL}/network_camera_list.cgi`);
16
+ async getNetworkCameraList(options) {
17
+ const data = await this.get(`${BASE_PATH}/network_camera_list.cgi`, undefined, options);
17
18
  return networkCameraListSchema.parse(data.camera_list);
18
19
  }
19
- async getStorageInfo() {
20
- const data = await this.get(`${BASE_URL}/package/get_storage.cgi`);
20
+ async getStorageInfo(options) {
21
+ const data = await this.get(`${BASE_PATH}/package/get_storage.cgi`, undefined, options);
21
22
  return storageSchema.parse(data);
22
23
  }
23
- async getPackageList() {
24
- const data = await this.get(`${BASE_URL}/package/list.cgi`);
24
+ async getPackageList(options) {
25
+ const data = await this.get(`${BASE_PATH}/package/list.cgi`, undefined, options);
25
26
  return packageInfoListSchema.parse(data);
26
27
  }
27
- async installPackages(formData, storage) {
28
- const data = await this.post(`${BASE_URL}/package/install.cgi?storage=${storage}`, formData);
28
+ async installPackages(formData, storage, options) {
29
+ const data = await this.post(`${BASE_PATH}/package/install.cgi?storage=${storage}`, formData, undefined, options);
29
30
  return camscripterApiResponseSchema.parse(data);
30
31
  }
31
- async uninstallPackage(packageId) {
32
- const data = await this.get(`${BASE_URL}/package/remove.cgi?package_name=${packageId}`);
32
+ async uninstallPackage(packageId, options) {
33
+ const data = await this.get(`${BASE_PATH}/package/remove.cgi?package_name=${packageId}`, undefined, options);
33
34
  return camscripterApiResponseSchema.parse(data);
34
35
  }
35
- async importSettings(packageId, formData) {
36
- const data = await this.post(`${BASE_URL}/package/data.cgi?action=IMPORT&package_name=${packageId}`, formData);
36
+ async importSettings(packageId, formData, options) {
37
+ const data = await this.post(`${BASE_PATH}/package/data.cgi?action=IMPORT&package_name=${packageId}`, formData, undefined, options);
37
38
  return camscripterApiResponseSchema.parse(data);
38
39
  }
39
- async exportSettings(packageId, formData) {
40
- const data = await this.post(`${BASE_URL}/package/data.cgi?action=EXPORT&package_name=${packageId}`, formData);
40
+ async exportSettings(packageId, formData, options) {
41
+ const data = await this.post(`${BASE_PATH}/package/data.cgi?action=EXPORT&package_name=${packageId}`, formData, undefined, options);
41
42
  return camscripterApiResponseSchema.parse(data);
42
43
  }
43
- async getNodejsStatus() {
44
- const data = await this.get(`${BASE_URL}/diagnostics.cgi`);
44
+ async getNodejsStatus(options) {
45
+ const data = await this.get(`${BASE_PATH}/diagnostics.cgi`, undefined, options);
45
46
  return nodeStateSchema.parse(data);
46
47
  }
47
- async installNodejs(storage) {
48
- const data = await this.get(`${BASE_URL}/node_update.cgi?storage=${storage}`);
48
+ async installNodejs(storage, options) {
49
+ const data = await this.get(`${BASE_PATH}/node_update.cgi?storage=${storage}`, undefined, options);
49
50
  return camscripterApiResponseSchema.parse(data);
50
51
  }
51
- async get(path, params) {
52
- const res = await this.client.get(path, params);
52
+ async get(path, parameters, options) {
53
+ const agent = this.getAgent(options?.proxyParams);
54
+ const res = await agent.get({ path, parameters, timeout: options?.timeout });
53
55
  if (res.ok) {
54
56
  return await res.json();
55
57
  }
@@ -57,8 +59,9 @@ export class CamScripterAPI {
57
59
  throw new Error(await responseStringify(res));
58
60
  }
59
61
  }
60
- async post(path, data, params) {
61
- const res = await this.client.post(path, data, params);
62
+ async post(path, data, parameters, options) {
63
+ const agent = this.getAgent(options?.proxyParams);
64
+ const res = await agent.post({ path, data, parameters, timeout: options?.timeout });
62
65
  if (res.ok) {
63
66
  return await res.json();
64
67
  }
@@ -66,4 +69,7 @@ export class CamScripterAPI {
66
69
  throw new Error(await responseStringify(res));
67
70
  }
68
71
  }
72
+ getAgent(proxyParams) {
73
+ return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
74
+ }
69
75
  }
@@ -1,16 +1,18 @@
1
1
  import { IClient, TResponse } from './internal/types';
2
2
  import { TStreamAttributes, TStreamList } from './types/CamStreamerAPI';
3
+ import { THttpRequestOptions } from './types/common';
3
4
  export declare class CamStreamerAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
4
5
  client: Client;
5
6
  constructor(client: Client);
6
- getStreamList(): Promise<TStreamList>;
7
- getStream(streamID: string): Promise<TStreamAttributes>;
8
- getStreamParameter(streamID: string, paramName: string): Promise<string>;
9
- setStream(streamID: string, params: Partial<TStreamAttributes>): Promise<void>;
10
- setStreamParameter(streamID: string, paramName: string, value: string): Promise<void>;
11
- isStreaming(streamID: string): Promise<boolean>;
12
- deleteStream(streamID: string): Promise<void>;
13
- wsAutoratization(): Promise<string>;
14
- getUtcTime(): Promise<number>;
7
+ getStreamList(options?: THttpRequestOptions): Promise<TStreamList>;
8
+ getStream(streamId: string, options?: THttpRequestOptions): Promise<TStreamAttributes>;
9
+ getStreamParameter(streamId: string, paramName: string, options?: THttpRequestOptions): Promise<string>;
10
+ setStream(streamId: string, params: Partial<TStreamAttributes>, options?: THttpRequestOptions): Promise<void>;
11
+ setStreamParameter(streamId: string, paramName: string, value: string, options?: THttpRequestOptions): Promise<void>;
12
+ isStreaming(streamId: string, options?: THttpRequestOptions): Promise<boolean>;
13
+ deleteStream(streamId: string, options?: THttpRequestOptions): Promise<void>;
14
+ wsAuthorization(options?: THttpRequestOptions): Promise<string>;
15
+ getUtcTime(options?: THttpRequestOptions): Promise<number>;
15
16
  private get;
17
+ private getAgent;
16
18
  }
@@ -1,50 +1,53 @@
1
+ import { ProxyClient } from './internal/ProxyClient';
1
2
  import { responseStringify } from './internal/utils';
2
3
  import { streamAttributesSchema, streamListSchema } from './types/CamStreamerAPI';
4
+ const BASE_PATH = '/local/camstreamer';
3
5
  export class CamStreamerAPI {
4
6
  client;
5
7
  constructor(client) {
6
8
  this.client = client;
7
9
  }
8
- async getStreamList() {
9
- const streamListRes = await this.get('/local/camstreamer/stream/list.cgi');
10
+ async getStreamList(options) {
11
+ const streamListRes = await this.get(`${BASE_PATH}/stream/list.cgi`, undefined, options);
10
12
  return streamListSchema.parse(streamListRes.data);
11
13
  }
12
- async getStream(streamID) {
13
- const stream = await this.get(`/local/camstreamer/stream/get.cgi?stream_id=${streamID}`);
14
+ async getStream(streamId, options) {
15
+ const stream = await this.get(`${BASE_PATH}/stream/get.cgi?stream_id=${streamId}`, undefined, options);
14
16
  return streamAttributesSchema.parse(stream.data);
15
17
  }
16
- async getStreamParameter(streamID, paramName) {
17
- const stream = await this.get(`/local/camstreamer/stream/get.cgi?stream_id=${streamID}`);
18
+ async getStreamParameter(streamId, paramName, options) {
19
+ const stream = await this.get(`${BASE_PATH}/stream/get.cgi?stream_id=${streamId}`, undefined, options);
18
20
  return stream.data[paramName];
19
21
  }
20
- async setStream(streamID, params) {
22
+ async setStream(streamId, params, options) {
21
23
  const { streamDelay, startTime, stopTime, ...rest } = params;
22
- await this.get('/local/camstreamer/stream/set.cgi', {
23
- stream_id: streamID,
24
+ await this.get(`${BASE_PATH}/stream/set.cgi`, {
25
+ stream_id: streamId,
24
26
  streamDelay: streamDelay ?? '',
25
27
  startTime: startTime ?? 'null',
26
28
  stopTime: stopTime ?? 'null',
27
29
  ...rest,
28
- });
30
+ }, options);
29
31
  }
30
- async setStreamParameter(streamID, paramName, value) {
31
- await this.get(`/local/camstreamer/stream/set.cgi?stream_id=${streamID}&${paramName}=${value}`);
32
+ async setStreamParameter(streamId, paramName, value, options) {
33
+ await this.get(`${BASE_PATH}/stream/set.cgi?stream_id=${streamId}&${paramName}=${value}`, undefined, options);
32
34
  }
33
- async isStreaming(streamID) {
34
- const response = await this.get(`/local/camstreamer/get_streamstat.cgi?stream_id=${streamID}`);
35
+ async isStreaming(streamId, options) {
36
+ const response = await this.get(`${BASE_PATH}/get_streamstat.cgi?stream_id=${streamId}`, undefined, options);
35
37
  return response.data.is_streaming === 1;
36
38
  }
37
- async deleteStream(streamID) {
38
- await this.get('/local/camstreamer/stream/remove.cgi', { stream_id: streamID });
39
+ async deleteStream(streamId, options) {
40
+ await this.get(`${BASE_PATH}/stream/remove.cgi`, { stream_id: streamId }, options);
39
41
  }
40
- wsAutoratization() {
41
- return this.get('/local/camstreamer/ws_authorization.cgi');
42
+ wsAuthorization(options) {
43
+ return this.get(`${BASE_PATH}/ws_authorization.cgi`, undefined, options);
42
44
  }
43
- async getUtcTime() {
44
- return await this.get('/local/camstreamer/get_utc_time.cgi');
45
+ async getUtcTime(options) {
46
+ return await this.get(`${BASE_PATH}/get_utc_time.cgi`, undefined, options);
45
47
  }
46
- async get(path, parameters) {
47
- const res = await this.client.get(path, parameters);
48
+ async get(path, parameters, options) {
49
+ const agent = this.getAgent(options?.proxyParams);
50
+ const res = await agent.get({ path, parameters, timeout: options?.timeout });
48
51
  if (res.ok) {
49
52
  return await res.json();
50
53
  }
@@ -52,4 +55,7 @@ export class CamStreamerAPI {
52
55
  throw new Error(await responseStringify(res));
53
56
  }
54
57
  }
58
+ getAgent(proxyParams) {
59
+ return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
60
+ }
55
61
  }
@@ -1,6 +1,6 @@
1
1
  import { IClient, TResponse } from './internal/types';
2
2
  import { TAudioPushInfo, TOutputInfo, TStorageInfo, TStreamSaveList, TClipList, TStreamSaveLoadList, TClipSaveLoadList, TPlaylistSaveLoadList, TTrackerSaveList, TrackerSaveLoadList, TClipSaveList, TPlaylistSaveList, TCameraOptions, TGlobalAudioSettings, TSecondaryAudioSettings } from './types/CamSwitcherAPI';
3
- import { TAudioChannel, TNetworkCamera, TStorageType } from './types/common';
3
+ import { TAudioChannel, THttpRequestOptions, TNetworkCamera, TStorageType } from './types/common';
4
4
  export declare class CamSwitcherAPI<Client extends IClient<TResponse> = IClient<TResponse>> {
5
5
  client: Client;
6
6
  private CustomFormData;
@@ -12,41 +12,42 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse> = IClient<
12
12
  static getProxyUrlPath: () => string;
13
13
  static getWsEventsUrlPath: () => string;
14
14
  static getClipPreviewUrlPath: (id: string, storage: TStorageType) => string;
15
- generateSilence(sampleRate: number, channels: TAudioChannel): Promise<void>;
16
- checkCameraTime(): Promise<boolean>;
17
- getIpListFromNetworkCheck(): Promise<TNetworkCamera[]>;
18
- getMaxFps(source: number): Promise<number>;
19
- getStorageInfo(): Promise<TStorageInfo[]>;
20
- wsAuthorization(): Promise<string>;
21
- getOutputInfo(): Promise<TOutputInfo>;
22
- getAudioPushInfo(): Promise<TAudioPushInfo>;
23
- getStreamSaveList(): Promise<TStreamSaveLoadList>;
24
- getClipSaveList(): Promise<TClipSaveLoadList>;
25
- getPlaylistSaveList(): Promise<TPlaylistSaveLoadList>;
26
- getTrackerSaveList(): Promise<TrackerSaveLoadList>;
27
- setStreamSaveList(data: TStreamSaveList): Promise<boolean>;
28
- setClipSaveList(data: TClipSaveList): Promise<boolean>;
29
- setPlaylistSaveList(data: TPlaylistSaveList): Promise<boolean>;
30
- setTrackerSaveList(data: TTrackerSaveList): Promise<boolean>;
31
- playlistSwitch(playlistName: string): Promise<void>;
32
- playlistQueuePush(playlistName: string): Promise<void>;
33
- playlistQueueClear(): Promise<void>;
34
- playlistQueueList(): Promise<string[]>;
35
- playlistQueuePlayNext(): Promise<void>;
36
- addNewClip(file: any, clipType: 'video' | 'audio', storage: TStorageType, id: string, fileName?: string): Promise<void>;
37
- removeClip(id: string, storage: TStorageType): Promise<any>;
38
- getClipList(): Promise<TClipList>;
39
- setCamSwitchOptions(data: TCameraOptions, cameraFWVersion: string): Promise<boolean>;
40
- setGlobalAudioSettings(settings: TGlobalAudioSettings): Promise<boolean>;
41
- setSecondaryAudioSettings(settings: TSecondaryAudioSettings): Promise<boolean>;
42
- setDefaultPlaylist(id: string): Promise<boolean>;
43
- setPermanentRtspUrlToken(token: string): Promise<boolean>;
44
- getCamSwitchOptions(): Promise<Partial<TCameraOptions>>;
45
- getGlobalAudioSettings(): Promise<TGlobalAudioSettings>;
46
- getSecondaryAudioSettings(): Promise<TSecondaryAudioSettings>;
47
- getPermanentRtspUrlToken(): Promise<string>;
15
+ generateSilence(sampleRate: number, channels: TAudioChannel, options?: THttpRequestOptions): Promise<void>;
16
+ checkCameraTime(options?: THttpRequestOptions): Promise<boolean>;
17
+ getNetworkCameraList(options?: THttpRequestOptions): Promise<TNetworkCamera[]>;
18
+ getMaxFps(source: number, options?: THttpRequestOptions): Promise<number>;
19
+ getStorageInfo(options?: THttpRequestOptions): Promise<TStorageInfo[]>;
20
+ wsAuthorization(options?: THttpRequestOptions): Promise<string>;
21
+ getOutputInfo(options?: THttpRequestOptions): Promise<TOutputInfo>;
22
+ getAudioPushInfo(options?: THttpRequestOptions): Promise<TAudioPushInfo>;
23
+ getStreamSaveList(options?: THttpRequestOptions): Promise<TStreamSaveLoadList>;
24
+ getClipSaveList(options?: THttpRequestOptions): Promise<TClipSaveLoadList>;
25
+ getPlaylistSaveList(options?: THttpRequestOptions): Promise<TPlaylistSaveLoadList>;
26
+ getTrackerSaveList(options?: THttpRequestOptions): Promise<TrackerSaveLoadList>;
27
+ setStreamSaveList(data: TStreamSaveList, options?: THttpRequestOptions): Promise<boolean>;
28
+ setClipSaveList(data: TClipSaveList, options?: THttpRequestOptions): Promise<boolean>;
29
+ setPlaylistSaveList(data: TPlaylistSaveList, options?: THttpRequestOptions): Promise<boolean>;
30
+ setTrackerSaveList(data: TTrackerSaveList, options?: THttpRequestOptions): Promise<boolean>;
31
+ playlistSwitch(playlistName: string, options?: THttpRequestOptions): Promise<void>;
32
+ playlistQueuePush(playlistName: string, options?: THttpRequestOptions): Promise<void>;
33
+ playlistQueueClear(options?: THttpRequestOptions): Promise<void>;
34
+ playlistQueueList(options?: THttpRequestOptions): Promise<string[]>;
35
+ playlistQueuePlayNext(options?: THttpRequestOptions): Promise<void>;
36
+ addNewClip(file: any, clipType: 'video' | 'audio', storage: TStorageType, id: string, fileName?: string, options?: THttpRequestOptions): Promise<void>;
37
+ removeClip(id: string, storage: TStorageType, options?: THttpRequestOptions): Promise<any>;
38
+ getClipList(options?: THttpRequestOptions): Promise<TClipList>;
39
+ setCamSwitchOptions(data: TCameraOptions, cameraFWVersion: string, options?: THttpRequestOptions): Promise<boolean>;
40
+ setGlobalAudioSettings(settings: TGlobalAudioSettings, options?: THttpRequestOptions): Promise<boolean>;
41
+ setSecondaryAudioSettings(settings: TSecondaryAudioSettings, options?: THttpRequestOptions): Promise<boolean>;
42
+ setDefaultPlaylist(id: string, options?: THttpRequestOptions): Promise<boolean>;
43
+ setPermanentRtspUrlToken(token: string, options?: THttpRequestOptions): Promise<boolean>;
44
+ getCamSwitchOptions(options?: THttpRequestOptions): Promise<Partial<TCameraOptions>>;
45
+ getGlobalAudioSettings(options?: THttpRequestOptions): Promise<TGlobalAudioSettings>;
46
+ getSecondaryAudioSettings(options?: THttpRequestOptions): Promise<TSecondaryAudioSettings>;
47
+ getPermanentRtspUrlToken(options?: THttpRequestOptions): Promise<string>;
48
48
  private get;
49
49
  private set;
50
50
  private setParamFromCameraJSON;
51
51
  private getParamFromCameraAndJSONParse;
52
+ private getAgent;
52
53
  }
@@ -2,11 +2,12 @@ import { z } from 'zod';
2
2
  import { AddNewClipError } from './errors/errors';
3
3
  import { isClip, isNullish, responseStringify } from './internal/utils';
4
4
  import { storageInfoListSchema, outputInfoSchema, audioPushInfoSchema, clipListSchema, playlistQueueSchema, streamSaveLoadSchema, clipSaveLoadSchema, playlistSaveLoadSchema, trackerSaveLoadSchema, } from './types/CamSwitcherAPI';
5
- import { networkCameraListSchema } from './types/common';
5
+ import { networkCameraListSchema, } from './types/common';
6
6
  import { VapixAPI } from './VapixAPI';
7
7
  import { isFirmwareVersionAtLeast } from './internal/versionCompare';
8
8
  import { FIRMWARE_WITH_BITRATE_MODES_SUPPORT } from './internal/constants';
9
- const baseUrl = '/local/camswitcher/api';
9
+ import { ProxyClient } from './internal/ProxyClient';
10
+ const BASE_PATH = '/local/camswitcher/api';
10
11
  export class CamSwitcherAPI {
11
12
  client;
12
13
  CustomFormData;
@@ -14,111 +15,117 @@ export class CamSwitcherAPI {
14
15
  constructor(client, CustomFormData = FormData) {
15
16
  this.client = client;
16
17
  this.CustomFormData = CustomFormData;
17
- this.vapixAgent = new VapixAPI(client, () => '');
18
+ this.vapixAgent = new VapixAPI(client);
18
19
  }
19
- static getProxyUrlPath = () => `${baseUrl}/proxy.cgi`;
20
+ static getProxyUrlPath = () => `${BASE_PATH}/proxy.cgi`;
20
21
  static getWsEventsUrlPath = () => `/local/camswitcher/events`;
21
- static getClipPreviewUrlPath = (id, storage) => `${baseUrl}/clip_preview.cgi?clip_name=${id}&storage=${storage}`;
22
- async generateSilence(sampleRate, channels) {
23
- await this.client.get(`${baseUrl}/generate_silence.cgi`, {
24
- sample_rate: sampleRate.toString(),
25
- channels,
22
+ static getClipPreviewUrlPath = (id, storage) => `${BASE_PATH}/clip_preview.cgi?clip_name=${id}&storage=${storage}`;
23
+ async generateSilence(sampleRate, channels, options) {
24
+ const agent = this.getAgent(options?.proxyParams);
25
+ await agent.get({
26
+ path: `${BASE_PATH}/generate_silence.cgi`,
27
+ parameters: {
28
+ sample_rate: sampleRate.toString(),
29
+ channels,
30
+ },
31
+ timeout: options?.timeout,
26
32
  });
27
33
  }
28
- async checkCameraTime() {
29
- const data = await this.get(`${baseUrl}/camera_time.cgi`);
34
+ async checkCameraTime(options) {
35
+ const data = await this.get(`${BASE_PATH}/camera_time.cgi`, undefined, options);
30
36
  return z.boolean().parse(data);
31
37
  }
32
- async getIpListFromNetworkCheck() {
33
- const data = await this.get(`${baseUrl}/network_camera_list.cgi`);
38
+ async getNetworkCameraList(options) {
39
+ const data = await this.get(`${BASE_PATH}/network_camera_list.cgi`, undefined, options);
34
40
  return networkCameraListSchema.parse(data);
35
41
  }
36
- async getMaxFps(source) {
37
- const data = await this.get(`${baseUrl}/get_max_framerate.cgi`, {
42
+ async getMaxFps(source, options) {
43
+ const data = await this.get(`${BASE_PATH}/get_max_framerate.cgi`, {
38
44
  video_source: source.toString(),
39
- });
45
+ }, options);
40
46
  return z.number().parse(data);
41
47
  }
42
- async getStorageInfo() {
43
- const data = await this.get(`${baseUrl}/get_storage.cgi`);
48
+ async getStorageInfo(options) {
49
+ const data = await this.get(`${BASE_PATH}/get_storage.cgi`, undefined, options);
44
50
  return storageInfoListSchema.parse(data);
45
51
  }
46
- async wsAuthorization() {
47
- const data = await this.get(`${baseUrl}/ws_authorization.cgi`);
52
+ async wsAuthorization(options) {
53
+ const data = await this.get(`${BASE_PATH}/ws_authorization.cgi`, undefined, options);
48
54
  return z.string().parse(data);
49
55
  }
50
- async getOutputInfo() {
51
- const data = await this.get(`${baseUrl}/output_info.cgi`);
56
+ async getOutputInfo(options) {
57
+ const data = await this.get(`${BASE_PATH}/output_info.cgi`, undefined, options);
52
58
  return outputInfoSchema.parse(data);
53
59
  }
54
- async getAudioPushInfo() {
55
- const data = await this.get(`${baseUrl}/audio_push_info.cgi`);
60
+ async getAudioPushInfo(options) {
61
+ const data = await this.get(`${BASE_PATH}/audio_push_info.cgi`, undefined, options);
56
62
  return audioPushInfoSchema.parse(data);
57
63
  }
58
- async getStreamSaveList() {
59
- const data = await this.get(`${baseUrl}/streams.cgi`, { action: 'get' });
64
+ async getStreamSaveList(options) {
65
+ const data = await this.get(`${BASE_PATH}/streams.cgi`, { action: 'get' }, options);
60
66
  return streamSaveLoadSchema.parse(data);
61
67
  }
62
- async getClipSaveList() {
63
- const data = await this.get(`${baseUrl}/clips.cgi`, { action: 'get' });
68
+ async getClipSaveList(options) {
69
+ const data = await this.get(`${BASE_PATH}/clips.cgi`, { action: 'get' }, options);
64
70
  return clipSaveLoadSchema.parse(data);
65
71
  }
66
- async getPlaylistSaveList() {
67
- const data = await this.get(`${baseUrl}/playlists.cgi`, { action: 'get' });
72
+ async getPlaylistSaveList(options) {
73
+ const data = await this.get(`${BASE_PATH}/playlists.cgi`, { action: 'get' }, options);
68
74
  return playlistSaveLoadSchema.parse(data);
69
75
  }
70
- async getTrackerSaveList() {
71
- const data = await this.get(`${baseUrl}/trackers.cgi`, { action: 'get' });
76
+ async getTrackerSaveList(options) {
77
+ const data = await this.get(`${BASE_PATH}/trackers.cgi`, { action: 'get' }, options);
72
78
  return trackerSaveLoadSchema.parse(data);
73
79
  }
74
- async setStreamSaveList(data) {
75
- return await this.set(`${baseUrl}/streams.cgi`, data, { action: 'set' });
80
+ async setStreamSaveList(data, options) {
81
+ return await this.set(`${BASE_PATH}/streams.cgi`, data, { action: 'set' }, options);
76
82
  }
77
- async setClipSaveList(data) {
78
- return await this.set(`${baseUrl}/clips.cgi`, data, { action: 'set' });
83
+ async setClipSaveList(data, options) {
84
+ return await this.set(`${BASE_PATH}/clips.cgi`, data, { action: 'set' }, options);
79
85
  }
80
- async setPlaylistSaveList(data) {
81
- return await this.set(`${baseUrl}/playlists.cgi`, data, { action: 'set' });
86
+ async setPlaylistSaveList(data, options) {
87
+ return await this.set(`${BASE_PATH}/playlists.cgi`, data, { action: 'set' }, options);
82
88
  }
83
- async setTrackerSaveList(data) {
84
- return await this.set(`${baseUrl}/trackers.cgi`, data, { action: 'set' });
89
+ async setTrackerSaveList(data, options) {
90
+ return await this.set(`${BASE_PATH}/trackers.cgi`, data, { action: 'set' }, options);
85
91
  }
86
- async playlistSwitch(playlistName) {
87
- await this.get(`${baseUrl}/playlist_switch.cgi?playlist_name=${playlistName}`);
92
+ async playlistSwitch(playlistName, options) {
93
+ await this.get(`${BASE_PATH}/playlist_switch.cgi`, { playlist_name: playlistName }, options);
88
94
  }
89
- async playlistQueuePush(playlistName) {
90
- await this.get(`${baseUrl}/playlist_queue_push.cgi?playlist_name=${playlistName}`);
95
+ async playlistQueuePush(playlistName, options) {
96
+ await this.get(`${BASE_PATH}/playlist_queue_push.cgi`, { playlist_name: playlistName }, options);
91
97
  }
92
- async playlistQueueClear() {
93
- await this.get(`${baseUrl}/playlist_queue_clear.cgi`);
98
+ async playlistQueueClear(options) {
99
+ await this.get(`${BASE_PATH}/playlist_queue_clear.cgi`, undefined, options);
94
100
  }
95
- async playlistQueueList() {
96
- const data = await this.get(`${baseUrl}/playlist_queue_list.cgi`);
101
+ async playlistQueueList(options) {
102
+ const data = await this.get(`${BASE_PATH}/playlist_queue_list.cgi`, undefined, options);
97
103
  return playlistQueueSchema.parse(data).playlistQueueList;
98
104
  }
99
- async playlistQueuePlayNext() {
100
- await this.get(`${baseUrl}/playlist_queue_play_next.cgi`);
105
+ async playlistQueuePlayNext(options) {
106
+ await this.get(`${BASE_PATH}/playlist_queue_play_next.cgi`, undefined, options);
101
107
  }
102
- async addNewClip(file, clipType, storage, id, fileName) {
108
+ async addNewClip(file, clipType, storage, id, fileName, options) {
109
+ const path = `${BASE_PATH}/clip_upload.cgi?storage=${storage}`;
103
110
  const formData = new this.CustomFormData();
104
111
  formData.append('clip_name', id);
105
112
  formData.append('clip_type', clipType);
106
113
  formData.append('file', file, fileName);
107
- const path = `${baseUrl}/clip_upload.cgi?storage=${storage}`;
108
- const res = await this.client.post(path, formData);
114
+ const agent = this.getAgent(options?.proxyParams);
115
+ const res = await agent.post({ path, data: formData, timeout: options?.timeout });
109
116
  const output = (await res.json());
110
117
  if (output.status !== 200) {
111
118
  throw new AddNewClipError(output.message);
112
119
  }
113
120
  }
114
- removeClip(id, storage) {
115
- return this.get(`${baseUrl}/clip_remove.cgi`, { clip_name: id, storage });
121
+ removeClip(id, storage, options) {
122
+ return this.get(`${BASE_PATH}/clip_remove.cgi`, { clip_name: id, storage }, options);
116
123
  }
117
- async getClipList() {
118
- const data = await this.get(`${baseUrl}/clip_list.cgi`);
124
+ async getClipList(options) {
125
+ const data = await this.get(`${BASE_PATH}/clip_list.cgi`, undefined, options);
119
126
  return clipListSchema.parse(data).clip_list;
120
127
  }
121
- setCamSwitchOptions(data, cameraFWVersion) {
128
+ setCamSwitchOptions(data, cameraFWVersion, options) {
122
129
  const bitrateVapixParams = parseBitrateOptionsToBitrateVapixParams(cameraFWVersion, data.bitrateMode, data);
123
130
  const saveData = {
124
131
  video: {
@@ -136,9 +143,9 @@ export class CamSwitcherAPI {
136
143
  },
137
144
  keyboard: data.keyboard,
138
145
  };
139
- return this.setParamFromCameraJSON(CSW_PARAM_NAMES.SETTINGS, saveData);
146
+ return this.setParamFromCameraJSON(CSW_PARAM_NAMES.SETTINGS, saveData, options);
140
147
  }
141
- setGlobalAudioSettings(settings) {
148
+ setGlobalAudioSettings(settings, options) {
142
149
  let acceptedType = 'NONE';
143
150
  if (settings.type === 'source' && settings.source) {
144
151
  if (isClip(settings.source)) {
@@ -154,9 +161,9 @@ export class CamSwitcherAPI {
154
161
  clip_name: settings.source,
155
162
  storage: settings.storage,
156
163
  };
157
- return this.setParamFromCameraJSON(CSW_PARAM_NAMES.MASTER_AUDIO, data);
164
+ return this.setParamFromCameraJSON(CSW_PARAM_NAMES.MASTER_AUDIO, data, options);
158
165
  }
159
- setSecondaryAudioSettings(settings) {
166
+ setSecondaryAudioSettings(settings, options) {
160
167
  const data = {
161
168
  type: settings.type,
162
169
  stream_name: settings.streamName ?? '',
@@ -165,19 +172,19 @@ export class CamSwitcherAPI {
165
172
  secondary_audio_level: settings.secondaryAudioLevel,
166
173
  master_audio_level: settings.masterAudioLevel,
167
174
  };
168
- return this.setParamFromCameraJSON(CSW_PARAM_NAMES.SECONDARY_AUDIO, data);
175
+ return this.setParamFromCameraJSON(CSW_PARAM_NAMES.SECONDARY_AUDIO, data, options);
169
176
  }
170
- setDefaultPlaylist(id) {
177
+ setDefaultPlaylist(id, options) {
171
178
  const value = JSON.stringify({ default_playlist_id: id });
172
179
  return this.vapixAgent.setParameter({
173
180
  [CSW_PARAM_NAMES.DEFAULT_PLAYLIST]: value,
174
- }, null);
181
+ }, options);
175
182
  }
176
- setPermanentRtspUrlToken(token) {
177
- return this.vapixAgent.setParameter({ [CSW_PARAM_NAMES.RTSP_TOKEN]: token }, null);
183
+ setPermanentRtspUrlToken(token, options) {
184
+ return this.vapixAgent.setParameter({ [CSW_PARAM_NAMES.RTSP_TOKEN]: token }, options);
178
185
  }
179
- async getCamSwitchOptions() {
180
- const saveData = await this.getParamFromCameraAndJSONParse(CSW_PARAM_NAMES.SETTINGS);
186
+ async getCamSwitchOptions(options) {
187
+ const saveData = await this.getParamFromCameraAndJSONParse(CSW_PARAM_NAMES.SETTINGS, options);
181
188
  if (isNullish(saveData.video)) {
182
189
  return saveData;
183
190
  }
@@ -202,12 +209,12 @@ export class CamSwitcherAPI {
202
209
  keyboard: saveData.keyboard,
203
210
  };
204
211
  }
205
- async getGlobalAudioSettings() {
212
+ async getGlobalAudioSettings(options) {
206
213
  const settings = {
207
214
  type: 'fromSource',
208
215
  source: 'fromSource',
209
216
  };
210
- const res = await this.getParamFromCameraAndJSONParse(CSW_PARAM_NAMES.MASTER_AUDIO);
217
+ const res = await this.getParamFromCameraAndJSONParse(CSW_PARAM_NAMES.MASTER_AUDIO, options);
211
218
  if (res.type === 'STREAM') {
212
219
  settings.type = 'source';
213
220
  settings.source = res.stream_name;
@@ -219,8 +226,8 @@ export class CamSwitcherAPI {
219
226
  }
220
227
  return settings;
221
228
  }
222
- async getSecondaryAudioSettings() {
223
- const res = await this.getParamFromCameraAndJSONParse(CSW_PARAM_NAMES.SECONDARY_AUDIO);
229
+ async getSecondaryAudioSettings(options) {
230
+ const res = await this.getParamFromCameraAndJSONParse(CSW_PARAM_NAMES.SECONDARY_AUDIO, options);
224
231
  const settings = {
225
232
  type: res.type ?? 'NONE',
226
233
  streamName: res.stream_name,
@@ -231,13 +238,14 @@ export class CamSwitcherAPI {
231
238
  };
232
239
  return settings;
233
240
  }
234
- async getPermanentRtspUrlToken() {
241
+ async getPermanentRtspUrlToken(options) {
235
242
  const paramName = CSW_PARAM_NAMES.RTSP_TOKEN;
236
- const res = await this.vapixAgent.getParameter([paramName], null);
243
+ const res = await this.vapixAgent.getParameter([paramName], options);
237
244
  return res[paramName] ?? '';
238
245
  }
239
- async get(path, parameters = {}) {
240
- const res = await this.client.get(path, parameters);
246
+ async get(path, parameters, options) {
247
+ const agent = this.getAgent(options?.proxyParams);
248
+ const res = await agent.get({ path, parameters, timeout: options?.timeout });
241
249
  if (res.ok) {
242
250
  const d = (await res.json());
243
251
  return d.data;
@@ -246,8 +254,9 @@ export class CamSwitcherAPI {
246
254
  throw new Error(await responseStringify(res));
247
255
  }
248
256
  }
249
- async set(path, data, parameters = {}) {
250
- const res = await this.client.post(path, JSON.stringify(data), parameters);
257
+ async set(path, data, parameters, options) {
258
+ const agent = this.getAgent(options?.proxyParams);
259
+ const res = await agent.post({ path, data: JSON.stringify(data), parameters, timeout: options?.timeout });
251
260
  if (res.ok) {
252
261
  const parsed = await res.json();
253
262
  return parsed.message === 'OK';
@@ -256,13 +265,13 @@ export class CamSwitcherAPI {
256
265
  throw new Error(await responseStringify(res));
257
266
  }
258
267
  }
259
- setParamFromCameraJSON(paramName, data) {
268
+ setParamFromCameraJSON(paramName, data, options) {
260
269
  const params = {};
261
270
  params[paramName] = JSON.stringify(data);
262
- return this.vapixAgent.setParameter(params, null);
271
+ return this.vapixAgent.setParameter(params, options);
263
272
  }
264
- async getParamFromCameraAndJSONParse(paramName) {
265
- const data = await this.vapixAgent.getParameter([paramName], null);
273
+ async getParamFromCameraAndJSONParse(paramName, options) {
274
+ const data = await this.vapixAgent.getParameter([paramName], options);
266
275
  if (data[paramName] !== undefined) {
267
276
  try {
268
277
  if (data[paramName] === '') {
@@ -278,6 +287,9 @@ export class CamSwitcherAPI {
278
287
  }
279
288
  throw new Error("Error: no parametr '" + paramName + "' was found");
280
289
  }
290
+ getAgent(proxyParams) {
291
+ return proxyParams ? new ProxyClient(this.client, proxyParams) : this.client;
292
+ }
281
293
  }
282
294
  const CSW_PARAM_NAMES = {
283
295
  SETTINGS: 'Camswitcher.Settings',