capacitor-plugin-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK for Capacitor
70 lines • 2.54 kB
JavaScript
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from rtu-ui-v2/schemas/check/CheckScannerUIResult.yaml
import { GenericDocument } from '../../documents/GenericDocument';
import { ImageRef } from '../../imageRef/image';
import { ToJsonConfiguration } from '../../utils/json/JsonSerializationTypes';
import { PartiallyConstructible } from '../../utils/utils';
/**
Configuration of the check scanner RTU UI result.
*/
export class CheckScannerUiResult extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<CheckScannerUiResult>`} */
constructor(source = {}) {
super();
this._released = false;
if (source.recognitionStatus !== undefined) {
this.recognitionStatus = source.recognitionStatus;
}
else {
throw new Error('recognitionStatus must be present in constructor argument');
}
if (source.croppedImage !== undefined) {
this.croppedImage = source.croppedImage != null ? ImageRef.From(source.croppedImage) : null;
}
else {
throw new Error('croppedImage must be present in constructor argument');
}
if (source.check !== undefined) {
this.check = source.check != null ? new GenericDocument(source.check) : null;
}
else {
throw new Error('check must be present in constructor argument');
}
}
async serialize(config = new ToJsonConfiguration()) {
return {
recognitionStatus: this.recognitionStatus,
croppedImage: config.serializeImages
? this.croppedImage != null
? await this.croppedImage.serialize(config.imageSerializationMode)
: null
: undefined,
check: this.check != null ? await this.check.serialize(config) : null,
};
}
release() {
if (this._released) {
return;
}
{
if (this.croppedImage != null) {
this.croppedImage.release();
}
}
{
if (this.check != null) {
this.check.release();
}
}
this._released = true;
}
async encodeImages() {
if (this.croppedImage != null) {
await this.croppedImage.encodeInPlace();
}
if (this.check != null) {
await this.check.encodeImages();
}
}
}
//# sourceMappingURL=CheckScannerUIResult.js.map