react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
94 lines (88 loc) • 2.37 kB
JavaScript
/// 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 {
/**
Scanned barcode.
*/
/**
Number of scanned barcodes of this symbology and value.
*/
/** @param source {@displayType `DeepPartial<BarcodeScannerUiItem>`} */
constructor(source = {}) {
super();
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
};
}
_released = false;
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 {
/**
Scanned barcode items.
*/
items = [];
/** @param source {@displayType `DeepPartial<BarcodeScannerUiResult>`} */
constructor(source = {}) {
super();
if (source.items !== undefined) {
this.items = source.items.map(it => {
return new BarcodeScannerUiItem(it);
});
}
}
async serialize(config = new ToJsonConfiguration()) {
return {
items: await Promise.all(this.items.map(async it => {
return await it.serialize(config);
}))
};
}
_released = false;
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