@microblink/blinkid-imagecapture-in-browser-sdk
Version:
A smart image capturing library for WebAssembly-enabled browsers.
51 lines (50 loc) • 2.12 kB
TypeScript
/**
* Copyright (c) Microblink Ltd. All rights reserved.
*/
import { ApiType, Configuration, RequestPayload, ResponseHealthcheck, ResponseRecognition } from "./data-structures";
export declare class Client {
private errorMessages;
private service;
/**
* Create new instance of Client service.
*
* This class requires API type and optional configuration object.
*/
constructor(type: ApiType, configuration?: Configuration);
/**
* Returns a promise which will resolve to `{ status: true }` if API service
* is available.
*
* In case of error, promise will reject and property `details` with full
* HTTP response will is added to object.
*
* Healthcheck endpoint can be configured with
* `Configuration.healthcheckEndpoint` property. If omitted, default value
* is used.
*/
getHealthcheck(): Promise<ResponseHealthcheck>;
/**
* Extract data from image. First argument is API endpoint, while the second
* one is body which is sent with the request.
*
* This method returns a promise which will always resolve/reject to
* `ResponseRecognition` object.
*
* Promise will resolve only when data has been extracted successfuly, or
* when no data has been extracted. In every other case promise will reject.
*
* For full list of endpoints and related payloads see official
* documentation for Cloud API or Self-hosted API.
*
* @example
* client.recognize( "/v2/recognizers/blinkid-single-side", { "imageSource": imageBase64 } )
* .then( ( result: ResponseRecognition ) => console.log( result.response.data.result ) )
* .catch( ( error: ResponseRecognition ) => console.log( error.error.message ) );
*/
recognize(endpoint: string, payload: RequestPayload): Promise<ResponseRecognition>;
/**
* Get Base64 representation of an image based on provided instance of ImageData.
*/
imageDataToBase64(imageData: ImageData): string;
}
export * from "./data-structures";