featherbone-shipengine
Version:
Forked and patched version of the official ShipEngine JavaScript SDK for Node.js
98 lines (97 loc) • 4.25 kB
TypeScript
import { ValidationMessageCode, ValidationMessageType } from "../../constants";
export declare type Result = AddressValidationResult[];
/**
* An input address to be validated.
*/
interface Address {
/**
* The first line of the address.
*/
addressLine1: string;
/**
* The second line of the address.
*/
addressLine2: string | null;
/**
* The third line of the address.
*/
addressLine3: string | null;
/**
* The ISO 3166 country code
*
* @see https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
*/
countryCode: Country;
/**
* The name of the sender or recipient at the address, if applicable.
*/
name: string;
/**
* The company name, if this is a business address.
*/
companyName: string | null;
/**
* The phone number associated with this address, if any.
*/
phone: string;
/**
* The city or locality
*/
cityLocality: string;
/**
* The state or province
*/
stateProvince: string;
/**
* The postal code
*/
postalCode: string;
/**
* Indicates whether the address is residential or commercial, if known.
*/
addressResidentialIndicator: "unknown" | "yes" | "no";
}
/**
* The result of validating an address, whether it's valid or not.
*/
interface AddressValidationResult {
/**
* Indicates whether the address has been verified
*/
status: "unverified" | "verified" | "warning" | "error";
/**
* The address given to be validated
*/
originalAddress: Address;
/**
* The normalized form of the address. This will only be populated if the
* address was valid (i.e. `isValid` is `true`).
*
* Addresses are normalized according to the normalization rules of the
* country they're in.
*/
normalizedAddress: Address | null;
/**
* Messages about the address validation, such as corrections or invalid fields.
*/
messages: AddressValidationMessage[];
}
/**
* A message about the address validation, such as a correction or an invalid field.
*/
interface AddressValidationMessage {
/**
* Indicates whether this message is just informational, or a warning/error.
*/
type: ValidationMessageType;
/**
* Indicates the specific validation message that was returned.
*/
detailCode: ValidationMessageCode;
/**
* The human-readable message.
*/
message: string;
}
declare type Country = "AF" | "AX" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AI" | "AQ" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BM" | "BT" | "BO" | "BA" | "BW" | "BV" | "BR" | "IO" | "BN" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "KY" | "CF" | "TD" | "CL" | "CN" | "CX" | "CC" | "CO" | "KM" | "CG" | "CD" | "CK" | "CR" | "CI" | "HR" | "CU" | "CY" | "CZ" | "DK" | "DJ" | "DM" | "DO" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FK" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "TF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GI" | "GR" | "GL" | "GD" | "GP" | "GU" | "GT" | "GG" | "GN" | "GW" | "GY" | "HT" | "HM" | "VA" | "HN" | "HK" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "KR" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LY" | "LI" | "LT" | "LU" | "MO" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MH" | "MQ" | "MR" | "MU" | "YT" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "MM" | "NA" | "NR" | "NP" | "NL" | "NC" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "MP" | "NO" | "OM" | "PK" | "PW" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PN" | "PL" | "PT" | "PR" | "QA" | "RE" | "RO" | "RU" | "RW" | "BL" | "SH" | "KN" | "LC" | "MF" | "PM" | "VC" | "WS" | "SM" | "ST" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SK" | "SI" | "SB" | "SO" | "ZA" | "GS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "SY" | "TW" | "TJ" | "TZ" | "TH" | "TL" | "TG" | "TK" | "TO" | "TT" | "TN" | "TR" | "TM" | "TC" | "TV" | "UG" | "UA" | "AE" | "GB" | "US" | "UM" | "UY" | "UZ" | "VU" | "VE" | "VN" | "VG" | "VI" | "WF" | "EH" | "YE" | "ZM" | "ZW";
export {};