mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
add serializer to InlineKeyboardButton and remove exact serializer for InlineKeyboardMarkup#keyboard
This commit is contained in:
parent
6d8190e5aa
commit
b002f61b71
@ -1,5 +1,10 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardButtons
|
package com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardButtons
|
||||||
|
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@Serializable(InlineKeyboardButtonSerializer::class)
|
||||||
interface InlineKeyboardButton {
|
interface InlineKeyboardButton {
|
||||||
val text: String
|
val text: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object InlineKeyboardButtonSerializer : KSerializer<InlineKeyboardButton> by ContextSerializer(InlineKeyboardButton::class)
|
||||||
|
@ -7,10 +7,5 @@ import kotlinx.serialization.internal.ArrayListSerializer
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class InlineKeyboardMarkup(
|
data class InlineKeyboardMarkup(
|
||||||
@SerialName("inline_keyboard")
|
@SerialName("inline_keyboard")
|
||||||
@Serializable(with = KeyboardSerializer::class)
|
|
||||||
val keyboard: Matrix<InlineKeyboardButton>
|
val keyboard: Matrix<InlineKeyboardButton>
|
||||||
) : KeyboardMarkup
|
) : KeyboardMarkup
|
||||||
|
|
||||||
object KeyboardSerializer : KSerializer<Matrix<InlineKeyboardButton>> by ArrayListSerializer(
|
|
||||||
ArrayListSerializer(ContextSerializer(InlineKeyboardButton::class))
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user