All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.appwrite.models.Currency.kt Maven / Gradle / Ivy

Go to download

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)

There is a newer version: 6.1.0
Show newest version
package io.appwrite.models

import com.google.gson.annotations.SerializedName
import io.appwrite.extensions.jsonCast

/**
 * Currency
 */
data class Currency(
    /**
     * Currency symbol.
     */
    @SerializedName("symbol")
    val symbol: String,

    /**
     * Currency name.
     */
    @SerializedName("name")
    val name: String,

    /**
     * Currency native symbol.
     */
    @SerializedName("symbolNative")
    val symbolNative: String,

    /**
     * Number of decimal digits.
     */
    @SerializedName("decimalDigits")
    val decimalDigits: Long,

    /**
     * Currency digit rounding.
     */
    @SerializedName("rounding")
    val rounding: Double,

    /**
     * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format.
     */
    @SerializedName("code")
    val code: String,

    /**
     * Currency plural name
     */
    @SerializedName("namePlural")
    val namePlural: String,

) {
    fun toMap(): Map = mapOf(
        "symbol" to symbol as Any,
        "name" to name as Any,
        "symbolNative" to symbolNative as Any,
        "decimalDigits" to decimalDigits as Any,
        "rounding" to rounding as Any,
        "code" to code as Any,
        "namePlural" to namePlural as Any,
    )

    companion object {

        @Suppress("UNCHECKED_CAST")
        fun from(
            map: Map,
        ) = Currency(
            symbol = map["symbol"] as String,
            name = map["name"] as String,
            symbolNative = map["symbolNative"] as String,
            decimalDigits = (map["decimalDigits"] as Number).toLong(),
            rounding = (map["rounding"] as Number).toDouble(),
            code = map["code"] as String,
            namePlural = map["namePlural"] as String,
        )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy