UNPKG

react-native-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS

66 lines (58 loc) 1.89 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from rtu-ui-v2/schemas/mrz/MRZScannerUIResult.yaml import { GenericDocument } from '../../documents/GenericDocument'; import { ToJsonConfiguration } from '../../utils/json/JsonSerializationTypes'; import { DeepPartial, PartiallyConstructible } from '../../utils/utils'; /** Configuration of the MRZ RTU UI result. */ export class MrzScannerUiResult extends PartiallyConstructible { /** Raw string value of MRZ. */ public readonly rawMRZ: string; /** Generic document containing MRZ data. */ public readonly mrzDocument: GenericDocument | null; /** @param source {@displayType `DeepPartial<MrzScannerUiResult>`} */ public constructor(source: DeepPartial<MrzScannerUiResult> = {}) { super(); if (source.rawMRZ !== undefined) { this.rawMRZ = source.rawMRZ; } else { throw new Error('rawMRZ must be present in constructor argument'); } if (source.mrzDocument !== undefined) { this.mrzDocument = source.mrzDocument != null ? new GenericDocument(source.mrzDocument) : null; } else { throw new Error('mrzDocument must be present in constructor argument'); } } public async serialize( config: ToJsonConfiguration = new ToJsonConfiguration() ): Promise<DeepPartial<MrzScannerUiResult>> { return { rawMRZ: this.rawMRZ, mrzDocument: this.mrzDocument != null ? await this.mrzDocument.serialize(config) : null, }; } private _released: Boolean = false; public release() { if (this._released) { return; } { if (this.mrzDocument != null) { this.mrzDocument.release(); } } this._released = true; } public async encodeImages(): Promise<void> { if (this.mrzDocument != null) { await this.mrzDocument.encodeImages(); } } }