mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-23 09:07:12 +00:00
fix of build and add annotation to all fields with one
This commit is contained in:
parent
aa315f6fec
commit
0013e91f6e
@ -16,6 +16,9 @@ kotlin {
|
|||||||
api project(":tgbotapi.core")
|
api project(":tgbotapi.core")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
configureEach {
|
||||||
|
languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.DeleteMessages
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
import kotlin.jvm.JvmName
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessages(
|
suspend fun TelegramBot.deleteMessages(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@ -44,6 +45,7 @@ suspend fun TelegramBot.deleteMessages(
|
|||||||
)
|
)
|
||||||
}.all { it }
|
}.all { it }
|
||||||
|
|
||||||
|
@JvmName("deleteMessagesWithMessages")
|
||||||
suspend fun TelegramBot.deleteMessages(
|
suspend fun TelegramBot.deleteMessages(
|
||||||
messages: List<AccessibleMessage>
|
messages: List<AccessibleMessage>
|
||||||
) = deleteMessages(messages.map { it.metaInfo })
|
) = deleteMessages(messages.map { it.metaInfo })
|
||||||
@ -70,6 +72,7 @@ suspend fun TelegramBot.delete(
|
|||||||
messagesMetas: List<Message.MetaInfo>
|
messagesMetas: List<Message.MetaInfo>
|
||||||
) = deleteMessages(messagesMetas)
|
) = deleteMessages(messagesMetas)
|
||||||
|
|
||||||
|
@JvmName("deleteWithMessages")
|
||||||
suspend fun TelegramBot.delete(
|
suspend fun TelegramBot.delete(
|
||||||
messages: List<AccessibleMessage>
|
messages: List<AccessibleMessage>
|
||||||
) = deleteMessages(messages)
|
) = deleteMessages(messages)
|
||||||
|
@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.ForwardMessages
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
import kotlin.jvm.JvmName
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessages(
|
suspend fun TelegramBot.forwardMessages(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
@ -85,6 +86,7 @@ suspend fun TelegramBot.forwardMessages(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmName("forwardMessagesWithMessages")
|
||||||
suspend fun TelegramBot.forwardMessages(
|
suspend fun TelegramBot.forwardMessages(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messages: List<AccessibleMessage>,
|
messages: List<AccessibleMessage>,
|
||||||
@ -173,6 +175,7 @@ suspend fun TelegramBot.forward(
|
|||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@JvmName("forwardWithMessages")
|
||||||
suspend fun TelegramBot.forward(
|
suspend fun TelegramBot.forward(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messages: List<AccessibleMessage>,
|
messages: List<AccessibleMessage>,
|
||||||
|
@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.send.CopyMessages
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
import kotlin.jvm.JvmName
|
||||||
|
|
||||||
suspend fun TelegramBot.copyMessages(
|
suspend fun TelegramBot.copyMessages(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
@ -84,6 +85,7 @@ suspend fun TelegramBot.copyMessages(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmName("copyMessagesWithMessages")
|
||||||
suspend fun TelegramBot.copyMessages(
|
suspend fun TelegramBot.copyMessages(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messages: List<AccessibleMessage>,
|
messages: List<AccessibleMessage>,
|
||||||
@ -172,6 +174,7 @@ suspend fun TelegramBot.copy(
|
|||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@JvmName("copyWithMessages")
|
||||||
suspend fun TelegramBot.copy(
|
suspend fun TelegramBot.copy(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messages: List<AccessibleMessage>,
|
messages: List<AccessibleMessage>,
|
||||||
|
@ -98,6 +98,7 @@ data class MultipartFile (
|
|||||||
private val inputSource: () -> Input
|
private val inputSource: () -> Input
|
||||||
) : InputFile() {
|
) : InputFile() {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val fileId: String = "${uuid4()}.${filename.fileExtension}"
|
override val fileId: String = "${uuid4()}.${filename.fileExtension}"
|
||||||
val input: Input
|
val input: Input
|
||||||
get() = inputSource()
|
get() = inputSource()
|
||||||
|
@ -112,6 +112,7 @@ data class CreateChatInviteLinkWithJoinRequest(
|
|||||||
override val expirationUnixTimeStamp: TelegramDate? = null,
|
override val expirationUnixTimeStamp: TelegramDate? = null,
|
||||||
) : CreateChatInviteLink<ChatInviteLinkWithJoinRequest>, WithJoinRequestChatInviteLinkRequest {
|
) : CreateChatInviteLink<ChatInviteLinkWithJoinRequest>, WithJoinRequestChatInviteLinkRequest {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(createsJoinRequestField)
|
@SerialName(createsJoinRequestField)
|
||||||
private val createsJoinRequest: Boolean = true
|
private val createsJoinRequest: Boolean = true
|
||||||
|
|
||||||
|
@ -126,6 +126,7 @@ data class EditChatInviteLinkWithJoinRequest(
|
|||||||
) : EditChatInviteLink<ChatInviteLinkWithJoinRequest>,
|
) : EditChatInviteLink<ChatInviteLinkWithJoinRequest>,
|
||||||
WithJoinRequestChatInviteLinkRequest {
|
WithJoinRequestChatInviteLinkRequest {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(createsJoinRequestField)
|
@SerialName(createsJoinRequestField)
|
||||||
private val createsJoinRequest: Boolean = true
|
private val createsJoinRequest: Boolean = true
|
||||||
|
|
||||||
|
@ -9,13 +9,15 @@ import kotlinx.serialization.encoding.Encoder
|
|||||||
import kotlinx.serialization.json.*
|
import kotlinx.serialization.json.*
|
||||||
|
|
||||||
@Serializable(MenuButtonSerializer::class)
|
@Serializable(MenuButtonSerializer::class)
|
||||||
|
@OptIn(ExperimentalSerializationApi::class)
|
||||||
sealed interface MenuButton {
|
sealed interface MenuButton {
|
||||||
@Required
|
@EncodeDefault
|
||||||
val type: String
|
val type: String
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object Commands : MenuButton {
|
object Commands : MenuButton {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String
|
override val type: String
|
||||||
get() = "commands"
|
get() = "commands"
|
||||||
}
|
}
|
||||||
@ -27,6 +29,7 @@ sealed interface MenuButton {
|
|||||||
val webApp: WebAppInfo
|
val webApp: WebAppInfo
|
||||||
) : MenuButton {
|
) : MenuButton {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String
|
override val type: String
|
||||||
get() = Companion.type
|
get() = Companion.type
|
||||||
|
|
||||||
@ -39,6 +42,7 @@ sealed interface MenuButton {
|
|||||||
@Serializable
|
@Serializable
|
||||||
object Default : MenuButton {
|
object Default : MenuButton {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String
|
override val type: String
|
||||||
get() = "default"
|
get() = "default"
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,7 @@ import dev.inmo.tgbotapi.abstracts.WithMessageId
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.chat.PreviewUser
|
import dev.inmo.tgbotapi.types.chat.PreviewUser
|
||||||
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||||
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
|
||||||
@ -31,6 +28,7 @@ sealed interface ChatBoostSource {
|
|||||||
override val user: PreviewUser
|
override val user: PreviewUser
|
||||||
) : ByUser {
|
) : ByUser {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
override val sourceName: String = sourceCode
|
override val sourceName: String = sourceCode
|
||||||
|
|
||||||
@ -45,6 +43,7 @@ sealed interface ChatBoostSource {
|
|||||||
override val user: PreviewUser
|
override val user: PreviewUser
|
||||||
) : ByUser {
|
) : ByUser {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
override val sourceName: String = sourceCode
|
override val sourceName: String = sourceCode
|
||||||
|
|
||||||
@ -67,9 +66,11 @@ sealed interface ChatBoostSource {
|
|||||||
override val user: PreviewUser
|
override val user: PreviewUser
|
||||||
) : Giveaway, ByUser {
|
) : Giveaway, ByUser {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
override val sourceName: String = Giveaway.sourceCode
|
override val sourceName: String = Giveaway.sourceCode
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(isUnclaimedField)
|
@SerialName(isUnclaimedField)
|
||||||
override val unclaimed: Boolean = false
|
override val unclaimed: Boolean = false
|
||||||
}
|
}
|
||||||
@ -80,9 +81,11 @@ sealed interface ChatBoostSource {
|
|||||||
override val messageId: MessageId
|
override val messageId: MessageId
|
||||||
) : Giveaway {
|
) : Giveaway {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
override val sourceName: String = Giveaway.sourceCode
|
override val sourceName: String = Giveaway.sourceCode
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(isUnclaimedField)
|
@SerialName(isUnclaimedField)
|
||||||
override val unclaimed: Boolean = true
|
override val unclaimed: Boolean = true
|
||||||
@SerialName(userField)
|
@SerialName(userField)
|
||||||
@ -104,6 +107,7 @@ sealed interface ChatBoostSource {
|
|||||||
@Serializable
|
@Serializable
|
||||||
private data class Surrogate(
|
private data class Surrogate(
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
val sourceName: String,
|
val sourceName: String,
|
||||||
@SerialName(userField)
|
@SerialName(userField)
|
||||||
|
@ -65,6 +65,7 @@ data class RequestLocationKeyboardButton(
|
|||||||
) : KeyboardButton {
|
) : KeyboardButton {
|
||||||
@SerialName(requestLocationField)
|
@SerialName(requestLocationField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
val requestLocation: Boolean = true
|
val requestLocation: Boolean = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ data class ReplyForce(
|
|||||||
) : KeyboardMarkup {
|
) : KeyboardMarkup {
|
||||||
@SerialName(forceReplyField)
|
@SerialName(forceReplyField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
val forceReply: Boolean = true
|
val forceReply: Boolean = true
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -8,5 +8,6 @@ data class ReplyKeyboardRemove(
|
|||||||
) : KeyboardMarkup {
|
) : KeyboardMarkup {
|
||||||
@SerialName("remove_keyboard")
|
@SerialName("remove_keyboard")
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
val removeKeyboard: Boolean = true
|
val removeKeyboard: Boolean = true
|
||||||
}
|
}
|
||||||
|
@ -45,5 +45,6 @@ data class AdministratorChatMemberImpl(
|
|||||||
) : AdministratorChatMember {
|
) : AdministratorChatMember {
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val status: ChatMember.Status = ChatMember.Status.Administrator
|
override val status: ChatMember.Status = ChatMember.Status.Administrator
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,6 @@ data class KickedChatMember(
|
|||||||
) : BannedChatMember {
|
) : BannedChatMember {
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val status: ChatMember.Status = ChatMember.Status.Kicked
|
override val status: ChatMember.Status = ChatMember.Status.Kicked
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,6 @@ data class LeftChatMemberImpl(
|
|||||||
) : LeftChatMember {
|
) : LeftChatMember {
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val status: ChatMember.Status = ChatMember.Status.Left
|
override val status: ChatMember.Status = ChatMember.Status.Left
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,6 @@ data class MemberChatMemberImpl(
|
|||||||
) : MemberChatMember {
|
) : MemberChatMember {
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val status: ChatMember.Status = ChatMember.Status.Member
|
override val status: ChatMember.Status = ChatMember.Status.Member
|
||||||
}
|
}
|
||||||
|
@ -45,5 +45,6 @@ data class OwnerChatMember(
|
|||||||
|
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val status: ChatMember.Status = ChatMember.Status.Creator
|
override val status: ChatMember.Status = ChatMember.Status.Creator
|
||||||
}
|
}
|
||||||
|
@ -44,5 +44,6 @@ data class RestrictedChatMember(
|
|||||||
) : BannedChatMember, SpecialRightsChatMember, ChatPermissions {
|
) : BannedChatMember, SpecialRightsChatMember, ChatPermissions {
|
||||||
@SerialName(statusField)
|
@SerialName(statusField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val status: ChatMember.Status = ChatMember.Status.Restricted
|
override val status: ChatMember.Status = ChatMember.Status.Restricted
|
||||||
}
|
}
|
||||||
|
@ -71,24 +71,28 @@ data class UnknownBotCommandScope internal constructor(
|
|||||||
@Serializable
|
@Serializable
|
||||||
object BotCommandScopeDefault : BotCommandScope {
|
object BotCommandScopeDefault : BotCommandScope {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String = "default"
|
override val type: String = "default"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object BotCommandScopeAllPrivateChats : BotCommandScope {
|
object BotCommandScopeAllPrivateChats : BotCommandScope {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String = "all_private_chats"
|
override val type: String = "all_private_chats"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object BotCommandScopeAllGroupChats : BotCommandScope {
|
object BotCommandScopeAllGroupChats : BotCommandScope {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String = "all_group_chats"
|
override val type: String = "all_group_chats"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object BotCommandScopeAllChatAdministrators : BotCommandScope {
|
object BotCommandScopeAllChatAdministrators : BotCommandScope {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String = "all_chat_administrators"
|
override val type: String = "all_chat_administrators"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +106,7 @@ data class BotCommandScopeChatAdministrators(
|
|||||||
override val chatId: ChatIdentifier
|
override val chatId: ChatIdentifier
|
||||||
) : ChatBotCommandScope {
|
) : ChatBotCommandScope {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String = BotCommandScopeChatAdministrators.type
|
override val type: String = BotCommandScopeChatAdministrators.type
|
||||||
companion object {
|
companion object {
|
||||||
const val type = "chat_administrators"
|
const val type = "chat_administrators"
|
||||||
@ -113,6 +118,7 @@ data class BotCommandScopeChat(
|
|||||||
override val chatId: ChatIdentifier
|
override val chatId: ChatIdentifier
|
||||||
) : ChatBotCommandScope {
|
) : ChatBotCommandScope {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String = BotCommandScopeChat.type
|
override val type: String = BotCommandScopeChat.type
|
||||||
companion object {
|
companion object {
|
||||||
const val type = "chat"
|
const val type = "chat"
|
||||||
@ -125,6 +131,7 @@ data class BotCommandScopeChatMember(
|
|||||||
val userId: UserId
|
val userId: UserId
|
||||||
) : ChatBotCommandScope {
|
) : ChatBotCommandScope {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String = BotCommandScopeChatMember.type
|
override val type: String = BotCommandScopeChatMember.type
|
||||||
companion object {
|
companion object {
|
||||||
const val type = "chat_member"
|
const val type = "chat_member"
|
||||||
|
@ -4,10 +4,7 @@ import dev.inmo.tgbotapi.abstracts.WithPreviewChatAndMessageId
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.chat.PreviewChat
|
import dev.inmo.tgbotapi.types.chat.PreviewChat
|
||||||
import dev.inmo.tgbotapi.types.chat.PreviewUser
|
import dev.inmo.tgbotapi.types.chat.PreviewUser
|
||||||
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
|
||||||
@ -32,6 +29,7 @@ sealed interface GiveawayPublicResults: GiveawayInfo, GiveawayResults, WithPrevi
|
|||||||
) : GiveawayPublicResults {
|
) : GiveawayPublicResults {
|
||||||
@SerialName(wasRefundedField)
|
@SerialName(wasRefundedField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val refunded: Boolean = true
|
override val refunded: Boolean = true
|
||||||
@SerialName(winnersCountField)
|
@SerialName(winnersCountField)
|
||||||
override val count: Int = 0
|
override val count: Int = 0
|
||||||
@ -78,6 +76,7 @@ sealed interface GiveawayPublicResults: GiveawayInfo, GiveawayResults, WithPrevi
|
|||||||
) : GiveawayPublicResults {
|
) : GiveawayPublicResults {
|
||||||
@SerialName(wasRefundedField)
|
@SerialName(wasRefundedField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val refunded: Boolean = false
|
override val refunded: Boolean = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,7 @@ package dev.inmo.tgbotapi.types.message
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.chat.*
|
import dev.inmo.tgbotapi.types.chat.*
|
||||||
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
|
||||||
@ -27,6 +24,7 @@ sealed interface MessageOrigin {
|
|||||||
) : MessageOrigin {
|
) : MessageOrigin {
|
||||||
@SerialName(typeField)
|
@SerialName(typeField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String = Companion.type
|
override val type: String = Companion.type
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@ -43,6 +41,7 @@ sealed interface MessageOrigin {
|
|||||||
) : MessageOrigin {
|
) : MessageOrigin {
|
||||||
@SerialName(typeField)
|
@SerialName(typeField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String = Companion.type
|
override val type: String = Companion.type
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@ -66,6 +65,7 @@ sealed interface MessageOrigin {
|
|||||||
) : Public {
|
) : Public {
|
||||||
@SerialName(typeField)
|
@SerialName(typeField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String = Companion.type
|
override val type: String = Companion.type
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@ -86,6 +86,7 @@ sealed interface MessageOrigin {
|
|||||||
) : Public {
|
) : Public {
|
||||||
@SerialName(typeField)
|
@SerialName(typeField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val type: String = Companion.type
|
override val type: String = Companion.type
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@ -105,6 +106,7 @@ sealed interface MessageOrigin {
|
|||||||
private data class Surrogate(
|
private data class Surrogate(
|
||||||
@SerialName(typeField)
|
@SerialName(typeField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
val type: String,
|
val type: String,
|
||||||
@SerialName(senderChatField)
|
@SerialName(senderChatField)
|
||||||
val senderChat: PreviewChat? = null,
|
val senderChat: PreviewChat? = null,
|
||||||
|
@ -100,6 +100,7 @@ data class PassportElementErrorDataField(
|
|||||||
) : PassportSingleElementError() {
|
) : PassportSingleElementError() {
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val source: String = dataField
|
override val source: String = dataField
|
||||||
}
|
}
|
||||||
fun EncryptedPassportElementWithData.createDataError(field: String, message: String) = PassportElementErrorDataField(
|
fun EncryptedPassportElementWithData.createDataError(field: String, message: String) = PassportElementErrorDataField(
|
||||||
@ -121,6 +122,7 @@ data class PassportElementErrorFrontSide(
|
|||||||
) : PassportElementFileError() {
|
) : PassportElementFileError() {
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val source: String = frontSideField
|
override val source: String = frontSideField
|
||||||
}
|
}
|
||||||
fun EncryptedPassportElementWithFrontSide.createFrontSideError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorFrontSide(
|
fun EncryptedPassportElementWithFrontSide.createFrontSideError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorFrontSide(
|
||||||
@ -141,6 +143,7 @@ data class PassportElementErrorReverseSide(
|
|||||||
) : PassportElementFileError() {
|
) : PassportElementFileError() {
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val source: String = reverseSideField
|
override val source: String = reverseSideField
|
||||||
}
|
}
|
||||||
fun EncryptedPassportElementWithReverseSide.createReverseSideError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorReverseSide(
|
fun EncryptedPassportElementWithReverseSide.createReverseSideError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorReverseSide(
|
||||||
@ -160,6 +163,7 @@ data class PassportElementErrorSelfie(
|
|||||||
) : PassportElementFileError() {
|
) : PassportElementFileError() {
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val source: String = selfieField
|
override val source: String = selfieField
|
||||||
}
|
}
|
||||||
fun EncryptedPassportElementWithSelfie.createSelfieError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorSelfie(
|
fun EncryptedPassportElementWithSelfie.createSelfieError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorSelfie(
|
||||||
@ -181,6 +185,7 @@ data class PassportElementErrorFile(
|
|||||||
) : PassportElementFileError() {
|
) : PassportElementFileError() {
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val source: String = fileField
|
override val source: String = fileField
|
||||||
}
|
}
|
||||||
fun EncryptedPassportElementWithFilesCollection.createFileError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorFile(
|
fun EncryptedPassportElementWithFilesCollection.createFileError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorFile(
|
||||||
@ -200,6 +205,7 @@ data class PassportElementErrorFiles(
|
|||||||
) : PassportElementFilesError() {
|
) : PassportElementFilesError() {
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val source: String = filesField
|
override val source: String = filesField
|
||||||
}
|
}
|
||||||
fun EncryptedPassportElementWithFilesCollection.createFilesError(message: String, unencryptedFileHashes: List<PassportElementHash>) = PassportElementErrorFiles(
|
fun EncryptedPassportElementWithFilesCollection.createFilesError(message: String, unencryptedFileHashes: List<PassportElementHash>) = PassportElementErrorFiles(
|
||||||
@ -221,6 +227,7 @@ data class PassportElementErrorTranslationFile(
|
|||||||
) : PassportElementFileError() {
|
) : PassportElementFileError() {
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val source: String = translationFileField
|
override val source: String = translationFileField
|
||||||
}
|
}
|
||||||
fun EncryptedPassportElementTranslatable.createFileError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorTranslationFile(
|
fun EncryptedPassportElementTranslatable.createFileError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorTranslationFile(
|
||||||
@ -239,6 +246,7 @@ data class PassportElementErrorTranslationFiles(
|
|||||||
) : PassportElementFilesError() {
|
) : PassportElementFilesError() {
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val source: String = translationFilesField
|
override val source: String = translationFilesField
|
||||||
}
|
}
|
||||||
fun EncryptedPassportElementTranslatable.createFilesError(message: String, unencryptedFileHashes: List<PassportElementHash>) = PassportElementErrorTranslationFiles(
|
fun EncryptedPassportElementTranslatable.createFilesError(message: String, unencryptedFileHashes: List<PassportElementHash>) = PassportElementErrorTranslationFiles(
|
||||||
@ -259,6 +267,7 @@ data class PassportElementErrorUnspecified(
|
|||||||
) : PassportElementFileError() {
|
) : PassportElementFileError() {
|
||||||
@SerialName(sourceField)
|
@SerialName(sourceField)
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
override val source: String = unspecifiedField
|
override val source: String = unspecifiedField
|
||||||
}
|
}
|
||||||
fun EncryptedPassportElement.createUnspecifiedError(message: String, elementHash: PassportElementHash) = PassportElementErrorUnspecified(
|
fun EncryptedPassportElement.createUnspecifiedError(message: String, elementHash: PassportElementHash) = PassportElementErrorUnspecified(
|
||||||
|
Loading…
Reference in New Issue
Block a user