UNPKG

react-native-scanbot-sdk

Version:

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

83 lines (78 loc) 2.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DocumentDataExtractorUiResult = void 0; var _GenericDocument = require("../../documents/GenericDocument"); var _image = require("../../imageRef/image"); var _JsonSerializationTypes = require("../../utils/json/JsonSerializationTypes"); var _utils = require("../../utils/utils"); /// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from rtu-ui-v2/schemas/documentdataextractor/DocumentDataExtractorUIResult.yaml /** Configuration of the generic text scanner RTU UI result. */ class DocumentDataExtractorUiResult extends _utils.PartiallyConstructible { /** The status of the generic text recognition step. */ /** Generic document containing text data. Not present, if status is FAIL. */ /** Crop of the document if it was detected. */ /** @param source {@displayType `DeepPartial<DocumentDataExtractorUiResult>`} */ constructor(source = {}) { super(); if (source.recognitionStatus !== undefined) { this.recognitionStatus = source.recognitionStatus; } else { throw new Error('recognitionStatus must be present in constructor argument'); } if (source.document !== undefined) { this.document = source.document != null ? new _GenericDocument.GenericDocument(source.document) : null; } else { throw new Error('document must be present in constructor argument'); } if (source.croppedImage !== undefined) { this.croppedImage = source.croppedImage != null ? _image.ImageRef.From(source.croppedImage) : null; } else { throw new Error('croppedImage must be present in constructor argument'); } } async serialize(config = new _JsonSerializationTypes.ToJsonConfiguration()) { return { recognitionStatus: this.recognitionStatus, document: this.document != null ? await this.document.serialize(config) : null, croppedImage: config.serializeImages ? this.croppedImage != null ? await this.croppedImage.serialize(config.imageSerializationMode) : null : undefined }; } _released = false; release() { if (this._released) { return; } { if (this.document != null) { this.document.release(); } } { if (this.croppedImage != null) { this.croppedImage.release(); } } this._released = true; } async encodeImages() { if (this.document != null) { await this.document.encodeImages(); } if (this.croppedImage != null) { await this.croppedImage.encodeInPlace(); } } } exports.DocumentDataExtractorUiResult = DocumentDataExtractorUiResult; //# sourceMappingURL=DocumentDataExtractorUIResult.js.map