repox-countries
Version:
Provides up-to-date country, state, city, language, currency, phone code, and postal code data, sourced daily from the GeoNames API. Integrate easily into forms or use for data verification. Updated versions are released when changes occur.
109 lines (108 loc) • 2.2 kB
TypeScript
/**
* Base interface for common properties across Country, State, and City.
*/
export interface Option {
id: number;
code: string;
name: string;
nativeName: string;
emoji?: string;
}
/**
* Represents a country with geographic and demographic details.
*/
export interface Country extends Option {
id: number;
name: string;
nativeName: string;
code: string;
isoAlpha3: string;
continent: string;
continentName: string;
phoneCode: string;
postalCodeFormat: string;
currencyCode: string;
currencyName: string;
currencySymbol: string;
capital: string;
languages: string;
emoji: string;
}
/**
* Represents a state/province within a country.
*/
export interface State extends Option {
id: number;
name: string;
nativeName: string;
code: string;
internalCode: string;
countryId: number;
countryCode: string;
latitude: number;
longitude: number;
}
/**
* Represents a city or district within a state.
*/
export interface City extends Option {
id: number;
name: string;
nativeName: string;
code: string;
countryId: number;
countryCode: string;
stateCode: string;
latitude: number;
longitude: number;
}
/**
* Represents a mapping of a country to its states.
*/
export interface CountryState {
countryId: number;
countryCode: string;
states: State[];
}
/**
* Represents a mapping of a state to its cities.
*/
export interface StateCity {
stateId: number;
stateCode: string;
countryCode: string;
cities: City[];
}
/**
* Represents a mapping of a country to its states and cities.
*/
export interface CountryStateCity {
countryId: number;
countryCode: string;
states: StateCity[];
}
/**
* Represents international dialing codes.
*/
export interface PhoneCode {
countryCode: string;
phoneCode: string;
emoji: string;
}
/**
* Represents currency details.
*/
export interface Currency {
countryCode: string;
code: string;
name: string;
symbol: string;
}
/**
* Represents language details.
*/
export interface Language {
code: string;
name: string;
native: string;
}