1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-04 15:33:47 +00:00

one more fix for serialization of AnswerInlineQuery

This commit is contained in:
InsanusMokrassar 2019-02-07 19:36:03 +08:00
parent f6ce40b62b
commit ceabdd4492

View File

@ -3,13 +3,16 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InlineQuery import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InlineQuery
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.internal.BooleanSerializer
data class AnswerInlineQuery( data class AnswerInlineQuery(
@SerialName(inlineQueryIdField) @SerialName(inlineQueryIdField)
val inlineQueryID: InlineQueryIdentifier, val inlineQueryID: InlineQueryIdentifier,
@Serializable(InlineQueryAnswersResultsSerializer::class)
@SerialName(resultsField) @SerialName(resultsField)
val results: List<InlineQueryResult> = emptyList(), val results: List<InlineQueryResult> = emptyList(),
@SerialName(cachedTimeField) @SerialName(cachedTimeField)
@ -48,3 +51,7 @@ fun InlineQuery.createAnswer(
switchPmText, switchPmText,
switchPmParameter switchPmParameter
) )
object InlineQueryAnswersResultsSerializer: KSerializer<List<InlineQueryResult>> by ArrayListSerializer(
InlineQueryResultSerializer
)