1
0
Fork 0
mirror of synced 2024-08-08 23:08:18 +12:00
appwrite/app/sdks/node/lib/services/locale.js

124 lines
3.1 KiB
JavaScript
Raw Normal View History

2019-06-10 06:13:55 +12:00
const Service = require('../service.js');
class Locale extends Service {
/**
* Get User Locale
*
2019-10-09 21:40:02 +13:00
* Get the current user location based on IP. Returns an object with user
* country code, country name, continent name, continent code, ip address and
2019-10-22 06:15:27 +13:00
* suggested currency. You can use the locale header to get the data in a
2019-10-09 21:40:02 +13:00
* supported language.
2019-06-10 06:13:55 +12:00
*
* @throws Exception
* @return {}
*/
async getLocale() {
let path = '/locale';
2019-10-20 06:21:36 +13:00
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
2019-06-10 06:13:55 +12:00
});
}
/**
* List Countries
*
2019-10-22 06:15:27 +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
2019-10-09 21:40:02 +13:00
* supported language.
2019-06-10 06:13:55 +12:00
*
* @throws Exception
* @return {}
*/
async getCountries() {
let path = '/locale/countries';
2019-10-20 06:21:36 +13:00
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
2019-06-10 06:13:55 +12:00
});
}
/**
* List EU Countries
*
2019-10-09 21:40:02 +13:00
* List of all countries that are currently members of the EU. You can use the
2019-10-22 06:15:27 +13:00
* locale header to get the data in a supported language. UK brexit date is
2019-10-09 21:40:02 +13:00
* currently set to 2019-10-31 and will be updated if and when needed.
2019-06-10 06:13:55 +12:00
*
* @throws Exception
* @return {}
*/
async getCountriesEU() {
let path = '/locale/countries/eu';
2019-10-20 06:21:36 +13:00
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
2019-06-10 06:13:55 +12:00
});
}
/**
* List Countries Phone Codes
*
2019-10-09 21:40:02 +13:00
* List of all countries phone codes. You can use the locale header to get the
2019-10-22 06:15:27 +13:00
* data in a supported language.
2019-06-10 06:13:55 +12:00
*
* @throws Exception
* @return {}
*/
async getCountriesPhones() {
let path = '/locale/countries/phones';
2019-10-20 06:21:36 +13:00
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
2019-06-10 06:13:55 +12:00
});
}
2019-08-23 09:10:32 +12:00
/**
2019-11-21 07:51:55 +13:00
* List Currencies
2019-08-23 09:10:32 +12:00
*
2019-10-09 21:40:02 +13:00
* 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
2019-10-22 06:15:27 +13:00
* get the data in a supported language.
2019-08-23 09:10:32 +12:00
*
* @throws Exception
* @return {}
*/
async getCurrencies() {
let path = '/locale/currencies';
2019-10-20 06:21:36 +13:00
return await this.client.call('get', path, {
'content-type': 'application/json',
},
{
2019-08-23 09:10:32 +12:00
});
}
2019-06-10 06:13:55 +12:00
}
module.exports = Locale;