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());