node-appwrite
Version:
Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API
157 lines (154 loc) • 4.29 kB
JavaScript
'use strict';
class Locale {
constructor(client) {
this.client = client;
}
/**
* 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 {AppwriteException}
* @returns {Promise<Models.Locale>}
*/
get() {
const apiPath = "/locale";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
/**
* List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
*
* @throws {AppwriteException}
* @returns {Promise<Models.LocaleCodeList>}
*/
listCodes() {
const apiPath = "/locale/codes";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
/**
* List of all continents. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.ContinentList>}
*/
listContinents() {
const apiPath = "/locale/continents";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
/**
* List of all countries. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.CountryList>}
*/
listCountries() {
const apiPath = "/locale/countries";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
/**
* 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 {AppwriteException}
* @returns {Promise<Models.CountryList>}
*/
listCountriesEU() {
const apiPath = "/locale/countries/eu";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
/**
* List of all countries phone codes. You can use the locale header to get the data in a supported language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.PhoneList>}
*/
listCountriesPhones() {
const apiPath = "/locale/countries/phones";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
/**
* List of all currencies, including currency symbol, 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 {AppwriteException}
* @returns {Promise<Models.CurrencyList>}
*/
listCurrencies() {
const apiPath = "/locale/currencies";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
/**
* List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
*
* @throws {AppwriteException}
* @returns {Promise<Models.LanguageList>}
*/
listLanguages() {
const apiPath = "/locale/languages";
const payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
const apiHeaders = {};
return this.client.call(
"get",
uri,
apiHeaders,
payload
);
}
}
exports.Locale = Locale;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=locale.js.map