From 0de1d9cfda55b7d79f05505dc959bedc731826ef Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 13 May 2020 19:53:27 +0600 Subject: [PATCH] UpdateDeserializationStrategy currently is public --- CHANGELOG.md | 3 +++ .../TelegramBotAPI/types/update/abstracts/Update.kt | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af0b7e5fde..e589ceb449 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,9 @@ ### 0.27.3 +* `TelegramBotAPI`: + * Currently `UpdateDeserializationStrategy` is publicly available + ### 0.27.2 * `Common`: diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt index fa2129f854..874d3860fc 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt @@ -26,7 +26,14 @@ internal object UpdateSerializerWithoutSerialization : KSerializer { override fun serialize(encoder: Encoder, value: Update) = throw UnsupportedOperationException() } -internal object UpdateDeserializationStrategy : DeserializationStrategy { +/** + * Use this object to deserialize objects with type [Update]. Currently it is restricted to use this + * [DeserializationStrategy] only with JSON + * + * @see StringFormat.parse + * @see kotlinx.serialization.json.Json.parse + */ +object UpdateDeserializationStrategy : DeserializationStrategy { override val descriptor: SerialDescriptor = JsonElementSerializer.descriptor override fun patch(decoder: Decoder, old: Update): Update = throw UpdateNotSupportedException("Update")