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

add EncodeDefault for required fields in LinkPreviewOptions

This commit is contained in:
InsanusMokrassar 2024-01-10 14:59:41 +06:00
parent d70c7fdbdf
commit bdae774c62

View File

@ -1,9 +1,6 @@
package dev.inmo.tgbotapi.types package dev.inmo.tgbotapi.types
import kotlinx.serialization.KSerializer import kotlinx.serialization.*
import kotlinx.serialization.Required
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.encoding.Encoder
@ -19,6 +16,7 @@ sealed interface LinkPreviewOptions {
@Serializable @Serializable
data object Disabled : LinkPreviewOptions { data object Disabled : LinkPreviewOptions {
@Required @Required
@EncodeDefault
@SerialName(isDisabledField) @SerialName(isDisabledField)
override val isDisabled: Boolean = true override val isDisabled: Boolean = true
override val url: String? override val url: String?
@ -39,9 +37,11 @@ sealed interface LinkPreviewOptions {
override val showAboveText: Boolean override val showAboveText: Boolean
) : LinkPreviewOptions { ) : LinkPreviewOptions {
@Required @Required
@EncodeDefault
@SerialName(isDisabledField) @SerialName(isDisabledField)
override val isDisabled: Boolean = false override val isDisabled: Boolean = false
@Required @Required
@EncodeDefault
@SerialName(preferLargeMediaField) @SerialName(preferLargeMediaField)
override val preferLargeMedia: Boolean = true override val preferLargeMedia: Boolean = true
override val preferSmallMedia: Boolean override val preferSmallMedia: Boolean
@ -56,9 +56,11 @@ sealed interface LinkPreviewOptions {
override val showAboveText: Boolean override val showAboveText: Boolean
) : LinkPreviewOptions { ) : LinkPreviewOptions {
@Required @Required
@EncodeDefault
@SerialName(isDisabledField) @SerialName(isDisabledField)
override val isDisabled: Boolean = false override val isDisabled: Boolean = false
@Required @Required
@EncodeDefault
@SerialName(preferSmallMediaField) @SerialName(preferSmallMediaField)
override val preferSmallMedia: Boolean = true override val preferSmallMedia: Boolean = true
override val preferLargeMedia: Boolean override val preferLargeMedia: Boolean
@ -73,6 +75,7 @@ sealed interface LinkPreviewOptions {
override val showAboveText: Boolean override val showAboveText: Boolean
) : LinkPreviewOptions { ) : LinkPreviewOptions {
@Required @Required
@EncodeDefault
@SerialName(isDisabledField) @SerialName(isDisabledField)
override val isDisabled: Boolean = false override val isDisabled: Boolean = false
override val preferSmallMedia: Boolean override val preferSmallMedia: Boolean