From 0b4b4950c28e44bc0174668f8a65bdbccf2b8fbc Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 12:54:15 +0600 Subject: [PATCH 01/11] started 0.25.0 --- CHANGELOG.md | 2 ++ gradle.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64ffa63f2e..80cf84c579 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # TelegramBotAPI changelog +## 0.25.0 + ## 0.24.0 * `TelegramBotAPI`: diff --git a/gradle.properties b/gradle.properties index 67f196be79..89302b1c16 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,6 @@ uuid_version=0.0.7 ktor_version=1.3.1 library_group=com.github.insanusmokrassar -library_version=0.24.1 +library_version=0.25.0 gradle_bintray_plugin_version=1.8.4 From a0120afb08c3b7edecd8e6ee6042cff9bae40284 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 12:56:52 +0600 Subject: [PATCH 02/11] now bot username is not nullable --- CHANGELOG.md | 3 +++ .../insanusmokrassar/TelegramBotAPI/types/User.kt | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80cf84c579..02f12fabf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 0.25.0 +* `TelegramBotAPI`: + * `Bot` implementations (as and `Bot` itself) now have not nullable `username` + ## 0.24.0 * `TelegramBotAPI`: diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt index d23a1ce1d0..8362b2cd42 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt @@ -22,17 +22,19 @@ data class CommonUser( ) : User() @Serializable(UserSerializer::class) -sealed class Bot : User() +sealed class Bot : User() { + abstract override val username: Username +} @Serializable data class CommonBot( override val id: ChatId, + @SerialName(usernameField) + override val username: Username, @SerialName(firstNameField) override val firstName: String, @SerialName(lastNameField) - override val lastName: String = "", - @SerialName(usernameField) - override val username: Username? = null + override val lastName: String = "" ) : Bot() { @SerialName(isBotField) private val isBot = true @@ -41,12 +43,12 @@ data class CommonBot( @Serializable data class ExtendedBot( override val id: ChatId, + @SerialName(usernameField) + override val username: Username, @SerialName(firstNameField) override val firstName: String, @SerialName(lastNameField) override val lastName: String = "", - @SerialName(usernameField) - override val username: Username? = null, @SerialName(canJoinGroupsField) val canJoinGroups: Boolean = false, @SerialName(canReadAllGroupMessagesField) From 574ffbc44d724124d5bbbc42f58ac77a4471c4ea Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 13:04:40 +0600 Subject: [PATCH 03/11] update versions --- CHANGELOG.md | 8 ++++++++ gradle.properties | 12 ++++++------ gradle/wrapper/gradle-wrapper.properties | 3 +-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02f12fabf9..b43081572c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ## 0.25.0 +* Common: + * Versions updates: + * `Kotlin`: `1.3.61` -> `1.3.70` + * `Kotlin coroutines`: `1.3.3` -> `1.3.5` + * `Kotlin serialization`: `0.14.0` -> `0.20.0` + * `Ktor`: `1.3.1` -> `1.3.2` + * `Klock`: `1.8.7` -> `1.10.0` + * `UUID`: `0.0.7` -> `0.1.0` * `TelegramBotAPI`: * `Bot` implementations (as and `Bot` itself) now have not nullable `username` diff --git a/gradle.properties b/gradle.properties index 89302b1c16..a917de2714 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,10 @@ kotlin.code.style=official -kotlin_version=1.3.61 -kotlin_coroutines_version=1.3.3 -kotlin_serialisation_runtime_version=0.14.0 -klock_version=1.8.7 -uuid_version=0.0.7 -ktor_version=1.3.1 +kotlin_version=1.3.70 +kotlin_coroutines_version=1.3.5 +kotlin_serialisation_runtime_version=0.20.0 +klock_version=1.10.0 +uuid_version=0.1.0 +ktor_version=1.3.2 library_group=com.github.insanusmokrassar library_version=0.25.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0879550bd9..8ef06692c2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Fri Nov 29 12:11:00 HKT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip From 6b3f836096f91033ccefb6c7ca5eec1912b83ae0 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 13:37:01 +0600 Subject: [PATCH 04/11] new libraries versions adaptation --- TelegramBotAPI/build.gradle | 3 ++ .../bot/Ktor/KtorRequestsExecutor.kt | 3 +- .../bot/exceptions/RequestException.kt | 2 +- .../TelegramBotAPI/requests/DeleteMessage.kt | 4 +- .../TelegramBotAPI/requests/GetUpdates.kt | 4 +- .../requests/abstracts/InputFile.kt | 4 +- .../requests/answers/AnswerCallbackQuery.kt | 4 +- .../requests/answers/AnswerInlineQuery.kt | 9 ++-- .../answers/payments/AnswerShippingQuery.kt | 5 +- .../abstracts/AnswerPreCheckoutQuery.kt | 4 +- .../payments/abstracts/AnswerShippingQuery.kt | 4 +- .../requests/chat/ExportChatInviteLink.kt | 6 +-- .../TelegramBotAPI/requests/chat/LeaveChat.kt | 4 +- .../chat/get/GetChatAdministrators.kt | 4 +- .../requests/chat/get/GetChatMembersCount.kt | 4 +- .../requests/chat/members/KickChatMember.kt | 4 +- .../chat/members/PromoteChatMember.kt | 4 +- .../chat/members/RestrictChatMember.kt | 4 +- .../SetChatAdministratorCustomTitle.kt | 4 +- .../requests/chat/members/UnbanChatMember.kt | 4 +- .../requests/chat/modify/DeleteChatPhoto.kt | 4 +- .../requests/chat/modify/PinChatMessage.kt | 7 +-- .../chat/modify/SetChatDescription.kt | 4 +- .../chat/modify/SetChatPermissions.kt | 4 +- .../requests/chat/modify/SetChatPhoto.kt | 4 +- .../requests/chat/modify/SetChatTitle.kt | 4 +- .../requests/chat/modify/UnpinChatMessage.kt | 4 +- .../chat/stickers/DeleteChatStickerSet.kt | 4 +- .../chat/stickers/SetChatStickerSet.kt | 4 +- .../edit/abstracts/EditInlineMessage.kt | 4 +- .../games/abstracts/GetGameHighScores.kt | 4 +- .../requests/games/abstracts/SetGameScore.kt | 1 + .../requests/send/SendAction.kt | 4 +- .../requests/send/media/SendMediaGroup.kt | 6 +-- .../requests/stickers/DeleteStickerFromSet.kt | 4 +- .../stickers/SetStickerPositionInSet.kt | 4 +- .../stickers/abstracts/StickerSetAction.kt | 4 +- .../requests/webhook/DeleteWebhook.kt | 4 +- .../requests/webhook/SetWebhook.kt | 4 +- .../TelegramBotAPI/types/ChatIdentifier.kt | 8 ++-- .../types/ChatMember/abstracts/ChatMember.kt | 8 ++-- .../InlineQueryResultSerializer.kt | 46 +++++++++---------- .../InputMessageContentSerializer.kt | 14 +++--- .../types/InputMedia/InputMediaPhoto.kt | 2 +- .../types/InputMedia/InputMediaSerializer.kt | 18 ++++---- .../types/InputMedia/InputMediaVideo.kt | 2 +- .../MediaGroupMemberInputMediaSerializer.kt | 10 ++-- .../types/ParseMode/ParseMode.kt | 4 +- .../TelegramBotAPI/types/TelegramDate.kt | 4 +- .../TelegramBotAPI/types/User.kt | 17 +++---- .../TelegramBotAPI/types/UserProfilePhotos.kt | 4 +- .../TelegramBotAPI/types/actions/BotAction.kt | 4 +- .../InlineKeyboardButtonSerializer.kt | 24 ++++++---- .../types/buttons/KeyboardButton.kt | 17 +++---- .../types/buttons/KeyboardButtonPollType.kt | 4 +- .../types/buttons/KeyboardMarkupSerializer.kt | 17 ++++--- .../types/chat/ChatSerializers.kt | 39 ++++++++-------- .../TelegramBotAPI/types/files/PhotoSize.kt | 4 +- .../types/message/abstracts/Message.kt | 6 +-- .../types/payments/ShippingOption.kt | 4 +- .../TelegramBotAPI/types/polls/Poll.kt | 25 +++++----- .../TelegramBotAPI/types/polls/PollOption.kt | 8 ++-- .../types/update/abstracts/Update.kt | 13 +++--- .../TelegramBotAPI/utils/JSON.kt | 9 +++- 64 files changed, 243 insertions(+), 230 deletions(-) diff --git a/TelegramBotAPI/build.gradle b/TelegramBotAPI/build.gradle index 85296ef5fe..c475e31eed 100644 --- a/TelegramBotAPI/build.gradle +++ b/TelegramBotAPI/build.gradle @@ -39,6 +39,7 @@ kotlin { implementation kotlin('stdlib') api "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$kotlin_coroutines_version" api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$kotlin_serialisation_runtime_version" + api "org.jetbrains.kotlinx:kotlinx-serialization-properties-common:$kotlin_serialisation_runtime_version" api "com.soywiz.korlibs.klock:klock:$klock_version" api "com.benasher44:uuid:$uuid_version" @@ -56,6 +57,7 @@ kotlin { jvmMain { dependencies { api "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlin_serialisation_runtime_version" + api "org.jetbrains.kotlinx:kotlinx-serialization-properties:$kotlin_serialisation_runtime_version" api "io.ktor:ktor-client:$ktor_version" api "io.ktor:ktor-server:$ktor_version" @@ -73,6 +75,7 @@ kotlin { jsMain { dependencies { api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$kotlin_serialisation_runtime_version" + api "org.jetbrains.kotlinx:kotlinx-serialization-properties-js:$kotlin_serialisation_runtime_version" api "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$kotlin_coroutines_version" api "io.ktor:ktor-client-js:$ktor_version" } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt index 33d33a6bcc..ae1f2a4407 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt @@ -10,6 +10,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request import com.github.insanusmokrassar.TelegramBotAPI.types.Response import com.github.insanusmokrassar.TelegramBotAPI.types.RetryAfterError import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper +import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import io.ktor.client.HttpClient import io.ktor.client.call.receive import io.ktor.client.features.* @@ -25,7 +26,7 @@ class KtorRequestsExecutor( callsFactories: List = emptyList(), excludeDefaultFactories: Boolean = false, private val requestsLimiter: RequestLimiter = EmptyLimiter, - private val jsonFormatter: Json = Json.nonstrict + private val jsonFormatter: Json = nonstrictJsonFormat ) : BaseRequestsExecutor(telegramAPIUrlsKeeper) { private val callsFactories: List = callsFactories.run { if (!excludeDefaultFactories) { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt index 4ec766ec53..4db320d4c0 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt @@ -1,7 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions import com.github.insanusmokrassar.TelegramBotAPI.types.Response -import kotlinx.io.IOException +import io.ktor.utils.io.errors.IOException fun newRequestException( response: Response, diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt index d5280dabae..33437adbfc 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt @@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class DeleteMessage( @@ -19,7 +19,7 @@ data class DeleteMessage( override fun method(): String = "deleteMessage" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt index 4c5a4547c4..5f89bcc368 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt @@ -5,9 +5,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UpdateSerializerWithoutDeserialization import kotlinx.serialization.* -import kotlinx.serialization.internal.ArrayListSerializer +import kotlinx.serialization.builtins.ListSerializer -private val updatesListSerializer = ArrayListSerializer( +private val updatesListSerializer = ListSerializer( UpdateSerializerWithoutDeserialization ) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt index 4a7cebba14..6744a78c37 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt @@ -22,8 +22,8 @@ fun String.toInputFile() = FileId(this) @Serializer(InputFile::class) internal object InputFileSerializer : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName(FileId::class.toString()) - override fun serialize(encoder: Encoder, obj: InputFile) = encoder.encodeString(obj.fileId) + override val descriptor: SerialDescriptor = PrimitiveDescriptor(FileId::class.toString(), PrimitiveKind.STRING) + override fun serialize(encoder: Encoder, value: InputFile) = encoder.encodeString(value.fileId) override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString()) } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt index 74465b9d26..5ddac8095a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt @@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQuery.CallbackQuery import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class AnswerCallbackQuery( @@ -22,7 +22,7 @@ data class AnswerCallbackQuery( ) : SimpleRequest { override fun method(): String = "answerCallbackQuery" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt index 0fb9a4097a..039c038243 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt @@ -1,14 +1,13 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* 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 kotlinx.serialization.* -import kotlinx.serialization.internal.ArrayListSerializer -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.ListSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class AnswerInlineQuery( @@ -30,7 +29,7 @@ data class AnswerInlineQuery( ): SimpleRequest { override fun method(): String = "answerInlineQuery" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } @@ -52,6 +51,6 @@ fun InlineQuery.createAnswer( switchPmParameter ) -internal object InlineQueryAnswersResultsSerializer: KSerializer> by ArrayListSerializer( +internal object InlineQueryAnswersResultsSerializer: KSerializer> by ListSerializer( InlineQueryResultSerializer ) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt index 8a9c41d455..5e61840797 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt @@ -1,12 +1,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerShippingQuery import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingOption import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingQuery import kotlinx.serialization.* -import kotlinx.serialization.internal.ArrayListSerializer +import kotlinx.serialization.builtins.ListSerializer @Serializable data class AnswerShippingQueryOk( @@ -22,7 +21,7 @@ data class AnswerShippingQueryOk( get() = serializer() } -internal object ShippingOptionsSerializer : KSerializer> by ArrayListSerializer( +internal object ShippingOptionsSerializer : KSerializer> by ListSerializer( ShippingOption.serializer() ) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerPreCheckoutQuery.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerPreCheckoutQuery.kt index 20388ba7e2..4fcca89ae9 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerPreCheckoutQuery.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerPreCheckoutQuery.kt @@ -3,12 +3,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abs import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.PreCheckoutQueryId import kotlinx.serialization.KSerializer -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer interface AnswerPreCheckoutQuery : SimpleRequest { override fun method(): String = "answerPreCheckoutQuery" override val resultDeserializer: KSerializer - get() = BooleanSerializer + get() = Boolean.serializer() val preCheckoutQueryId: PreCheckoutQueryId val isOk: Boolean diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerShippingQuery.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerShippingQuery.kt index cf9b8f3e5b..49dcba9c5e 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerShippingQuery.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerShippingQuery.kt @@ -3,12 +3,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abs import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.ShippingQueryIdentifier import kotlinx.serialization.DeserializationStrategy -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer interface AnswerShippingQuery : SimpleRequest { override fun method(): String = "answerShippingQuery" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() val shippingQueryId: ShippingQueryIdentifier val isOk: Boolean diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt index a0532da8a9..67bcb3b17a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt @@ -1,13 +1,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* -import kotlinx.serialization.internal.StringSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class ExportChatInviteLink( @@ -16,7 +14,7 @@ data class ExportChatInviteLink( ): ChatRequest, SimpleRequest { override fun method(): String = "exportChatInviteLink" override val resultDeserializer: DeserializationStrategy - get() = StringSerializer + get() = String.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt index 956e2e4a43..ea0d1dc729 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt @@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class LeaveChat( @@ -16,7 +16,7 @@ data class LeaveChat( ): ChatRequest, SimpleRequest { override fun method(): String = "leaveChat" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt index 0e43498c1c..a2ae400d83 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt @@ -9,9 +9,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.Adm import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* -import kotlinx.serialization.internal.ArrayListSerializer +import kotlinx.serialization.builtins.ListSerializer -private val chatMembersListSerializer = ArrayListSerializer( +private val chatMembersListSerializer = ListSerializer( AdministratorChatMemberSerializerWithoutDeserialization ) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt index 2ba659c347..85b24b0cc0 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt @@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* -import kotlinx.serialization.internal.IntSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class GetChatMembersCount( @@ -16,7 +16,7 @@ data class GetChatMembersCount( ): ChatRequest, SimpleRequest { override fun method(): String = "getChatMembersCount" override val resultDeserializer: DeserializationStrategy - get() = IntSerializer + get() = Int.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt index 740a699cc7..6fb3ebafc9 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt @@ -6,7 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMe import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class KickChatMember( @@ -19,7 +19,7 @@ data class KickChatMember( ) : ChatMemberRequest, UntilDate { override fun method(): String = "kickChatMember" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt index 1e8a9eeb91..bee0174a14 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt @@ -6,7 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMe import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class PromoteChatMember( @@ -35,7 +35,7 @@ data class PromoteChatMember( ) : ChatMemberRequest, UntilDate { override fun method(): String = "promoteChatMember" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt index 2986af0c7c..d7cc099c8b 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt @@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class RestrictChatMember( @@ -22,7 +22,7 @@ data class RestrictChatMember( ) : ChatMemberRequest, UntilDate { override fun method(): String = "restrictChatMember" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt index 91785b0299..c97035fb38 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt @@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMe import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer /** * Representation of https://core.telegram.org/bots/api#setchatadministratorcustomtitle @@ -23,7 +23,7 @@ data class SetChatAdministratorCustomTitle( ) : ChatMemberRequest { override fun method(): String = "setChatAdministratorCustomTitle" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = RestrictChatMember.serializer() diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt index 005efe98e6..c7f47f66f9 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt @@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMe import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class UnbanChatMember( @@ -16,7 +16,7 @@ data class UnbanChatMember( ) : ChatMemberRequest { override fun method(): String = "unbanChatMember" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt index c88c03cfc7..3be6760e48 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt @@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class DeleteChatPhoto( @@ -16,7 +16,7 @@ data class DeleteChatPhoto( ): ChatRequest, SimpleRequest { override fun method(): String = "deleteChatPhoto" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt index a1d32f2209..41af62b0c3 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt @@ -1,13 +1,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.* -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class PinChatMessage ( @@ -20,7 +17,7 @@ data class PinChatMessage ( ): ChatRequest, SimpleRequest, MessageAction, DisableNotification { override fun method(): String = "pinChatMessage" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt index f62656f2cc..3dc2e89011 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt @@ -6,7 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class SetChatDescription ( @@ -23,7 +23,7 @@ data class SetChatDescription ( override fun method(): String = "setChatDescription" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt index 6909f1426f..96b5d3b5a5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt @@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class SetChatPermissions ( @@ -18,7 +18,7 @@ data class SetChatPermissions ( ): ChatRequest, SimpleRequest { override fun method(): String = "setChatPermissions" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt index 7d4ef9b408..52a623ca5e 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt @@ -8,7 +8,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.utils.toJson import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer import kotlinx.serialization.json.JsonObject @Serializable @@ -19,7 +19,7 @@ data class SetChatPhoto ( ): ChatRequest, MultipartRequest { override fun method(): String = "setChatPhoto" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val mediaMap: Map = mapOf(photoField to photo) override val paramsJson: JsonObject = toJson(serializer()) } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt index ba86c5954b..b1fd4d2161 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt @@ -6,7 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class SetChatTitle ( @@ -23,7 +23,7 @@ data class SetChatTitle ( override fun method(): String = "setChatTitle" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt index 8fee87557c..911e80fec3 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt @@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class UnpinChatMessage( @@ -16,7 +16,7 @@ data class UnpinChatMessage( ): ChatRequest, SimpleRequest { override fun method(): String = "unpinChatMessage" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt index bd27af1f3e..42e5fd8268 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt @@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class DeleteChatStickerSet( @@ -16,7 +16,7 @@ data class DeleteChatStickerSet( ): ChatRequest, SimpleRequest { override fun method(): String = "deleteChatStickerSet" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt index 4529f7c83e..144691c4b6 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt @@ -6,7 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class SetChatStickerSet( @@ -17,7 +17,7 @@ data class SetChatStickerSet( ): ChatRequest, SimpleRequest { override fun method(): String = "setChatStickerSet" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt index c2cf5fed0a..ae90e47c59 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt @@ -3,10 +3,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier import kotlinx.serialization.DeserializationStrategy -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer interface EditInlineMessage : SimpleRequest { val inlineMessageId: InlineMessageIdentifier override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() } \ No newline at end of file diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/GetGameHighScores.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/GetGameHighScores.kt index 0915454e86..a4017a85fa 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/GetGameHighScores.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/GetGameHighScores.kt @@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.UserId import com.github.insanusmokrassar.TelegramBotAPI.types.games.GameHighScore import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.KSerializer -import kotlinx.serialization.internal.ArrayListSerializer +import kotlinx.serialization.builtins.ListSerializer interface GetGameHighScores : SimpleRequest> { val userId: UserId @@ -15,4 +15,4 @@ interface GetGameHighScores : SimpleRequest> { get() = GameHighScoresSerializer } -internal object GameHighScoresSerializer : KSerializer> by ArrayListSerializer(GameHighScore.serializer()) +internal object GameHighScoresSerializer : KSerializer> by ListSerializer(GameHighScore.serializer()) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt index b0498392f1..285119fc0e 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt @@ -3,6 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.UserId import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.builtins.serializer import kotlinx.serialization.serializer interface SetGameScore : SimpleRequest { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt index 65fc2f4d36..154db6fcb9 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt @@ -6,7 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.actions.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer /** * Send notification to user which will be shown for 5 seconds or while user have no messages from bot @@ -20,7 +20,7 @@ data class SendAction( ): SendChatMessageRequest { override fun method(): String = "sendChatAction" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt index 63bae97836..f2e2f1b3b5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt @@ -12,7 +12,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaG import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass import com.github.insanusmokrassar.TelegramBotAPI.utils.toJsonWithoutNulls import kotlinx.serialization.* -import kotlinx.serialization.internal.ArrayListSerializer +import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.json.jsonArray val membersCountInMediaGroup: IntRange = 2 .. 10 @@ -55,8 +55,8 @@ fun SendMediaGroup( } } -private val messagesListSerializer: ArrayListSerializer - = ArrayListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass()) +private val messagesListSerializer: KSerializer> + = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass()) @Serializable data class SendMediaGroupData internal constructor( diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt index 46e52b243b..adbc82f59f 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt @@ -6,7 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class DeleteStickerFromSet( @@ -15,7 +15,7 @@ data class DeleteStickerFromSet( ) : SimpleRequest { override fun method(): String = "deleteStickerFromSet" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt index fb71206675..a60bb1012b 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt @@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker import com.github.insanusmokrassar.TelegramBotAPI.types.positionField import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable data class SetStickerPositionInSet( @@ -24,7 +24,7 @@ data class SetStickerPositionInSet( override fun method(): String = "setStickerPositionInSet" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StickerSetAction.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StickerSetAction.kt index d46e316e71..7563fb0752 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StickerSetAction.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StickerSetAction.kt @@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque import com.github.insanusmokrassar.TelegramBotAPI.types.UserId import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition import kotlinx.serialization.KSerializer -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer interface StickerSetAction : SimpleRequest { val userId: UserId @@ -13,5 +13,5 @@ interface StickerSetAction : SimpleRequest { val maskPosition: MaskPosition? override val resultDeserializer: KSerializer - get() = BooleanSerializer + get() = Boolean.serializer() } \ No newline at end of file diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/DeleteWebhook.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/DeleteWebhook.kt index b061cfb830..27a1df4256 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/DeleteWebhook.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/DeleteWebhook.kt @@ -2,14 +2,14 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer @Serializable class DeleteWebhook : SimpleRequest { override fun method(): String = "deleteWebhook" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt index 305611f57a..a29d9f2b9a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt @@ -6,7 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.DataR import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.MultipartRequestImpl import com.github.insanusmokrassar.TelegramBotAPI.types.* import kotlinx.serialization.* -import kotlinx.serialization.internal.BooleanSerializer +import kotlinx.serialization.builtins.serializer fun SetWebhook( url: String, @@ -53,7 +53,7 @@ data class SetWebhook internal constructor( ) : DataRequest { override fun method(): String = "setWebhook" override val resultDeserializer: DeserializationStrategy - get() = BooleanSerializer + get() = Boolean.serializer() override val requestSerializer: SerializationStrategy<*> get() = serializer() diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt index cc6d97f46e..a871bceaa3 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt @@ -49,10 +49,10 @@ internal object ChatIdentifierSerializer : KSerializer { } } - override fun serialize(encoder: Encoder, obj: ChatIdentifier) { - when (obj) { - is ChatId -> encoder.encodeLong(obj.chatId) - is Username -> encoder.encodeString(obj.username) + override fun serialize(encoder: Encoder, value: ChatIdentifier) { + when (value) { + is ChatId -> encoder.encodeLong(value.chatId) + is Username -> encoder.encodeString(value.username) } } } \ No newline at end of file diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt index 4137309d63..7a00b7b6ed 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt @@ -10,16 +10,16 @@ interface ChatMember { } internal object AdministratorChatMemberSerializerWithoutDeserialization : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName("ChatMemberSerializerWithoutDeserialization") + override val descriptor: SerialDescriptor = ChatMemberDeserializationStrategy.descriptor override fun deserialize(decoder: Decoder): AdministratorChatMember = ChatMemberDeserializationStrategy.deserialize(decoder) as AdministratorChatMember - override fun serialize(encoder: Encoder, obj: AdministratorChatMember) = throw UnsupportedOperationException() + override fun serialize(encoder: Encoder, value: AdministratorChatMember) = throw UnsupportedOperationException() } internal object ChatMemberDeserializationStrategy : DeserializationStrategy { - override val descriptor: SerialDescriptor = StringDescriptor.withName("ChatMemberDeserializationStrategy") + override val descriptor: SerialDescriptor = RawChatMember.serializer().descriptor override fun deserialize(decoder: Decoder): ChatMember = RawChatMember.serializer().deserialize(decoder).asChatMember - override fun patch(decoder: Decoder, old: ChatMember): ChatMember = throw UpdateNotSupportedException(descriptor.name) + override fun patch(decoder: Decoder, old: ChatMember): ChatMember = throw UpdateNotSupportedException("ChatMember") } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt index e114e76a84..a030020254 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt @@ -7,29 +7,29 @@ import kotlinx.serialization.internal.StringDescriptor @Serializer(InlineQueryResult::class) internal object InlineQueryResultSerializer : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName(InlineQueryResult::class.toString()) - override fun serialize(encoder: Encoder, obj: InlineQueryResult) { - when(obj) { - is InlineQueryResultArticle -> InlineQueryResultArticle.serializer().serialize(encoder, obj) - is InlineQueryResultAudioCachedImpl -> InlineQueryResultAudioCachedImpl.serializer().serialize(encoder, obj) - is InlineQueryResultAudioImpl -> InlineQueryResultAudioImpl.serializer().serialize(encoder, obj) - is InlineQueryResultContact -> InlineQueryResultContact.serializer().serialize(encoder, obj) - is InlineQueryResultDocumentCachedImpl -> InlineQueryResultDocumentCachedImpl.serializer().serialize(encoder, obj) - is InlineQueryResultDocumentImpl -> InlineQueryResultDocumentImpl.serializer().serialize(encoder, obj) - is InlineQueryResultGame -> InlineQueryResultGame.serializer().serialize(encoder, obj) - is InlineQueryResultGifCachedImpl -> InlineQueryResultGifCachedImpl.serializer().serialize(encoder, obj) - is InlineQueryResultGifImpl -> InlineQueryResultGifImpl.serializer().serialize(encoder, obj) - is InlineQueryResultLocation -> InlineQueryResultLocation.serializer().serialize(encoder, obj) - is InlineQueryResultMpeg4GifCachedImpl -> InlineQueryResultMpeg4GifCachedImpl.serializer().serialize(encoder, obj) - is InlineQueryResultMpeg4GifImpl -> InlineQueryResultMpeg4GifImpl.serializer().serialize(encoder, obj) - is InlineQueryResultPhotoCachedImpl -> InlineQueryResultPhotoCachedImpl.serializer().serialize(encoder, obj) - is InlineQueryResultPhotoImpl -> InlineQueryResultPhotoImpl.serializer().serialize(encoder, obj) - is InlineQueryResultStickerCached -> InlineQueryResultStickerCached.serializer().serialize(encoder, obj) - is InlineQueryResultVenue -> InlineQueryResultVenue.serializer().serialize(encoder, obj) - is InlineQueryResultVideoCachedImpl -> InlineQueryResultVideoCachedImpl.serializer().serialize(encoder, obj) - is InlineQueryResultVideoImpl -> InlineQueryResultVideoImpl.serializer().serialize(encoder, obj) - is InlineQueryResultVoiceCachedImpl -> InlineQueryResultVoiceCachedImpl.serializer().serialize(encoder, obj) - is InlineQueryResultVoiceImpl -> InlineQueryResultVoiceImpl.serializer().serialize(encoder, obj) + override val descriptor: SerialDescriptor = SerialDescriptor(InlineQueryResult::class.toString(), PolymorphicKind.OPEN) + override fun serialize(encoder: Encoder, value: InlineQueryResult) { + when(value) { + is InlineQueryResultArticle -> InlineQueryResultArticle.serializer().serialize(encoder, value) + is InlineQueryResultAudioCachedImpl -> InlineQueryResultAudioCachedImpl.serializer().serialize(encoder, value) + is InlineQueryResultAudioImpl -> InlineQueryResultAudioImpl.serializer().serialize(encoder, value) + is InlineQueryResultContact -> InlineQueryResultContact.serializer().serialize(encoder, value) + is InlineQueryResultDocumentCachedImpl -> InlineQueryResultDocumentCachedImpl.serializer().serialize(encoder, value) + is InlineQueryResultDocumentImpl -> InlineQueryResultDocumentImpl.serializer().serialize(encoder, value) + is InlineQueryResultGame -> InlineQueryResultGame.serializer().serialize(encoder, value) + is InlineQueryResultGifCachedImpl -> InlineQueryResultGifCachedImpl.serializer().serialize(encoder, value) + is InlineQueryResultGifImpl -> InlineQueryResultGifImpl.serializer().serialize(encoder, value) + is InlineQueryResultLocation -> InlineQueryResultLocation.serializer().serialize(encoder, value) + is InlineQueryResultMpeg4GifCachedImpl -> InlineQueryResultMpeg4GifCachedImpl.serializer().serialize(encoder, value) + is InlineQueryResultMpeg4GifImpl -> InlineQueryResultMpeg4GifImpl.serializer().serialize(encoder, value) + is InlineQueryResultPhotoCachedImpl -> InlineQueryResultPhotoCachedImpl.serializer().serialize(encoder, value) + is InlineQueryResultPhotoImpl -> InlineQueryResultPhotoImpl.serializer().serialize(encoder, value) + is InlineQueryResultStickerCached -> InlineQueryResultStickerCached.serializer().serialize(encoder, value) + is InlineQueryResultVenue -> InlineQueryResultVenue.serializer().serialize(encoder, value) + is InlineQueryResultVideoCachedImpl -> InlineQueryResultVideoCachedImpl.serializer().serialize(encoder, value) + is InlineQueryResultVideoImpl -> InlineQueryResultVideoImpl.serializer().serialize(encoder, value) + is InlineQueryResultVoiceCachedImpl -> InlineQueryResultVoiceCachedImpl.serializer().serialize(encoder, value) + is InlineQueryResultVoiceImpl -> InlineQueryResultVoiceImpl.serializer().serialize(encoder, value) } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt index 4eca591bbe..d1d6adfc67 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt @@ -7,13 +7,13 @@ import kotlinx.serialization.internal.StringDescriptor @Serializer(InputMessageContent::class) internal object InputMessageContentSerializer : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName(InputMessageContent::class.toString()) - override fun serialize(encoder: Encoder, obj: InputMessageContent) { - when (obj) { - is InputContactMessageContent -> InputContactMessageContent.serializer().serialize(encoder, obj) - is InputLocationMessageContent -> InputLocationMessageContent.serializer().serialize(encoder, obj) - is InputTextMessageContent -> InputTextMessageContent.serializer().serialize(encoder, obj) - is InputVenueMessageContent -> InputVenueMessageContent.serializer().serialize(encoder, obj) + override val descriptor: SerialDescriptor = SerialDescriptor(InputMessageContent::class.toString(), PolymorphicKind.OPEN) + override fun serialize(encoder: Encoder, value: InputMessageContent) { + when (value) { + is InputContactMessageContent -> InputContactMessageContent.serializer().serialize(encoder, value) + is InputLocationMessageContent -> InputLocationMessageContent.serializer().serialize(encoder, value) + is InputTextMessageContent -> InputTextMessageContent.serializer().serialize(encoder, value) + is InputVenueMessageContent -> InputVenueMessageContent.serializer().serialize(encoder, value) else -> throw IllegalArgumentException("Unknown for serializing InputContactMessageContent") } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaPhoto.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaPhoto.kt index 2e5ea13d13..e98e8b38f7 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaPhoto.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaPhoto.kt @@ -25,7 +25,7 @@ data class InputMediaPhoto( } @Transient - override val arguments: Map = Mapper.mapNullable(serializer(), this) + override val arguments: Map = Properties.storeNullable(serializer(), this) } fun PhotoSize.toInputMediaPhoto( diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt index 72b2f98050..078fc8448a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt @@ -5,15 +5,15 @@ import kotlinx.serialization.internal.StringDescriptor @Serializer(InputMedia::class) internal object InputMediaSerializer : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName(InputMedia::class.toString()) - override fun serialize(encoder: Encoder, obj: InputMedia) { - when (obj) { - is InputMediaVideo -> InputMediaVideo.serializer().serialize(encoder, obj) - is InputMediaAudio -> InputMediaAudio.serializer().serialize(encoder, obj) - is InputMediaPhoto -> InputMediaPhoto.serializer().serialize(encoder, obj) - is InputMediaAnimation -> InputMediaAnimation.serializer().serialize(encoder, obj) - is InputMediaDocument -> InputMediaDocument.serializer().serialize(encoder, obj) - else -> throw IllegalArgumentException("Can't perform and serialize $obj") + override val descriptor: SerialDescriptor = SerialDescriptor(InputMedia::class.toString(), PolymorphicKind.OPEN) + override fun serialize(encoder: Encoder, value: InputMedia) { + when (value) { + is InputMediaVideo -> InputMediaVideo.serializer().serialize(encoder, value) + is InputMediaAudio -> InputMediaAudio.serializer().serialize(encoder, value) + is InputMediaPhoto -> InputMediaPhoto.serializer().serialize(encoder, value) + is InputMediaAnimation -> InputMediaAnimation.serializer().serialize(encoder, value) + is InputMediaDocument -> InputMediaDocument.serializer().serialize(encoder, value) + else -> throw IllegalArgumentException("Can't perform and serialize $value") } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaVideo.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaVideo.kt index faf5a15f3c..1c32f30adb 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaVideo.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaVideo.kt @@ -28,5 +28,5 @@ data class InputMediaVideo( } @Transient - override val arguments: Map = Mapper.mapNullable(serializer(), this) + override val arguments: Map = Properties.storeNullable(serializer(), this) } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt index 235b67e871..5f097f33fd 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt @@ -5,11 +5,11 @@ import kotlinx.serialization.internal.StringDescriptor @Serializer(MediaGroupMemberInputMedia::class) internal object MediaGroupMemberInputMediaSerializer : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName(MediaGroupMemberInputMedia::class.toString()) - override fun serialize(encoder: Encoder, obj: MediaGroupMemberInputMedia) { - when (obj) { - is InputMediaPhoto -> InputMediaPhoto.serializer().serialize(encoder, obj) - is InputMediaVideo -> InputMediaVideo.serializer().serialize(encoder, obj) + override val descriptor: SerialDescriptor = SerialDescriptor(MediaGroupMemberInputMedia::class.toString(), PolymorphicKind.OPEN) + override fun serialize(encoder: Encoder, value: MediaGroupMemberInputMedia) { + when (value) { + is InputMediaPhoto -> InputMediaPhoto.serializer().serialize(encoder, value) + is InputMediaVideo -> InputMediaVideo.serializer().serialize(encoder, value) } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseMode/ParseMode.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseMode/ParseMode.kt index e3558593d7..9e53d9b5d7 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseMode/ParseMode.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseMode/ParseMode.kt @@ -43,7 +43,7 @@ internal object ParseModeSerializerObject : KSerializer { } } - override fun serialize(encoder: Encoder, obj: ParseMode) { - encoder.encodeString(obj.parseModeName) + override fun serialize(encoder: Encoder, value: ParseMode) { + encoder.encodeString(value.parseModeName) } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDate.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDate.kt index 62e19cbbf0..f4ac135f99 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDate.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDate.kt @@ -24,9 +24,9 @@ fun DateTime.toTelegramDate(): TelegramDate = TelegramDate(this) @Serializer(TelegramDate::class) internal object TelegramDateSerializer : KSerializer { - override fun serialize(encoder: Encoder, obj: TelegramDate) { + override fun serialize(encoder: Encoder, value: TelegramDate) { encoder.encodeLong( - obj.date + value.date ) } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt index 8362b2cd42..a4cefd2b2b 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt @@ -1,6 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat +import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObjectSerializer @@ -67,7 +68,7 @@ internal object UserSerializer : KSerializer { val asJson = JsonObjectSerializer.deserialize(decoder) return when { - asJson.getPrimitiveOrNull(isBotField) ?.booleanOrNull != true -> Json.nonstrict.fromJson( + asJson.getPrimitiveOrNull(isBotField) ?.booleanOrNull != true -> nonstrictJsonFormat.fromJson( CommonUser.serializer(), asJson ) @@ -76,12 +77,12 @@ internal object UserSerializer : KSerializer { ?: asJson.get(canReadAllGroupMessagesField) ?: asJson.get(supportInlineQueriesField)) != null ) { - Json.nonstrict.fromJson( + nonstrictJsonFormat.fromJson( ExtendedBot.serializer(), asJson ) } else { - Json.nonstrict.fromJson( + nonstrictJsonFormat.fromJson( CommonBot.serializer(), asJson ) @@ -90,11 +91,11 @@ internal object UserSerializer : KSerializer { } } - override fun serialize(encoder: Encoder, obj: User) { - when (obj) { - is CommonUser -> CommonUser.serializer().serialize(encoder, obj) - is CommonBot -> CommonBot.serializer().serialize(encoder, obj) - is ExtendedBot -> ExtendedBot.serializer().serialize(encoder, obj) + override fun serialize(encoder: Encoder, value: User) { + when (value) { + is CommonUser -> CommonUser.serializer().serialize(encoder, value) + is CommonBot -> CommonBot.serializer().serialize(encoder, value) + is ExtendedBot -> ExtendedBot.serializer().serialize(encoder, value) } } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserProfilePhotos.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserProfilePhotos.kt index 133610427b..21cdc9d9d5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserProfilePhotos.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserProfilePhotos.kt @@ -3,7 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types import com.github.insanusmokrassar.TelegramBotAPI.types.files.Photo import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSerializer import kotlinx.serialization.* -import kotlinx.serialization.internal.ArrayListSerializer +import kotlinx.serialization.builtins.ListSerializer @Serializable data class UserProfilePhotos ( @@ -13,6 +13,6 @@ data class UserProfilePhotos ( val photos: List ) -internal object UserProfilePhotosPhotosSerializer : KSerializer> by ArrayListSerializer( +internal object UserProfilePhotosPhotosSerializer : KSerializer> by ListSerializer( PhotoSerializer ) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/actions/BotAction.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/actions/BotAction.kt index 5f0915a211..f8bd33f045 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/actions/BotAction.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/actions/BotAction.kt @@ -9,8 +9,8 @@ sealed class BotAction { @Serializer(BotAction::class) internal object BotActionSerializer: KSerializer { - override fun serialize(encoder: Encoder, obj: BotAction) { - encoder.encodeString(obj.actionName) + override fun serialize(encoder: Encoder, value: BotAction) { + encoder.encodeString(value.actionName) } override fun deserialize(decoder: Decoder): BotAction { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt index 317cc57901..9d5a7c94c0 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt @@ -1,12 +1,16 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardButtons import com.github.insanusmokrassar.TelegramBotAPI.types.* +import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* import kotlinx.serialization.internal.StringDescriptor import kotlinx.serialization.json.* internal object InlineKeyboardButtonSerializer : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName("com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardButtons.InlineKeyboardButton") + override val descriptor: SerialDescriptor = SerialDescriptor( + "com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardButtons.InlineKeyboardButton", + PolymorphicKind.SEALED + ) private fun resolveSerializer(json: JsonObject): KSerializer { return when { @@ -23,17 +27,17 @@ internal object InlineKeyboardButtonSerializer : KSerializer CallbackDataInlineKeyboardButton.serializer().serialize(encoder, obj) - is LoginURLInlineKeyboardButton -> LoginURLInlineKeyboardButton.serializer().serialize(encoder, obj) - is PayInlineKeyboardButton -> PayInlineKeyboardButton.serializer().serialize(encoder, obj) - is SwitchInlineQueryInlineKeyboardButton -> SwitchInlineQueryInlineKeyboardButton.serializer().serialize(encoder, obj) - is SwitchInlineQueryCurrentChatInlineKeyboardButton -> SwitchInlineQueryCurrentChatInlineKeyboardButton.serializer().serialize(encoder, obj) - is URLInlineKeyboardButton -> URLInlineKeyboardButton.serializer().serialize(encoder, obj) + override fun serialize(encoder: Encoder, value: InlineKeyboardButton) { + when (value) { + is CallbackDataInlineKeyboardButton -> CallbackDataInlineKeyboardButton.serializer().serialize(encoder, value) + is LoginURLInlineKeyboardButton -> LoginURLInlineKeyboardButton.serializer().serialize(encoder, value) + is PayInlineKeyboardButton -> PayInlineKeyboardButton.serializer().serialize(encoder, value) + is SwitchInlineQueryInlineKeyboardButton -> SwitchInlineQueryInlineKeyboardButton.serializer().serialize(encoder, value) + is SwitchInlineQueryCurrentChatInlineKeyboardButton -> SwitchInlineQueryCurrentChatInlineKeyboardButton.serializer().serialize(encoder, value) + is URLInlineKeyboardButton -> URLInlineKeyboardButton.serializer().serialize(encoder, value) } } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButton.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButton.kt index de8eee0c55..f913c0d07a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButton.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButton.kt @@ -1,6 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.buttons import com.github.insanusmokrassar.TelegramBotAPI.types.* +import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* import kotlinx.serialization.json.* @@ -58,7 +59,7 @@ internal object KeyboardButtonSerializer : KSerializer { ) asJson is JsonObject && asJson.getObjectOrNull(requestPollField) != null -> RequestPollKeyboardButton( asJson.getPrimitive(textField).content, - Json.nonstrict.fromJson( + nonstrictJsonFormat.fromJson( KeyboardButtonPollType.serializer(), asJson.getObject(requestPollField) ) @@ -74,13 +75,13 @@ internal object KeyboardButtonSerializer : KSerializer { } } - override fun serialize(encoder: Encoder, obj: KeyboardButton) { - when (obj) { - is RequestContactKeyboardButton -> RequestContactKeyboardButton.serializer().serialize(encoder, obj) - is RequestLocationKeyboardButton -> RequestLocationKeyboardButton.serializer().serialize(encoder, obj) - is RequestPollKeyboardButton -> RequestPollKeyboardButton.serializer().serialize(encoder, obj) - is SimpleKeyboardButton -> encoder.encodeString(obj.text) - is UnknownKeyboardButton -> JsonElementSerializer.serialize(encoder, Json.nonstrict.parseJson(obj.raw)) + override fun serialize(encoder: Encoder, value: KeyboardButton) { + when (value) { + is RequestContactKeyboardButton -> RequestContactKeyboardButton.serializer().serialize(encoder, value) + is RequestLocationKeyboardButton -> RequestLocationKeyboardButton.serializer().serialize(encoder, value) + is RequestPollKeyboardButton -> RequestPollKeyboardButton.serializer().serialize(encoder, value) + is SimpleKeyboardButton -> encoder.encodeString(value.text) + is UnknownKeyboardButton -> JsonElementSerializer.serialize(encoder, nonstrictJsonFormat.parseJson(value.raw)) } } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButtonPollType.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButtonPollType.kt index b4140699f3..aef28823a3 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButtonPollType.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButtonPollType.kt @@ -42,12 +42,12 @@ internal object KeyboardButtonPollTypeSerializer : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName(KeyboardMarkup::class.toString()) - override fun serialize(encoder: Encoder, obj: KeyboardMarkup) { - when(obj) { - is ForceReply -> ForceReply.serializer().serialize(encoder, obj) - is InlineKeyboardMarkup -> InlineKeyboardMarkup.serializer().serialize(encoder, obj) - is ReplyKeyboardMarkup -> ReplyKeyboardMarkup.serializer().serialize(encoder, obj) - is ReplyKeyboardRemove -> ReplyKeyboardRemove.serializer().serialize(encoder, obj) + override val descriptor: SerialDescriptor = SerialDescriptor( + KeyboardMarkup::class.toString(), + PolymorphicKind.OPEN + ) + override fun serialize(encoder: Encoder, value: KeyboardMarkup) { + when(value) { + is ForceReply -> ForceReply.serializer().serialize(encoder, value) + is InlineKeyboardMarkup -> InlineKeyboardMarkup.serializer().serialize(encoder, value) + is ReplyKeyboardMarkup -> ReplyKeyboardMarkup.serializer().serialize(encoder, value) + is ReplyKeyboardRemove -> ReplyKeyboardRemove.serializer().serialize(encoder, value) } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatSerializers.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatSerializers.kt index abb66ad729..927a59966a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatSerializers.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatSerializers.kt @@ -5,16 +5,15 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.UnknownChatType import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended.* +import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* -import kotlinx.serialization.internal.LongSerializer -import kotlinx.serialization.internal.StringDescriptor -import kotlinx.serialization.json.Json +import kotlinx.serialization.builtins.serializer import kotlinx.serialization.json.JsonObjectSerializer -private val formatter = Json.nonstrict +private val formatter = nonstrictJsonFormat internal object PreviewChatSerializer : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName("PreviewChatSerializer") + override val descriptor: SerialDescriptor = SerialDescriptor("PreviewChatSerializer", PolymorphicKind.OPEN) override fun deserialize(decoder: Decoder): Chat { val decodedJson = JsonObjectSerializer.deserialize(decoder) @@ -27,25 +26,25 @@ internal object PreviewChatSerializer : KSerializer { "supergroup" -> formatter.fromJson(SupergroupChatImpl.serializer(), decodedJson) "channel" -> formatter.fromJson(ChannelChatImpl.serializer(), decodedJson) else -> UnknownChatType( - formatter.fromJson(LongSerializer, decodedJson.getPrimitive(chatIdField)).toChatId(), + formatter.fromJson(Long.serializer(), decodedJson.getPrimitive(chatIdField)).toChatId(), decodedJson.toString() ) } } - override fun serialize(encoder: Encoder, obj: Chat) { - when (obj) { - is ExtendedChat -> ExtendedChatSerializer.serialize(encoder, obj) - is PrivateChatImpl -> PrivateChatImpl.serializer().serialize(encoder, obj) - is GroupChatImpl -> GroupChatImpl.serializer().serialize(encoder, obj) - is SupergroupChatImpl -> SupergroupChatImpl.serializer().serialize(encoder, obj) - is ChannelChatImpl -> ChannelChatImpl.serializer().serialize(encoder, obj) + override fun serialize(encoder: Encoder, value: Chat) { + when (value) { + is ExtendedChat -> ExtendedChatSerializer.serialize(encoder, value) + is PrivateChatImpl -> PrivateChatImpl.serializer().serialize(encoder, value) + is GroupChatImpl -> GroupChatImpl.serializer().serialize(encoder, value) + is SupergroupChatImpl -> SupergroupChatImpl.serializer().serialize(encoder, value) + is ChannelChatImpl -> ChannelChatImpl.serializer().serialize(encoder, value) } } } internal object ExtendedChatSerializer : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName("PreviewChatSerializer") + override val descriptor: SerialDescriptor = SerialDescriptor("PreviewChatSerializer", PolymorphicKind.OPEN) override fun deserialize(decoder: Decoder): ExtendedChat { val decodedJson = JsonObjectSerializer.deserialize(decoder) @@ -61,12 +60,12 @@ internal object ExtendedChatSerializer : KSerializer { } } - override fun serialize(encoder: Encoder, obj: ExtendedChat) { - when (obj) { - is ExtendedPrivateChatImpl -> ExtendedPrivateChatImpl.serializer().serialize(encoder, obj) - is ExtendedGroupChatImpl -> ExtendedGroupChatImpl.serializer().serialize(encoder, obj) - is ExtendedSupergroupChatImpl -> ExtendedSupergroupChatImpl.serializer().serialize(encoder, obj) - is ExtendedChannelChatImpl -> ExtendedChannelChatImpl.serializer().serialize(encoder, obj) + override fun serialize(encoder: Encoder, value: ExtendedChat) { + when (value) { + is ExtendedPrivateChatImpl -> ExtendedPrivateChatImpl.serializer().serialize(encoder, value) + is ExtendedGroupChatImpl -> ExtendedGroupChatImpl.serializer().serialize(encoder, value) + is ExtendedSupergroupChatImpl -> ExtendedSupergroupChatImpl.serializer().serialize(encoder, value) + is ExtendedChannelChatImpl -> ExtendedChannelChatImpl.serializer().serialize(encoder, value) } } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt index 93f9ae1b39..360070e62c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt @@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId import com.github.insanusmokrassar.TelegramBotAPI.types.fileUniqueIdField import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.* import kotlinx.serialization.* -import kotlinx.serialization.internal.ArrayListSerializer +import kotlinx.serialization.builtins.ListSerializer typealias Photo = List @@ -13,7 +13,7 @@ fun Photo.biggest(): PhotoSize? = maxBy { it.resolution } -internal object PhotoSerializer : KSerializer by ArrayListSerializer( +internal object PhotoSerializer : KSerializer by ListSerializer( PhotoSize.serializer() ) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt index 7a809c8b46..63f7dd4ce6 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt @@ -21,9 +21,9 @@ data class UnknownMessageType( ) : Message internal class TelegramBotAPIMessageDeserializationStrategyClass : DeserializationStrategy { - override val descriptor: SerialDescriptor = StringDescriptor.withName("TelegramBotAPIMessageSerializer") + override val descriptor: SerialDescriptor = SerialDescriptor("TelegramBotAPIMessageSerializer", PolymorphicKind.OPEN) - override fun patch(decoder: Decoder, old: T): T = throw UpdateNotSupportedException(descriptor.name) + override fun patch(decoder: Decoder, old: T): T = throw UpdateNotSupportedException("TelegramBotAPIMessageSerializer") override fun deserialize(decoder: Decoder): T { return RawMessage.serializer().deserialize(decoder).asMessage as T } @@ -40,7 +40,7 @@ internal class TelegramBotAPIMessageDeserializeOnlySerializerClass return deserializer.deserialize(decoder) } - override fun serialize(encoder: Encoder, obj: T) { + override fun serialize(encoder: Encoder, value: T) { throw UnsupportedOperationException("Currently, Message objects can't be serialized y this serializer") } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingOption.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingOption.kt index 95ab6ca48a..6fe86673e2 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingOption.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingOption.kt @@ -3,7 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.payments import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.payments.abstracts.Priced import kotlinx.serialization.* -import kotlinx.serialization.internal.ArrayListSerializer +import kotlinx.serialization.builtins.ListSerializer @Serializable data class ShippingOption( @@ -16,6 +16,6 @@ data class ShippingOption( override val prices: List ) : Priced -internal object LabeledPricesSerializer : KSerializer> by ArrayListSerializer( +internal object LabeledPricesSerializer : KSerializer> by ListSerializer( LabeledPrice.serializer() ) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt index 5334927df4..2c9990e5b5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt @@ -1,8 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.polls import com.github.insanusmokrassar.TelegramBotAPI.types.* +import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* -import kotlinx.serialization.internal.ArrayListSerializer +import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.json.* @Serializable(PollSerializer::class) @@ -73,23 +74,23 @@ data class QuizPoll( @Serializer(Poll::class) internal object PollSerializer : KSerializer { - private val pollOptionsSerializer = ArrayListSerializer(PollOption.serializer()) + private val pollOptionsSerializer = ListSerializer(PollOption.serializer()) override fun deserialize(decoder: Decoder): Poll { val asJson = JsonObjectSerializer.deserialize(decoder) return when (asJson.getPrimitive(typeField).content) { - regularPollType -> Json.nonstrict.fromJson( + regularPollType -> nonstrictJsonFormat.fromJson( RegularPoll.serializer(), asJson ) - quizPollType -> Json.nonstrict.fromJson( + quizPollType -> nonstrictJsonFormat.fromJson( QuizPoll.serializer(), asJson ) else -> UnknownPollType( asJson.getPrimitive(idField).content, asJson.getPrimitive(questionField).content, - Json.nonstrict.fromJson( + nonstrictJsonFormat.fromJson( pollOptionsSerializer, asJson.getArray(optionsField) ), @@ -101,17 +102,17 @@ internal object PollSerializer : KSerializer { } } - override fun serialize(encoder: Encoder, obj: Poll) { - val asJson = when (obj) { - is RegularPoll -> Json.nonstrict.toJson(RegularPoll.serializer(), obj) - is QuizPoll -> Json.nonstrict.toJson(QuizPoll.serializer(), obj) - is UnknownPollType -> throw IllegalArgumentException("Currently unable to correctly serialize object of poll $obj") + override fun serialize(encoder: Encoder, value: Poll) { + val asJson = when (value) { + is RegularPoll -> nonstrictJsonFormat.toJson(RegularPoll.serializer(), value) + is QuizPoll -> nonstrictJsonFormat.toJson(QuizPoll.serializer(), value) + is UnknownPollType -> throw IllegalArgumentException("Currently unable to correctly serialize object of poll $value") } val resultJson = JsonObject( - asJson.jsonObject + (typeField to when (obj) { + asJson.jsonObject + (typeField to when (value) { is RegularPoll -> JsonPrimitive(regularPollType) is QuizPoll -> JsonPrimitive(quizPollType) - is UnknownPollType -> throw IllegalArgumentException("Currently unable to correctly serialize object of poll $obj") + is UnknownPollType -> throw IllegalArgumentException("Currently unable to correctly serialize object of poll $value") }) ) JsonObjectSerializer.serialize(encoder, resultJson) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt index 247a7567aa..feebf09325 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt @@ -20,17 +20,17 @@ data class SimplePollOption ( ) : PollOption() internal object PollOptionSerializer : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName(PollOption::class.simpleName ?: "PollOption") + override val descriptor: SerialDescriptor = SimplePollOption.serializer().descriptor override fun deserialize(decoder: Decoder): PollOption = SimplePollOption.serializer().deserialize( decoder ) - override fun serialize(encoder: Encoder, obj: PollOption) { - when (obj) { + override fun serialize(encoder: Encoder, value: PollOption) { + when (value) { is SimplePollOption -> SimplePollOption.serializer().serialize( encoder, - obj + value ) } } 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 6d317c4071..536fd33827 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 @@ -2,9 +2,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.update.RawUpdate +import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor -import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonElementSerializer interface Update { @@ -18,21 +17,21 @@ data class UnknownUpdateType( ) : Update internal object UpdateSerializerWithoutDeserialization : KSerializer { - override val descriptor: SerialDescriptor = StringDescriptor.withName("UpdateSerializerWithoutDeserialization") + override val descriptor: SerialDescriptor = JsonElementSerializer.descriptor override fun deserialize(decoder: Decoder): Update = UpdateDeserializationStrategy.deserialize(decoder) - override fun serialize(encoder: Encoder, obj: Update) = throw UnsupportedOperationException() + override fun serialize(encoder: Encoder, value: Update) = throw UnsupportedOperationException() } internal object UpdateDeserializationStrategy : DeserializationStrategy { - override val descriptor: SerialDescriptor = StringDescriptor.withName("UpdateDeserializationStrategy") + override val descriptor: SerialDescriptor = JsonElementSerializer.descriptor - override fun patch(decoder: Decoder, old: Update): Update = throw UpdateNotSupportedException(descriptor.name) + override fun patch(decoder: Decoder, old: Update): Update = throw UpdateNotSupportedException("Update") override fun deserialize(decoder: Decoder): Update { val asJson = JsonElementSerializer.deserialize(decoder) - return Json.nonstrict.fromJson( + return nonstrictJsonFormat.fromJson( RawUpdate.serializer(), asJson ).asUpdate( diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt index 35e674808a..f579d13706 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt @@ -3,9 +3,16 @@ package com.github.insanusmokrassar.TelegramBotAPI.utils import kotlinx.serialization.SerializationStrategy import kotlinx.serialization.json.* +val nonstrictJsonFormat = Json { + isLenient = true + ignoreUnknownKeys = true + serializeSpecialFloatingPointValues = true + useArrayPolymorphism = true +} + inline fun T.toJsonWithoutNulls(serializer: SerializationStrategy): JsonObject = toJson(serializer).withoutNulls() -inline fun T.toJson(serializer: SerializationStrategy): JsonObject = Json.nonstrict.toJson( +inline fun T.toJson(serializer: SerializationStrategy): JsonObject = nonstrictJsonFormat.toJson( serializer, this ).jsonObject From c85faa73c0689a77542b9bdd0e89e1973c372c98 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 13:53:42 +0600 Subject: [PATCH 05/11] fixes --- .../TelegramBotAPI/types/ChatIdentifierTests.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt index bcf6f87870..68654a45e4 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt @@ -1,5 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types +import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json @@ -54,25 +55,25 @@ class ChatIdentifierTests { ) Example(chatIdentifierChatId.toChatId()).let { withChatId -> - val stringified = Json.plain.stringify(Example.serializer(), withChatId) + val stringified = nonstrictJsonFormat.stringify(Example.serializer(), withChatId) assertEquals(stringified, "{\"identifier\":$chatIdentifierChatId}") - val deserialized = Json.plain.parse(Example.serializer(), stringified) + val deserialized = nonstrictJsonFormat.parse(Example.serializer(), stringified) assertEquals(withChatId, deserialized) } Example(testUsername.toUsername()).let { withUsername -> - val stringified = Json.plain.stringify(Example.serializer(), withUsername) + val stringified = nonstrictJsonFormat.stringify(Example.serializer(), withUsername) assertEquals(stringified, "{\"identifier\":\"$testUsername\"}") - val deserialized = Json.plain.parse(Example.serializer(), stringified) + val deserialized = nonstrictJsonFormat.parse(Example.serializer(), stringified) assertEquals(withUsername, deserialized) } // Replace @ by empty string, because from time to time we can retrieve from Telegram system // username without starting @ symbol Example(testUsername.toUsername()).let { withUsername -> - val stringified = Json.plain.stringify(Example.serializer(), withUsername).replace("@", "") + val stringified = nonstrictJsonFormat.stringify(Example.serializer(), withUsername).replace("@", "") assertEquals("{\"identifier\":\"${testUsername.replace("@", "")}\"}", stringified) - val deserialized = Json.plain.parse(Example.serializer(), stringified) + val deserialized = nonstrictJsonFormat.parse(Example.serializer(), stringified) assertEquals(withUsername, deserialized) } } From 865edf385f085157774fb9f798c5ca1d6ec34003 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 14:07:00 +0600 Subject: [PATCH 06/11] fix several todo --- CHANGELOG.md | 3 +++ .../requests/send/SendLocation.kt | 1 - .../InlineKeyboardButton.kt | 1 - .../types/buttons/InlineKeyboardMarkup.kt | 18 +++++++++++++++++- .../abstracts/InputFileFromJavaFile.kt | 10 +++++++--- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b43081572c..060c8ae8f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ * `UUID`: `0.0.7` -> `0.1.0` * `TelegramBotAPI`: * `Bot` implementations (as and `Bot` itself) now have not nullable `username` + * `File#toInputFile` extension now will throw error when file does not exists + * `InlineKeyboardMarkup` will check that `PayInlineKeyboardButton` is the first in case if it is exists in + `keyboard` ## 0.24.0 diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt index 363dee4d01..f06c804c20 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt @@ -16,7 +16,6 @@ import kotlinx.serialization.* private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() -// TODO:: Add location tracker for tracking location @Serializable data class SendLocation( @SerialName(chatIdField) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt index d477c11b18..0c2da03af1 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt @@ -9,7 +9,6 @@ sealed class InlineKeyboardButton { abstract val text: String } -//TODO:: add check that this button first in a row (it MUST be first in a row) @Serializable data class PayInlineKeyboardButton( override val text: String, diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt index 64d3490c59..7529c49112 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt @@ -1,6 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.buttons import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardButtons.InlineKeyboardButton +import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardButtons.PayInlineKeyboardButton import com.github.insanusmokrassar.TelegramBotAPI.types.inlineKeyboardField import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -9,4 +10,19 @@ import kotlinx.serialization.Serializable data class InlineKeyboardMarkup( @SerialName(inlineKeyboardField) val keyboard: Matrix -) : KeyboardMarkup +) : KeyboardMarkup { + init { + val isTherePayButton = keyboard.any { it -> + it.any { + it is PayInlineKeyboardButton + } + } + if (isTherePayButton) { + // first button is not PayInlineKeyboardButton + val firstIsPaymentButton = keyboard.first().firstOrNull() is PayInlineKeyboardButton + if (!firstIsPaymentButton) { + error("In case if PayInlineKeyboardButton included in keyboard - it must ") + } + } + } +} diff --git a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFileFromJavaFile.kt b/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFileFromJavaFile.kt index 99b52b76e6..58193b52ac 100644 --- a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFileFromJavaFile.kt +++ b/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFileFromJavaFile.kt @@ -3,6 +3,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts import com.github.insanusmokrassar.TelegramBotAPI.utils.StorageFile import java.io.File -fun File.toInputFile() = MultipartFile( - StorageFile(this) -) +fun File.toInputFile() = if (exists()) { + MultipartFile( + StorageFile(this) + ) +} else { + error("Specified file $absolutePath does not exists") +} From 89881a7349d39b8b8e0278e4a1654772527ae84f Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 15:15:01 +0600 Subject: [PATCH 07/11] removing of deprecations --- CHANGELOG.md | 2 + .../TelegramBotAPI/bot/UpdatesPoller.kt | 10 -- .../requests/chat/get/GetChat.kt | 10 -- .../chat/get/GetChatAdministrators.kt | 10 -- .../requests/chat/get/GetChatMembersCount.kt | 10 -- .../requests/chat/members/GetChatMember.kt | 24 --- .../chat/members/RestrictChatMember.kt | 33 ---- .../SetChatAdministratorCustomTitle.kt | 28 ---- .../chat/modify/SetChatDescription.kt | 12 -- .../chat/modify/SetChatPermissions.kt | 12 -- .../requests/chat/modify/SetChatPhoto.kt | 12 -- .../edit/caption/EditChatMessageCaption.kt | 30 ---- .../edit/caption/EditInlineMessageCaption.kt | 8 - .../edit/media/EditChatMessageMedia.kt | 25 --- .../edit/media/EditInlineMessageMedia.kt | 7 - .../requests/edit/text/EditChatMessageText.kt | 31 ---- .../TelegramBotAPI/requests/get/GetFile.kt | 12 -- .../requests/get/GetStickerSet.kt | 14 -- .../requests/get/GetUserProfilePhotos.kt | 18 --- .../TelegramBotAPI/requests/send/SendVenue.kt | 56 ------- .../requests/send/media/SendAnimation.kt | 141 ----------------- .../requests/send/media/SendMediaGroup.kt | 22 --- .../requests/send/media/SendPhoto.kt | 92 ----------- .../requests/send/media/SendSticker.kt | 65 -------- .../requests/send/media/SendVideo.kt | 145 ------------------ .../requests/send/media/SendVoice.kt | 129 ---------------- .../requests/send/payments/SendInvoice.kt | 48 ------ .../requests/send/polls/SendPoll.kt | 133 ---------------- .../requests/stickers/AddStickerToSet.kt | 95 ------------ .../requests/webhook/GetWebhookInfo.kt | 3 - .../types/ChatMember/abstracts/ChatMember.kt | 1 - .../InlineQueryResultSerializer.kt | 1 - .../InputMessageContentSerializer.kt | 1 - .../types/InputMedia/InputMediaSerializer.kt | 1 - .../MediaGroupMemberInputMediaSerializer.kt | 1 - .../InlineKeyboardButtonSerializer.kt | 1 - .../types/message/ForwardInfo.kt | 33 ---- .../abstracts/PossiblyForwardedMessage.kt | 6 - .../updateshandlers/KtorUpdatesPoller.kt | 144 ----------------- .../updateshandlers/UpdatesFilter.kt | 43 ------ .../TelegramBotAPI/utils/Annotations.kt | 7 +- .../TelegramBotAPI/utils/JSON.kt | 6 +- .../TelegramBotAPI/utils/LinksFormatting.kt | 2 - .../utils/extensions/UpdatesPolling.kt | 118 -------------- .../TelegramBotAPI/TestsJsonFormat.kt | 12 ++ .../TelegramBotAPI/types/BotActionTests.kt | 5 +- .../types/ChatIdentifierTests.kt | 15 +- .../TelegramBotAPI/types/ParseModeTests.kt | 9 +- .../TelegramBotAPI/types/TelegramDateTests.kt | 13 +- .../updateshandlers/KtorUpdatesCIOPoller.kt | 78 ---------- .../utils/extensions/Webhooks.kt | 6 +- 51 files changed, 47 insertions(+), 1693 deletions(-) delete mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/UpdatesPoller.kt delete mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/KtorUpdatesPoller.kt delete mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPolling.kt create mode 100644 TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt delete mode 100644 TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/KtorUpdatesCIOPoller.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 060c8ae8f6..084f9d3807 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ * `File#toInputFile` extension now will throw error when file does not exists * `InlineKeyboardMarkup` will check that `PayInlineKeyboardButton` is the first in case if it is exists in `keyboard` + * `makeLinkToMessage` now is not `PreviewFeature` + * All deprecations was removed ## 0.24.0 diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/UpdatesPoller.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/UpdatesPoller.kt deleted file mode 100644 index f2fb0a61ec..0000000000 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/UpdatesPoller.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.insanusmokrassar.TelegramBotAPI.bot - -import io.ktor.utils.io.core.Closeable -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers - -@Deprecated("Deprecated due to more simple way to get updates using TelegramBotAPI-extensions-api") -interface UpdatesPoller : Closeable { - fun start(scope: CoroutineScope = CoroutineScope(Dispatchers.Default)) -} \ No newline at end of file diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt index cd257a99f8..d32ecb534b 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt @@ -21,13 +21,3 @@ data class GetChat( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getChat( - chatId: ChatIdentifier -) = execute(GetChat(chatId)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getChat( - chat: Chat -) = getChat(chat.id) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt index a2ae400d83..434a05f450 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt @@ -26,13 +26,3 @@ data class GetChatAdministrators( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getChatAdministrators( - chatId: ChatIdentifier -) = execute(GetChatAdministrators(chatId)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getChatAdministrators( - chat: PublicChat -) = getChatAdministrators(chat.id) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt index 85b24b0cc0..112ba193e7 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt @@ -20,13 +20,3 @@ data class GetChatMembersCount( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getChatMembersCount( - chatId: ChatIdentifier -) = execute(GetChatMembersCount(chatId)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getChatMembersCount( - chat: PublicChat -) = getChatMembersCount(chat.id) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt index cb75a0da7a..deb26c79b1 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt @@ -21,27 +21,3 @@ data class GetChatMember( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getChatMember( - chatId: ChatIdentifier, - userId: UserId -) = execute(GetChatMember(chatId, userId)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getChatMember( - chat: PublicChat, - userId: UserId -) = getChatMember(chat.id, userId) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getChatMember( - chatId: ChatId, - user: User -) = getChatMember(chatId, user.id) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getChatMember( - chat: PublicChat, - user: User -) = getChatMember(chat.id, user.id) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt index d7cc099c8b..93b802d2a2 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt @@ -26,36 +26,3 @@ data class RestrictChatMember( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.restrictChatMember( - chatId: ChatIdentifier, - userId: UserId, - untilDate: TelegramDate? = null, - permissions: ChatPermissions = ChatPermissions() -) = execute(RestrictChatMember(chatId, userId, untilDate, permissions)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.restrictChatMember( - chat: PublicChat, - userId: UserId, - untilDate: TelegramDate? = null, - permissions: ChatPermissions = ChatPermissions() -) = restrictChatMember(chat.id, userId, untilDate, permissions) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.restrictChatMember( - chatId: ChatId, - user: User, - untilDate: TelegramDate? = null, - permissions: ChatPermissions = ChatPermissions() -) = restrictChatMember(chatId, user.id, untilDate, permissions) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.restrictChatMember( - chat: PublicChat, - user: User, - untilDate: TelegramDate? = null, - permissions: ChatPermissions = ChatPermissions() -) = restrictChatMember(chat.id, user.id, untilDate, permissions) - diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt index c97035fb38..95a490fa92 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt @@ -33,31 +33,3 @@ data class SetChatAdministratorCustomTitle( } } } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatAdministratorCustomTitle( - chatId: ChatId, - userId: UserId, - customTitle: String -) = execute(SetChatAdministratorCustomTitle(chatId, userId, customTitle)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatAdministratorCustomTitle( - chat: PublicChat, - userId: UserId, - customTitle: String -) = setChatAdministratorCustomTitle(chat.id, userId, customTitle) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatAdministratorCustomTitle( - chatId: ChatId, - user: User, - customTitle: String -) = setChatAdministratorCustomTitle(chatId, user.id, customTitle) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatAdministratorCustomTitle( - chat: PublicChat, - user: User, - customTitle: String -) = setChatAdministratorCustomTitle(chat.id, user.id, customTitle) \ No newline at end of file diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt index 3dc2e89011..fa3f8f91da 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt @@ -27,15 +27,3 @@ data class SetChatDescription ( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatDescription( - chatId: ChatIdentifier, - description: String -) = execute(SetChatDescription(chatId, description)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatDescription( - chat: PublicChat, - description: String -) = setChatDescription(chat.id, description) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt index 96b5d3b5a5..4d022d4163 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt @@ -22,15 +22,3 @@ data class SetChatPermissions ( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setDefaultChatMembersPermissions( - chatId: ChatIdentifier, - permissions: ChatPermissions -) = execute(SetChatPermissions(chatId, permissions)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setDefaultChatMembersPermissions( - chat: PublicChat, - permissions: ChatPermissions -) = setDefaultChatMembersPermissions(chat.id, permissions) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt index 52a623ca5e..7b63260702 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt @@ -23,15 +23,3 @@ data class SetChatPhoto ( override val mediaMap: Map = mapOf(photoField to photo) override val paramsJson: JsonObject = toJson(serializer()) } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatPhoto( - chatId: ChatIdentifier, - photo: MultipartFile -) = execute(SetChatPhoto(chatId, photo)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatPhoto( - chat: PublicChat, - photo: MultipartFile -) = setChatPhoto(chat.id, photo) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt index e818a68484..5f2523d5fb 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt @@ -35,33 +35,3 @@ data class EditChatMessageCaption( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageCaption( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - text: String, - parseMode: ParseMode? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = execute( - EditChatMessageCaption(chatId, messageId, text, parseMode, replyMarkup) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageCaption( - chat: Chat, - messageId: MessageIdentifier, - text: String, - parseMode: ParseMode? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageCaption(chat.id, messageId, text, parseMode, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageCaption( - message: ContentMessage, - text: String, - parseMode: ParseMode? = null, - replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage where T : CaptionedInput, T : MediaContent { - return editMessageCaption(message.chat.id, message.messageId, text, parseMode, replyMarkup) -} diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt index 59688e9763..a75463e1e6 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt @@ -23,11 +23,3 @@ data class EditInlineMessageCaption( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageCaption( - inlineMessageId: InlineMessageIdentifier, - text: String, - parseMode: ParseMode? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = execute(EditInlineMessageCaption(inlineMessageId, text, parseMode, replyMarkup)) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt index ef7b97dede..88deaf9e90 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt @@ -40,28 +40,3 @@ data class EditChatMessageMedia( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageMedia( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - media: InputMedia, - replyMarkup: InlineKeyboardMarkup? = null -) = execute( - EditChatMessageMedia(chatId, messageId, media, replyMarkup) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageMedia( - chat: Chat, - messageId: MessageIdentifier, - media: InputMedia, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageMedia(chat.id, messageId, media, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageMedia( - message: ContentMessage, - media: InputMedia, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageMedia(message.chat.id, message.messageId, media, replyMarkup) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt index 5d90e71ecb..009a418861 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt @@ -28,10 +28,3 @@ data class EditInlineMessageMedia( override fun method(): String = editMessageMediaMethod } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageCaption( - inlineMessageId: InlineMessageIdentifier, - media: InputMedia, - replyMarkup: InlineKeyboardMarkup? = null -) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup)) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt index 416e75742b..1298dd39bf 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt @@ -36,34 +36,3 @@ data class EditChatMessageText( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageText( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - text: String, - parseMode: ParseMode? = null, - disableWebPagePreview: Boolean? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = execute( - EditChatMessageText(chatId, messageId, text, parseMode, disableWebPagePreview, replyMarkup) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageText( - chat: Chat, - messageId: MessageIdentifier, - text: String, - parseMode: ParseMode? = null, - disableWebPagePreview: Boolean? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageText(chat.id, messageId, text, parseMode, disableWebPagePreview, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageText( - message: ContentMessage, - text: String, - parseMode: ParseMode? = null, - disableWebPagePreview: Boolean? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageText(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup) \ No newline at end of file diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt index 74c689a05c..8af8be3e07 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt @@ -19,15 +19,3 @@ data class GetFile( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getFileAdditionalInfo( - fileId: FileId -) = execute( - GetFile(fileId) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getFileAdditionalInfo( - file: TelegramMediaFile -) = getFileAdditionalInfo(file.fileId) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt index ccc410e957..8469808cd9 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt @@ -18,17 +18,3 @@ data class GetStickerSet( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getStickerSet( - name: String -) = execute( - GetStickerSet(name) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getStickerSet( - sticker: Sticker -) = getStickerSet( - sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method") -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt index 84b12ec02c..ec12767fae 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt @@ -29,21 +29,3 @@ data class GetUserProfilePhotos( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getUserProfilePhotos( - userId: UserId, - offset: Int? = null, - limit: Int? = null -) = execute( - GetUserProfilePhotos( - userId, offset, limit - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getUserProfilePhotos( - user: CommonUser, - offset: Int? = null, - limit: Int? = null -) = getUserProfilePhotos(user.id, offset, limit) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt index 0bb20b9c4d..4a7df3a869 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt @@ -75,59 +75,3 @@ fun Venue.toRequest( replyToMessageId, replyMarkup ) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVenue( - chatId: ChatIdentifier, - latitude: Double, - longitude: Double, - title: String, - address: String, - foursquareId: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVenue( - chatId, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVenue( - chat: Chat, - latitude: Double, - longitude: Double, - title: String, - address: String, - foursquareId: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVenue( - chat.id, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVenue( - chatId: ChatIdentifier, - venue: Venue, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVenue( - chatId, venue, disableNotification, replyToMessageId, replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVenue( - chat: Chat, - venue: Venue, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVenue( - chat.id, venue, disableNotification, replyToMessageId, replyMarkup -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt index 08140cec76..4d90d13f52 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt @@ -115,144 +115,3 @@ data class SendAnimationFiles internal constructor( animationField to animation, thumbField to thumb ) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: FileId, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendAnimationData( - chatId, - animation.fileId, - thumb ?.fileId, - text, - parseMode, - duration, - width, - height, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: AnimationFile, - thumb: PhotoSize? = animation.thumb, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAnimation( - chatId, animation.fileId, thumb ?.fileId, text, parseMode, animation.duration, animation.width, animation.height, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendAnimationData( - chatId, null, thumb ?.fileId, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup - ), - SendAnimationFiles(animation) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendAnimationData( - chatId, null, null, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup - ), - SendAnimationFiles(animation, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendAnimationData( - chatId, animation.fileId, null, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup - ), - SendAnimationFiles(null, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: MultipartFile, - thumb: PhotoSize? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAnimation( - chatId, animation, thumb ?.fileId , text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: AnimationFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAnimation( - chatId, animation.fileId, thumb, text, parseMode, animation.duration, animation.width, animation.height, disableNotification, replyToMessageId, replyMarkup -) - diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt index f2e2f1b3b5..ab3162ce58 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt @@ -87,25 +87,3 @@ data class SendMediaGroupData internal constructor( data class SendMediaGroupFiles internal constructor( val files: List ) : Files by (files.map { it.fileId to it }.toMap()) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendMediaGroup( - chatId: ChatIdentifier, - media: List, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null -) = execute( - SendMediaGroup( - chatId, media, disableNotification, replyToMessageId - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendMediaGroup( - chat: Chat, - media: List, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null -) = sendMediaGroup( - chat.id, media, disableNotification, replyToMessageId -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt index 289985641c..28b89345b6 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt @@ -85,95 +85,3 @@ data class SendPhotoFiles internal constructor( ) : Files by mapOf( photoField to photo ) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendPhoto( - chatId: ChatIdentifier, - fileId: FileId, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendPhotoData( - chatId, - fileId.fileId, - caption, - parseMode, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendPhoto( - chatId: ChatIdentifier, - file: PhotoSize, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendPhoto( - chatId, file.fileId, caption, parseMode, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendPhoto( - chatId: ChatIdentifier, - photo: Photo, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendPhoto( - chatId, photo.biggest() ?: throw IllegalArgumentException("Photo $photo is empty"), caption, parseMode, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendPhoto( - chat: Chat, - fileId: FileId, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendPhoto( - chat.id, - fileId, - caption, - parseMode, - disableNotification, - replyToMessageId, - replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendPhoto( - chat: Chat, - file: PhotoSize, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendPhoto( - chat.id, file.fileId, caption, parseMode, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendPhoto( - chat: Chat, - photo: Photo, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendPhoto( - chat.id, photo.biggest() ?: throw IllegalArgumentException("Photo $photo is empty"), caption, parseMode, disableNotification, replyToMessageId, replyMarkup -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt index 3fbfd21974..b6db8ee837 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt @@ -65,68 +65,3 @@ data class SendStickerByFile internal constructor( override val mediaMap: Map = mapOf(stickerField to sticker) override val paramsJson: JsonObject = sendStickerByFileId.toJsonWithoutNulls(SendStickerByFileId.serializer()) } - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendSticker( - chatId: ChatIdentifier, - sticker: FileId, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendStickerByFileId(chatId, sticker, disableNotification, replyToMessageId, replyMarkup) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendSticker( - chatId: ChatIdentifier, - sticker: MultipartFile, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendStickerByFile( - SendStickerByFileId(chatId, null, disableNotification, replyToMessageId, replyMarkup), - sticker - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendSticker( - chat: Chat, - sticker: FileId, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendSticker(chat.id, sticker, disableNotification, replyToMessageId, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendSticker( - chat: Chat, - sticker: MultipartFile, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendSticker(chat.id, sticker, disableNotification, replyToMessageId, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendSticker( - chatId: ChatIdentifier, - sticker: Sticker, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendSticker( - chatId, sticker.fileId, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendSticker( - chat: Chat, - sticker: Sticker, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendSticker(chat.id, sticker.fileId, disableNotification, replyToMessageId, replyMarkup) - diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt index 0ff86d9ab0..c4b08c8bde 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt @@ -119,148 +119,3 @@ data class SendVideoFiles internal constructor( videoField to video, thumbField to thumb ) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: FileId, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVideoData( - chatId, - video.fileId, - thumb ?.fileId, - text, - parseMode, - duration, - width, - height, - null, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: VideoFile, - thumb: PhotoSize? = video.thumb, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVideo( - chatId, video.fileId, thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - supportStreaming: Boolean? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendVideoData( - chatId, null, thumb ?.fileId, text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup - ), - SendVideoFiles(video) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - supportStreaming: Boolean? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendVideoData( - chatId, null, null, text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup - ), - SendVideoFiles(video, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendVideoData( - chatId, video.fileId, null, text, parseMode, duration, width, height, null, disableNotification, replyToMessageId, replyMarkup - ), - SendVideoFiles(null, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: MultipartFile, - thumb: PhotoSize? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - supportStreaming: Boolean? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVideo( - chatId, video, thumb ?.fileId , text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: VideoFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVideo( - chatId, video.fileId, thumb, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, replyMarkup -) - diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt index 46b6e3c499..90e14a0c47 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt @@ -106,132 +106,3 @@ data class SendVoiceFiles internal constructor( voiceField to voice, thumbField to thumb ) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: FileId, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVoiceData( - chatId, - voice.fileId, - thumb ?.fileId, - text, - parseMode, - duration, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: AudioFile, - thumb: PhotoSize? = voice.thumb, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVoice( - chatId, voice.fileId, thumb ?.fileId, text, parseMode, voice.duration, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendVoiceData( - chatId, null, thumb ?.fileId, text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup - ), - SendVoiceFiles(voice) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendVoiceData( - chatId, null, null, text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup - ), - SendVoiceFiles(voice, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendVoiceData( - chatId, voice.fileId, null, text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup - ), - SendVoiceFiles(null, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: MultipartFile, - thumb: PhotoSize? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVoice( - chatId, voice, thumb ?.fileId , text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: AudioFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVoice( - chatId, voice.fileId, thumb, text, parseMode, voice.duration, disableNotification, replyToMessageId, replyMarkup -) - diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt index 74579a267c..9e1b06cacf 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt @@ -106,51 +106,3 @@ data class SendInvoice( photoHeight = null } } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendInvoice( - chatId: ChatId, - title: String, - description: String, - payload: String, - providerToken: String, - startParameter: StartParameter, - currency: Currency, - prices: List, - providerData: String? = null, - requireName: Boolean = false, - requirePhoneNumber: Boolean = false, - requireEmail: Boolean = false, - requireShippingAddress: Boolean = false, - shouldSendPhoneNumberToProvider: Boolean = false, - shouldSendEmailToProvider: Boolean = false, - priceDependOnShipAddress: Boolean = false, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = execute( - SendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendInvoice( - user: CommonUser, - title: String, - description: String, - payload: String, - providerToken: String, - startParameter: StartParameter, - currency: Currency, - prices: List, - providerData: String? = null, - requireName: Boolean = false, - requirePhoneNumber: Boolean = false, - requireEmail: Boolean = false, - requireShippingAddress: Boolean = false, - shouldSendPhoneNumberToProvider: Boolean = false, - shouldSendEmailToProvider: Boolean = false, - priceDependOnShipAddress: Boolean = false, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = sendInvoice(user.id, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt index 1298576c65..28cd72abdf 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt @@ -185,136 +185,3 @@ data class SendQuizPoll( } } } - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendRegularPoll( - chatId: ChatIdentifier, - question: String, - options: List, - isAnonymous: Boolean = true, - isClosed: Boolean = false, - allowMultipleAnswers: Boolean = false, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendRegularPoll( - chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup - ) -) -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendRegularPoll( - chatId: ChatIdentifier, - poll: RegularPoll, - isClosed: Boolean = false, - question: String = poll.question, - options: List = poll.options.map { it.text }, - isAnonymous: Boolean = poll.isAnonymous, - allowMultipleAnswers: Boolean = poll.allowMultipleAnswers, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendRegularPoll( - chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendRegularPoll( - chat: Chat, - question: String, - options: List, - isAnonymous: Boolean = true, - isClosed: Boolean = false, - allowMultipleAnswers: Boolean = false, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendRegularPoll( - chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendRegularPoll( - chat: Chat, - poll: RegularPoll, - isClosed: Boolean = false, - question: String = poll.question, - options: List = poll.options.map { it.text }, - isAnonymous: Boolean = poll.isAnonymous, - allowMultipleAnswers: Boolean = poll.allowMultipleAnswers, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendRegularPoll( - chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup -) - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendQuizPoll( - chatId: ChatIdentifier, - question: String, - options: List, - correctOptionId: Int, - isAnonymous: Boolean = true, - isClosed: Boolean = false, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendQuizPoll( - chatId, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendQuizPoll( - chat: Chat, - question: String, - options: List, - correctOptionId: Int, - isAnonymous: Boolean = true, - isClosed: Boolean = false, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendQuizPoll( - chat.id, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendQuizPoll( - chatId: ChatIdentifier, - isClosed: Boolean = false, - quizPoll: QuizPoll, - question: String = quizPoll.question, - options: List = quizPoll.options.map { it.text }, - correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"), - isAnonymous: Boolean = quizPoll.isAnonymous, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendQuizPoll( - chatId, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendQuizPoll( - chat: Chat, - isClosed: Boolean = false, - quizPoll: QuizPoll, - question: String = quizPoll.question, - options: List = quizPoll.options.map { it.text }, - correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"), - isAnonymous: Boolean = quizPoll.isAnonymous, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendQuizPoll( - chat.id, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStickerToSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStickerToSet.kt index 4069488cc5..46a34dcbad 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStickerToSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStickerToSet.kt @@ -50,98 +50,3 @@ data class AddStickerToSet internal constructor( override fun method(): String = "addStickerToSet" } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.addStickerToSet( - userId: UserId, - stickerSetName: String, - sticker: FileId, - emojis: String, - maskPosition: MaskPosition? = null -) = execute( - AddStickerToSet( - userId, stickerSetName, emojis, sticker, maskPosition - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.addStickerToSet( - userId: UserId, - stickerSetName: String, - sticker: MultipartFile, - emojis: String, - maskPosition: MaskPosition? = null -) = execute( - CommonMultipartFileRequest( - AddStickerToSet( - userId, stickerSetName, emojis, null, maskPosition - ), - mapOf(pngStickerField to sticker) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.addStickerToSet( - user: CommonUser, - stickerSetName: String, - sticker: FileId, - emojis: String, - maskPosition: MaskPosition? = null -) = addStickerToSet( - user.id, stickerSetName, sticker, emojis, maskPosition -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.addStickerToSet( - user: CommonUser, - stickerSetName: String, - sticker: MultipartFile, - emojis: String, - maskPosition: MaskPosition? = null -) = addStickerToSet( - user.id, stickerSetName, sticker, emojis, maskPosition -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.addStickerToSet( - userId: UserId, - stickerSet: StickerSet, - sticker: FileId, - emojis: String, - maskPosition: MaskPosition? = null -) = addStickerToSet( - userId, stickerSet.name, sticker, emojis, maskPosition -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.addStickerToSet( - userId: UserId, - stickerSet: StickerSet, - sticker: MultipartFile, - emojis: String, - maskPosition: MaskPosition? = null -) = addStickerToSet( - userId, stickerSet.name, sticker, emojis, maskPosition -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.addStickerToSet( - user: CommonUser, - stickerSet: StickerSet, - sticker: FileId, - emojis: String, - maskPosition: MaskPosition? = null -) = addStickerToSet( - user.id, stickerSet.name, sticker, emojis, maskPosition -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.addStickerToSet( - user: CommonUser, - stickerSet: StickerSet, - sticker: MultipartFile, - emojis: String, - maskPosition: MaskPosition? = null -) = addStickerToSet( - user.id, stickerSet.name, sticker, emojis, maskPosition -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt index 1d3332f4a6..218f59a08c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt @@ -14,6 +14,3 @@ class GetWebhookInfo : SimpleRequest { override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getWebhookInfo() = execute(GetWebhookInfo()) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt index 7a00b7b6ed..93c60cbf9b 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt @@ -3,7 +3,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.RawChatMember import com.github.insanusmokrassar.TelegramBotAPI.types.User import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor interface ChatMember { val user: User diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt index a030020254..91a03bb442 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt @@ -3,7 +3,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQue import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.* import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor @Serializer(InlineQueryResult::class) internal object InlineQueryResultSerializer : KSerializer { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt index d1d6adfc67..eefeae7248 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt @@ -3,7 +3,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InputMessageContent.* import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor @Serializer(InputMessageContent::class) internal object InputMessageContentSerializer : KSerializer { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt index 078fc8448a..9da0db77fe 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt @@ -1,7 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor @Serializer(InputMedia::class) internal object InputMediaSerializer : KSerializer { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt index 5f097f33fd..2f57259689 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt @@ -1,7 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor @Serializer(MediaGroupMemberInputMedia::class) internal object MediaGroupMemberInputMediaSerializer : KSerializer { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt index 9d5a7c94c0..59a168aaf5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt @@ -3,7 +3,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardB import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor import kotlinx.serialization.json.* internal object InlineKeyboardButtonSerializer : KSerializer { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt index 4ca379de2e..f6fff2681d 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt @@ -2,54 +2,21 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.ChannelChat -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -@Deprecated( - "Renamed", - ReplaceWith( - "ForwardInfo", - "com.github.insanusmokrassar.TelegramBotAPI.types.message.ForwardInfo" - ) -) -typealias ForwardedMessage = ForwardInfo sealed class ForwardInfo { abstract val dateOfOriginal: TelegramDate } -@Deprecated( - "Renamed", - ReplaceWith( - "AnonymousForwardInfo", - "com.github.insanusmokrassar.TelegramBotAPI.types.message.AnonymousForwardInfo" - ) -) -typealias AnonymousForwardedMessage = AnonymousForwardInfo data class AnonymousForwardInfo( override val dateOfOriginal: TelegramDate, val senderName: String ) : ForwardInfo() -@Deprecated( - "Renamed", - ReplaceWith( - "UserForwardInfo", - "com.github.insanusmokrassar.TelegramBotAPI.types.message.UserForwardInfo" - ) -) -typealias UserForwardedMessage = UserForwardInfo data class UserForwardInfo( override val dateOfOriginal: TelegramDate, val from: User ) : ForwardInfo() -@Deprecated( - "Renamed", - ReplaceWith( - "ForwardFromChannelInfo", - "com.github.insanusmokrassar.TelegramBotAPI.types.message.ForwardFromChannelInfo" - ) -) -typealias ForwardedFromChannelMessage = ForwardFromChannelInfo data class ForwardFromChannelInfo( override val dateOfOriginal: TelegramDate, val messageId: MessageIdentifier, diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyForwardedMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyForwardedMessage.kt index 01e2b58768..225de5af71 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyForwardedMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyForwardedMessage.kt @@ -4,10 +4,4 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.ForwardInfo interface PossiblyForwardedMessage : Message { val forwardInfo: ForwardInfo? - @Deprecated( - "Renamed", - ReplaceWith("forwardInfo") - ) - val forwarded: ForwardInfo? - get() = forwardInfo } \ No newline at end of file diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/KtorUpdatesPoller.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/KtorUpdatesPoller.kt deleted file mode 100644 index 81f393e2d5..0000000000 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/KtorUpdatesPoller.kt +++ /dev/null @@ -1,144 +0,0 @@ -package com.github.insanusmokrassar.TelegramBotAPI.updateshandlers - -import com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.KtorRequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.bot.UpdatesPoller -import com.github.insanusmokrassar.TelegramBotAPI.requests.GetUpdates -import com.github.insanusmokrassar.TelegramBotAPI.requests.webhook.DeleteWebhook -import com.github.insanusmokrassar.TelegramBotAPI.types.ALL_UPDATES_LIST -import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage -import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate -import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update -import com.github.insanusmokrassar.TelegramBotAPI.utils.* -import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.executeUnsafe -import io.ktor.client.HttpClient -import io.ktor.client.engine.HttpClientEngine -import kotlinx.coroutines.* -import kotlinx.coroutines.channels.Channel - -@Deprecated("Deprecated due to more simple way to get updates using TelegramBotAPI-extensions-api") -fun KtorUpdatesPoller( - telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, - engine: HttpClientEngine, - timeoutSeconds: Int? = null, - oneTimeUpdatesLimit: Int? = null, - allowedUpdates: List = ALL_UPDATES_LIST, - exceptionsHandler: (Exception) -> Boolean = { true }, - updatesReceiver: UpdateReceiver -): KtorUpdatesPoller { - val executor = KtorRequestsExecutor( - telegramAPIUrlsKeeper, - HttpClient(engine) - ) - - return KtorUpdatesPoller( - executor, - timeoutSeconds, - oneTimeUpdatesLimit, - allowedUpdates, - exceptionsHandler, - updatesReceiver - ) -} - -@Deprecated("Deprecated due to more simple way to get updates using TelegramBotAPI-extensions-api") -class KtorUpdatesPoller( - private val executor: RequestsExecutor, - private val timeoutSeconds: Int? = null, - private val oneTimeUpdatesLimit: Int? = null, - private val allowedUpdates: List = ALL_UPDATES_LIST, - private val exceptionsHandler: (Exception) -> Boolean = { true }, - private val updatesReceiver: UpdateReceiver -) : UpdatesPoller { - private var lastHandledUpdate: UpdateIdentifier = 0L - private val mediaGroup: MutableList = mutableListOf() - - private var pollerJob: Job? = null - - private suspend fun sendToBlock(data: Update) { - updatesReceiver(data) - lastHandledUpdate = data.updateId - } - - private suspend fun pushMediaGroupUpdate(update: BaseMessageUpdate? = null) { - val inputMediaGroupId = (update ?.data as? MediaGroupMessage) ?.mediaGroupId - if (mediaGroup.isNotEmpty() && inputMediaGroupId ?.equals(mediaGroup.mediaGroupId) != true) { - mediaGroup.sortBy { it.updateId } - mediaGroup.convertWithMediaGroupUpdates().forEach { - sendToBlock(it) - } - mediaGroup.clear() - } - inputMediaGroupId ?.let { - mediaGroup.add(update) - } ?: sendToBlock(update ?: return) - } - - private suspend fun getUpdates(): List { - return executor.execute( - GetUpdates( - lastHandledUpdate + 1, // incremented because offset counted from 1 when updates id from 0 - oneTimeUpdatesLimit, - timeoutSeconds, - allowedUpdates - ) - ) - } - - private suspend fun handleUpdates(updates: List) { - for (update in updates) { - (update as? BaseMessageUpdate) ?.let { - if (it.data is MediaGroupMessage) { - pushMediaGroupUpdate(it) - } else { - null - } - } ?:let { - pushMediaGroupUpdate() - sendToBlock(update) - } - } - - pushMediaGroupUpdate() - } - - private val startStopScope = CoroutineScope(Dispatchers.Default) - private val startStopQueue = Channel(2) - private val startStopJob = startStopScope.launch { - for (scope in startStopQueue) { - scope ?.also { - pollerJob ?: scope.launch { - executor.executeUnsafe(DeleteWebhook()) - while (isActive) { - try { - val updates = getUpdates() - handleUpdates(updates) - } catch (e: Exception) { - if (exceptionsHandler(e)) { - continue - } else { - close() - break - } - } - } - }.also { - pollerJob = it - } - } ?: also { - startStopQueue.close() - pollerJob ?.cancel() - startStopScope.cancel() - return@launch - } - } - } - override fun start(scope: CoroutineScope) { - startStopQueue.offer(scope) - } - - override fun close() { - startStopQueue.offer(null) - } -} \ No newline at end of file diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt index ba0daee6b7..868484ccb1 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt @@ -13,49 +13,6 @@ interface UpdatesFilter { val allowedUpdates: List } -@Deprecated( - "It is builder function for SimpleUpdatesFilter", - ReplaceWith( - "SimpleUpdatesFilter", - "com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.SimpleUpdatesFilter" - ) -) -fun UpdatesFilter( - messageCallback: UpdateReceiver? = null, - messageMediaGroupCallback: UpdateReceiver? = null, - editedMessageCallback: UpdateReceiver? = null, - editedMessageMediaGroupCallback: UpdateReceiver? = null, - channelPostCallback: UpdateReceiver? = null, - channelPostMediaGroupCallback: UpdateReceiver? = null, - editedChannelPostCallback: UpdateReceiver? = null, - editedChannelPostMediaGroupCallback: UpdateReceiver? = null, - chosenInlineResultCallback: UpdateReceiver? = null, - inlineQueryCallback: UpdateReceiver? = null, - callbackQueryCallback: UpdateReceiver? = null, - shippingQueryCallback: UpdateReceiver? = null, - preCheckoutQueryCallback: UpdateReceiver? = null, - pollUpdateCallback: UpdateReceiver? = null, - pollAnswerUpdateCallback: UpdateReceiver? = null, - unknownUpdateTypeCallback: UpdateReceiver? = null -) = SimpleUpdatesFilter( - messageCallback, - messageMediaGroupCallback, - editedMessageCallback, - editedMessageMediaGroupCallback, - channelPostCallback, - channelPostMediaGroupCallback, - editedChannelPostCallback, - editedChannelPostMediaGroupCallback, - chosenInlineResultCallback, - inlineQueryCallback, - callbackQueryCallback, - shippingQueryCallback, - preCheckoutQueryCallback, - pollUpdateCallback, - pollAnswerUpdateCallback, - unknownUpdateTypeCallback -) - data class SimpleUpdatesFilter( private val messageCallback: UpdateReceiver? = null, private val messageMediaGroupCallback: UpdateReceiver? = null, diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt index fc431a2ca1..a2a11b80ba 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt @@ -1,6 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.utils -import kotlin.Experimental.Level - -@Experimental(Level.WARNING) +@RequiresOptIn( + "It is possible, that bevahiour of this thing will be changed later", + RequiresOptIn.Level.WARNING +) annotation class PreviewFeature diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt index f579d13706..89aca12d12 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt @@ -3,16 +3,16 @@ package com.github.insanusmokrassar.TelegramBotAPI.utils import kotlinx.serialization.SerializationStrategy import kotlinx.serialization.json.* -val nonstrictJsonFormat = Json { +internal val nonstrictJsonFormat = Json { isLenient = true ignoreUnknownKeys = true serializeSpecialFloatingPointValues = true useArrayPolymorphism = true } -inline fun T.toJsonWithoutNulls(serializer: SerializationStrategy): JsonObject = toJson(serializer).withoutNulls() +fun T.toJsonWithoutNulls(serializer: SerializationStrategy): JsonObject = toJson(serializer).withoutNulls() -inline fun T.toJson(serializer: SerializationStrategy): JsonObject = nonstrictJsonFormat.toJson( +fun T.toJson(serializer: SerializationStrategy): JsonObject = nonstrictJsonFormat.toJson( serializer, this ).jsonObject diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/LinksFormatting.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/LinksFormatting.kt index cc7ec0d8ea..29523ab7ea 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/LinksFormatting.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/LinksFormatting.kt @@ -7,7 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended. private const val internalLinkBeginning = "https://t.me" -@PreviewFeature fun makeLinkToMessage( username: String, messageId: MessageIdentifier @@ -16,7 +15,6 @@ fun makeLinkToMessage( private val linkIdRedundantPartRegex = Regex("^-100") private val usernameBeginSymbolRegex = Regex("^@") -@PreviewFeature fun makeLinkToMessage( chat: ExtendedChat, messageId: MessageIdentifier diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPolling.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPolling.kt deleted file mode 100644 index 56295e5b51..0000000000 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPolling.kt +++ /dev/null @@ -1,118 +0,0 @@ -package com.github.insanusmokrassar.TelegramBotAPI.utils.extensions - -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.bot.UpdatesPoller -import com.github.insanusmokrassar.TelegramBotAPI.types.ALL_UPDATES_LIST -import com.github.insanusmokrassar.TelegramBotAPI.types.update.* -import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.* -import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update -import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.KtorUpdatesPoller -import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesFilter -import kotlinx.coroutines.* - -@Deprecated( - "Replaced", - ReplaceWith( - "UpdateReceiver", - "com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdateReceiver" - ) -) -typealias UpdateReceiver = com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdateReceiver - -@Deprecated("Replaced into TelegramBotAPI-extensions-api") -fun RequestsExecutor.startGettingOfUpdates( - timeoutMillis: Long = 30 * 1000, - scope: CoroutineScope = CoroutineScope(Dispatchers.Default), - allowedUpdates: List? = null, - block: UpdateReceiver -): UpdatesPoller { - return KtorUpdatesPoller( - this, - timeoutMillis.toInt() / 1000, - allowedUpdates = allowedUpdates ?: ALL_UPDATES_LIST, - updatesReceiver = block - ).also { - it.start(scope) - } -} - -@Deprecated("Replaced into TelegramBotAPI-extensions-api") -fun RequestsExecutor.startGettingOfUpdates( - messageCallback: UpdateReceiver? = null, - messageMediaGroupCallback: UpdateReceiver? = null, - editedMessageCallback: UpdateReceiver? = null, - editedMessageMediaGroupCallback: UpdateReceiver? = null, - channelPostCallback: UpdateReceiver? = null, - channelPostMediaGroupCallback: UpdateReceiver? = null, - editedChannelPostCallback: UpdateReceiver? = null, - editedChannelPostMediaGroupCallback: UpdateReceiver? = null, - chosenInlineResultCallback: UpdateReceiver? = null, - inlineQueryCallback: UpdateReceiver? = null, - callbackQueryCallback: UpdateReceiver? = null, - shippingQueryCallback: UpdateReceiver? = null, - preCheckoutQueryCallback: UpdateReceiver? = null, - pollCallback: UpdateReceiver? = null, - pollAnswerCallback: UpdateReceiver? = null, - timeoutMillis: Long = 30 * 1000, - scope: CoroutineScope = GlobalScope -): UpdatesPoller { - val filter = UpdatesFilter( - messageCallback, - messageMediaGroupCallback, - editedMessageCallback, - editedMessageMediaGroupCallback, - channelPostCallback, - channelPostMediaGroupCallback, - editedChannelPostCallback, - editedChannelPostMediaGroupCallback, - chosenInlineResultCallback, - inlineQueryCallback, - callbackQueryCallback, - shippingQueryCallback, - preCheckoutQueryCallback, - pollCallback, - pollAnswerCallback - ) - return startGettingOfUpdates( - timeoutMillis, - scope, - filter.allowedUpdates, - filter.asUpdateReceiver - ) -} - -@Deprecated("Replaced into TelegramBotAPI-extensions-api") -fun RequestsExecutor.startGettingOfUpdates( - messageCallback: UpdateReceiver? = null, - mediaGroupCallback: UpdateReceiver? = null, - editedMessageCallback: UpdateReceiver? = null, - channelPostCallback: UpdateReceiver? = null, - editedChannelPostCallback: UpdateReceiver? = null, - chosenInlineResultCallback: UpdateReceiver? = null, - inlineQueryCallback: UpdateReceiver? = null, - callbackQueryCallback: UpdateReceiver? = null, - shippingQueryCallback: UpdateReceiver? = null, - preCheckoutQueryCallback: UpdateReceiver? = null, - pollCallback: UpdateReceiver? = null, - pollAnswerCallback: UpdateReceiver? = null, - timeoutMillis: Long = 30 * 1000, - scope: CoroutineScope = CoroutineScope(Dispatchers.Default) -): UpdatesPoller = startGettingOfUpdates( - messageCallback = messageCallback, - messageMediaGroupCallback = mediaGroupCallback, - editedMessageCallback = editedMessageCallback, - editedMessageMediaGroupCallback = mediaGroupCallback, - channelPostCallback = channelPostCallback, - channelPostMediaGroupCallback = mediaGroupCallback, - editedChannelPostCallback = editedChannelPostCallback, - editedChannelPostMediaGroupCallback = mediaGroupCallback, - chosenInlineResultCallback = chosenInlineResultCallback, - inlineQueryCallback = inlineQueryCallback, - callbackQueryCallback = callbackQueryCallback, - shippingQueryCallback = shippingQueryCallback, - preCheckoutQueryCallback = preCheckoutQueryCallback, - pollCallback = pollCallback, - pollAnswerCallback = pollAnswerCallback, - timeoutMillis = timeoutMillis, - scope = scope -) diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt new file mode 100644 index 0000000000..50219dd4c5 --- /dev/null +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt @@ -0,0 +1,12 @@ +package com.github.insanusmokrassar.TelegramBotAPI + +import kotlinx.serialization.json.Json +import kotlinx.serialization.json.JsonConfiguration + +val TestsJsonFormat = Json(JsonConfiguration.Stable) +val NonstrictTestsJsonFormat = Json { + isLenient = true + ignoreUnknownKeys = true + serializeSpecialFloatingPointValues = true + useArrayPolymorphism = true +} diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt index a00391b948..bc1c2e3f27 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt @@ -1,5 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types +import com.github.insanusmokrassar.TelegramBotAPI.TestsJsonFormat import com.github.insanusmokrassar.TelegramBotAPI.types.actions.* import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable @@ -33,10 +34,10 @@ class BotActionTests { } private fun checkBotActionSerializeDeserialize(example: Example) { - val stringified = Json.plain.stringify(Example.serializer(), example) + val stringified = TestsJsonFormat.stringify(Example.serializer(), example) assertEquals("{\"botAction\":\"${example.botAction.actionName}\"}", stringified) - val deserialized = Json.plain.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) assertEquals(example, deserialized) diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt index 68654a45e4..a11c7a22ed 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt @@ -1,6 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types -import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat +import com.github.insanusmokrassar.TelegramBotAPI.NonstrictTestsJsonFormat +import com.github.insanusmokrassar.TelegramBotAPI.TestsJsonFormat import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json @@ -55,25 +56,25 @@ class ChatIdentifierTests { ) Example(chatIdentifierChatId.toChatId()).let { withChatId -> - val stringified = nonstrictJsonFormat.stringify(Example.serializer(), withChatId) + val stringified = NonstrictTestsJsonFormat.stringify(Example.serializer(), withChatId) assertEquals(stringified, "{\"identifier\":$chatIdentifierChatId}") - val deserialized = nonstrictJsonFormat.parse(Example.serializer(), stringified) + val deserialized = NonstrictTestsJsonFormat.parse(Example.serializer(), stringified) assertEquals(withChatId, deserialized) } Example(testUsername.toUsername()).let { withUsername -> - val stringified = nonstrictJsonFormat.stringify(Example.serializer(), withUsername) + val stringified = NonstrictTestsJsonFormat.stringify(Example.serializer(), withUsername) assertEquals(stringified, "{\"identifier\":\"$testUsername\"}") - val deserialized = nonstrictJsonFormat.parse(Example.serializer(), stringified) + val deserialized = NonstrictTestsJsonFormat.parse(Example.serializer(), stringified) assertEquals(withUsername, deserialized) } // Replace @ by empty string, because from time to time we can retrieve from Telegram system // username without starting @ symbol Example(testUsername.toUsername()).let { withUsername -> - val stringified = nonstrictJsonFormat.stringify(Example.serializer(), withUsername).replace("@", "") + val stringified = NonstrictTestsJsonFormat.stringify(Example.serializer(), withUsername).replace("@", "") assertEquals("{\"identifier\":\"${testUsername.replace("@", "")}\"}", stringified) - val deserialized = nonstrictJsonFormat.parse(Example.serializer(), stringified) + val deserialized = NonstrictTestsJsonFormat.parse(Example.serializer(), stringified) assertEquals(withUsername, deserialized) } } diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt index 42aa361716..6225bb715e 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt @@ -1,5 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types +import com.github.insanusmokrassar.TelegramBotAPI.TestsJsonFormat import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.* import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable @@ -18,10 +19,10 @@ class ParseModeTests { fun `Markdown parse mode correctly serializing and deserializing`() { val example = Example(Markdown) - val stringified = Json.plain.stringify(Example.serializer(), example) + val stringified = TestsJsonFormat.stringify(Example.serializer(), example) assertEquals("{\"mode\":\"Markdown\"}", stringified) - val deserialized = Json.plain.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) assertEquals(example, deserialized) } @@ -29,10 +30,10 @@ class ParseModeTests { fun `HTML parse mode correctly serializing and deserializing`() { val example = Example(HTML) - val stringified = Json.plain.stringify(Example.serializer(), example) + val stringified = TestsJsonFormat.stringify(Example.serializer(), example) assertEquals("{\"mode\":\"HTML\"}", stringified) - val deserialized = Json.plain.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) assertEquals(example, deserialized) } } diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt index 648965a44c..ec4fa3e8ae 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt @@ -1,16 +1,15 @@ package com.github.insanusmokrassar.TelegramBotAPI.types +import com.github.insanusmokrassar.TelegramBotAPI.NonstrictTestsJsonFormat import com.soywiz.klock.DateTime import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json -import java.util.concurrent.TimeUnit import kotlin.test.Test import kotlin.test.assertEquals -private val dateTimeMillis = System.currentTimeMillis() -private val dateTimeUnix = TimeUnit.MILLISECONDS.toSeconds(dateTimeMillis) -private val dateTime = DateTime(TimeUnit.SECONDS.toMillis(dateTimeUnix)) +private val dateTimeUnix = DateTime.nowUnixLong() +private val dateTimeMillis = dateTimeUnix * 1000 +private val dateTime = DateTime(dateTimeMillis) @ImplicitReflectionSerializer class TelegramDateTests { @@ -22,10 +21,10 @@ class TelegramDateTests { fun `Serializtion of TelegramDate is working correctly`() { val example = Example(TelegramDate(dateTimeUnix)) - val stringified = Json.plain.stringify(Example.serializer(), example) + val stringified = NonstrictTestsJsonFormat.stringify(Example.serializer(), example) assertEquals("{\"dateTime\":$dateTimeUnix}", stringified) - val deserialized = Json.plain.parse(Example.serializer(), stringified) + val deserialized = NonstrictTestsJsonFormat.parse(Example.serializer(), stringified) assertEquals(example, deserialized) assertEquals(dateTime, deserialized.dateTime.asDate) diff --git a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/KtorUpdatesCIOPoller.kt b/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/KtorUpdatesCIOPoller.kt deleted file mode 100644 index ba6d7be94c..0000000000 --- a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/KtorUpdatesCIOPoller.kt +++ /dev/null @@ -1,78 +0,0 @@ -package com.github.insanusmokrassar.TelegramBotAPI.updateshandlers - -import com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.KtorRequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.types.ALL_UPDATES_LIST -import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update -import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper -import io.ktor.client.HttpClient -import io.ktor.client.engine.HttpClientEngine -import io.ktor.client.engine.cio.CIO -import io.ktor.client.engine.cio.endpoint -import io.ktor.util.KtorExperimentalAPI - -@Deprecated("Deprecated due to more simple way to get updates using TelegramBotAPI-extensions-api") -@KtorExperimentalAPI -fun KtorUpdatesPoller( - telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, - timeoutSeconds: Int? = null, - oneTimeUpdatesLimit: Int? = null, - allowedUpdates: List = ALL_UPDATES_LIST, - exceptionsHandler: (Exception) -> Boolean = { true }, - updatesReceiver: UpdateReceiver -): KtorUpdatesPoller { - val executor = KtorRequestsExecutor( - telegramAPIUrlsKeeper, - HttpClient( - CIO.create { - endpoint { - timeoutSeconds ?.times(1000) ?.also { timeOutMillis -> - keepAliveTime = timeOutMillis.toLong() - } - connectTimeout = 1000 - } - } - ) - ) - - return KtorUpdatesPoller( - executor, - timeoutSeconds, - oneTimeUpdatesLimit, - allowedUpdates, - exceptionsHandler, - updatesReceiver - ) -} - -@Deprecated("Deprecated due to more simple way to get updates using TelegramBotAPI-extensions-api") -@KtorExperimentalAPI -fun KtorUpdatesPoller( - telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, - timeoutSeconds: Int? = null, - oneTimeUpdatesLimit: Int? = null, - allowedUpdates: List = ALL_UPDATES_LIST, - exceptionsHandler: (Exception) -> Boolean = { true }, - clientEngine: HttpClientEngine = CIO.create { - endpoint { - timeoutSeconds ?.times(1000) ?.also { timeOutMillis -> - keepAliveTime = timeOutMillis.toLong() - } - connectTimeout = 1000 - } - }, - updatesReceiver: UpdateReceiver -): KtorUpdatesPoller { - val executor = KtorRequestsExecutor( - telegramAPIUrlsKeeper, - HttpClient(clientEngine) - ) - - return KtorUpdatesPoller( - executor, - timeoutSeconds, - oneTimeUpdatesLimit, - allowedUpdates, - exceptionsHandler, - updatesReceiver - ) -} diff --git a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt b/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt index 1a6c82ce32..984a3372e9 100644 --- a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt +++ b/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt @@ -8,9 +8,11 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates import com.github.insanusmokrassar.TelegramBotAPI.types.update.RawUpdate import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update +import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdateReceiver import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesFilter import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.webhook.WebhookPrivateKeyConfig import com.github.insanusmokrassar.TelegramBotAPI.utils.convertWithMediaGroupUpdates +import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import io.ktor.application.call import io.ktor.request.receiveText import io.ktor.response.respond @@ -73,8 +75,8 @@ suspend fun RequestsExecutor.setWebhook( module { routing { post(listenRoute) { - val asJson = Json.nonstrict.parseJson(call.receiveText()) - val update = Json.nonstrict.fromJson( + val asJson = nonstrictJsonFormat.parseJson(call.receiveText()) + val update = nonstrictJsonFormat.fromJson( RawUpdate.serializer(), asJson ) From c5c8a743e67681a38b59c8e830a4e662b33db266 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 15:53:37 +0600 Subject: [PATCH 08/11] fixes in ChatIdentifierSerializer --- CHANGELOG.md | 2 ++ .../TelegramBotAPI/types/ChatIdentifier.kt | 15 +++++++++------ .../TelegramBotAPI/types/ChatIdentifierTests.kt | 14 ++++++-------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 084f9d3807..abcea7f75e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ `keyboard` * `makeLinkToMessage` now is not `PreviewFeature` * All deprecations was removed + * `RequestException` now extends `io.ktor.utils.io.errors.IOException` instead of `kotlinx.io.IOException` + * `Any#toJson` now is NOT `inline` ## 0.24.0 diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt index a871bceaa3..603eb5e838 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt @@ -1,6 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types import kotlinx.serialization.* +import kotlinx.serialization.json.JsonPrimitiveSerializer @Serializable(ChatIdentifierSerializer::class) sealed class ChatIdentifier @@ -39,13 +40,15 @@ fun String.toUsername(): Username = Username(this) @Serializer(ChatIdentifier::class) internal object ChatIdentifierSerializer : KSerializer { override fun deserialize(decoder: Decoder): ChatIdentifier { - val id = decoder.decodeString() - return id.toLongOrNull() ?.let { + val id = JsonPrimitiveSerializer.deserialize(decoder) + return id.longOrNull ?.let { ChatId(it) - } ?: if (!id.startsWith("@")) { - Username("@$id") - } else { - Username(id) + } ?: id.content.let { + if (!it.startsWith("@")) { + Username("@$it") + } else { + Username(it) + } } } diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt index a11c7a22ed..02005ee51c 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types -import com.github.insanusmokrassar.TelegramBotAPI.NonstrictTestsJsonFormat import com.github.insanusmokrassar.TelegramBotAPI.TestsJsonFormat import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json import kotlin.test.* @ImplicitReflectionSerializer @@ -56,25 +54,25 @@ class ChatIdentifierTests { ) Example(chatIdentifierChatId.toChatId()).let { withChatId -> - val stringified = NonstrictTestsJsonFormat.stringify(Example.serializer(), withChatId) + val stringified = TestsJsonFormat.stringify(Example.serializer(), withChatId) assertEquals(stringified, "{\"identifier\":$chatIdentifierChatId}") - val deserialized = NonstrictTestsJsonFormat.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) assertEquals(withChatId, deserialized) } Example(testUsername.toUsername()).let { withUsername -> - val stringified = NonstrictTestsJsonFormat.stringify(Example.serializer(), withUsername) + val stringified = TestsJsonFormat.stringify(Example.serializer(), withUsername) assertEquals(stringified, "{\"identifier\":\"$testUsername\"}") - val deserialized = NonstrictTestsJsonFormat.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) assertEquals(withUsername, deserialized) } // Replace @ by empty string, because from time to time we can retrieve from Telegram system // username without starting @ symbol Example(testUsername.toUsername()).let { withUsername -> - val stringified = NonstrictTestsJsonFormat.stringify(Example.serializer(), withUsername).replace("@", "") + val stringified = TestsJsonFormat.stringify(Example.serializer(), withUsername).replace("@", "") assertEquals("{\"identifier\":\"${testUsername.replace("@", "")}\"}", stringified) - val deserialized = NonstrictTestsJsonFormat.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) assertEquals(withUsername, deserialized) } } From d18863b7b3880309d5ea280f0f371d367040380e Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 15:56:05 +0600 Subject: [PATCH 09/11] TelegramDateTests now using strict json --- .../TelegramBotAPI/types/TelegramDateTests.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt index ec4fa3e8ae..faf94bf560 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt @@ -1,6 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types -import com.github.insanusmokrassar.TelegramBotAPI.NonstrictTestsJsonFormat +import com.github.insanusmokrassar.TelegramBotAPI.TestsJsonFormat import com.soywiz.klock.DateTime import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable @@ -21,10 +21,10 @@ class TelegramDateTests { fun `Serializtion of TelegramDate is working correctly`() { val example = Example(TelegramDate(dateTimeUnix)) - val stringified = NonstrictTestsJsonFormat.stringify(Example.serializer(), example) + val stringified = TestsJsonFormat.stringify(Example.serializer(), example) assertEquals("{\"dateTime\":$dateTimeUnix}", stringified) - val deserialized = NonstrictTestsJsonFormat.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) assertEquals(example, deserialized) assertEquals(dateTime, deserialized.dateTime.asDate) From fb34b0bec1fa67fa4ba71487823c034084b4045a Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 16:04:11 +0600 Subject: [PATCH 10/11] optimize imports --- .../extensions/api/send/media/SendAnimation.kt | 3 +-- .../TelegramBotAPI/extensions/api/send/media/SendAudio.kt | 3 +-- .../TelegramBotAPI/extensions/api/send/media/SendDocument.kt | 3 +-- .../TelegramBotAPI/extensions/api/send/media/SendPhoto.kt | 4 +--- .../TelegramBotAPI/extensions/api/send/media/SendSticker.kt | 4 +--- .../TelegramBotAPI/extensions/api/send/media/SendVideo.kt | 3 +-- .../extensions/api/send/media/SendVideoNote.kt | 3 +-- .../TelegramBotAPI/extensions/api/send/media/SendVoice.kt | 3 +-- .../TelegramBotAPI/requests/DeleteMessage.kt | 3 --- .../TelegramBotAPI/requests/ForwardMessage.kt | 5 ++--- .../github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt | 1 - .../insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt | 3 --- .../TelegramBotAPI/requests/abstracts/InputFile.kt | 1 - .../TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt | 1 - .../requests/answers/payments/AnswerPreCheckoutQuery.kt | 1 - .../TelegramBotAPI/requests/chat/LeaveChat.kt | 2 -- .../TelegramBotAPI/requests/chat/get/GetChat.kt | 2 -- .../requests/chat/get/GetChatAdministrators.kt | 2 -- .../TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt | 2 -- .../TelegramBotAPI/requests/chat/members/GetChatMember.kt | 2 -- .../TelegramBotAPI/requests/chat/members/KickChatMember.kt | 2 -- .../requests/chat/members/PromoteChatMember.kt | 2 -- .../requests/chat/members/RestrictChatMember.kt | 2 -- .../requests/chat/members/SetChatAdministratorCustomTitle.kt | 2 -- .../TelegramBotAPI/requests/chat/members/UnbanChatMember.kt | 2 -- .../TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt | 2 -- .../requests/chat/modify/SetChatDescription.kt | 2 -- .../requests/chat/modify/SetChatPermissions.kt | 2 -- .../TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt | 2 -- .../TelegramBotAPI/requests/chat/modify/SetChatTitle.kt | 2 -- .../TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt | 2 -- .../requests/chat/stickers/DeleteChatStickerSet.kt | 2 -- .../requests/chat/stickers/SetChatStickerSet.kt | 2 -- .../edit/LiveLocation/EditChatMessageLiveLocation.kt | 2 -- .../edit/LiveLocation/EditInlineMessageLiveLocation.kt | 1 - .../edit/LiveLocation/StopChatMessageLiveLocation.kt | 2 -- .../edit/LiveLocation/StopInlineMessageLiveLocation.kt | 1 - .../requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt | 5 ++--- .../edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt | 1 - .../requests/edit/caption/EditChatMessageCaption.kt | 3 --- .../requests/edit/caption/EditInlineMessageCaption.kt | 1 - .../requests/edit/media/EditChatMessageMedia.kt | 2 -- .../requests/edit/media/EditInlineMessageMedia.kt | 1 - .../TelegramBotAPI/requests/edit/text/EditChatMessageText.kt | 2 -- .../requests/edit/text/EditInlineMessageText.kt | 1 - .../TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt | 4 ---- .../requests/games/GetGameHighScoresByInlineMessageId.kt | 1 - .../TelegramBotAPI/requests/games/SetGameScoreByChatId.kt | 4 ---- .../requests/games/SetGameScoreByInlineMessageId.kt | 1 - .../TelegramBotAPI/requests/games/abstracts/SetGameScore.kt | 1 - .../insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt | 2 -- .../TelegramBotAPI/requests/get/GetStickerSet.kt | 2 -- .../TelegramBotAPI/requests/get/GetUserProfilePhotos.kt | 1 - .../TelegramBotAPI/requests/send/SendAction.kt | 4 +--- .../TelegramBotAPI/requests/send/SendContact.kt | 2 -- .../TelegramBotAPI/requests/send/SendLocation.kt | 4 ---- .../TelegramBotAPI/requests/send/SendMessage.kt | 2 -- .../TelegramBotAPI/requests/send/SendVenue.kt | 2 -- .../TelegramBotAPI/requests/send/games/SendGame.kt | 3 --- .../TelegramBotAPI/requests/send/media/SendAnimation.kt | 3 --- .../TelegramBotAPI/requests/send/media/SendAudio.kt | 3 --- .../TelegramBotAPI/requests/send/media/SendDocument.kt | 3 --- .../TelegramBotAPI/requests/send/media/SendMediaGroup.kt | 2 -- .../TelegramBotAPI/requests/send/media/SendPhoto.kt | 3 --- .../TelegramBotAPI/requests/send/media/SendSticker.kt | 3 --- .../TelegramBotAPI/requests/send/media/SendVideo.kt | 3 --- .../TelegramBotAPI/requests/send/media/SendVideoNote.kt | 3 --- .../TelegramBotAPI/requests/send/media/SendVoice.kt | 3 --- .../TelegramBotAPI/requests/send/payments/SendInvoice.kt | 1 - .../TelegramBotAPI/requests/send/polls/SendPoll.kt | 2 -- .../TelegramBotAPI/requests/stickers/AddStickerToSet.kt | 2 -- .../TelegramBotAPI/requests/stickers/CreateNewStickerSet.kt | 1 - .../TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt | 2 -- .../requests/stickers/SetStickerPositionInSet.kt | 2 -- .../TelegramBotAPI/requests/stickers/UploadStickerFile.kt | 1 - .../TelegramBotAPI/requests/webhook/GetWebhookInfo.kt | 1 - .../TelegramBotAPI/requests/webhook/SetWebhook.kt | 1 - .../com/github/insanusmokrassar/TelegramBotAPI/types/User.kt | 1 - .../InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt | 3 ++- .../TelegramBotAPI/types/buttons/KeyboardMarkupSerializer.kt | 1 - .../TelegramBotAPI/types/message/abstracts/Message.kt | 1 - .../TelegramBotAPI/types/polls/PollOption.kt | 1 - .../TelegramBotAPI/types/update/ChannelPostUpdate.kt | 1 - .../TelegramBotAPI/types/update/MessageUpdate.kt | 1 - .../insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt | 1 - .../types/MessageEntity/TextPartsCreatingTests.kt | 1 - .../insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt | 1 - .../TelegramBotAPI/utils/extensions/Webhooks.kt | 1 - 88 files changed, 15 insertions(+), 169 deletions(-) diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAnimation.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAnimation.kt index 26aabea908..28a3471007 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAnimation.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAnimation.kt @@ -1,14 +1,13 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAnimation import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize suspend fun RequestsExecutor.sendAnimation( chatId: ChatIdentifier, diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAudio.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAudio.kt index 49c3599d3f..afcbd0983d 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAudio.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAudio.kt @@ -1,14 +1,13 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAudio import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize suspend fun RequestsExecutor.sendAudio( chatId: ChatIdentifier, diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendDocument.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendDocument.kt index a59bfcc7b0..0e583adabc 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendDocument.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendDocument.kt @@ -1,14 +1,13 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendDocument import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize suspend fun RequestsExecutor.sendDocument( chatId: ChatIdentifier, diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendPhoto.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendPhoto.kt index 0d3d93311b..c42d4d8a0d 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendPhoto.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendPhoto.kt @@ -1,14 +1,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendPhoto import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.files.* suspend fun RequestsExecutor.sendPhoto( chatId: ChatIdentifier, diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendSticker.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendSticker.kt index 031c6d99bf..2235b2a960 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendSticker.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendSticker.kt @@ -1,13 +1,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendSticker import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker suspend fun RequestsExecutor.sendSticker( chatId: ChatIdentifier, diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideo.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideo.kt index dab5fb8eb9..38c9062991 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideo.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideo.kt @@ -1,13 +1,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideo import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile suspend fun RequestsExecutor.sendVideo( diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideoNote.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideoNote.kt index 15c6e16a97..21b3060189 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideoNote.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideoNote.kt @@ -1,13 +1,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideoNote import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile suspend fun RequestsExecutor.sendVideoNote( diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVoice.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVoice.kt index c837c19128..91e8e70ed2 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVoice.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVoice.kt @@ -1,14 +1,13 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVoice import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize suspend fun RequestsExecutor.sendVoice( chatId: ChatIdentifier, diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt index 33437adbfc..42a12caa77 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt @@ -1,11 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt index 807c0226a8..21c92f71cd 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt @@ -1,11 +1,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.* +import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.PossiblyForwardedMessage +import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import kotlinx.serialization.* private val AbleToBeForwardedMessageDeserializer = TelegramBotAPIMessageDeserializationStrategyClass() diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt index 03c8fe5407..b0cd428c8c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.ExtendedBot import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt index b203433871..9b8b83166b 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt @@ -2,12 +2,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt index 6744a78c37..03065c533b 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt @@ -2,7 +2,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts import com.github.insanusmokrassar.TelegramBotAPI.utils.StorageFile import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor @Serializable(InputFileSerializer::class) sealed class InputFile { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt index 5ddac8095a..077255c52c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQuery.CallbackQuery diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt index 2fa9b4277c..ff7d297270 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerPreCheckoutQuery import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.payments.PreCheckoutQuery diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt index ea0d1dc729..5148f965ca 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt index d32ecb534b..fb0decdbad 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt @@ -1,11 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ExtendedChatSerializer -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt index 434a05f450..28853f1f74 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt @@ -1,12 +1,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMember import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMemberSerializerWithoutDeserialization -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* import kotlinx.serialization.builtins.ListSerializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt index 112ba193e7..247f55b303 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt index deb26c79b1..7ec1b18bab 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt @@ -1,11 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMember import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMemberDeserializationStrategy -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* @Serializable diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt index 6fb3ebafc9..5037ab339f 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt index bee0174a14..1be36db1fd 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt index 93b802d2a2..8c6d255e76 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt @@ -1,11 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt index 95a490fa92..f91dcfc41b 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt @@ -1,9 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt index c7f47f66f9..3c82edcb31 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt @@ -1,9 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt index 3be6760e48..e3370a1efd 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt index fa3f8f91da..011d4680e0 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt index 4d022d4163..e0e075c75a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt @@ -1,11 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt index 7b63260702..6af5b3cfbb 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt @@ -1,11 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.utils.toJson import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt index b1fd4d2161..ac88f69f25 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt index 911e80fec3..8e9c2772c4 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt index 42e5fd8268..e44237b1fa 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt index 144691c4b6..17f4b485a3 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt index 7bdc3ace54..dcdc143392 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt index 1317b175c2..26b974cb3c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt index 66d0b8cc47..a0f1c3d9fe 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt @@ -1,11 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt index 4da75d7df7..dbe0667ab1 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage import com.github.insanusmokrassar.TelegramBotAPI.types.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt index 044482316f..702e233ea7 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt @@ -1,12 +1,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.* +import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage +import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt index d8c982e8a1..15a51074af 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage import com.github.insanusmokrassar.TelegramBotAPI.types.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt index 5f2523d5fb..855366a788 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt @@ -1,14 +1,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption -import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.MediaContentMessageResultDeserializer import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt index a75463e1e6..b918ae79fd 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt index 88deaf9e90..af97409eda 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt @@ -1,12 +1,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt index 009a418861..fed5b7c66c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt index 1298dd39bf..1596f45cfc 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt @@ -1,13 +1,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.TextContentMessageResultDeserializer import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt index e749155472..9219cd0949 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.editMessageMediaMethod import com.github.insanusmokrassar.TelegramBotAPI.types.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt index f76a637066..d1cd6effd5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt @@ -1,12 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.games import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage -import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent import kotlinx.serialization.* @Serializable diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt index f6077d4b96..7e35cbce06 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt @@ -1,7 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.games import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores import com.github.insanusmokrassar.TelegramBotAPI.types.* import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt index 487875e51e..7cb00e4dc8 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt @@ -1,12 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.games import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage -import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent import kotlinx.serialization.* @Serializable diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt index 36ae744186..23deee5967 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt @@ -1,7 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.games import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore import com.github.insanusmokrassar.TelegramBotAPI.types.* import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt index 285119fc0e..3b0d258af9 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt @@ -4,7 +4,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque import com.github.insanusmokrassar.TelegramBotAPI.types.UserId import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.builtins.serializer -import kotlinx.serialization.serializer interface SetGameScore : SimpleRequest { val userId: UserId diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt index 8af8be3e07..54e5e00a1f 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.get -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.files.PathedFile -import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.fileIdField import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt index 8469808cd9..41fc2f031a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt @@ -1,8 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.get -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest -import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker import com.github.insanusmokrassar.TelegramBotAPI.types.stickerSetNameField import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt index ec12767fae..f9270a7571 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.get -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt index 154db6fcb9..01be3ad029 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendChatMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.actions.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat +import com.github.insanusmokrassar.TelegramBotAPI.types.actions.BotAction import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt index 2829f03893..51dff056f3 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt @@ -1,11 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.ContactContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt index f06c804c20..2c4f72c1b6 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt @@ -1,15 +1,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent -import com.soywiz.klock.DateTime -import com.soywiz.klock.TimeSpan import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt index d1cb8dd4f4..8d91a0eb40 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt @@ -1,13 +1,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.DisableWebPagePreview -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt index 4a7df3a869..18e3931cfe 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.VenueContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt index 099df2f01c..8b95236ad9 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt @@ -1,12 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.games import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.games.Game import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt index 4d90d13f52..0de73f8fdc 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* @@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.AnimationContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt index 08bfc93bc1..5facb438f5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt @@ -1,7 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Performerable -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* @@ -9,8 +8,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.AudioContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt index 144ba864f5..44ff036ec2 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* @@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.DocumentContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt index ab3162ce58..4f7054bb29 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt @@ -1,13 +1,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.* -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass import com.github.insanusmokrassar.TelegramBotAPI.utils.toJsonWithoutNulls diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt index 28b89345b6..b9b005d8b4 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* @@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.files.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.PhotoContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt index b6db8ee837..e1f23403d6 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt @@ -1,13 +1,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.StickerContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt index c4b08c8bde..97781a1f7a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* @@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize -import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VideoContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt index ca57bfbfc8..e4e3d11bfd 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* @@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize -import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VideoNoteContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt index 90e14a0c47..a341372e5c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* @@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile -import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VoiceContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt index 9e1b06cacf..7179f0fd13 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt @@ -1,7 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.payments import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.* -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt index 28cd72abdf..9db62be4c1 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt @@ -1,11 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send.polls -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.PollContent diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStickerToSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStickerToSet.kt index 46a34dcbad..113ad5966e 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStickerToSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStickerToSet.kt @@ -1,12 +1,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition -import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet import kotlinx.serialization.* fun AddStickerToSet( diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStickerSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStickerSet.kt index 2cd93d0f94..b02b967fc3 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStickerSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStickerSet.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt index adbc82f59f..9ff0d9206f 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt @@ -1,9 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest -import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt index a60bb1012b..39f84b61a3 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt @@ -1,9 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest -import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker import com.github.insanusmokrassar.TelegramBotAPI.types.positionField import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt index 0fa1d1307c..967f3682c6 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest import com.github.insanusmokrassar.TelegramBotAPI.types.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt index 218f59a08c..607a5aa7fd 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.WebhookInfo import kotlinx.serialization.* diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt index a29d9f2b9a..43c53b89aa 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt @@ -1,6 +1,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.DataRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.MultipartRequestImpl diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt index a4cefd2b2b..2410f6fad0 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt @@ -3,7 +3,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* -import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObjectSerializer @Serializable(UserSerializer::class) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt index 59a168aaf5..463b6608cb 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt @@ -3,7 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardB import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* -import kotlinx.serialization.json.* +import kotlinx.serialization.json.JsonElementSerializer +import kotlinx.serialization.json.JsonObject internal object InlineKeyboardButtonSerializer : KSerializer { override val descriptor: SerialDescriptor = SerialDescriptor( diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardMarkupSerializer.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardMarkupSerializer.kt index b9d9ae3d10..e30494fb11 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardMarkupSerializer.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardMarkupSerializer.kt @@ -1,7 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.buttons import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor @Serializer(KeyboardMarkup::class) internal object KeyboardMarkupSerializer : KSerializer { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt index 63f7dd4ce6..756fdef996 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt @@ -5,7 +5,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.soywiz.klock.DateTime import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor interface Message { val messageId: MessageIdentifier diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt index feebf09325..c85eb47306 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt @@ -3,7 +3,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.polls import com.github.insanusmokrassar.TelegramBotAPI.types.textField import com.github.insanusmokrassar.TelegramBotAPI.types.votesCountField import kotlinx.serialization.* -import kotlinx.serialization.internal.StringDescriptor @Serializable(PollOptionSerializer::class) sealed class PollOption { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChannelPostUpdate.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChannelPostUpdate.kt index 97146d1278..43030af744 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChannelPostUpdate.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChannelPostUpdate.kt @@ -2,7 +2,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.update import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message -import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseSentMessageUpdate data class ChannelPostUpdate( diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MessageUpdate.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MessageUpdate.kt index 8b855fff22..a6b938bc9d 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MessageUpdate.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MessageUpdate.kt @@ -2,7 +2,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.update import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message -import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseSentMessageUpdate data class MessageUpdate( diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt index bc1c2e3f27..4c1cf4d8f3 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt @@ -4,7 +4,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.TestsJsonFormat import com.github.insanusmokrassar.TelegramBotAPI.types.actions.* import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json import kotlin.test.Test import kotlin.test.assertEquals diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/TextPartsCreatingTests.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/TextPartsCreatingTests.kt index 7a2024523e..4ed06dd286 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/TextPartsCreatingTests.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/TextPartsCreatingTests.kt @@ -1,7 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.* -import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownV2 import com.github.insanusmokrassar.TelegramBotAPI.utils.* import kotlin.test.* diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt index 6225bb715e..6bacbc57e8 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt +++ b/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt @@ -4,7 +4,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.TestsJsonFormat import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.* import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable -import kotlinx.serialization.json.Json import kotlin.test.Test import kotlin.test.assertEquals diff --git a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt b/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt index 984a3372e9..fd995cde3d 100644 --- a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt +++ b/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt @@ -21,7 +21,6 @@ import io.ktor.routing.routing import io.ktor.server.engine.* import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel -import kotlinx.serialization.json.Json import java.util.concurrent.Executors import java.util.concurrent.TimeUnit From a0db95d9293d89bdbd134271607ca3254720f6ae Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 16:41:48 +0600 Subject: [PATCH 11/11] suppressions nad compiler args --- CHANGELOG.md | 3 +++ TelegramBotAPI/build.gradle | 9 +++++++++ .../TelegramBotAPI/requests/abstracts/SimpleRequest.kt | 2 +- .../TelegramBotAPI/types/files/PathedFile.kt | 2 +- .../TelegramBotAPI/types/files/PhotoSize.kt | 1 - .../TelegramBotAPI/types/message/RawMessage.kt | 1 - .../TelegramBotAPI/types/message/abstracts/Message.kt | 2 ++ .../TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt | 2 ++ 8 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abcea7f75e..2f18ad2b52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ * All deprecations was removed * `RequestException` now extends `io.ktor.utils.io.errors.IOException` instead of `kotlinx.io.IOException` * `Any#toJson` now is NOT `inline` + * `FlowsUpdatesFilter` now as marked my annotation `FlowPreview` + * `PathedFile#fullUrl` now is not `inline` function + * `SimpleRequest#json` now is not `inline` and `internal` function ## 0.24.0 diff --git a/TelegramBotAPI/build.gradle b/TelegramBotAPI/build.gradle index c475e31eed..d42e420763 100644 --- a/TelegramBotAPI/build.gradle +++ b/TelegramBotAPI/build.gradle @@ -81,4 +81,13 @@ kotlin { } } } + + + targets.all { + compilations.all { + kotlinOptions { + freeCompilerArgs += ["-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xopt-in=kotlin.RequiresOptIn"] + } + } + } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt index 523b1c069d..89ba8af5b5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt @@ -9,4 +9,4 @@ interface SimpleRequest : Request { } @Suppress("UNCHECKED_CAST") -inline fun > K.json(): JsonObject = toJsonWithoutNulls(requestSerializer as SerializationStrategy) +internal fun > K.json(): JsonObject = toJsonWithoutNulls(requestSerializer as SerializationStrategy) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt index c2a01cab85..24331c325a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt @@ -21,4 +21,4 @@ data class PathedFile( ): TelegramMediaFile fun TelegramAPIUrlsKeeper.resolveFileURL(file: PathedFile): String = "$fileBaseUrl/${file.filePath}" -inline fun PathedFile.fullUrl(keeper: TelegramAPIUrlsKeeper): String = keeper.resolveFileURL(this) +fun PathedFile.fullUrl(keeper: TelegramAPIUrlsKeeper): String = keeper.resolveFileURL(this) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt index 360070e62c..a79862a075 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt @@ -28,7 +28,6 @@ data class PhotoSize( override val width: Int, override val height: Int ) : SizedMediaFile { - @Transient val resolution: Long by lazy { width.toLong() * height } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt index b1a0cad11f..8e4ff44663 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt @@ -134,7 +134,6 @@ internal data class RawMessage( } } - @Transient private val forwarded: ForwardInfo? by lazy { forward_date ?: return@lazy null // According to the documentation, now any forwarded message contains this field when { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt index 756fdef996..cd9d2d4408 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt @@ -23,6 +23,8 @@ internal class TelegramBotAPIMessageDeserializationStrategyClass : Deserializ override val descriptor: SerialDescriptor = SerialDescriptor("TelegramBotAPIMessageSerializer", PolymorphicKind.OPEN) override fun patch(decoder: Decoder, old: T): T = throw UpdateNotSupportedException("TelegramBotAPIMessageSerializer") + + @Suppress("UNCHECKED_CAST") override fun deserialize(decoder: Decoder): T { return RawMessage.serializer().deserialize(decoder).asMessage as T } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt index e57697e4fa..c0cafb4710 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt @@ -3,6 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.updateshandlers import com.github.insanusmokrassar.TelegramBotAPI.types.update.* import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.* import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.channels.BroadcastChannel import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.Flow @@ -10,6 +11,7 @@ import kotlinx.coroutines.flow.asFlow private fun BroadcastChannel.createUpdateReceiver(): UpdateReceiver = ::send +@FlowPreview class FlowsUpdatesFilter( broadcastChannelsSize: Int = Channel.CONFLATED ): UpdatesFilter {