mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
add LinkPreviewOptions
This commit is contained in:
parent
90225a9380
commit
4e1ecc0e34
@ -545,6 +545,10 @@ const val providerTokenField = "provider_token"
|
|||||||
const val providerDataField = "provider_data"
|
const val providerDataField = "provider_data"
|
||||||
const val usersField = "users"
|
const val usersField = "users"
|
||||||
const val startDateField = "start_date"
|
const val startDateField = "start_date"
|
||||||
|
const val showAboveTextField = "show_above_text"
|
||||||
|
const val isDisabledField = "is_disabled"
|
||||||
|
const val preferSmallMediaField = "prefer_small_media"
|
||||||
|
const val preferLargeMediaField = "prefer_large_media"
|
||||||
|
|
||||||
const val requireNameField = "need_name"
|
const val requireNameField = "need_name"
|
||||||
const val requirePhoneNumberField = "need_phone_number"
|
const val requirePhoneNumberField = "need_phone_number"
|
||||||
|
@ -0,0 +1,79 @@
|
|||||||
|
package dev.inmo.tgbotapi.types
|
||||||
|
|
||||||
|
import kotlinx.serialization.Required
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
sealed interface LinkPreviewOptions {
|
||||||
|
val isDisabled: Boolean
|
||||||
|
val url: String?
|
||||||
|
val preferSmallMedia: Boolean
|
||||||
|
val preferLargeMedia: Boolean
|
||||||
|
val showAboveText: Boolean
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data object Disabled : LinkPreviewOptions {
|
||||||
|
@Required
|
||||||
|
@SerialName(isDisabledField)
|
||||||
|
override val isDisabled: Boolean = true
|
||||||
|
override val url: String?
|
||||||
|
get() = null
|
||||||
|
override val preferSmallMedia: Boolean
|
||||||
|
get() = false
|
||||||
|
override val preferLargeMedia: Boolean
|
||||||
|
get() = false
|
||||||
|
override val showAboveText: Boolean
|
||||||
|
get() = false
|
||||||
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Large(
|
||||||
|
@SerialName(urlField)
|
||||||
|
override val url: String?,
|
||||||
|
@SerialName(showAboveTextField)
|
||||||
|
override val showAboveText: Boolean
|
||||||
|
) : LinkPreviewOptions {
|
||||||
|
@Required
|
||||||
|
@SerialName(isDisabledField)
|
||||||
|
override val isDisabled: Boolean = false
|
||||||
|
@Required
|
||||||
|
@SerialName(preferLargeMediaField)
|
||||||
|
override val preferLargeMedia: Boolean = true
|
||||||
|
override val preferSmallMedia: Boolean
|
||||||
|
get() = false
|
||||||
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Small(
|
||||||
|
@SerialName(urlField)
|
||||||
|
override val url: String?,
|
||||||
|
@SerialName(showAboveTextField)
|
||||||
|
override val showAboveText: Boolean
|
||||||
|
) : LinkPreviewOptions {
|
||||||
|
@Required
|
||||||
|
@SerialName(isDisabledField)
|
||||||
|
override val isDisabled: Boolean = false
|
||||||
|
@Required
|
||||||
|
@SerialName(preferSmallMediaField)
|
||||||
|
override val preferSmallMedia: Boolean = true
|
||||||
|
override val preferLargeMedia: Boolean
|
||||||
|
get() = false
|
||||||
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Medium(
|
||||||
|
@SerialName(urlField)
|
||||||
|
override val url: String?,
|
||||||
|
@SerialName(showAboveTextField)
|
||||||
|
override val showAboveText: Boolean
|
||||||
|
) : LinkPreviewOptions {
|
||||||
|
@Required
|
||||||
|
@SerialName(isDisabledField)
|
||||||
|
override val isDisabled: Boolean = false
|
||||||
|
override val preferSmallMedia: Boolean
|
||||||
|
get() = false
|
||||||
|
override val preferLargeMedia: Boolean
|
||||||
|
get() = false
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user