camstreamerlib 4.0.0-beta.150 → 4.0.0-beta.151

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.
@@ -162,4 +162,7 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> exte
162
162
  downloadReport(options?: THttpRequestOptions): Promise<string>;
163
163
  private setParamFromCameraJSON;
164
164
  private getParamFromCameraAndJSONParse;
165
+ getUploadedFileList(clipName: string, storage: TStorageType, options?: THttpRequestOptions): Promise<string[]>;
166
+ downloadClipFile(fileName: string, storage: TStorageType, options?: THttpRequestOptions): Promise<ReturnType<Awaited<ReturnType<Client["get"]>>["blob"]>>;
167
+ uploadClipFiles(files: File[], storage: TStorageType, options?: THttpRequestOptions): Promise<void>;
165
168
  }
@@ -285,6 +285,20 @@ class CamSwitcherAPI extends BasicAPI_1.BasicAPI {
285
285
  }
286
286
  throw new errors_1.ParameterNotFoundError(paramName);
287
287
  }
288
+ async getUploadedFileList(clipName, storage, options) {
289
+ const res = await this._getJson(`${BASE_PATH}/clip_files.cgi`, { clip_name: clipName, storage }, options);
290
+ return CamSwitcherAPI_1.clipFilesListSchema.parse(res).data.files;
291
+ }
292
+ async downloadClipFile(fileName, storage, options) {
293
+ return await this._getBlob(`${BASE_PATH}/clip_download_file.cgi`, { file_name: fileName, storage }, options);
294
+ }
295
+ async uploadClipFiles(files, storage, options) {
296
+ const formData = new FormData();
297
+ for (const file of files) {
298
+ formData.append(file.name, file);
299
+ }
300
+ await this._post(`${BASE_PATH}/clip_upload_file.cgi`, formData, { storage }, options);
301
+ }
288
302
  }
289
303
  exports.CamSwitcherAPI = CamSwitcherAPI;
290
304
  const CSW_PARAM_NAMES = {
@@ -871,4 +871,28 @@ export declare const secondaryAudioSettingsSchema: z.ZodObject<{
871
871
  clipName?: string | undefined;
872
872
  }>;
873
873
  export type TSecondaryAudioSettings = z.infer<typeof secondaryAudioSettingsSchema>;
874
+ export declare const clipFilesListSchema: z.ZodObject<{
875
+ status: z.ZodNumber;
876
+ message: z.ZodString;
877
+ data: z.ZodObject<{
878
+ files: z.ZodArray<z.ZodString, "many">;
879
+ }, "strip", z.ZodTypeAny, {
880
+ files: string[];
881
+ }, {
882
+ files: string[];
883
+ }>;
884
+ }, "strip", z.ZodTypeAny, {
885
+ status: number;
886
+ message: string;
887
+ data: {
888
+ files: string[];
889
+ };
890
+ }, {
891
+ status: number;
892
+ message: string;
893
+ data: {
894
+ files: string[];
895
+ };
896
+ }>;
897
+ export type TClipFilesList = z.infer<typeof clipFilesListSchema>;
874
898
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.secondaryAudioSettingsSchema = exports.globalAudioSettingsSchema = exports.globalAudioSettingsTypeSchema = exports.cameraOptionsSchema = exports.clipListSchema = exports.playlistQueueSchema = exports.trackerSaveLoadSchema = exports.trackerSaveSchema = exports.playlistSaveLoadSchema = exports.clipSaveLoadSchema = exports.clipSaveSchema = exports.streamSaveLoadSchema = exports.audioPushInfoSchema = exports.outputInfoSchema = exports.storageInfoListSchema = void 0;
3
+ exports.clipFilesListSchema = exports.secondaryAudioSettingsSchema = exports.globalAudioSettingsSchema = exports.globalAudioSettingsTypeSchema = exports.cameraOptionsSchema = exports.clipListSchema = exports.playlistQueueSchema = exports.trackerSaveLoadSchema = exports.trackerSaveSchema = exports.playlistSaveLoadSchema = exports.clipSaveLoadSchema = exports.clipSaveSchema = exports.streamSaveLoadSchema = exports.audioPushInfoSchema = exports.outputInfoSchema = exports.storageInfoListSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const transformers_1 = require("../internal/transformers");
6
6
  const common_1 = require("./common");
@@ -165,3 +165,10 @@ exports.secondaryAudioSettingsSchema = zod_1.z.object({
165
165
  secondaryAudioLevel: zod_1.z.number(),
166
166
  masterAudioLevel: zod_1.z.number(),
167
167
  });
168
+ exports.clipFilesListSchema = zod_1.z.object({
169
+ status: zod_1.z.number(),
170
+ message: zod_1.z.string(),
171
+ data: zod_1.z.object({
172
+ files: zod_1.z.array(zod_1.z.string()),
173
+ }),
174
+ });
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { AddNewClipError, JsonParseError, ParameterNotFoundError } from './errors/errors';
3
3
  import { parseBitrateOptionsToVapixParams, parseVapixParamsToBitrateOptions } from './internal/convertors';
4
4
  import { isClip, isNullish } from './internal/utils';
5
- import { storageInfoListSchema, outputInfoSchema, audioPushInfoSchema, clipListSchema, playlistQueueSchema, streamSaveLoadSchema, clipSaveLoadSchema, playlistSaveLoadSchema, trackerSaveLoadSchema, secondaryAudioSettingsSchema, globalAudioSettingsSchema, } from './types/CamSwitcherAPI';
5
+ import { storageInfoListSchema, outputInfoSchema, audioPushInfoSchema, clipListSchema, playlistQueueSchema, streamSaveLoadSchema, clipSaveLoadSchema, playlistSaveLoadSchema, trackerSaveLoadSchema, secondaryAudioSettingsSchema, globalAudioSettingsSchema, clipFilesListSchema, } from './types/CamSwitcherAPI';
6
6
  import { networkCameraListSchema, } from './types/common';
7
7
  import { VapixAPI } from './VapixAPI';
8
8
  import { BasicAPI } from './internal/BasicAPI';
@@ -282,6 +282,20 @@ export class CamSwitcherAPI extends BasicAPI {
282
282
  }
283
283
  throw new ParameterNotFoundError(paramName);
284
284
  }
285
+ async getUploadedFileList(clipName, storage, options) {
286
+ const res = await this._getJson(`${BASE_PATH}/clip_files.cgi`, { clip_name: clipName, storage }, options);
287
+ return clipFilesListSchema.parse(res).data.files;
288
+ }
289
+ async downloadClipFile(fileName, storage, options) {
290
+ return await this._getBlob(`${BASE_PATH}/clip_download_file.cgi`, { file_name: fileName, storage }, options);
291
+ }
292
+ async uploadClipFiles(files, storage, options) {
293
+ const formData = new FormData();
294
+ for (const file of files) {
295
+ formData.append(file.name, file);
296
+ }
297
+ await this._post(`${BASE_PATH}/clip_upload_file.cgi`, formData, { storage }, options);
298
+ }
285
299
  }
286
300
  const CSW_PARAM_NAMES = {
287
301
  SETTINGS: 'Camswitcher.Settings',
@@ -162,3 +162,10 @@ export const secondaryAudioSettingsSchema = z.object({
162
162
  secondaryAudioLevel: z.number(),
163
163
  masterAudioLevel: z.number(),
164
164
  });
165
+ export const clipFilesListSchema = z.object({
166
+ status: z.number(),
167
+ message: z.string(),
168
+ data: z.object({
169
+ files: z.array(z.string()),
170
+ }),
171
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "camstreamerlib",
3
- "version": "4.0.0-beta.150",
3
+ "version": "4.0.0-beta.151",
4
4
  "description": "Helper library for CamStreamer ACAP applications.",
5
5
  "prettier": "@camstreamer/prettier-config",
6
6
  "engine": {
@@ -162,4 +162,7 @@ export declare class CamSwitcherAPI<Client extends IClient<TResponse, any>> exte
162
162
  downloadReport(options?: THttpRequestOptions): Promise<string>;
163
163
  private setParamFromCameraJSON;
164
164
  private getParamFromCameraAndJSONParse;
165
+ getUploadedFileList(clipName: string, storage: TStorageType, options?: THttpRequestOptions): Promise<string[]>;
166
+ downloadClipFile(fileName: string, storage: TStorageType, options?: THttpRequestOptions): Promise<ReturnType<Awaited<ReturnType<Client["get"]>>["blob"]>>;
167
+ uploadClipFiles(files: File[], storage: TStorageType, options?: THttpRequestOptions): Promise<void>;
165
168
  }
@@ -871,4 +871,28 @@ export declare const secondaryAudioSettingsSchema: z.ZodObject<{
871
871
  clipName?: string | undefined;
872
872
  }>;
873
873
  export type TSecondaryAudioSettings = z.infer<typeof secondaryAudioSettingsSchema>;
874
+ export declare const clipFilesListSchema: z.ZodObject<{
875
+ status: z.ZodNumber;
876
+ message: z.ZodString;
877
+ data: z.ZodObject<{
878
+ files: z.ZodArray<z.ZodString, "many">;
879
+ }, "strip", z.ZodTypeAny, {
880
+ files: string[];
881
+ }, {
882
+ files: string[];
883
+ }>;
884
+ }, "strip", z.ZodTypeAny, {
885
+ status: number;
886
+ message: string;
887
+ data: {
888
+ files: string[];
889
+ };
890
+ }, {
891
+ status: number;
892
+ message: string;
893
+ data: {
894
+ files: string[];
895
+ };
896
+ }>;
897
+ export type TClipFilesList = z.infer<typeof clipFilesListSchema>;
874
898
  export {};