/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from xplatforms/schemas/document_scanner/OCREngineResult.yaml import { ToJsonConfiguration } from '../core/common/JsonSerializationTypes'; import { OcrPage } from '../core/ocr/OcrTypes'; import { DeepPartial } from '../core/utils/utils'; /** OCR configurations result. */ export class OcrConfigsResult { /** The OCR languages data path. */ public readonly languageDataPath: string; /** The list of installed OCR languages. */ public readonly installedLanguages: string[]; /** @param source {@displayType `DeepPartial`} */ public constructor(source: DeepPartial = {}) { if (source.languageDataPath !== undefined) { this.languageDataPath = source.languageDataPath; } else { throw new Error('languageDataPath must be present in constructor argument'); } if (source.installedLanguages !== undefined) { this.installedLanguages = source.installedLanguages.map((it: DeepPartial) => { return it; }); } else { throw new Error('installedLanguages must be present in constructor argument'); } } public serialize( config: ToJsonConfiguration = new ToJsonConfiguration() ): DeepPartial { return { languageDataPath: this.languageDataPath, installedLanguages: this.installedLanguages.map((it: any) => { return it; }), }; } } /** The result of OCR recognition. */ export class PerformOcrResult { /** The OCR result as plain text. */ public readonly recognizedText: string; /** The array of recognized OCR pages. */ public readonly pages: OcrPage[]; /** @param source {@displayType `DeepPartial`} */ public constructor(source: DeepPartial = {}) { if (source.recognizedText !== undefined) { this.recognizedText = source.recognizedText; } else { throw new Error('recognizedText must be present in constructor argument'); } if (source.pages !== undefined) { this.pages = source.pages.map((it: DeepPartial) => { return new OcrPage(it); }); } else { throw new Error('pages must be present in constructor argument'); } } public serialize( config: ToJsonConfiguration = new ToJsonConfiguration() ): DeepPartial { return { recognizedText: this.recognizedText, pages: this.pages.map((it: any) => { return it.serialize(config); }), }; } }