2020-01-28 10:50:41 +13:00
|
|
|
const Service = require('../service.js');
|
|
|
|
|
|
|
|
class Locale extends Service {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get User Locale
|
|
|
|
*
|
|
|
|
* Get the current user location based on IP. Returns an object with user
|
|
|
|
* country code, country name, continent name, continent code, ip address and
|
|
|
|
* suggested currency. You can use the locale header to get the data in a
|
|
|
|
* supported language.
|
|
|
|
*
|
|
|
|
* ([IP Geolocation by DB-IP](https://db-ip.com))
|
|
|
|
*
|
|
|
|
* @throws Exception
|
|
|
|
* @return {}
|
|
|
|
*/
|
2020-01-31 05:18:59 +13:00
|
|
|
async get() {
|
2020-01-28 10:50:41 +13:00
|
|
|
let path = '/locale';
|
|
|
|
|
|
|
|
return await this.client.call('get', path, {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-05-01 07:16:14 +12:00
|
|
|
* List Continents
|
2020-01-28 10:50:41 +13:00
|
|
|
*
|
|
|
|
* List of all continents. You can use the locale header to get the data in a
|
|
|
|
* supported language.
|
|
|
|
*
|
|
|
|
* @throws Exception
|
|
|
|
* @return {}
|
|
|
|
*/
|
|
|
|
async getContinents() {
|
|
|
|
let path = '/locale/continents';
|
|
|
|
|
|
|
|
return await this.client.call('get', path, {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List Countries
|
|
|
|
*
|
|
|
|
* List of all countries. You can use the locale header to get the data in a
|
|
|
|
* supported language.
|
|
|
|
*
|
|
|
|
* @throws Exception
|
|
|
|
* @return {}
|
|
|
|
*/
|
|
|
|
async getCountries() {
|
|
|
|
let path = '/locale/countries';
|
|
|
|
|
|
|
|
return await this.client.call('get', path, {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List EU Countries
|
|
|
|
*
|
|
|
|
* List of all countries that are currently members of the EU. You can use the
|
|
|
|
* locale header to get the data in a supported language.
|
|
|
|
*
|
|
|
|
* @throws Exception
|
|
|
|
* @return {}
|
|
|
|
*/
|
|
|
|
async getCountriesEU() {
|
|
|
|
let path = '/locale/countries/eu';
|
|
|
|
|
|
|
|
return await this.client.call('get', path, {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List Countries Phone Codes
|
|
|
|
*
|
|
|
|
* List of all countries phone codes. You can use the locale header to get the
|
|
|
|
* data in a supported language.
|
|
|
|
*
|
|
|
|
* @throws Exception
|
|
|
|
* @return {}
|
|
|
|
*/
|
|
|
|
async getCountriesPhones() {
|
|
|
|
let path = '/locale/countries/phones';
|
|
|
|
|
|
|
|
return await this.client.call('get', path, {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List Currencies
|
|
|
|
*
|
|
|
|
* List of all currencies, including currency symol, name, plural, and decimal
|
|
|
|
* digits for all major and minor currencies. You can use the locale header to
|
|
|
|
* get the data in a supported language.
|
|
|
|
*
|
|
|
|
* @throws Exception
|
|
|
|
* @return {}
|
|
|
|
*/
|
|
|
|
async getCurrencies() {
|
|
|
|
let path = '/locale/currencies';
|
|
|
|
|
|
|
|
return await this.client.call('get', path, {
|
|
|
|
'content-type': 'application/json',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Locale;
|