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

io.elderscrollslegends.Set.kt Maven / Gradle / Ivy

Go to download

A java wrapper around the Elder Scrolls: Legends API of https://elderscrollslegends.io

The newest version!
package io.elderscrollslegends

import com.fasterxml.jackson.annotation.JsonProperty

data class Set (
    val id: String,
    val name: String = "",
    val releaseDate: String = "",
    val totalCards: Int = 0
) {
    companion object {
        private val queryBuilder = QueryBuilder()
        private const val RESOURCE_NAME = "sets"

        @JvmStatic
        fun all(): List {
            return where(emptyMap())
        }

        @JvmStatic
        fun find(id: String): Set? {
            return queryBuilder.find(resource = RESOURCE_NAME, id = id, cls = SetSingle::class.java)?.set
        }

        @JvmStatic
        fun where(predicates: Map): List {
            return queryBuilder.where(resource = RESOURCE_NAME, cls = Sets::class.java, predicates = predicates) { sets, setList ->
                setList.addAll(sets?.sets ?: emptyList())
            }
        }
    }
}

data class Sets (
    val sets: List,

    @JsonProperty("_pageSize")
    override val pageSize: Int,
    @JsonProperty("_totalCount")
    override val totalCount: Int
) : ResultCounters(pageSize, totalCount)

data class SetSingle(
    val set: Set
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy