update models for better work with new libraries

This commit is contained in:
InsanusMokrassar 2019-04-22 09:54:42 +08:00
parent 671af0517b
commit 653967129a
3 changed files with 3 additions and 19 deletions

View File

@ -7,8 +7,6 @@ import kotlinx.serialization.json.*
@Serializable
data class Header(
@SerialName("user_id")
val userId: Int,
@SerialName("account_type")
val accountType: String,
@SerialName("short_limit")
@ -35,7 +33,9 @@ data class Header(
@SerialName("query_image")
val queryImage: String, // something like "uuid.jpg"
@SerialName("results_returned")
val resultsCount: Int
val resultsCount: Int,
@SerialName("user_id")
val userId: Int? = null
)
object IndexesSerializer : KSerializer<List<HeaderIndex?>> {

View File

@ -1,14 +1,11 @@
package com.github.insanusmokrassar.SauceNaoAPI.models
import kotlinx.serialization.Optional
import kotlinx.serialization.Serializable
@Serializable
data class HeaderIndex(
val status: Int,
val id: Int,
@Optional
val results: Int = 0,
@Optional
val parent_id: Int? = null
)

View File

@ -2,48 +2,35 @@ package com.github.insanusmokrassar.SauceNaoAPI.models
import com.github.insanusmokrassar.SauceNaoAPI.utils.CommonMultivariantStringSerializer
import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer
import kotlinx.serialization.internal.StringSerializer
@Serializable
data class ResultData(
@Serializable(CommonMultivariantStringSerializer::class)
@SerialName("danbooru_id")
@Optional
val danbooruId: String? = null,
@Serializable(CommonMultivariantStringSerializer::class)
@SerialName("gelbooru_id")
@Optional
val gelbooruId: String? = null,
@Serializable(CommonMultivariantStringSerializer::class)
@SerialName("drawr_id")
@Optional
val drawrId: String? = null,
@Serializable(CommonMultivariantStringSerializer::class)
@SerialName("pixiv_id")
@Optional
val pixivId: String? = null,
@Serializable(CommonMultivariantStringSerializer::class)
@Optional
val title: String? = null,
@Serializable(CommonMultivariantStringSerializer::class)
@Optional
val creator: String? = null,
@Serializable(CommonMultivariantStringSerializer::class)
@Optional
val material: String? = null,
@Serializable(CommonMultivariantStringSerializer::class)
@SerialName("member_name")
@Optional
val memberName: String? = null,
@Serializable(CommonMultivariantStringSerializer::class)
@SerialName("member_id")
@Optional
val memberId: String? = null,
@Serializable(CommonMultivariantStringSerializer::class)
@Optional
val characters: String? = null,
@SerialName("ext_urls")
@Optional
val extUrls: List<String> = emptyList()
)