camstreamerlib 4.0.0-beta.80 → 4.0.0-beta.82

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 (33) hide show
  1. package/cjs/CamStreamerAPI.d.ts +85 -3
  2. package/cjs/CamStreamerAPI.js +82 -35
  3. package/cjs/errors/errors.d.ts +7 -3
  4. package/cjs/types/CamStreamerAPI/CamStreamerAPI.d.ts +424 -0
  5. package/cjs/types/CamStreamerAPI/CamStreamerAPI.js +28 -1
  6. package/cjs/types/CamStreamerAPI/facebookSchema.d.ts +3 -0
  7. package/cjs/types/CamStreamerAPI/hlsSchema.d.ts +3 -0
  8. package/cjs/types/CamStreamerAPI/mpegDvbSchema.d.ts +3 -0
  9. package/cjs/types/CamStreamerAPI/oldStreamSchema.d.ts +71 -0
  10. package/cjs/types/CamStreamerAPI/oldStreamSchema.js +4 -1
  11. package/cjs/types/CamStreamerAPI/rtmpSchema.d.ts +3 -0
  12. package/cjs/types/CamStreamerAPI/sdCardSchema.d.ts +3 -0
  13. package/cjs/types/CamStreamerAPI/streamCommonTypes.d.ts +3 -0
  14. package/cjs/types/CamStreamerAPI/streamCommonTypes.js +1 -0
  15. package/cjs/types/CamStreamerAPI/windySchema.d.ts +3 -0
  16. package/cjs/types/CamStreamerAPI/youtubeSchema.d.ts +3 -0
  17. package/esm/CamStreamerAPI.js +84 -37
  18. package/esm/types/CamStreamerAPI/CamStreamerAPI.js +27 -0
  19. package/esm/types/CamStreamerAPI/oldStreamSchema.js +3 -0
  20. package/esm/types/CamStreamerAPI/streamCommonTypes.js +1 -0
  21. package/package.json +1 -1
  22. package/types/CamStreamerAPI.d.ts +85 -3
  23. package/types/errors/errors.d.ts +7 -3
  24. package/types/types/CamStreamerAPI/CamStreamerAPI.d.ts +424 -0
  25. package/types/types/CamStreamerAPI/facebookSchema.d.ts +3 -0
  26. package/types/types/CamStreamerAPI/hlsSchema.d.ts +3 -0
  27. package/types/types/CamStreamerAPI/mpegDvbSchema.d.ts +3 -0
  28. package/types/types/CamStreamerAPI/oldStreamSchema.d.ts +71 -0
  29. package/types/types/CamStreamerAPI/rtmpSchema.d.ts +3 -0
  30. package/types/types/CamStreamerAPI/sdCardSchema.d.ts +3 -0
  31. package/types/types/CamStreamerAPI/streamCommonTypes.d.ts +3 -0
  32. package/types/types/CamStreamerAPI/windySchema.d.ts +3 -0
  33. package/types/types/CamStreamerAPI/youtubeSchema.d.ts +3 -0
@@ -66,6 +66,77 @@ export declare const oldStringStreamSchema: z.ZodObject<{
66
66
  startTime: string;
67
67
  stopTime: string;
68
68
  }>;
69
+ export declare const oldStringStreamSchemaWithId: z.ZodObject<{
70
+ enabled: z.ZodString;
71
+ active: z.ZodString;
72
+ audioSource: z.ZodString;
73
+ avSyncMsec: z.ZodString;
74
+ internalVapixParameters: z.ZodString;
75
+ userVapixParameters: z.ZodString;
76
+ outputParameters: z.ZodString;
77
+ outputType: z.ZodString;
78
+ mediaServerUrl: z.ZodString;
79
+ inputType: z.ZodString;
80
+ inputUrl: z.ZodString;
81
+ forceStereo: z.ZodString;
82
+ streamDelay: z.ZodString;
83
+ statusLed: z.ZodString;
84
+ statusPort: z.ZodString;
85
+ callApi: z.ZodString;
86
+ trigger: z.ZodString;
87
+ schedule: z.ZodString;
88
+ prepareAhead: z.ZodString;
89
+ startTime: z.ZodString;
90
+ stopTime: z.ZodString;
91
+ } & {
92
+ id: z.ZodString;
93
+ }, "strip", z.ZodTypeAny, {
94
+ enabled: string;
95
+ id: string;
96
+ active: string;
97
+ audioSource: string;
98
+ avSyncMsec: string;
99
+ internalVapixParameters: string;
100
+ userVapixParameters: string;
101
+ outputParameters: string;
102
+ outputType: string;
103
+ mediaServerUrl: string;
104
+ inputType: string;
105
+ inputUrl: string;
106
+ forceStereo: string;
107
+ streamDelay: string;
108
+ statusLed: string;
109
+ statusPort: string;
110
+ callApi: string;
111
+ trigger: string;
112
+ schedule: string;
113
+ prepareAhead: string;
114
+ startTime: string;
115
+ stopTime: string;
116
+ }, {
117
+ enabled: string;
118
+ id: string;
119
+ active: string;
120
+ audioSource: string;
121
+ avSyncMsec: string;
122
+ internalVapixParameters: string;
123
+ userVapixParameters: string;
124
+ outputParameters: string;
125
+ outputType: string;
126
+ mediaServerUrl: string;
127
+ inputType: string;
128
+ inputUrl: string;
129
+ forceStereo: string;
130
+ streamDelay: string;
131
+ statusLed: string;
132
+ statusPort: string;
133
+ callApi: string;
134
+ trigger: string;
135
+ schedule: string;
136
+ prepareAhead: string;
137
+ startTime: string;
138
+ stopTime: string;
139
+ }>;
69
140
  export type TOldStringStream = z.infer<typeof oldStringStreamSchema>;
70
141
  export declare const oldStreamSchema: z.ZodObject<{
71
142
  enabled: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oldStreamSchema = exports.oldStringStreamSchema = void 0;
3
+ exports.oldStreamSchema = exports.oldStringStreamSchemaWithId = exports.oldStringStreamSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.oldStringStreamSchema = zod_1.z.object({
6
6
  enabled: zod_1.z.string(),
@@ -25,6 +25,9 @@ exports.oldStringStreamSchema = zod_1.z.object({
25
25
  startTime: zod_1.z.string(),
26
26
  stopTime: zod_1.z.string(),
27
27
  });
28
+ exports.oldStringStreamSchemaWithId = exports.oldStringStreamSchema.extend({
29
+ id: zod_1.z.string(),
30
+ });
28
31
  exports.oldStreamSchema = zod_1.z.object({
29
32
  enabled: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
30
33
  active: zod_1.z.union([zod_1.z.literal(0), zod_1.z.literal(1)]),
@@ -1,5 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const rtmpSchema: z.ZodObject<{
3
+ id: z.ZodNumber;
3
4
  enabled: z.ZodBoolean;
4
5
  active: z.ZodBoolean;
5
6
  title: z.ZodString;
@@ -8,11 +9,13 @@ export declare const rtmpSchema: z.ZodObject<{
8
9
  }, "strip", z.ZodTypeAny, {
9
10
  type: "rtmp";
10
11
  enabled: boolean;
12
+ id: number;
11
13
  active: boolean;
12
14
  title: string;
13
15
  }, {
14
16
  type: "rtmp";
15
17
  enabled: boolean;
18
+ id: number;
16
19
  active: boolean;
17
20
  title: string;
18
21
  }>;
@@ -1,5 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const sdCardSchema: z.ZodObject<{
3
+ id: z.ZodNumber;
3
4
  enabled: z.ZodBoolean;
4
5
  active: z.ZodBoolean;
5
6
  title: z.ZodString;
@@ -8,11 +9,13 @@ export declare const sdCardSchema: z.ZodObject<{
8
9
  }, "strip", z.ZodTypeAny, {
9
10
  type: "sd_card";
10
11
  enabled: boolean;
12
+ id: number;
11
13
  active: boolean;
12
14
  title: string;
13
15
  }, {
14
16
  type: "sd_card";
15
17
  enabled: boolean;
18
+ id: number;
16
19
  active: boolean;
17
20
  title: string;
18
21
  }>;
@@ -2,15 +2,18 @@ import { z } from 'zod';
2
2
  export declare const streamTypeSchema: z.ZodUnion<[z.ZodLiteral<"youtube">, z.ZodLiteral<"facebook">, z.ZodLiteral<"sd_card">, z.ZodLiteral<"windy">, z.ZodLiteral<"mpeg_dvb">, z.ZodLiteral<"hls">, z.ZodLiteral<"rtmp">]>;
3
3
  export type TStreamType = z.infer<typeof streamTypeSchema>;
4
4
  export declare const streamCommonSchema: z.ZodObject<{
5
+ id: z.ZodNumber;
5
6
  enabled: z.ZodBoolean;
6
7
  active: z.ZodBoolean;
7
8
  title: z.ZodString;
8
9
  }, "strip", z.ZodTypeAny, {
9
10
  enabled: boolean;
11
+ id: number;
10
12
  active: boolean;
11
13
  title: string;
12
14
  }, {
13
15
  enabled: boolean;
16
+ id: number;
14
17
  active: boolean;
15
18
  title: string;
16
19
  }>;
@@ -12,6 +12,7 @@ exports.streamTypeSchema = zod_1.z.union([
12
12
  zod_1.z.literal('rtmp'),
13
13
  ]);
14
14
  exports.streamCommonSchema = zod_1.z.object({
15
+ id: zod_1.z.number(),
15
16
  enabled: zod_1.z.boolean(),
16
17
  active: zod_1.z.boolean(),
17
18
  title: zod_1.z.string(),
@@ -1,5 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const windySchema: z.ZodObject<{
3
+ id: z.ZodNumber;
3
4
  enabled: z.ZodBoolean;
4
5
  active: z.ZodBoolean;
5
6
  title: z.ZodString;
@@ -8,11 +9,13 @@ export declare const windySchema: z.ZodObject<{
8
9
  }, "strip", z.ZodTypeAny, {
9
10
  type: "windy";
10
11
  enabled: boolean;
12
+ id: number;
11
13
  active: boolean;
12
14
  title: string;
13
15
  }, {
14
16
  type: "windy";
15
17
  enabled: boolean;
18
+ id: number;
16
19
  active: boolean;
17
20
  title: string;
18
21
  }>;
@@ -1,5 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const youtubeSchema: z.ZodObject<{
3
+ id: z.ZodNumber;
3
4
  enabled: z.ZodBoolean;
4
5
  active: z.ZodBoolean;
5
6
  title: z.ZodString;
@@ -8,11 +9,13 @@ export declare const youtubeSchema: z.ZodObject<{
8
9
  }, "strip", z.ZodTypeAny, {
9
10
  type: "youtube";
10
11
  enabled: boolean;
12
+ id: number;
11
13
  active: boolean;
12
14
  title: string;
13
15
  }, {
14
16
  type: "youtube";
15
17
  enabled: boolean;
18
+ id: number;
16
19
  active: boolean;
17
20
  title: string;
18
21
  }>;
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  import { ProxyClient } from './internal/ProxyClient';
3
- import { streamSchema } from './types/CamStreamerAPI/CamStreamerAPI';
3
+ import { audioFileListSchema, storageListSchema, streamSchema, } from './types/CamStreamerAPI/CamStreamerAPI';
4
4
  import { ErrorWithResponse, UtcTimeFetchError, WsAuthorizationError, MigrationError } from './errors/errors';
5
- import { oldStringStreamSchema } from './types/CamStreamerAPI/oldStreamSchema';
5
+ import { oldStringStreamSchema, oldStringStreamSchemaWithId, } from './types/CamStreamerAPI/oldStreamSchema';
6
6
  const BASE_PATH = '/local/camstreamer';
7
7
  export class CamStreamerAPI {
8
8
  client;
@@ -28,55 +28,81 @@ export class CamStreamerAPI {
28
28
  return z.number().parse(res.data);
29
29
  }
30
30
  async getStreamList(options) {
31
- const res = await this._getJson(`${BASE_PATH}/stream/list.cgi`, undefined, options);
32
- const streamList = {};
33
- const invalidList = {};
34
- for (const [key, value] of Object.entries(res.data)) {
35
- const id = parseInt(key);
36
- try {
37
- const parsed = streamSchema.parse(value);
38
- streamList[id] = parsed;
31
+ const res = await this._getJson(`${BASE_PATH}/stream_list.cgi`, { action: 'get' }, options);
32
+ const oldStreamListRecord = z.record(z.string(), oldStringStreamSchema).safeParse(res.data);
33
+ if (oldStreamListRecord.success) {
34
+ const data = Object.entries(oldStreamListRecord.data).map(([id, streamData]) => ({
35
+ id: parseInt(id),
36
+ ...parseCameraStreamResponse(streamData),
37
+ }));
38
+ throw new MigrationError([], data);
39
+ }
40
+ const newStreamData = [];
41
+ const oldStreamData = [];
42
+ for (const streamData of res.data.streamList) {
43
+ const newStreamParse = streamSchema.safeParse(streamData);
44
+ if (newStreamParse.success) {
45
+ newStreamData.push(newStreamParse.data);
46
+ continue;
39
47
  }
40
- catch (err) {
41
- const oldStream = oldStringStreamSchema.parse(value);
42
- const parsedOldStream = parseCameraStreamResponse(oldStream);
43
- invalidList[id] = parsedOldStream;
48
+ const oldStreamParse = oldStringStreamSchemaWithId.safeParse(streamData);
49
+ if (oldStreamParse.success) {
50
+ oldStreamData.push({
51
+ id: parseInt(oldStreamParse.data.id),
52
+ ...parseCameraStreamResponse(oldStreamParse.data),
53
+ });
54
+ continue;
44
55
  }
56
+ throw new Error('Failed to parse some stream entries');
45
57
  }
46
- if (Object.keys(invalidList).length > 0) {
47
- throw new MigrationError(streamList, invalidList);
58
+ if (oldStreamData.length > 0) {
59
+ throw new MigrationError(newStreamData, oldStreamData);
48
60
  }
49
- return streamList;
61
+ return newStreamData;
62
+ }
63
+ async setStreamList(streamList, options) {
64
+ await this._postJsonEncoded(`${BASE_PATH}/stream_list.cgi`, JSON.stringify({ streamList }), {
65
+ action: 'set',
66
+ }, options);
50
67
  }
51
68
  async getStream(streamId, options) {
52
- const res = await this._getJson(`${BASE_PATH}/stream/get.cgi`, { stream_id: streamId }, options);
53
- try {
54
- return streamSchema.parse(res.data);
55
- }
56
- catch (err) {
57
- const oldStream = oldStringStreamSchema.parse(res.data);
58
- const parsedOldStream = parseCameraStreamResponse(oldStream);
59
- throw new MigrationError({}, { [streamId]: parsedOldStream });
69
+ const res = await this._getJson(`${BASE_PATH}/stream_list.cgi`, { action: 'get', stream_id: streamId }, options);
70
+ const newStream = streamSchema.safeParse(res.data);
71
+ if (newStream.success) {
72
+ return newStream.data;
60
73
  }
74
+ const oldStream = oldStringStreamSchema.passthrough().parse(res.data);
75
+ throw new MigrationError([], [{ id: streamId, ...parseCameraStreamResponse(oldStream) }]);
61
76
  }
62
77
  async setStream(streamId, streamData, options) {
63
- const agent = this.getClient(options?.proxyParams);
64
- await agent.post({
65
- path: `${BASE_PATH}/stream/set.cgi`,
66
- data: JSON.stringify(streamData),
67
- parameters: {
68
- stream_id: streamId,
69
- },
70
- timeout: options?.timeout,
71
- });
78
+ await this._postJsonEncoded(`${BASE_PATH}/stream_list.cgi`, JSON.stringify(streamData), {
79
+ action: 'set',
80
+ stream_id: streamId,
81
+ }, options);
72
82
  }
73
83
  async isStreaming(streamId, options) {
74
84
  const res = await this._getJson(`${BASE_PATH}/get_streamstat.cgi`, { stream_id: streamId }, options);
75
85
  return res.data.is_streaming === 1;
76
86
  }
77
- async deleteStream(streamId, options) {
78
- const res = await this._getJson(`${BASE_PATH}/stream/remove.cgi`, { stream_id: streamId }, options);
79
- return res.data.status === 200;
87
+ async listFiles(options) {
88
+ const res = await this._getJson(`${BASE_PATH}/upload_audio.cgi`, { action: 'list' }, options);
89
+ return audioFileListSchema.parse(res.data);
90
+ }
91
+ async uploadFile(formData, storage, options) {
92
+ await this._post(`${BASE_PATH}/upload_audio.cgi`, formData, {
93
+ action: 'upload',
94
+ storage: storage,
95
+ }, options);
96
+ }
97
+ async removeFile(fileParams, options) {
98
+ await this._getJson(`${BASE_PATH}/upload_audio.cgi`, {
99
+ action: 'remove',
100
+ ...fileParams,
101
+ }, options);
102
+ }
103
+ async getFileStorage(options) {
104
+ const res = await this._getJson(`${BASE_PATH}/upload_audio.cgi`, { action: 'get_storage' }, options);
105
+ return storageListSchema.parse(res.data);
80
106
  }
81
107
  async _getJson(path, parameters, options) {
82
108
  const agent = this.getClient(options?.proxyParams);
@@ -88,6 +114,27 @@ export class CamStreamerAPI {
88
114
  throw new ErrorWithResponse(res);
89
115
  }
90
116
  }
117
+ async _postJsonEncoded(path, data, parameters, options, headers) {
118
+ const agent = this.getClient(options?.proxyParams);
119
+ const baseHeaders = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
120
+ return agent.post({
121
+ path,
122
+ data,
123
+ parameters,
124
+ timeout: options?.timeout,
125
+ headers: { ...baseHeaders, ...headers },
126
+ });
127
+ }
128
+ async _post(path, data, parameters, options, headers) {
129
+ const agent = this.getClient(options?.proxyParams);
130
+ const res = await agent.post({ path, data, parameters, headers, timeout: options?.timeout });
131
+ if (res.ok) {
132
+ return await res.json();
133
+ }
134
+ else {
135
+ throw new ErrorWithResponse(res);
136
+ }
137
+ }
91
138
  }
92
139
  export const parseCameraStreamResponse = (cameraStreamData) => {
93
140
  return {
@@ -15,6 +15,7 @@ export const streamSchema = z.discriminatedUnion('type', [
15
15
  windySchema,
16
16
  youtubeSchema,
17
17
  ]);
18
+ export const streamListSchema = z.object({ streamList: z.array(streamSchema) });
18
19
  export const isFacebookStream = (stream) => {
19
20
  return stream.type === 'facebook';
20
21
  };
@@ -36,3 +37,29 @@ export const isWindyStream = (stream) => {
36
37
  export const isYouTubeStream = (stream) => {
37
38
  return stream.type === 'youtube';
38
39
  };
40
+ export var AudioType;
41
+ (function (AudioType) {
42
+ AudioType[AudioType["MP3"] = 0] = "MP3";
43
+ AudioType[AudioType["AAC"] = 1] = "AAC";
44
+ })(AudioType || (AudioType = {}));
45
+ export const audioFileStorageTypeSchema = z.union([z.literal('flash'), z.literal('SD0'), z.literal('url')]);
46
+ export const storageListSchema = z.array(z.discriminatedUnion('type', [
47
+ z.object({
48
+ type: z.literal('flash'),
49
+ flash: z.string(),
50
+ }),
51
+ z.object({
52
+ type: z.literal('SD0'),
53
+ SD0: z.string(),
54
+ }),
55
+ ]));
56
+ export const audioFileSchema = z.object({
57
+ name: z.string(),
58
+ path: z.string(),
59
+ storage: audioFileStorageTypeSchema,
60
+ });
61
+ export const audioFileListSchema = z.array(audioFileSchema);
62
+ export const audioFileDataSchema = z.object({
63
+ code: z.number(),
64
+ list: audioFileListSchema,
65
+ });
@@ -22,6 +22,9 @@ export const oldStringStreamSchema = z.object({
22
22
  startTime: z.string(),
23
23
  stopTime: z.string(),
24
24
  });
25
+ export const oldStringStreamSchemaWithId = oldStringStreamSchema.extend({
26
+ id: z.string(),
27
+ });
25
28
  export const oldStreamSchema = z.object({
26
29
  enabled: z.union([z.literal(0), z.literal(1)]),
27
30
  active: z.union([z.literal(0), z.literal(1)]),
@@ -9,6 +9,7 @@ export const streamTypeSchema = z.union([
9
9
  z.literal('rtmp'),
10
10
  ]);
11
11
  export const streamCommonSchema = z.object({
12
+ id: z.number(),
12
13
  enabled: z.boolean(),
13
14
  active: z.boolean(),
14
15
  title: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.0-beta.80",
3
+ "version": "4.0.0-beta.82",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "engine": {
@@ -1,6 +1,6 @@
1
1
  import { ProxyClient } from './internal/ProxyClient';
2
2
  import { IClient, TResponse } from './internal/types';
3
- import { TStream } from './types/CamStreamerAPI/CamStreamerAPI';
3
+ import { TAudioFile, TAudioFileStorageType, TStream, TStreamList } from './types/CamStreamerAPI/CamStreamerAPI';
4
4
  import { THttpRequestOptions, TProxyParams } from './types/common';
5
5
  import { TOldStream, TOldStringStream } from './types/CamStreamerAPI/oldStreamSchema';
6
6
  export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> {
@@ -10,21 +10,84 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> {
10
10
  getClient(proxyParams?: TProxyParams): Client | ProxyClient<Client>;
11
11
  wsAuthorization(options?: THttpRequestOptions): Promise<string>;
12
12
  getUtcTime(options?: THttpRequestOptions): Promise<number>;
13
- getStreamList(options?: THttpRequestOptions): Promise<Record<number, TStream>>;
13
+ getStreamList(options?: THttpRequestOptions): Promise<({
14
+ type: "facebook";
15
+ enabled: boolean;
16
+ id: number;
17
+ active: boolean;
18
+ title: string;
19
+ } | {
20
+ type: "hls";
21
+ enabled: boolean;
22
+ id: number;
23
+ active: boolean;
24
+ title: string;
25
+ } | {
26
+ type: "mpeg_dvb";
27
+ port: number;
28
+ enabled: boolean;
29
+ id: number;
30
+ active: boolean;
31
+ title: string;
32
+ ipAddress: string;
33
+ standard: "DVB" | "ATSC";
34
+ nullPacketsPaddingEnabled: boolean;
35
+ nullPacketsPaddingKbps: number;
36
+ videoPid: number;
37
+ audioPid: number;
38
+ mpegtsStreamId: number;
39
+ pmtPid: number;
40
+ pcrPid: number;
41
+ pcrPeriodMs: number;
42
+ providerName: string;
43
+ serviceName: string;
44
+ triggerType: "manual" | "onetime" | "recurrent" | "io" | "nonstop";
45
+ statusCameraLed: boolean;
46
+ statusCameraOutput: string;
47
+ saveToSdCard: boolean;
48
+ } | {
49
+ type: "rtmp";
50
+ enabled: boolean;
51
+ id: number;
52
+ active: boolean;
53
+ title: string;
54
+ } | {
55
+ type: "sd_card";
56
+ enabled: boolean;
57
+ id: number;
58
+ active: boolean;
59
+ title: string;
60
+ } | {
61
+ type: "windy";
62
+ enabled: boolean;
63
+ id: number;
64
+ active: boolean;
65
+ title: string;
66
+ } | {
67
+ type: "youtube";
68
+ enabled: boolean;
69
+ id: number;
70
+ active: boolean;
71
+ title: string;
72
+ })[]>;
73
+ setStreamList(streamList: TStreamList['streamList'], options?: THttpRequestOptions): Promise<void>;
14
74
  getStream(streamId: number, options?: THttpRequestOptions): Promise<{
15
75
  type: "facebook";
16
76
  enabled: boolean;
77
+ id: number;
17
78
  active: boolean;
18
79
  title: string;
19
80
  } | {
20
81
  type: "hls";
21
82
  enabled: boolean;
83
+ id: number;
22
84
  active: boolean;
23
85
  title: string;
24
86
  } | {
25
87
  type: "mpeg_dvb";
26
88
  port: number;
27
89
  enabled: boolean;
90
+ id: number;
28
91
  active: boolean;
29
92
  title: string;
30
93
  ipAddress: string;
@@ -46,27 +109,46 @@ export declare class CamStreamerAPI<Client extends IClient<TResponse, any>> {
46
109
  } | {
47
110
  type: "rtmp";
48
111
  enabled: boolean;
112
+ id: number;
49
113
  active: boolean;
50
114
  title: string;
51
115
  } | {
52
116
  type: "sd_card";
53
117
  enabled: boolean;
118
+ id: number;
54
119
  active: boolean;
55
120
  title: string;
56
121
  } | {
57
122
  type: "windy";
58
123
  enabled: boolean;
124
+ id: number;
59
125
  active: boolean;
60
126
  title: string;
61
127
  } | {
62
128
  type: "youtube";
63
129
  enabled: boolean;
130
+ id: number;
64
131
  active: boolean;
65
132
  title: string;
66
133
  }>;
67
134
  setStream(streamId: number, streamData: Partial<TStream>, options?: THttpRequestOptions): Promise<void>;
68
135
  isStreaming(streamId: number, options?: THttpRequestOptions): Promise<boolean>;
69
- deleteStream(streamId: number, options?: THttpRequestOptions): Promise<boolean>;
136
+ listFiles(options?: THttpRequestOptions): Promise<{
137
+ path: string;
138
+ name: string;
139
+ storage: "url" | "flash" | "SD0";
140
+ }[]>;
141
+ uploadFile(formData: Parameters<Client['post']>[0]['data'], storage: TAudioFileStorageType, options?: THttpRequestOptions): Promise<void>;
142
+ removeFile(fileParams: TAudioFile, options?: THttpRequestOptions): Promise<void>;
143
+ getFileStorage(options?: THttpRequestOptions): Promise<({
144
+ type: "flash";
145
+ flash: string;
146
+ } | {
147
+ type: "SD0";
148
+ SD0: string;
149
+ })[]>;
70
150
  private _getJson;
151
+ private _postJsonEncoded;
152
+ private _post;
71
153
  }
72
154
  export declare const parseCameraStreamResponse: (cameraStreamData: TOldStringStream) => TOldStream;
@@ -91,8 +91,12 @@ export declare class BadRequestError<T extends TResponse> extends ErrorWithRespo
91
91
  constructor(res: T);
92
92
  }
93
93
  export declare class MigrationError extends Error {
94
- readonly valid: Record<number, TStream>;
95
- readonly invalid: Record<number, TOldStream>;
96
- constructor(valid: Record<number, TStream>, invalid: Record<number, TOldStream>);
94
+ readonly valid: TStream[];
95
+ readonly invalid: (TOldStream & {
96
+ id: number;
97
+ })[];
98
+ constructor(valid: TStream[], invalid: (TOldStream & {
99
+ id: number;
100
+ })[]);
97
101
  }
98
102
  export {};