io.elderscrollslegends.Set.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elderscrolls-legends-sdk-java Show documentation
Show all versions of elderscrolls-legends-sdk-java Show documentation
A java wrapper around the Elder Scrolls: Legends API of https://elderscrollslegends.io
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
)