Rules
interface Rules {
country: Named;
lang: Lang;
curated: boolean;
version: string;
currency?: string;
region?: RegionName;
address: AddressSource;
fields: Partial<Record<FieldName, Field>>;
}One country's rules in one language. CountryResponse is this, with the state options when they are asked for.
Properties
country: Named
The country, named in lang. A code with no country behind it keeps its code and gets the default layout, never a 404.
lang: Lang
The language every label, message and placeholder is in.
curated: boolean
true when the country has a layout of its own. false for the default layout, where the postcode and state are optional and no value is checked against a pattern.
version: string
The data version: the same string GET /v1/version reports. It changes whenever any rule or text does, so a client that keeps rules keys them on it.
currency: string
The ISO 4217 currency in circulation in the country. A reading of where a visitor is, not what to charge them.
region: RegionName
The country's UN M49 region and subregion, named in lang.
address: AddressSource
The address: how it is typed in (layout, fixed), how it is written for reading (format, format_latin, upper), and a real one to preview both with (example).
fields: Partial<Record<FieldName, Field>>
Every field in address.layout, and the email, keyed by name.