react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
163 lines (146 loc) • 5.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.VinScannerResult = exports.VinScannerConfiguration = exports.VinBarcodeResult = exports.VinBarcodeExtractionStatusValues = void 0;
var _TextPatternScannerTypes = require("../text_pattern_scanner/TextPatternScannerTypes");
var _JsonSerializationTypes = require("../utils/json/JsonSerializationTypes");
var _utils = require("../utils/utils");
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from core/schemas/VINScannerTypes.yaml
/**
Status of the barcode extraction.
- `SUCCESS`:
Barcode containing a VIN was successfully extracted.
- `BARCODE_WITHOUT_VIN`:
Barcode was found but it does not contain a VIN.
- `NO_BARCODE_FOUND`:
No barcode was found in the image.
- `BARCODE_EXTRACTION_DISABLED`:
Barcode extraction is disabled in the configuration.
*/
const VinBarcodeExtractionStatusValues = exports.VinBarcodeExtractionStatusValues = ['SUCCESS', 'BARCODE_WITHOUT_VIN', 'NO_BARCODE_FOUND', 'BARCODE_EXTRACTION_DISABLED'];
/**
Result of the barcode scanner.
*/
class VinBarcodeResult extends _utils.PartiallyConstructible {
/**
Text result of the barcode scanner.
*/
/**
Rectangle of the barcode in the image.
*/
/**
Status of the barcode extraction.
*/
/** @param source {@displayType `DeepPartial<VinBarcodeResult>`} */
constructor(source = {}) {
super();
if (source.extractedVIN !== undefined) {
this.extractedVIN = source.extractedVIN;
} else {
throw new Error('extractedVIN must be present in constructor argument');
}
if (source.rectangle !== undefined) {
this.rectangle = source.rectangle.map(it => {
return {
x: it.x,
y: it.y
};
});
} else {
throw new Error('rectangle must be present in constructor argument');
}
if (source.status !== undefined) {
this.status = source.status;
} else {
throw new Error('status must be present in constructor argument');
}
}
serialize(config = new _JsonSerializationTypes.ToJsonConfiguration()) {
return {
extractedVIN: this.extractedVIN,
rectangle: this.rectangle.map(it => {
return it;
}),
status: this.status
};
}
}
/**
Result of the VIN scanner.
*/
exports.VinBarcodeResult = VinBarcodeResult;
class VinScannerResult extends _utils.PartiallyConstructible {
/**
Text result of the VIN scanner.
*/
/**
Barcode result of the VIN scanner.
*/
/** @param source {@displayType `DeepPartial<VinScannerResult>`} */
constructor(source = {}) {
super();
if (source.textResult !== undefined) {
this.textResult = new _TextPatternScannerTypes.TextPatternScannerResult(source.textResult);
} else {
throw new Error('textResult must be present in constructor argument');
}
if (source.barcodeResult !== undefined) {
this.barcodeResult = new VinBarcodeResult(source.barcodeResult);
} else {
throw new Error('barcodeResult must be present in constructor argument');
}
}
serialize(config = new _JsonSerializationTypes.ToJsonConfiguration()) {
return {
textResult: this.textResult.serialize(config),
barcodeResult: this.barcodeResult.serialize(config)
};
}
}
/**
Configuration for the VIN scanner.
*/
exports.VinScannerResult = VinScannerResult;
class VinScannerConfiguration extends _utils.PartiallyConstructible {
/**
If true, the VIN scanner will also extract VINs from barcodes.
Requires a license that allows barcode scanning in addition to VIN scanning.
Default is false
*/
extractVINFromBarcode = false;
/**
Maximum image size (height or width) for OCR process. 0 - do not rescale.
Default is 0
*/
ocrResolutionLimit = 0;
/**
Maximum number of accumulated frames to inspect before actual result is returned.
Default is 3
*/
maximumNumberOfAccumulatedFrames = 3;
/**
Minimum number of accumulated frames that have equal result.
Default is 2
*/
minimumNumberOfRequiredFramesWithEqualScanningResult = 2;
/** @param source {@displayType `DeepPartial<VinScannerConfiguration>`} */
constructor(source = {}) {
super();
if (source.extractVINFromBarcode !== undefined) {
this.extractVINFromBarcode = source.extractVINFromBarcode;
}
if (source.ocrResolutionLimit !== undefined) {
this.ocrResolutionLimit = source.ocrResolutionLimit;
}
if (source.maximumNumberOfAccumulatedFrames !== undefined) {
this.maximumNumberOfAccumulatedFrames = source.maximumNumberOfAccumulatedFrames;
}
if (source.minimumNumberOfRequiredFramesWithEqualScanningResult !== undefined) {
this.minimumNumberOfRequiredFramesWithEqualScanningResult = source.minimumNumberOfRequiredFramesWithEqualScanningResult;
}
}
}
exports.VinScannerConfiguration = VinScannerConfiguration;
//# sourceMappingURL=VinScannerTypes.js.map