1
0
Fork 0
mirror of synced 2024-07-19 13:25:42 +12:00
appwrite/app/sdks/client-swift/Sources/Appwrite/Services/Locale.swift
2020-08-30 19:23:15 +03:00

165 lines
4.1 KiB
Swift

class Locale: 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 array
*/
func get() -> Array<Any> {
let path: String = "/locale"
let params: [String: Any] = [:]
return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [
"content-type": "application/json",
], params: params)];
}
/**
* List Continents
*
* List of all continents. You can use the locale header to get the data in a
* supported language.
*
* @throws Exception
* @return array
*/
func getContinents() -> Array<Any> {
let path: String = "/locale/continents"
let params: [String: Any] = [:]
return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [
"content-type": "application/json",
], params: params)];
}
/**
* List Countries
*
* List of all countries. You can use the locale header to get the data in a
* supported language.
*
* @throws Exception
* @return array
*/
func getCountries() -> Array<Any> {
let path: String = "/locale/countries"
let params: [String: Any] = [:]
return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [
"content-type": "application/json",
], params: params)];
}
/**
* 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 array
*/
func getCountriesEU() -> Array<Any> {
let path: String = "/locale/countries/eu"
let params: [String: Any] = [:]
return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [
"content-type": "application/json",
], params: params)];
}
/**
* 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 array
*/
func getCountriesPhones() -> Array<Any> {
let path: String = "/locale/countries/phones"
let params: [String: Any] = [:]
return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [
"content-type": "application/json",
], params: params)];
}
/**
* List Currencies
*
* 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 Exception
* @return array
*/
func getCurrencies() -> Array<Any> {
let path: String = "/locale/currencies"
let params: [String: Any] = [:]
return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [
"content-type": "application/json",
], params: params)];
}
/**
* List Languages
*
* List of all languages classified by ISO 639-1 including 2-letter code, name
* in English, and name in the respective language.
*
* @throws Exception
* @return array
*/
func getLanguages() -> Array<Any> {
let path: String = "/locale/languages"
let params: [String: Any] = [:]
return [self.client.call(method: Client.HTTPMethod.get.rawValue, path: path, headers: [
"content-type": "application/json",
], params: params)];
}
}