mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
add custom MediaGroupMemberInputMedia serializer
This commit is contained in:
parent
c7ba6c1028
commit
385426552e
@ -1,7 +1,9 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.StringFormat
|
||||
|
||||
@Serializable(MediaGroupMemberInputMediaSerializer::class)
|
||||
interface MediaGroupMemberInputMedia: InputMedia {
|
||||
fun serialize(format: StringFormat): String
|
||||
val arguments: Map<String, Any?>
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user