From 311512b5dbfb95ccbbe905c8490c97b35b08fac4 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 7 Nov 2020 01:34:22 +0600 Subject: [PATCH] fix chat interfaces serializers --- .../dev/inmo/tgbotapi/types/chat/abstracts/ChannelChat.kt | 4 ++++ .../dev/inmo/tgbotapi/types/chat/abstracts/GroupChat.kt | 4 ++++ .../dev/inmo/tgbotapi/types/chat/abstracts/PrivateChat.kt | 4 ++++ .../dev/inmo/tgbotapi/types/chat/abstracts/PublicChat.kt | 4 ++++ .../dev/inmo/tgbotapi/types/chat/abstracts/SuperPublicChat.kt | 4 ++++ .../dev/inmo/tgbotapi/types/chat/abstracts/SupergroupChat.kt | 4 ++++ .../dev/inmo/tgbotapi/types/chat/abstracts/UsernameChat.kt | 3 +++ .../types/chat/abstracts/extended/ExtendedChannelChat.kt | 3 +++ .../types/chat/abstracts/extended/ExtendedGroupChat.kt | 3 +++ .../types/chat/abstracts/extended/ExtendedPrivateChat.kt | 3 +++ .../types/chat/abstracts/extended/ExtendedSupergroupChat.kt | 3 +++ 11 files changed, 39 insertions(+) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/ChannelChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/ChannelChat.kt index 2a6043809f..3e42f887d1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/ChannelChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/ChannelChat.kt @@ -1,3 +1,7 @@ package dev.inmo.tgbotapi.types.chat.abstracts +import dev.inmo.tgbotapi.types.chat.PreviewChatSerializer +import kotlinx.serialization.Serializable + +@Serializable(PreviewChatSerializer::class) interface ChannelChat : SuperPublicChat diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/GroupChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/GroupChat.kt index 849d6b9e3a..591a565624 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/GroupChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/GroupChat.kt @@ -1,3 +1,7 @@ package dev.inmo.tgbotapi.types.chat.abstracts +import dev.inmo.tgbotapi.types.chat.PreviewChatSerializer +import kotlinx.serialization.Serializable + +@Serializable(PreviewChatSerializer::class) interface GroupChat : PublicChat diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/PrivateChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/PrivateChat.kt index 2459398282..65a254544b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/PrivateChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/PrivateChat.kt @@ -1,5 +1,9 @@ package dev.inmo.tgbotapi.types.chat.abstracts +import dev.inmo.tgbotapi.types.chat.PreviewChatSerializer +import kotlinx.serialization.Serializable + +@Serializable(PreviewChatSerializer::class) interface PrivateChat : Chat, UsernameChat { val firstName: String val lastName: String diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/PublicChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/PublicChat.kt index 98c70cec84..f78e434f44 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/PublicChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/PublicChat.kt @@ -1,5 +1,9 @@ package dev.inmo.tgbotapi.types.chat.abstracts +import dev.inmo.tgbotapi.types.chat.PreviewChatSerializer +import kotlinx.serialization.Serializable + +@Serializable(PreviewChatSerializer::class) interface PublicChat : Chat { val title: String } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/SuperPublicChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/SuperPublicChat.kt index 0403f89fa6..ce290dbe2f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/SuperPublicChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/SuperPublicChat.kt @@ -1,3 +1,7 @@ package dev.inmo.tgbotapi.types.chat.abstracts +import dev.inmo.tgbotapi.types.chat.PreviewChatSerializer +import kotlinx.serialization.Serializable + +@Serializable(PreviewChatSerializer::class) interface SuperPublicChat : PublicChat, UsernameChat diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/SupergroupChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/SupergroupChat.kt index f49d4d144f..d4ad4d90d2 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/SupergroupChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/SupergroupChat.kt @@ -1,3 +1,7 @@ package dev.inmo.tgbotapi.types.chat.abstracts +import dev.inmo.tgbotapi.types.chat.PreviewChatSerializer +import kotlinx.serialization.Serializable + +@Serializable(PreviewChatSerializer::class) interface SupergroupChat : GroupChat, SuperPublicChat diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/UsernameChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/UsernameChat.kt index 99ced04a6a..eb2149799f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/UsernameChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/UsernameChat.kt @@ -1,7 +1,10 @@ package dev.inmo.tgbotapi.types.chat.abstracts import dev.inmo.tgbotapi.types.Username +import dev.inmo.tgbotapi.types.chat.PreviewChatSerializer +import kotlinx.serialization.Serializable +@Serializable(PreviewChatSerializer::class) interface UsernameChat : Chat { val username: Username? } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedChannelChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedChannelChat.kt index cbda4c68db..e21d2e314b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedChannelChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedChannelChat.kt @@ -1,8 +1,11 @@ package dev.inmo.tgbotapi.types.chat.abstracts.extended import dev.inmo.tgbotapi.types.ChatId +import dev.inmo.tgbotapi.types.chat.ExtendedChatSerializer import dev.inmo.tgbotapi.types.chat.abstracts.ChannelChat +import kotlinx.serialization.Serializable +@Serializable(ExtendedChatSerializer::class) interface ExtendedChannelChat : ChannelChat, ExtendedPublicChat { val linkedGroupChatId: ChatId? } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedGroupChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedGroupChat.kt index df9c9e157b..a24939a299 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedGroupChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedGroupChat.kt @@ -1,8 +1,11 @@ package dev.inmo.tgbotapi.types.chat.abstracts.extended import dev.inmo.tgbotapi.types.chat.ChatPermissions +import dev.inmo.tgbotapi.types.chat.ExtendedChatSerializer import dev.inmo.tgbotapi.types.chat.abstracts.GroupChat +import kotlinx.serialization.Serializable +@Serializable(ExtendedChatSerializer::class) interface ExtendedGroupChat : GroupChat, ExtendedPublicChat { val permissions: ChatPermissions } \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedPrivateChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedPrivateChat.kt index 297c7f3986..55a03723a5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedPrivateChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedPrivateChat.kt @@ -1,7 +1,10 @@ package dev.inmo.tgbotapi.types.chat.abstracts.extended +import dev.inmo.tgbotapi.types.chat.ExtendedChatSerializer import dev.inmo.tgbotapi.types.chat.abstracts.PrivateChat +import kotlinx.serialization.Serializable +@Serializable(ExtendedChatSerializer::class) interface ExtendedPrivateChat : PrivateChat, ExtendedChat { val bio: String } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedSupergroupChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedSupergroupChat.kt index 75ef3df3f6..fc50b3bd37 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedSupergroupChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedSupergroupChat.kt @@ -1,8 +1,11 @@ package dev.inmo.tgbotapi.types.chat.abstracts.extended import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.chat.ExtendedChatSerializer import dev.inmo.tgbotapi.types.chat.abstracts.SupergroupChat +import kotlinx.serialization.Serializable +@Serializable(ExtendedChatSerializer::class) interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat { val slowModeDelay: Long? val stickerSetName: StickerSetName?