UNPKG

capacitor-plugin-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK for Capacitor

94 lines (93 loc) 2.91 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from rtu-ui-v2/schemas/barcode/BarcodeScannerUIResult.yaml import { BarcodeItem } from '../../barcode/BarcodeScannerTypes'; import { ToJsonConfiguration } from '../../utils/json/JsonSerializationTypes'; import { PartiallyConstructible } from '../../utils/utils'; /** Data about the scanned barcode. */ export class BarcodeScannerUiItem extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<BarcodeScannerUiItem>`} */ constructor(source = {}) { super(); this._released = false; if (source.barcode !== undefined) { this.barcode = new BarcodeItem(source.barcode); } else { throw new Error('barcode must be present in constructor argument'); } if (source.count !== undefined) { this.count = source.count; } else { throw new Error('count must be present in constructor argument'); } } async serialize(config = new ToJsonConfiguration()) { return { barcode: await this.barcode.serialize(config), count: this.count, }; } release() { if (this._released) { return; } this.barcode.release(); this._released = true; } async encodeImages() { await this.barcode.encodeImages(); } } /** Results of the barcode scan. */ export class BarcodeScannerUiResult extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<BarcodeScannerUiResult>`} */ constructor(source = {}) { super(); /** Selected zoom factor for the camera. Default is 1.0 */ this.selectedZoomFactor = 1.0; /** Scanned barcode items. */ this.items = []; this._released = false; if (source.selectedZoomFactor !== undefined) { this.selectedZoomFactor = source.selectedZoomFactor; } if (source.items !== undefined) { this.items = source.items.map((it) => { return new BarcodeScannerUiItem(it); }); } } async serialize(config = new ToJsonConfiguration()) { return { selectedZoomFactor: this.selectedZoomFactor, items: await Promise.all(this.items.map(async (it) => { return await it.serialize(config); })), }; } release() { if (this._released) { return; } this.items.forEach((it) => { it.release(); }); this._released = true; } async encodeImages() { await Promise.all(this.items.map(async (it) => { await it.encodeImages(); })); } } //# sourceMappingURL=BarcodeScannerUiResult.js.map