### Install CountriesAtlas using npm Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Install the CountriesAtlas library using npm. This command should be run in your project's terminal. ```bash npm install @amplifiedhq/countries-atlas ``` -------------------------------- ### Nuxt.js Setup for Countries Atlas Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Configure Nuxt.js to transpile the @amplifiedhq/countries-atlas package. This setup helps avoid CommonJS Dynamic Require Errors in Nuxt.js projects. ```javascript export default defineNuxtConfig({ build: { transpile: ['@amplifiedhq/countries-atlas'], } } ``` -------------------------------- ### Vite.js Setup for Countries Atlas Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Configure Vite.js to handle CommonJS modules from the countries-atlas package by installing and configuring `@rollup/plugin-commonjs`. This is necessary to avoid CommonJS Dynamic Require Errors. ```bash npm install @rollup/plugin-commonjs ``` ```javascript import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import commonjs from '@rollup/plugin-commonjs'; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), commonjs({ dynamicRequireTargets: [ // include using a glob pattern (either a string or an array of strings) 'node_modules/@amplifiedhq/countries-atlas/dist/data/**/*.json', ] }), ], }) ``` -------------------------------- ### Install Patch Version for Vite/Nuxt Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md If Vite.js or Nuxt.js issues persist, install a specific patch version of the library that uses static imports. Note that this version may not have the latest features and might consume more memory. ```bash npm install @amplifiedhq/countries-atlas@1.4.13 ``` -------------------------------- ### Get All Flags Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve all available country flags. ```javascript CountryAtlas.getFlags() ``` -------------------------------- ### Get All Timezones Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve a comprehensive list of all available timezones. ```javascript CountryAtlas.getTimezones() ``` -------------------------------- ### Get Currency by ISO2 Code Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Fetch currency details for a given country using its ISO2 code. The result includes the currency code and its symbol. ```javascript CountryAtlas.currency('US') ``` -------------------------------- ### Get Currencies Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve all available currency information. This method is intended to provide comprehensive currency data. ```APIDOC ## Get Currencies ### Description Retrieves a list of all available currencies, including their ISO codes, names, and symbols. Flags will be added to the currency information in future updates. ### Method `CountryAtlas.getCurrencies()` ### Note This method is intended to provide comprehensive currency data, and flags will be added in future updates. ``` -------------------------------- ### Get All States for a Country Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve a list of all states belonging to a specific country, identified by its ISO2 code. ```javascript CountryAtlas.states('US') ``` -------------------------------- ### Get All Currencies Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve all available currency information. This method internally uses CountryAtlas.getCountries with selected properties. ```javascript CountryAtlas.getCurrencies() ``` -------------------------------- ### Get Timezones Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve all timezones or get timezones associated with a specific country using its ISO2 code. ```APIDOC ## Get Timezones ### Description Retrieves a list of all available timezones or specific timezones associated with a given country using its ISO2 code. ### Method `CountryAtlas.getTimezones()` `CountryAtlas.timezone(iso2Code)` ### Parameters #### `timezone` - **iso2Code** (string) - Required - The ISO2 code of the country for which to retrieve timezones. ``` -------------------------------- ### Get Calling Codes Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve all calling codes or get the calling code for a specific country using its ISO2 code. Flags will be added to calling code information. ```APIDOC ## Get Calling Codes ### Description Retrieves a list of all calling codes or the calling code associated with a specific country using its ISO2 code. Flags will be added to the calling code information in future updates. ### Method `CountryAtlas.getCallingCodes()` `CountryAtlas.callingCode(iso2Code)` ### Parameters #### `callingCode` - **iso2Code** (string) - Required - The ISO2 code of the country for which to retrieve the calling code. ### Note Flags will be added to the calling codes in future updates. ``` -------------------------------- ### Get Timezones by ISO2 Code Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Fetch the timezone information for a specific country using its ISO2 code. ```javascript CountryAtlas.timezone('US') ``` -------------------------------- ### Get Calling Code by ISO2 Code Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Fetch the calling code for a specific country using its ISO2 code. ```javascript CountryAtlas.callingCode('US') ``` -------------------------------- ### Find State by Code and Access Properties Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Get a specific state by its country's ISO2 code and the state's code. Properties like name, latitude, longitude, and cities can be accessed directly. ```javascript CountryAtlas.state('US', 'NY') ``` ```javascript CountryAtlas.state('US', 'NY').name ``` ```javascript CountryAtlas.state('US', 'NY').latitude ``` ```javascript CountryAtlas.state('US', 'NY').longitude ``` ```javascript CountryAtlas.state('US', 'NY').cities ``` -------------------------------- ### Get Countries Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve a list of all countries or find specific countries by ISO codes. You can also select specific properties to be returned. ```APIDOC ## Get Countries ### Description Retrieves a list of all countries or allows finding a specific country using its ISO2 or ISO3 code. It also supports selecting specific properties for the returned country objects. ### Method `CountryAtlas.getCountries([properties])` `CountryAtlas.find(codeType, code)` ### Parameters #### `getCountries` - **properties** (Array) - Optional - An array of strings specifying which properties to include in the returned country objects. #### `find` - **codeType** (string) - Required - The type of code to search by. Accepted values: 'iso2', 'iso3'. - **code** (string) - Required - The country code to search for. ### Method Chaining It is possible to chain methods to directly access specific properties of a found country. #### Example - `CountryAtlas.find('iso2', 'US').name` - `CountryAtlas.find('iso2', 'US').capital` - `CountryAtlas.find('iso2', 'US').currency` ``` -------------------------------- ### Get All Calling Codes Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve a list of all international calling codes. Flags will be appended to the calling code data. ```javascript CountryAtlas.getCallingCodes() ``` -------------------------------- ### Get Currency Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve currency information for a specific country using its ISO2 code. Also supports finding countries associated with a specific currency. ```APIDOC ## Get Currency ### Description Retrieves currency details for a given country using its ISO2 code. It can also be used to find countries that use a specific currency, with options to select returned properties. ### Method `CountryAtlas.currency(iso2Code)` `CountryAtlas.getCountriesWithCurrency(currencyCode, [properties])` ### Parameters #### `currency` - **iso2Code** (string) - Required - The ISO2 code of the country. #### `getCountriesWithCurrency` - **currencyCode** (string) - Required - The currency code (e.g., 'USD'). - **properties** (Array) - Optional - An array of strings specifying which properties to include in the returned country objects (e.g., ['iso2', 'iso3']). ### Response Example for `currency('US')` ```json { "currency": "usd", "currency_symbol": "$" } ``` ### Response Example for `getCountriesWithCurrency('USD')` ```json [ { "iso2": "US", "iso3": "USA", "currency": "usd", "currency_symbol": "$" } ] ``` ### Response Example for `getCountriesWithCurrency('USD', ['iso2', 'iso3'])` ```json [ { "iso2": "US", "iso3": "USA" } ] ``` ``` -------------------------------- ### Get Countries with Specific Currency Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Find countries that use a specified currency. You can optionally select which properties to return for each country. ```javascript CountryAtlas.getCountriesWithCurrency('USD') ``` ```javascript CountryAtlas.getCountriesWithCurrency('USD', ['iso2', 'iso3']) ``` -------------------------------- ### Get All Countries Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Retrieve an array containing all countries in the world. Each country object has extensive properties. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const countries = CountriesAtlas.getCountries() //[ // { // "code": "AD", // "name": "Andorra", // "native": "Andorra", // "phone": 376, // "continent": "Europe", // "capital": "Andorra la Vella", // "currency": "EUR", // "languages": "ca", // "iso3": "AND", // "iso2": "AD", // "currency_symbol": "€", // "region": "Europe", // "subregion": "Southern Europe", // "timezones": [ // { // "zoneName": "Europe/Andorra", // "gmtOffset": 3600, // "gmtOffsetName": "UTC+01:00", // "abbreviation": "CET", // "tzName": "Central European Time" // } // ], // "translations": { // "kr": "안도라", // "br": "Andorra", // "pt": "Andorra", // "nl": "Andorra", // "hr": "Andora", // "fa": "آندورا", // "de": "Andorra", // "es": "Andorra", // "fr": "Andorre", // "ja": "アンドラ", // "it": "Andorra", // "cn": "安道尔" // }, // "latitude": "42.50000000", // "longitude": "1.50000000", // "emoji": "🇦🇩", // "emojiU": "U+1F1E6 U+1F1E9", // "currency_name": "Euro" // }, //] ``` -------------------------------- ### Get All Currencies - TypeScript Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Retrieves an array of all available currencies. Each object contains the country name, ISO 2 code, currency code, currency symbol, currency name, and a flag class. Import the flag CSS file if flag classes are needed. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const currencies = CountriesAtlas.getCurrencies() // [ // { // "name": "Andorra", // "iso2": "AD", // "currency": "EUR", // "currency_symbol": "€", // "currency_name": "Euro", // "flag": "flag flag-ad" // }, // { // "name": "United Arab Emirates", // "iso2": "AE", // "currency": "AED", // "currency_symbol": "إ.د", // "flag": "flag flag-ae" // }, // ] ``` -------------------------------- ### Get Flag by ISO2 Code Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Fetch the SVG representation of a country's flag using its ISO2 code. ```javascript CountryAtlas.getFlag('US') ``` -------------------------------- ### Get Timezone by Country ISO2 Code Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Use `timezone()` to get the timezone information for a specific country, identified by its ISO2 code. Returns `undefined` if the timezone is not found. You can access properties like `tzName` from the returned timezone object. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const timezone = CountriesAtlas.timezone('AD') // { ... timezone data ... } const timezoneName = CountriesAtlas.timezone('AD')?.[0]?.tzName // Central European Time ``` -------------------------------- ### Get Flags Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve all country flags or a specific country's flag using its ISO2 code. The flag is returned as an SVG. ```APIDOC ## Get Flags ### Description Retrieves all country flags or a specific country's flag using its ISO2 code. The flag is returned in SVG format. ### Method `CountryAtlas.getFlags()` `CountryAtlas.getFlag(iso2Code)` ### Parameters #### `getFlag` - **iso2Code** (string) - Required - The ISO2 code of the country for which to retrieve the flag. ``` -------------------------------- ### Import Flags in React.js Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Import country flags for use in your React.js components. This example shows how to import and display flags using their imported variables. ```jsx import { AD, AE } from '@amplifiedhq/countries-atlas/dist/flags'; const App = () => { return (
); } export default App; ``` -------------------------------- ### Get States Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve all states for a given country or find a specific state by its code. Supports method chaining to access state properties. ```APIDOC ## Get States ### Description Retrieves all states for a specified country or a specific state by its code. Method chaining is supported to access individual state properties or its cities. ### Method `CountryAtlas.states(countryCode)` `CountryAtlas.state(countryCode, stateCode)` ### Parameters #### `states` - **countryCode** (string) - Required - The ISO2 code of the country for which to retrieve states. #### `state` - **countryCode** (string) - Required - The ISO2 code of the country. - **stateCode** (string) - Required - The code of the state to retrieve. ### Method Chaining Allows direct access to state properties or its cities after finding a specific state. #### Example - `CountryAtlas.state('US', 'NY').name` - `CountryAtlas.state('US', 'NY').latitude` - `CountryAtlas.state('US', 'NY').longitude` - `CountryAtlas.state('US', 'NY').cities` ``` -------------------------------- ### Get All Calling Codes - TypeScript Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Retrieves an array of all available calling codes. Each object includes country name, phone code, ISO 2 code, phone code with a '+' prefix, and a flag class. Ensure the flag CSS file is imported if flag classes are to be used. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const callingCodes = CountriesAtlas.getCallingCodes() // [ // { // "name": "Andorra", // "phone": 376, // "iso2": "AD", // "phone_code": "+376", // "flag": "flag flag-ad" // }, // { // "name": "United Arab Emirates", // "phone": 971, // "iso2": "AE", // "phone_code": "+971", // "flag": "flag flag-ae" // }, // ] ``` -------------------------------- ### Get Specific Country Properties Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Retrieve an array of countries, but only include specified properties like 'name', 'iso2', and 'emoji'. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const countries = CountriesAtlas.getCountries(['name', 'iso2', 'emoji']) //[ // { // "name": "Andorra", // "iso2": "AD", // "emoji": "🇦🇩" // }, //] ``` -------------------------------- ### Get Currency by ISO2 - TypeScript Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Fetches the currency details for a specific country using its ISO 3166-1 alpha-2 code. Returns undefined if the country code is not found. The result includes country name, ISO 2 code, currency code, currency symbol, currency name, and a flag class. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const currency = CountriesAtlas.currency('AD') // { // "name": "Andorra", // "iso2": "AD", // "currency": "EUR", // "currency_symbol": "€", // "currency_name": "Euro", // "flag": "flag flag-ad" // } ``` -------------------------------- ### Get States by Country ISO2 Code Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md The `getStates()` method returns an array of states for a given country, identified by its ISO2 code. Each state object includes its name, state code, coordinates, and associated cities. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const states = CountriesAtlas.getStates('AD') // [ ... state data ... ] ``` -------------------------------- ### Get All Available Timezones Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md The `getTimezones()` method retrieves a list of all available timezones. Each timezone object contains its name, GMT offset, abbreviation, and full timezone name. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const timezones = CountriesAtlas.getTimezones() // [ ... timezone data ... ] ``` -------------------------------- ### Get Specific State by ISO2 and State Code Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Use `state()` to find a specific state within a country using the country's ISO2 code and the state's code. Returns `undefined` if the state is not found. You can access individual properties like `name` from the returned state object. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const state = CountriesAtlas.state('AD', '07') // { ... state data ... } const stateName = CountriesAtlas.state('AD', '07')?.name // Andorra la Vella ``` -------------------------------- ### Get Calling Code by ISO2 - TypeScript Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Fetches the calling code details for a specific country using its ISO 3166-1 alpha-2 code. Returns undefined if the country code is not found. The result includes country name, phone code, ISO 2 code, phone code with a '+' prefix, and a flag class. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const callingCode = CountriesAtlas.callingCode('AD') // { // "name": "Andorra", // "phone": 376, // "iso2": "AD", // "phone_code": "+376", // "flag": "flag flag-ad" // } ``` -------------------------------- ### Import Flag SCSS via HTML Link Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Include the flag SCSS file in your HTML. Use a CDN, local path, or unpkg. ```html ``` ```html ``` ```html ``` -------------------------------- ### Import Flag SCSS via SCSS @import Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Import the flag SCSS file into your SCSS files. Options include CDN, local path, or unpkg. ```scss @import '~@amplifiedhq/countries-atlas/dist/flags/scss/flags.scss'; ``` ```scss @import 'https://cdn.jsdelivr.net/npm/@amplifiedhq/countries-atlas/dist/flags/scss/flags.scss'; ``` ```scss @import 'https://unpkg.com/@amplifiedhq/countries-atlas/dist/flags/scss/flags.scss'; ``` -------------------------------- ### Import CountriesAtlas Class Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Import the CountriesAtlas class from the library. This is the first step before creating an instance. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' ``` -------------------------------- ### Import Flag CSS via CSS @import Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Import the flag CSS file directly into your CSS file. Options include CDN, local path, or unpkg. ```css @import '~@amplifiedhq/countries-atlas/dist/flags/css/flags.min.css'; ``` ```css @import 'https://cdn.jsdelivr.net/npm/@amplifiedhq/countries-atlas/dist/flags/css/flags.min.css'; ``` ```css @import 'node_modules/@amplifiedhq/countries-atlas/dist/flags/css/flags.min.css'; ``` ```css @import 'https://unpkg.com/@amplifiedhq/countries-atlas/dist/flags/css/flags.min.css'; ``` -------------------------------- ### Import Flag CSS via HTML Link Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Include the flag CSS file in your HTML to enable flag display. You can use a CDN, local path, or unpkg. ```html ``` ```html ``` ```html ``` -------------------------------- ### find() Method Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Finds a specific country by its ISO 3166-1 alpha-2 code. Returns the country object if found, otherwise returns undefined. ```APIDOC ## find(iso2: string) Method ### Description Finds a country by its ISO 3166-1 alpha-2 code. It will return the country if it exists, otherwise it will return `undefined`. ### Method `find(iso2: string)` ### Parameters #### Path Parameters - **iso2** (string) - Required - The ISO 3166-1 alpha-2 code of the country to find. ### Request Example ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const country = CountriesAtlas.find('AD') ``` ### Response #### Success Response (200) - **country** (Object | undefined) - The country object if found, otherwise `undefined`. ### Response Example ```json { "code": "AD", "name": "Andorra", "native": "Andorra", "phone": 376, "continent": "Europe", "capital": "Andorra la Vella", "currency": "EUR", "languages": "ca", "iso3": "AND", "iso2": "AD", "currency_symbol": "€", "region": "Europe", "subregion": "Southern Europe", "timezones": [ { "zoneName": "Europe/Andorra", "gmtOffset": 3600, "gmtOffsetName": "UTC+01:00", "abbreviation": "CET", "tzName": "Central European Time" } ], "translations": { "kr": "안도라", "br": "Andorra", "pt": "Andorra", "nl": "Andorra", "hr": "Andora", "fa": "آندورا", "de": "Andorra", "es": "Andorra", "fr": "Andorre", "ja": "アンドラ", "it": "Andorra", "cn": "安道尔" }, "latitude": "42.50000000", "longitude": "1.50000000", "emoji": "🇦🇩", "emojiU": "U+1F1E6 U+1F1E9", "currency_name": "Euro" } ``` ## find(iso2: string)?.propertyName Method ### Description Accesses a specific property of the country object returned by the `find()` method. ### Method `find(iso2: string)?.propertyName` ### Parameters #### Path Parameters - **iso2** (string) - Required - The ISO 3166-1 alpha-2 code of the country to find. - **propertyName** (string) - Required - The name of the property to access on the country object. ### Request Example ```typescript const countryName = CountriesAtlas.find('AD')?.name ``` ### Response #### Success Response (200) - **propertyNameValue** (any) - The value of the requested property. ### Response Example ``` Andorra ``` ``` -------------------------------- ### getStates() Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Retrieves an array of states for a given country ISO2 code. Each state object includes name, state code, latitude, longitude, and cities. ```APIDOC ## getStates() ### Description Retrieves an array of states for a given country ISO2 code. Each state object includes name, state code, latitude, longitude, and cities. ### Method `getStates(iso2: string): State[]` ### Parameters #### Path Parameters - **iso2** (string) - Required - The 2-letter ISO code of the country for which to retrieve states. ### Response #### Success Response - **State[]** (array) - An array of state objects. ### Request Example ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const states = CountriesAtlas.getStates('AD') ``` ### Response Example ```json [ { "name": "Andorra la Vella", "state_code": "07", "latitude": "42.50631740", "longitude": "1.52183550", "cities": [ { "name": "Andorra la Vella", "latitude": "42.50779000", "longitude": "1.52109000" } ] } ] ``` ``` -------------------------------- ### state() Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Retrieves a specific state by country ISO2 code and state code. Returns the state object if found, otherwise returns undefined. ```APIDOC ## state() ### Description Retrieves a specific state by country ISO2 code and state code. Returns the state object if found, otherwise returns undefined. ### Method `state(iso2: string, state_code: string): State | undefined` ### Parameters #### Path Parameters - **iso2** (string) - Required - The 2-letter ISO code of the country. - **state_code** (string) - Required - The code of the state to retrieve. ### Response #### Success Response - **State** (object) - An object containing state details if found. ### Request Example ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const state = CountriesAtlas.state('AD', '07') ``` ### Response Example ```json { "name": "Andorra la Vella", "state_code": "07", "latitude": "42.50631740", "longitude": "1.52183550", "cities": [ { "name": "Andorra la Vella", "latitude": "42.50779000", "longitude": "1.52109000" } ] } ``` ``` -------------------------------- ### Display Country Flags using HTML Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Apply the 'flag' class along with the country code class (e.g., 'flag-ad') to an element to display its flag. ```html ``` ```html ``` -------------------------------- ### getCurrencies() Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Retrieves an array of all available currency information for countries. Each entry includes country name, ISO 2-letter code, currency code, currency symbol, currency name, and a flag class. ```APIDOC ## getCurrencies() ### Description Returns an array of currency information for all available countries. Each object includes the country's name, ISO 2-letter code, currency code, currency symbol, currency name, and a flag class. ### Method `getCurrencies()` ### Parameters None ### Response An array of objects, where each object represents a country and its currency information. #### Response Example ```json [ { "name": "Andorra", "iso2": "AD", "currency": "EUR", "currency_symbol": "€", "currency_name": "Euro", "flag": "flag flag-ad" } ] ``` ``` -------------------------------- ### currency(iso2) Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Fetches the currency information for a specific country using its ISO 2-letter code. Returns undefined if the country is not found. ```APIDOC ## currency(iso2) ### Description Retrieves the currency information for a specific country based on its ISO 3166-1 alpha-2 code. Returns the country's currency details or `undefined` if no matching country is found. ### Method `currency(iso2: string)` ### Parameters #### Path Parameters - **iso2** (string) - Required - The ISO 3166-1 alpha-2 code of the country. ### Response An object containing the country's currency information, or `undefined`. #### Response Example ```json { "name": "Andorra", "iso2": "AD", "currency": "EUR", "currency_symbol": "€", "currency_name": "Euro", "flag": "flag flag-ad" } ``` ``` -------------------------------- ### getCallingCodes() Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Retrieves an array of all available calling codes for countries. Each entry includes country name, phone code, ISO 2-letter code, phone code with a '+' prefix, and a flag class. ```APIDOC ## getCallingCodes() ### Description Returns an array of calling codes for all available countries. Each object in the array contains details about the country's name, phone number, ISO 2-letter code, phone code with a '+' prefix, and a flag class. ### Method `getCallingCodes()` ### Parameters None ### Response An array of objects, where each object represents a country and its calling code information. #### Response Example ```json [ { "name": "Andorra", "phone": 376, "iso2": "AD", "phone_code": "+376", "flag": "flag flag-ad" } ] ``` ``` -------------------------------- ### Find Country by ISO Code Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Retrieve country data using its ISO2 or ISO3 code. You can also select specific properties to fetch. ```javascript CountryAtlas.find('iso2', 'US') ``` ```javascript CountryAtlas.find('iso3', 'USA') ``` ```javascript CountryAtlas.getCountries([..properties]) ``` -------------------------------- ### Import ValidatorAtlas Class Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Import the ValidatorAtlas class from the '@amplifiedhq/countries-atlas' library. ```typescript import { ValidatorAtlas } from '@amplifiedhq/countries-atlas' ``` -------------------------------- ### Access Country Properties via Method Chaining Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Chain method calls to directly access specific properties of a found country, such as its name, capital, or currency. ```javascript CountryAtlas.find('iso2', 'US').name ``` ```javascript CountryAtlas.find('iso2', 'US').capital ``` ```javascript CountryAtlas.find('iso2', 'US').currency ``` -------------------------------- ### getCountries() Method Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Retrieves an array of all countries in the world. Optionally accepts an array of property names to filter the returned data. ```APIDOC ## getCountries() ### Description Retrieves an array of all countries in the world. It also contains the following properties: code, name, native, phone, continent, capital, currency, languages, iso3, iso2, currency_symbol, region, subregion, timezones, translations, latitude, longitude, emoji, emojiU, currency_name. ### Method `getCountries()` ### Parameters #### Query Parameters - **properties** (string[]) - Optional - An array of property names to include in the returned country objects. ### Request Example ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const countries = CountriesAtlas.getCountries() ``` ### Response #### Success Response (200) - **countries** (Array) - An array of country objects, each containing detailed information. ### Response Example ```json [ { "code": "AD", "name": "Andorra", "native": "Andorra", "phone": 376, "continent": "Europe", "capital": "Andorra la Vella", "currency": "EUR", "languages": "ca", "iso3": "AND", "iso2": "AD", "currency_symbol": "€", "region": "Europe", "subregion": "Southern Europe", "timezones": [ { "zoneName": "Europe/Andorra", "gmtOffset": 3600, "gmtOffsetName": "UTC+01:00", "abbreviation": "CET", "tzName": "Central European Time" } ], "translations": { "kr": "안도라", "br": "Andorra", "pt": "Andorra", "nl": "Andorra", "hr": "Andora", "fa": "آندورا", "de": "Andorra", "es": "Andorra", "fr": "Andorre", "ja": "アンドラ", "it": "Andorra", "cn": "安道尔" }, "latitude": "42.50000000", "longitude": "1.50000000", "emoji": "🇦🇩", "emojiU": "U+1F1E6 U+1F1E9", "currency_name": "Euro" } ] ``` ## getCountries(properties) Method ### Description Retrieves a subset of country data, returning only the specified properties. ### Method `getCountries(properties: string[])` ### Parameters #### Query Parameters - **properties** (string[]) - Required - An array of property names to include in the returned country objects. ### Request Example ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const countries = CountriesAtlas.getCountries(['name', 'iso2', 'emoji']) ``` ### Response #### Success Response (200) - **countries** (Array) - An array of country objects, each containing only the specified properties. ### Response Example ```json [ { "name": "Andorra", "iso2": "AD", "emoji": "🇦🇩" } ] ``` ``` -------------------------------- ### callingCode(iso2) Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Fetches the calling code information for a specific country using its ISO 2-letter code. Returns undefined if the country is not found. ```APIDOC ## callingCode(iso2) ### Description Retrieves the calling code information for a specific country based on its ISO 3166-1 alpha-2 code. Returns the country's calling code details or `undefined` if no matching country is found. ### Method `callingCode(iso2: string)` ### Parameters #### Path Parameters - **iso2** (string) - Required - The ISO 3166-1 alpha-2 code of the country. ### Response An object containing the country's calling code information, or `undefined`. #### Response Example ```json { "name": "Andorra", "phone": 376, "iso2": "AD", "phone_code": "+376", "flag": "flag flag-ad" } ``` ``` -------------------------------- ### Import Flags in Vue.js Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Import individual country flags as needed for your Vue.js application. Ensure flags are imported from the correct path. ```javascript ``` -------------------------------- ### getTimezones() Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Retrieves an array of all available timezones. Each timezone object includes zone name, GMT offset, abbreviation, and timezone name. ```APIDOC ## getTimezones() ### Description Retrieves an array of all available timezones. Each timezone object includes zone name, GMT offset, abbreviation, and timezone name. ### Method `getTimezones(): Timezone[]` ### Response #### Success Response - **Timezone[]** (array) - An array of timezone objects. ### Request Example ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const timezones = CountriesAtlas.getTimezones() ``` ### Response Example ```json [ { "zoneName": "Europe/Andorra", "gmtOffset": 3600, "gmtOffsetName": "UTC+01:00", "abbreviation": "CET", "tzName": "Central European Time" }, { "zoneName": "Asia/Dubai", "gmtOffset": 14400, "gmtOffsetName": "UTC+04:00", "abbreviation": "GST", "tzName": "Gulf Standard Time" } ] ``` ``` -------------------------------- ### timezone() Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Retrieves the timezone for a given country ISO2 code. Returns the timezone object if found, otherwise returns undefined. ```APIDOC ## timezone() ### Description Retrieves the timezone for a given country ISO2 code. Returns the timezone object if found, otherwise returns undefined. ### Method `timezone(iso2: string): Timezone[] | undefined` ### Parameters #### Path Parameters - **iso2** (string) - Required - The 2-letter ISO code of the country for which to retrieve the timezone. ### Response #### Success Response - **Timezone[]** (array) - An array containing the timezone object if found. ### Request Example ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const timezone = CountriesAtlas.timezone('AD') ``` ### Response Example ```json { "zoneName": "Europe/Andorra", "gmtOffset": 3600, "gmtOffsetName": "UTC+01:00", "abbreviation": "CET", "tzName": "Central European Time" } ``` ``` -------------------------------- ### findByIso3() Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Finds a country by its 3-letter ISO code. Returns the country object if found, otherwise returns undefined. ```APIDOC ## findByIso3() ### Description Finds a country by its 3-letter ISO code. Returns the country object if found, otherwise returns undefined. ### Method `findByIso3(iso3: string): Country | undefined` ### Parameters #### Path Parameters - **iso3** (string) - Required - The 3-letter ISO code of the country to find. ### Response #### Success Response - **Country** (object) - An object containing country details if found. ### Request Example ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const country = CountriesAtlas.findByIso3('AND') ``` ### Response Example ```json [ { "code": "AD", "name": "Andorra", "native": "Andorra", "phone": 376, "continent": "Europe", "capital": "Andorra la Vella", "currency": "EUR", "languages": "ca", "iso3": "AND", "iso2": "AD", "currency_symbol": "€", "region": "Europe", "subregion": "Southern Europe", "timezones": [ { "zoneName": "Europe/Andorra", "gmtOffset": 3600, "gmtOffsetName": "UTC+01:00", "abbreviation": "CET", "tzName": "Central European Time" } ], "translations": { "kr": "안도라", "br": "Andorra", "pt": "Andorra", "nl": "Andorra", "hr": "Andora", "fa": "آندورا", "de": "Andorra", "es": "Andorra", "fr": "Andorre", "ja": "アンドラ", "it": "Andorra", "cn": "安道尔" }, "latitude": "42.50000000", "longitude": "1.50000000", "emoji": "🇦🇩", "emojiU": "U+1F1E6 U+1F1E9", "currency_name": "Euro" } ] ``` ``` -------------------------------- ### Validate Codes and Names Source: https://github.com/amplifiedhq/countries-atlas/blob/main/TODO.md Utilize various validation methods to check the correctness of ISO codes, currency codes, timezone names, state codes, and state names. All validation methods return a boolean value. ```javascript CountryAtlas.isValidIso2('US') ``` ```javascript CountryAtlas.isValidIso3('USA') ``` ```javascript CountryAtlas.isValidCurrency('USD') ``` ```javascript CountryAtlas.isValidTimezone('America/New_York') ``` ```javascript CountryAtlas.isValidCallingCode('1') ``` ```javascript CountryAtlas.isValidStateCode('NY') ``` ```javascript CountryAtlas.isValidStateName('New York') ``` -------------------------------- ### Find Country by ISO3 Code Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Use `findByIso3()` to retrieve country data using its ISO3 code. Returns `undefined` if the country is not found. You can access individual properties like `name` from the returned country object. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const country = CountriesAtlas.findByIso3('AND') //[ ... country data ... ] const countryName = CountriesAtlas.findByIso3('AND')?.name // Andorra ``` -------------------------------- ### isValidCallingCode() Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Validates if the given calling code is valid. Returns true if valid, false otherwise. ```APIDOC ## isValidCallingCode() ### Description Validates the given `callingCode` property. Returns `true` if the `callingCode` is valid, otherwise returns `false`. ### Method static ### Parameters #### Path Parameters - **callingCode** (string) - Required - The calling code to validate. ### Request Example ```typescript import { ValidatorAtlas } from '@amplifiedhq/countries-atlas' const isValid = ValidatorAtlas.isValidCallingCode('376') // true const isValid = ValidatorAtlas.isValidCallingCode('ABC') // false ``` ### Response #### Success Response - **isValid** (boolean) - True if the `callingCode` is valid, false otherwise. #### Response Example ```json true ``` #### Response Example (Invalid) ```json false ``` ``` -------------------------------- ### Find Country by ISO2 Code Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Find a specific country using its ISO 3166-1 alpha-2 code. Returns the country object or undefined if not found. ```typescript import { CountriesAtlas } from '@amplifiedhq/countries-atlas' const country = CountriesAtlas.find('AD') //[ // { // "code": "AD", // "name": "Andorra", // "native": "Andorra", // "phone": 376, // "continent": "Europe", // "capital": "Andorra la Vella", // "currency": "EUR", // "languages": "ca", // "iso3": "AND", // "iso2": "AD", // "currency_symbol": "€", // "region": "Europe", // "subregion": "Southern Europe", // "timezones": [ // { // "zoneName": "Europe/Andorra", // "gmtOffset": 3600, // "gmtOffsetName": "UTC+01:00", // "abbreviation": "CET", // "tzName": "Central European Time" // } // ], // "translations": { // "kr": "안도라", // "br": "Andorra", // "pt": "Andorra", // "nl": "Andorra", // "hr": "Andora", // "fa": "آندورا", // "de": "Andorra", // "es": "Andorra", // "fr": "Andorre", // "ja": "アンドラ", // "it": "Andorra", // "cn": "安道尔" // }, // "latitude": "42.50000000", // "longitude": "1.50000000", // "emoji": "🇦🇩", // "emojiU": "U+1F1E6 U+1F1E9", // "currency_name": "Euro" // }, //] // You can also get any property you want from the country by using the . operator const countryName = CountriesAtlas.find('AD')?.name // Andorra ``` -------------------------------- ### isValidCurrency() Source: https://github.com/amplifiedhq/countries-atlas/blob/main/README.md Validates if the given currency code is valid. Returns true if valid, false otherwise. ```APIDOC ## isValidCurrency() ### Description Validates the given `currency` property. Returns `true` if the `currency` is valid, otherwise returns `false`. ### Method static ### Parameters #### Path Parameters - **currency** (string) - Required - The currency code to validate. ### Request Example ```typescript import { ValidatorAtlas } from '@amplifiedhq/countries-atlas' const isValid = ValidatorAtlas.isValidCurrency('EUR') // true const isValid = ValidatorAtlas.isValidCurrency('ABC') // false ``` ### Response #### Success Response - **isValid** (boolean) - True if the `currency` is valid, false otherwise. #### Response Example ```json true ``` #### Response Example (Invalid) ```json false ``` ```