UNPKG

capacitor-plugin-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK for Capacitor

119 lines (116 loc) 4.55 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/schemas/CheckScannerTypes.yaml import { DocumentDetectionResult } from '../document_scanner/DocumentScannerTypes'; import { GenericDocument } from '../documents/GenericDocument'; import { ImageRef } from '../imageRef/image'; import { ToJsonConfiguration } from '../utils/json/JsonSerializationTypes'; import { PartiallyConstructible } from '../utils/utils'; export const CheckDocumentDetectionModeValues = [ 'DISABLED', 'DETECT_DOCUMENT', 'DETECT_AND_CROP_DOCUMENT', ]; export const CheckMagneticInkStripScanningStatusValues = [ 'SUCCESS', 'INCOMPLETE_VALIDATION', 'ERROR_NOTHING_FOUND', ]; /** The result of check scanning. */ export class CheckScanningResult extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<CheckScanningResult>`} */ constructor(source = {}) { super(); /** Magnetic ink strip scanning status. Default is ERROR_NOTHING_FOUND */ this.status = 'ERROR_NOTHING_FOUND'; /** Crop of the check if documentDetectionMode is set to DETECT_AND_CROP_DOCUMENT. Will be non-empty, only if check recognition succeeded. */ this.croppedImage = null; this._released = false; if (source.status !== undefined) { this.status = source.status; } 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'); } if (source.documentDetectionResult !== undefined) { this.documentDetectionResult = source.documentDetectionResult != null ? new DocumentDetectionResult(source.documentDetectionResult) : null; } else { throw new Error('documentDetectionResult must be present in constructor argument'); } if (source.croppedImage !== undefined) { this.croppedImage = source.croppedImage != null ? ImageRef.From(source.croppedImage) : null; } } async serialize(config = new ToJsonConfiguration()) { return { status: this.status, check: this.check != null ? await this.check.serialize(config) : null, documentDetectionResult: this.documentDetectionResult != null ? this.documentDetectionResult.serialize(config) : null, croppedImage: config.serializeImages ? this.croppedImage != null ? await this.croppedImage.serialize(config.imageSerializationMode) : null : undefined, }; } release() { if (this._released) { return; } { if (this.check != null) { this.check.release(); } } { if (this.croppedImage != null) { this.croppedImage.release(); } } this._released = true; } async encodeImages() { if (this.check != null) { await this.check.encodeImages(); } if (this.croppedImage != null) { await this.croppedImage.encodeInPlace(); } } } /** Configuration of the check scanner. */ export class CheckScannerConfiguration extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<CheckScannerConfiguration>`} */ constructor(source = {}) { super(); /** Document detection to be performed in addition to scanning the machine-readable data in the check. By default only the machine-readable data is extracted during check scanning. Optionally, the coordinates and a crop of the entire check document can be returned, in addition to the check data. A check scan result may still be successful even if the whole document is not visible in the input image and the complete document could not be located. Default is DISABLED */ this.documentDetectionMode = 'DISABLED'; if (source.documentDetectionMode !== undefined) { this.documentDetectionMode = source.documentDetectionMode; } } serialize(config = new ToJsonConfiguration()) { return { documentDetectionMode: this.documentDetectionMode, }; } } //# sourceMappingURL=CheckScannerTypes.js.map