mirror of
https://github.com/InsanusMokrassar/SauceNaoAPI.git
synced 2024-06-01 23:45:12 +00:00
25 lines
587 B
Kotlin
25 lines
587 B
Kotlin
package dev.inmo.saucenaoapi.additional.header
|
|
|
|
import dev.inmo.saucenaoapi.models.Header
|
|
|
|
data class IndexInfo(
|
|
val id: Int,
|
|
val status: Int = 500,
|
|
val results: Int = 0,
|
|
val parent_id: Int? = null
|
|
)
|
|
|
|
val Header.adaptedIndexes: List<IndexInfo>
|
|
get() = indexes.mapNotNull {
|
|
it ?.let { _ ->
|
|
it.id ?.let { id ->
|
|
IndexInfo(
|
|
id,
|
|
it.status ?: 500, // Serverside error if not set
|
|
it.results ?: 0,
|
|
it.parent_id
|
|
)
|
|
}
|
|
}
|
|
}
|