diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/Request.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/Request.kt index 7ab7129b23..3776c1c69d 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/Request.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/Request.kt @@ -5,12 +5,13 @@ import com.github.insanusmokrassar.TelegramBotAPI.utils.toJsonWithoutNulls import kotlinx.serialization.* import kotlinx.serialization.json.JsonObject +@Serializable(RequestSerializer::class) interface Request { fun method(): String fun resultSerializer(): KSerializer - @ImplicitReflectionSerializer - fun json(): JsonObject = toJsonWithoutNulls() + fun json(): JsonObject = toJsonWithoutNulls(RequestSerializer) } +object RequestSerializer : KSerializer> by ContextSerializer(Request::class) fun StringFormat.extractResult( from: String, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/DataRequest.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/DataRequest.kt index 996e3227ee..d9b3f3213b 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/DataRequest.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/DataRequest.kt @@ -1,5 +1,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest +import kotlinx.serialization.ContextSerializer +import kotlinx.serialization.KSerializer +import kotlinx.serialization.Serializable -interface DataRequest : SimpleRequest \ No newline at end of file +@Serializable(DataRequestSerializer::class) +interface DataRequest : SimpleRequest + +object DataRequestSerializer : KSerializer> by ContextSerializer(DataRequest::class) \ No newline at end of file