io.appwrite.models.Locale.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk-for-kotlin Show documentation
Show all versions of sdk-for-kotlin Show documentation
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Kotlin SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
package io.appwrite.models
import com.google.gson.annotations.SerializedName
import io.appwrite.extensions.jsonCast
/**
* Locale
*/
data class Locale(
/**
* User IP address.
*/
@SerializedName("ip")
val ip: String,
/**
* Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format
*/
@SerializedName("countryCode")
val countryCode: String,
/**
* Country name. This field support localization.
*/
@SerializedName("country")
val country: String,
/**
* Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America.
*/
@SerializedName("continentCode")
val continentCode: String,
/**
* Continent name. This field support localization.
*/
@SerializedName("continent")
val continent: String,
/**
* True if country is part of the European Union.
*/
@SerializedName("eu")
val eu: Boolean,
/**
* Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format
*/
@SerializedName("currency")
val currency: String,
) {
fun toMap(): Map = mapOf(
"ip" to ip as Any,
"countryCode" to countryCode as Any,
"country" to country as Any,
"continentCode" to continentCode as Any,
"continent" to continent as Any,
"eu" to eu as Any,
"currency" to currency as Any,
)
companion object {
@Suppress("UNCHECKED_CAST")
fun from(
map: Map,
) = Locale(
ip = map["ip"] as String,
countryCode = map["countryCode"] as String,
country = map["country"] as String,
continentCode = map["continentCode"] as String,
continent = map["continent"] as String,
eu = map["eu"] as Boolean,
currency = map["currency"] as String,
)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy