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

io.appwrite.models.BucketList.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

/**
 * Buckets List
 */
data class BucketList(
    /**
     * Total number of buckets documents that matched your query.
     */
    @SerializedName("total")
    val total: Long,

    /**
     * List of buckets.
     */
    @SerializedName("buckets")
    val buckets: List,

) {
    fun toMap(): Map = mapOf(
        "total" to total as Any,
        "buckets" to buckets.map { it.toMap() } as Any,
    )

    companion object {

        @Suppress("UNCHECKED_CAST")
        fun from(
            map: Map,
        ) = BucketList(
            total = (map["total"] as Number).toLong(),
            buckets = (map["buckets"] as List>).map { Bucket.from(map = it) },
        )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy