1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

add custom MediaGroupMemberInputMedia serializer

This commit is contained in:
InsanusMokrassar 2019-02-23 18:21:24 +08:00
parent c7ba6c1028
commit 385426552e
2 changed files with 15 additions and 0 deletions

View File

@ -1,7 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia
import kotlinx.serialization.Serializable
import kotlinx.serialization.StringFormat import kotlinx.serialization.StringFormat
@Serializable(MediaGroupMemberInputMediaSerializer::class)
interface MediaGroupMemberInputMedia: InputMedia { interface MediaGroupMemberInputMedia: InputMedia {
fun serialize(format: StringFormat): String fun serialize(format: StringFormat): String
val arguments: Map<String, Any?> val arguments: Map<String, Any?>

View File

@ -0,0 +1,13 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia
import kotlinx.serialization.*
@Serializer(MediaGroupMemberInputMedia::class)
object MediaGroupMemberInputMediaSerializer : KSerializer<MediaGroupMemberInputMedia> {
override fun serialize(encoder: Encoder, obj: MediaGroupMemberInputMedia) {
when (obj) {
is InputMediaPhoto -> InputMediaPhoto.serializer().serialize(encoder, obj)
is InputMediaVideo -> InputMediaVideo.serializer().serialize(encoder, obj)
}
}
}