Skip to content

Commit

Permalink
Export more types
Browse files Browse the repository at this point in the history
  • Loading branch information
myrotvorets-team committed Sep 16, 2023
1 parent 7f57fba commit 774ec01
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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<R.SearchUploadAck | R.SearchUploadError> {
Expand Down
8 changes: 5 additions & 3 deletions src/videoclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<R.VideoUploadAck> {
public async uploadVideo(video: VideoType, priority: VideoUploadPriority = 'C'): Promise<R.VideoUploadAck> {
const builder = await this._requestBuilder
.reset(VideoCommands.VIDEO_UPLOAD)
.setClientID(priority)
Expand All @@ -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<R.VideoResult> {
public async getVideoResult(guid: string, type: VideoResultType, archiveNumber = 1): Promise<R.VideoResult> {
const builder = this._requestBuilder.reset(VideoCommands.VIDEO_RESULT, guid);
builder.setParams(type === 'detect' ? 1 : 2, archiveNumber);
return this._sendRequest(await builder.get());
Expand Down

0 comments on commit 774ec01

Please sign in to comment.