From 774ec01f7beaa044cdbda831b28b6d0098b44dc6 Mon Sep 17 00:00:00 2001 From: Myrotvorets Date: Sat, 16 Sep 2023 08:00:18 +0300 Subject: [PATCH] Export more types --- src/client.ts | 5 +++-- src/videoclient.ts | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/client.ts b/src/client.ts index b2152de..afe631c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -4,7 +4,8 @@ import { Commands } from './request/commands'; import { IFaceXRequestBuilder, IRemoteTransport } from './interfaces'; import * as R from './responses'; -type PhotoType = Buffer | string | NodeJS.ReadableStream; +export type PhotoType = Buffer | string | NodeJS.ReadableStream; +export type PhotoUploadPriority = 'A' | 'B' | 'C'; export class Client extends ClientBase { public constructor(url: string, transport: IRemoteTransport, requestBuilder: IFaceXRequestBuilder) { @@ -18,7 +19,7 @@ export class Client extends ClientBase { public async uploadPhotoForSearch( photo: PhotoType, - priority: 'A' | 'B' | 'C' = 'C', + priority: PhotoUploadPriority = 'C', comment = '', minSimialrity = 0, ): Promise { diff --git a/src/videoclient.ts b/src/videoclient.ts index 981c568..1f6f0d0 100644 --- a/src/videoclient.ts +++ b/src/videoclient.ts @@ -4,14 +4,16 @@ import { ClientRequestEncoder } from './encoders/client'; import { VideoCommands } from './request/commands'; import * as R from './responses'; -type VideoType = Buffer | string | NodeJS.ReadableStream; +export type VideoType = Buffer | string | NodeJS.ReadableStream; +export type VideoUploadPriority = 'A' | 'B' | 'C'; +export type VideoResultType = 'detect' | 'match'; export class VideoClient extends ClientBase { public constructor(url: string, transport: IRemoteTransport, requestBuilder: IFaceXRequestBuilder) { super(url, transport, new ClientRequestEncoder(), requestBuilder); } - public async uploadVideo(video: VideoType, priority: 'A' | 'B' | 'C' = 'C'): Promise { + public async uploadVideo(video: VideoType, priority: VideoUploadPriority = 'C'): Promise { const builder = await this._requestBuilder .reset(VideoCommands.VIDEO_UPLOAD) .setClientID(priority) @@ -24,7 +26,7 @@ export class VideoClient extends ClientBase { return this._sendRequest(await builder.get()); } - public async getVideoResult(guid: string, type: 'detect' | 'match', archiveNumber = 1): Promise { + public async getVideoResult(guid: string, type: VideoResultType, archiveNumber = 1): Promise { const builder = this._requestBuilder.reset(VideoCommands.VIDEO_RESULT, guid); builder.setParams(type === 'detect' ? 1 : 2, archiveNumber); return this._sendRequest(await builder.get());