@@ -147,13 +147,45 @@ export interface QrcodeResultDebugData {
147147 decoderName ?: string ;
148148}
149149
150+ /** types of metadata that can exist in a result */
151+ export enum ResultMetadataType {
152+ OTHER = 0 ,
153+ ORIENTATION = 1 ,
154+ BYTE_SEGMENTS = 2 ,
155+ ERROR_CORRECTION_LEVEL = 3 ,
156+ ISSUE_NUMBER = 4 ,
157+ SUGGESTED_PRICE = 5 ,
158+ POSSIBLE_COUNTRY = 6 ,
159+ UPC_EAN_EXTENSION = 7 ,
160+ PDF417_EXTRA_METADATA = 8 ,
161+ STRUCTURED_APPEND_SEQUENCE = 9 ,
162+ STRUCTURED_APPEND_PARITY = 10
163+ }
164+
165+ /** metadata for a result, basically a `Map` but with specific key/value pairs */
166+ export interface ResultMetadata {
167+ get ( key : ResultMetadataType . OTHER ) : unknown | undefined ;
168+ get ( key : ResultMetadataType . ORIENTATION ) : number | undefined ;
169+ get ( key : ResultMetadataType . BYTE_SEGMENTS ) : Uint8Array [ ] | undefined ;
170+ get ( key : ResultMetadataType . ERROR_CORRECTION_LEVEL ) : unknown ;
171+ get ( key : ResultMetadataType . ISSUE_NUMBER ) : number | undefined ;
172+ get ( key : ResultMetadataType . SUGGESTED_PRICE ) : string | undefined ;
173+ get ( key : ResultMetadataType . POSSIBLE_COUNTRY ) : string | undefined ;
174+ get ( key : ResultMetadataType . UPC_EAN_EXTENSION ) : unknown | undefined ;
175+ get ( key : ResultMetadataType . PDF417_EXTRA_METADATA ) : unknown | undefined ;
176+ get ( key : ResultMetadataType . STRUCTURED_APPEND_SEQUENCE ) : unknown | undefined ;
177+ get ( key : ResultMetadataType . STRUCTURED_APPEND_PARITY ) : unknown | undefined ;
178+ }
179+
150180/**
151181 * Detailed scan result.
152182 */
153183export interface QrcodeResult {
154184 /** Decoded text. */
155185 text : string ;
156186
187+ metadata ?: ResultMetadata ;
188+
157189 /** Format that was successfully scanned. */
158190 format ?: QrcodeResultFormat ,
159191
0 commit comments