UNPKG

react-native-scanbot-sdk

Version:

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

122 lines (111 loc) 3.62 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/schemas/VINScannerTypes.yaml import { TextPatternScannerResult } from '../text_pattern_scanner/TextPatternScannerTypes'; import { ToJsonConfiguration } from '../utils/json/JsonSerializationTypes'; import { DeepPartial, PartiallyConstructible, Point } from '../utils/utils'; /** 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. */ export type VinBarcodeExtractionStatus = | 'SUCCESS' | 'BARCODE_WITHOUT_VIN' | 'NO_BARCODE_FOUND' | 'BARCODE_EXTRACTION_DISABLED'; export const VinBarcodeExtractionStatusValues: VinBarcodeExtractionStatus[] = [ 'SUCCESS', 'BARCODE_WITHOUT_VIN', 'NO_BARCODE_FOUND', 'BARCODE_EXTRACTION_DISABLED', ]; /** Result of the barcode scanner. */ export class VinBarcodeResult extends PartiallyConstructible { /** Text result of the barcode scanner. */ public readonly extractedVIN: string; /** Rectangle of the barcode in the image. */ public readonly rectangle: Point[]; /** Status of the barcode extraction. */ public readonly status: VinBarcodeExtractionStatus; /** @param source {@displayType `DeepPartial<VinBarcodeResult>`} */ public constructor(source: DeepPartial<VinBarcodeResult> = {}) { 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: any) => { 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'); } } public serialize( config: ToJsonConfiguration = new ToJsonConfiguration() ): DeepPartial<VinBarcodeResult> { return { extractedVIN: this.extractedVIN, rectangle: this.rectangle.map((it: any) => { return it; }), status: this.status, }; } } /** Result of the VIN scanner. */ export class VinScannerResult extends PartiallyConstructible { /** Text result of the VIN scanner. */ public readonly textResult: TextPatternScannerResult; /** Barcode result of the VIN scanner. */ public readonly barcodeResult: VinBarcodeResult; /** @param source {@displayType `DeepPartial<VinScannerResult>`} */ public constructor(source: DeepPartial<VinScannerResult> = {}) { super(); if (source.textResult !== undefined) { this.textResult = new 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'); } } public serialize( config: ToJsonConfiguration = new ToJsonConfiguration() ): DeepPartial<VinScannerResult> { return { textResult: this.textResult.serialize(config), barcodeResult: this.barcodeResult.serialize(config), }; } }