UNPKG

react-native-scanbot-sdk

Version:

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

638 lines (612 loc) 15.8 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/schemas/BarcodeTypes.yaml import { ToJsonConfiguration } from '../utils/json/JsonSerializationTypes'; import { DeepPartial, PartiallyConstructible } from '../utils/utils'; /** Enumerates character encodings. - `UNKNOWN`: Unknown encoding. - `ASCII`: ASCII (ISO 646). - `ISO_8859_PART1`: ISO/IEC 8859 Part 1, a.k.a. Latin-1 Western European. - `ISO_8859_PART2`: ISO/IEC 8859 Part 2, a.k.a. Latin-2 Central European. - `ISO_8859_PART3`: ISO/IEC 8859 Part 3, a.k.a. Latin-3 South European. - `ISO_8859_PART4`: ISO/IEC 8859 Part 4, a.k.a. Latin-4 North European. - `ISO_8859_PART5`: ISO/IEC 8859 Part 5, a.k.a. Latin/Cyrillic. - `ISO_8859_PART6`: ISO/IEC 8859 Part 6, a.k.a. Latin/Arabic. - `ISO_8859_PART7`: ISO/IEC 8859 Part 7, a.k.a. Latin/Greek. - `ISO_8859_PART8`: ISO/IEC 8859 Part 8, a.k.a. Latin/Hebrew. - `ISO_8859_PART9`: ISO/IEC 8859 Part 9, a.k.a. Latin-5 Turkish. - `ISO_8859_PART10`: ISO/IEC 8859 Part 10, a.k.a. Latin-6 Nordic. - `ISO_8859_PART11`: ISO/IEC 8859 Part 11, a.k.a. Latin/Thai. - `ISO_8859_PART13`: ISO/IEC 8859 Part 13, a.k.a. Latin-7 Baltic Rim. - `ISO_8859_PART14`: ISO/IEC 8859 Part 14, a.k.a. Latin-8 Celtic. - `ISO_8859_PART15`: ISO/IEC 8859 Part 15, a.k.a. Latin-9. - `ISO_8859_PART16`: ISO/IEC 8859 Part 16, a.k.a. Latin-10 South-Eastern European. - `CP_437`: CP437 (DOS Latin US). - `CP_1250`: Windows-1250 (Eastern European). - `CP_1251`: Windows-1251 (Cyrillic). - `CP_1252`: Windows-1252 (Western European). - `CP_1256`: Windows-1256 (Arabic). - `SHIFT_JIS`: Shift JIS (Japanese). - `BIG_5`: Big5 (Traditional Chinese). - `GB_2312`: GB2312 (Simplified Chinese). - `GB_18030`: GB18030 (Simplified Chinese). - `EUC_JP`: EUC-JP (Japanese). - `EUC_KR`: EUC-KR (Korean). - `UTF_16_BE`: UTF16BE (UTF-16 Big Endian), a.k.a. UnicodeBig. - `UTF_8`: UTF8 (UTF-8). - `UTF_16_LE`: UTF16LE (UTF-16 Little Endian). - `UTF_32_BE`: UTF32BE (UTF-32 Big Endian). - `UTF_32_LE`: UTF32LE (UTF-32 Little Endian). - `BINARY`: Binary data. */ export type CharacterEncoding = | 'UNKNOWN' | 'ASCII' | 'ISO_8859_PART1' | 'ISO_8859_PART2' | 'ISO_8859_PART3' | 'ISO_8859_PART4' | 'ISO_8859_PART5' | 'ISO_8859_PART6' | 'ISO_8859_PART7' | 'ISO_8859_PART8' | 'ISO_8859_PART9' | 'ISO_8859_PART10' | 'ISO_8859_PART11' | 'ISO_8859_PART13' | 'ISO_8859_PART14' | 'ISO_8859_PART15' | 'ISO_8859_PART16' | 'CP_437' | 'CP_1250' | 'CP_1251' | 'CP_1252' | 'CP_1256' | 'SHIFT_JIS' | 'BIG_5' | 'GB_2312' | 'GB_18030' | 'EUC_JP' | 'EUC_KR' | 'UTF_16_BE' | 'UTF_8' | 'UTF_16_LE' | 'UTF_32_BE' | 'UTF_32_LE' | 'BINARY'; export const CharacterEncodingValues: CharacterEncoding[] = [ 'UNKNOWN', 'ASCII', 'ISO_8859_PART1', 'ISO_8859_PART2', 'ISO_8859_PART3', 'ISO_8859_PART4', 'ISO_8859_PART5', 'ISO_8859_PART6', 'ISO_8859_PART7', 'ISO_8859_PART8', 'ISO_8859_PART9', 'ISO_8859_PART10', 'ISO_8859_PART11', 'ISO_8859_PART13', 'ISO_8859_PART14', 'ISO_8859_PART15', 'ISO_8859_PART16', 'CP_437', 'CP_1250', 'CP_1251', 'CP_1252', 'CP_1256', 'SHIFT_JIS', 'BIG_5', 'GB_2312', 'GB_18030', 'EUC_JP', 'EUC_KR', 'UTF_16_BE', 'UTF_8', 'UTF_16_LE', 'UTF_32_BE', 'UTF_32_LE', 'BINARY', ]; /** A character encoding for a given range of bytes. */ export class RangeEncoding extends PartiallyConstructible { /** Start index of the range. */ public readonly start: number; /** End index of the range (inclusive). */ public readonly end: number; /** Character encoding for the given range. */ public readonly encoding: CharacterEncoding; /** @param source {@displayType `DeepPartial<RangeEncoding>`} */ public constructor(source: DeepPartial<RangeEncoding> = {}) { super(); if (source.start !== undefined) { this.start = source.start; } else { throw new Error('start must be present in constructor argument'); } if (source.end !== undefined) { this.end = source.end; } else { throw new Error('end must be present in constructor argument'); } if (source.encoding !== undefined) { this.encoding = source.encoding; } else { throw new Error('encoding must be present in constructor argument'); } } public serialize( config: ToJsonConfiguration = new ToJsonConfiguration() ): DeepPartial<RangeEncoding> { return { start: this.start, end: this.end, encoding: this.encoding, }; } } /** The structured append mode can be used to split a message across multiple barcodes. */ export class StructuredAppendInfo extends PartiallyConstructible { /** The number of barcodes in the structured append set. */ public readonly count: number; /** The index of the barcode in the structured append set. */ public readonly index: number; /** The ID of the structured append set. */ public readonly id: string; /** @param source {@displayType `DeepPartial<StructuredAppendInfo>`} */ public constructor(source: DeepPartial<StructuredAppendInfo> = {}) { super(); if (source.count !== undefined) { this.count = source.count; } else { throw new Error('count must be present in constructor argument'); } if (source.index !== undefined) { this.index = source.index; } else { throw new Error('index must be present in constructor argument'); } if (source.id !== undefined) { this.id = source.id; } else { throw new Error('id must be present in constructor argument'); } } public serialize( config: ToJsonConfiguration = new ToJsonConfiguration() ): DeepPartial<StructuredAppendInfo> { return { count: this.count, index: this.index, id: this.id, }; } } /** Enumerates barcode formats. - `NONE`: Used as a return value if no valid barcode has been detected. - `AZTEC`: Aztec (2D). - `CODABAR`: CODABAR (1D). - `CODE_39`: Code 39 (1D). - `CODE_93`: Code 93 (1D). - `CODE_128`: Code 128 (1D). - `DATA_MATRIX`: Data Matrix (2D). - `EAN_8`: EAN-8 (1D). - `EAN_13`: EAN-13 (1D). - `ITF`: ITF (Interleaved Two of Five) (1D). - `MAXI_CODE`: MaxiCode (2D). - `PDF_417`: PDF417 (2D). - `QR_CODE`: QR Code (2D). - `DATABAR`: GS1 DataBar-14 (formerly RSS-14) (1D). - `DATABAR_EXPANDED`: GS1 DataBar Expanded (formerly RSS Expanded) (1D). - `UPC_A`: UPC-A (1D). - `UPC_E`: UPC-E (1D). - `MSI_PLESSEY`: MSI PLESSEY. - `IATA_2_OF_5`: IATA 2 of 5 (1D). - `INDUSTRIAL_2_OF_5`: INDUSTRIAL 2 of 5 (1D). - `CODE_25`: CODE 25 (1D). - `MICRO_QR_CODE`: Micro QR Code (2D). - `USPS_INTELLIGENT_MAIL`: USPS Intelligent Mail, a.k.a. USPS OneCode, USPS-STD-11. - `ROYAL_MAIL`: Royal Mail Four-State Customer Code, a.k.a. RM4SCC, CBC, BPO 4 State Code. - `JAPAN_POST`: Japan Post Four-State Barcode. - `ROYAL_TNT_POST`: Royal TNT Post Four-State Barcode, a.k.a. KIX, Klant IndeX. - `AUSTRALIA_POST`: Australia Post Four-State Customer Code. - `DATABAR_LIMITED`: GS1 DataBar Limited. - `MICRO_PDF_417`: Micro PDF417 (2D). - `GS1_COMPOSITE`: GS1 COMPOSITE (combined linear and 2D). - `RMQR_CODE`: Rectangular Micro QR Code (2D). - `CODE_11`: Code 11 (1D). - `CODE_32`: Code 32 (Italian Pharmacode) (1D). - `PHARMA_CODE`: Pharmacode, a.k.a. One-Track Pharmacode, Pharmaceutical Binary Code (1D). - `PHARMA_CODE_TWO_TRACK`: Two-Track Pharmacode, a.k.a. Pharmaceutical Binary Code. - `PZN_7`: PZN7, legacy PZN (Pharmazentralnummer), invalid since 01.01.2020 (1D). - `PZN_8`: PZN8, a.k.a. PZN, Pharmazentralnummer, German Pharmaceutical Central Number (1D). */ export type BarcodeFormat = | 'NONE' | 'AZTEC' | 'CODABAR' | 'CODE_39' | 'CODE_93' | 'CODE_128' | 'DATA_MATRIX' | 'EAN_8' | 'EAN_13' | 'ITF' | 'MAXI_CODE' | 'PDF_417' | 'QR_CODE' | 'DATABAR' | 'DATABAR_EXPANDED' | 'UPC_A' | 'UPC_E' | 'MSI_PLESSEY' | 'IATA_2_OF_5' | 'INDUSTRIAL_2_OF_5' | 'CODE_25' | 'MICRO_QR_CODE' | 'USPS_INTELLIGENT_MAIL' | 'ROYAL_MAIL' | 'JAPAN_POST' | 'ROYAL_TNT_POST' | 'AUSTRALIA_POST' | 'DATABAR_LIMITED' | 'MICRO_PDF_417' | 'GS1_COMPOSITE' | 'RMQR_CODE' | 'CODE_11' | 'CODE_32' | 'PHARMA_CODE' | 'PHARMA_CODE_TWO_TRACK' | 'PZN_7' | 'PZN_8'; export const BarcodeFormatValues: BarcodeFormat[] = [ 'NONE', 'AZTEC', 'CODABAR', 'CODE_39', 'CODE_93', 'CODE_128', 'DATA_MATRIX', 'EAN_8', 'EAN_13', 'ITF', 'MAXI_CODE', 'PDF_417', 'QR_CODE', 'DATABAR', 'DATABAR_EXPANDED', 'UPC_A', 'UPC_E', 'MSI_PLESSEY', 'IATA_2_OF_5', 'INDUSTRIAL_2_OF_5', 'CODE_25', 'MICRO_QR_CODE', 'USPS_INTELLIGENT_MAIL', 'ROYAL_MAIL', 'JAPAN_POST', 'ROYAL_TNT_POST', 'AUSTRALIA_POST', 'DATABAR_LIMITED', 'MICRO_PDF_417', 'GS1_COMPOSITE', 'RMQR_CODE', 'CODE_11', 'CODE_32', 'PHARMA_CODE', 'PHARMA_CODE_TWO_TRACK', 'PZN_7', 'PZN_8', ]; /** Lists of barcode formats to decode. */ export class BarcodeFormats extends PartiallyConstructible { /** @param source {@displayType `DeepPartial<BarcodeFormats>`} */ public constructor(source: DeepPartial<BarcodeFormats> = {}) { super(); } public serialize( config: ToJsonConfiguration = new ToJsonConfiguration() ): DeepPartial<BarcodeFormats> { return {}; } } export namespace BarcodeFormats { /** List of 1D barcode formats. */ export const oned: BarcodeFormat[] = [ 'CODABAR', 'CODE_11', 'CODE_25', 'CODE_32', 'CODE_39', 'CODE_93', 'CODE_128', 'DATABAR', 'DATABAR_EXPANDED', 'DATABAR_LIMITED', 'EAN_8', 'EAN_13', 'IATA_2_OF_5', 'INDUSTRIAL_2_OF_5', 'ITF', 'MSI_PLESSEY', 'PHARMA_CODE', 'PZN_7', 'PZN_8', 'UPC_A', 'UPC_E', ]; /** List of 2D barcode formats. */ export const twod: BarcodeFormat[] = [ 'AZTEC', 'DATA_MATRIX', 'MAXI_CODE', 'MICRO_QR_CODE', 'MICRO_PDF_417', 'PDF_417', 'QR_CODE', 'RMQR_CODE', ]; /** List of postal barcode formats. */ export const postal: BarcodeFormat[] = [ 'AUSTRALIA_POST', 'JAPAN_POST', 'ROYAL_MAIL', 'ROYAL_TNT_POST', 'USPS_INTELLIGENT_MAIL', ]; /** List of pharmaceutical barcode formats. */ export const pharma: BarcodeFormat[] = [ 'CODE_32', 'PHARMA_CODE', 'PHARMA_CODE_TWO_TRACK', 'PZN_7', 'PZN_8', ]; /** List of common barcode formats. */ export const common: BarcodeFormat[] = [ 'AZTEC', 'CODABAR', 'CODE_39', 'CODE_93', 'CODE_128', 'DATA_MATRIX', 'DATABAR', 'DATABAR_EXPANDED', 'DATABAR_LIMITED', 'EAN_13', 'EAN_8', 'ITF', 'MICRO_QR_CODE', 'PDF_417', 'QR_CODE', 'UPC_A', 'UPC_E', ]; /** List of all barcode formats. */ export const all: BarcodeFormat[] = [ 'AUSTRALIA_POST', 'AZTEC', 'CODABAR', 'CODE_11', 'CODE_25', 'CODE_32', 'CODE_39', 'CODE_93', 'CODE_128', 'DATA_MATRIX', 'DATABAR', 'DATABAR_EXPANDED', 'DATABAR_LIMITED', 'EAN_13', 'EAN_8', 'GS1_COMPOSITE', 'IATA_2_OF_5', 'INDUSTRIAL_2_OF_5', 'ITF', 'JAPAN_POST', 'MAXI_CODE', 'MICRO_PDF_417', 'MICRO_QR_CODE', 'MSI_PLESSEY', 'PDF_417', 'PHARMA_CODE', 'PHARMA_CODE_TWO_TRACK', 'PZN_7', 'PZN_8', 'QR_CODE', 'RMQR_CODE', 'ROYAL_MAIL', 'ROYAL_TNT_POST', 'UPC_A', 'UPC_E', 'USPS_INTELLIGENT_MAIL', ]; } /** GS1 message handling options. The GS1 standard defines a key-value format for business-centric data that can be encoded into many 1D and 2D barcode types. https://ref.gs1.org/standards/genspecs/ GS1 messages have two representations or formats: a human-readable format and a machine-readable format. The human-readable format uses parentheses to wrap the keys in each pair. For example, the string "(01)012345678901(37)02(3922)00278" contains three AI keys: 01, 37, and 3922. The corresponding values are 012345678901, 02, and 00278. The machine-readable format uses the special ASCII \x1D character to terminate key-value pairs in the string in cases where the given key implies that the value is variable-length. The equivalent machine-readable string for the above example is "010123456789013702\x1D392200278". In the above example, the 01 AI key is fixed-length, so the \x1D character is not necessary. The 37 AI keys is variable-length, so the \x1D character is necessary after the value in the pair. The 3922 AI key is also variable-length, but it is the last pair in the message, so the \x1D character is not necessary at the end. The character \x1D is UNPRINTABLE - this means that if you try to print or otherwise visualize a GS1 message containing the \x1D character, you may see a number of different results, depending on how the system handles unprintable characters. You may see a question mark, a box, an escape sequence, a space or nothing at all. - `PARSE`: This is the default. GS1 messages are converted to the machine-readable format per the GS1 spec (the special FNC1 character is converted to ASCII \x1D). The implied 01 AI key is prepended to DataBar results. No validation is performed. - `VALIDATE_STRUCTURE`: Same as PARSE. Additionally, messages containing unknown AI keys, or containing values that don't fulfill the length, character set or regex requirements for known keys, are rejected. - `DECODE_STRUCTURE`: Same as VALIDATE_STRUCTURE. Additionally, GS1 strings are converted to the human-readable format, instead (with parentheses used to wrap AI keys, e.g. "(01)123456789"). The \x1D character is never used in this representation. - `VALIDATE_FULL`: Includes all validations from VALIDATE_STRUCTURE. Additionally, GS1 messages which have missing or incompatible combinations of AI keys are rejected. Additionally, values are checked against a list of known linting rules, e.g. checksums are calculated and verified, dates are checked for validity, etc. Results that fail any of the linter rules are rejected. The complete set of linter rules from the GS1 Syntax Dictionary are implemented. - `DECODE_FULL`: Combines the validations of VALIDATE_FULL and the human-readable output format of DECODE_STRUCTURE. */ export type Gs1Handling = | 'PARSE' | 'VALIDATE_STRUCTURE' | 'DECODE_STRUCTURE' | 'VALIDATE_FULL' | 'DECODE_FULL'; export const Gs1HandlingValues: Gs1Handling[] = [ 'PARSE', 'VALIDATE_STRUCTURE', 'DECODE_STRUCTURE', 'VALIDATE_FULL', 'DECODE_FULL', ]; /** Behavior when scanning UPC/EAN barcodes with EAN-2 or EAN-5 extensions. - `REQUIRE_2`: Only barcodes with a 2-digit extension are accepted. - `REQUIRE_5`: Only barcodes with a 5-digit extension are accepted. - `REQUIRE_ANY`: Only barcodes with either a 2-digit or a 5-digit extension are accepted. - `IGNORE`: Always ignore the extension. - `ALLOW_2`: Return detected 2-digit extension if present, but do not require it. Ignore the 5-digit extension. - `ALLOW_5`: Return detected 5-digit extension if present, but do not require it. Ignore the 2-digit extension. - `ALLOW_ANY`: Return any detected extension if present, but do not require it. */ export type UpcEanExtensionBehavior = | 'REQUIRE_2' | 'REQUIRE_5' | 'REQUIRE_ANY' | 'IGNORE' | 'ALLOW_2' | 'ALLOW_5' | 'ALLOW_ANY'; export const UpcEanExtensionBehaviorValues: UpcEanExtensionBehavior[] = [ 'REQUIRE_2', 'REQUIRE_5', 'REQUIRE_ANY', 'IGNORE', 'ALLOW_2', 'ALLOW_5', 'ALLOW_ANY', ];