parse

fun parse(uri: String, permitZeroSuppressedGtin: Boolean = false): Gs1Message(source)

Parses a GS1 Digital Link URI into a Gs1Message (path elements first, then query parameters).

Accepts an optional ]Q1 symbology identifier prefix as sent by barcode readers. Query parameters that are not AIs (e.g. ?utm_source=x) are ignored; the fragment is ignored.

Parameters

permitZeroSuppressedGtin

accept a GTIN-8, GTIN-12 or GTIN-13 for AI (01) and pad it to 14 digits (legacy URIs; the standard requires 14 digits).

Throws

if the URI is not a valid GS1 Digital Link URI or the data is invalid.