From e30361ad1e0fbf83bcef82b959d41675a5b14e13 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 10 Mar 2023 12:01:08 +0600 Subject: [PATCH] rename thumb field --- .../api/send/media/SendAnimation.kt | 4 +- .../extensions/api/send/media/SendAudio.kt | 4 +- .../extensions/api/send/media/SendDocument.kt | 4 +- .../extensions/api/send/media/SendVideo.kt | 4 +- .../api/send/media/SendVideoNote.kt | 2 +- .../abstracts/ThumbedSendMessageRequest.kt | 6 ++- .../requests/send/media/SendAnimation.kt | 8 ++-- .../tgbotapi/requests/send/media/SendAudio.kt | 8 ++-- .../requests/send/media/SendDocument.kt | 8 ++-- .../tgbotapi/requests/send/media/SendVideo.kt | 8 ++-- .../requests/send/media/SendVideoNote.kt | 8 ++-- .../tgbotapi/requests/send/media/SendVoice.kt | 4 +- .../requests/stickers/SetStickerSetThumb.kt | 7 ++-- .../kotlin/dev/inmo/tgbotapi/types/Common.kt | 2 + .../tgbotapi/types/files/AnimationFile.kt | 2 +- .../inmo/tgbotapi/types/files/AudioFile.kt | 4 +- .../inmo/tgbotapi/types/files/DocumentFile.kt | 4 +- .../dev/inmo/tgbotapi/types/files/Sticker.kt | 40 +++++++++---------- .../tgbotapi/types/files/ThumbedMediaFile.kt | 7 ++-- .../inmo/tgbotapi/types/files/VideoFile.kt | 8 ++-- .../tgbotapi/types/files/VideoNoteFile.kt | 2 +- .../types/media/TelegramMediaAudio.kt | 4 +- .../types/media/TelegramMediaDocument.kt | 4 +- .../types/message/content/AnimationContent.kt | 4 +- .../types/message/content/AudioContent.kt | 2 +- .../types/message/content/DocumentContent.kt | 2 +- .../types/message/content/StickerContent.kt | 2 +- .../types/message/content/VideoContent.kt | 2 +- .../types/message/content/VideoNoteContent.kt | 4 +- .../tgbotapi/types/stickers/StickerSet.kt | 21 +++++----- 30 files changed, 97 insertions(+), 92 deletions(-) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt index 623e44ccf2..22817f4192 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt @@ -73,7 +73,7 @@ suspend fun TelegramBot.sendAnimation( allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendAnimation( - chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup + chatId, animation.fileId, animation.thumbnail ?.fileId, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup ) /** @@ -177,7 +177,7 @@ suspend fun TelegramBot.sendAnimation( allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendAnimation( - chatId, animation.fileId, animation.thumb ?.fileId, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup + chatId, animation.fileId, animation.thumbnail ?.fileId, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup ) /** diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt index a6752e3470..355a26fa85 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt @@ -88,7 +88,7 @@ suspend fun TelegramBot.sendAudio( replyToMessageId: MessageId? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, text, parseMode, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -180,7 +180,7 @@ suspend inline fun TelegramBot.sendAudio( replyToMessageId: MessageId? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, entities, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, entities, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendDocument.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendDocument.kt index 7173129726..787e5fc7f6 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendDocument.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendDocument.kt @@ -83,7 +83,7 @@ suspend fun TelegramBot.sendDocument( replyMarkup: KeyboardMarkup? = null, disableContentTypeDetection: Boolean? = null ) = sendDocument( - chatId, document.fileId, document.thumb ?.fileId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection + chatId, document.fileId, document.thumbnail ?.fileId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection ) /** @@ -170,7 +170,7 @@ suspend inline fun TelegramBot.sendDocument( replyMarkup: KeyboardMarkup? = null, disableContentTypeDetection: Boolean? = null ) = sendDocument( - chatId, document.fileId, document.thumb ?.fileId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection + chatId, document.fileId, document.thumbnail ?.fileId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection ) /** diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideo.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideo.kt index 3b1b6c7481..c9ad764b91 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideo.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideo.kt @@ -70,7 +70,7 @@ suspend fun TelegramBot.sendVideo( replyToMessageId: MessageId? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, text, parseMode, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, text, parseMode, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -167,7 +167,7 @@ suspend inline fun TelegramBot.sendVideo( replyToMessageId: MessageId? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, entities, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) +) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, entities, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideoNote.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideoNote.kt index 5eb4b848b3..d4c0cc11a6 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideoNote.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendVideoNote.kt @@ -57,7 +57,7 @@ suspend fun TelegramBot.sendVideoNote( allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendVideoNote( - chatId, videoNote.fileId, videoNote.thumb ?.fileId, videoNote.duration, videoNote.width, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup + chatId, videoNote.fileId, videoNote.thumbnail ?.fileId, videoNote.duration, videoNote.width, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup ) /** diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/ThumbedSendMessageRequest.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/ThumbedSendMessageRequest.kt index 450c624f69..97cedd3095 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/ThumbedSendMessageRequest.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/abstracts/ThumbedSendMessageRequest.kt @@ -1,5 +1,9 @@ package dev.inmo.tgbotapi.requests.send.abstracts interface ThumbedSendMessageRequest: SendMessageRequest { + val thumbnail: String? + + @Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnail")) val thumb: String? -} \ No newline at end of file + get() = thumbnail +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt index ec83f84067..ae61f5c46d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt @@ -129,8 +129,8 @@ data class SendAnimationData internal constructor( override val chatId: ChatIdentifier, @SerialName(animationField) val animation: String? = null, - @SerialName(thumbField) - override val thumb: String? = null, + @SerialName(thumbnailField) + override val thumbnail: String? = null, @SerialName(captionField) override val text: String? = null, @SerialName(parseModeField) @@ -187,8 +187,8 @@ data class SendAnimationData internal constructor( data class SendAnimationFiles internal constructor( val animation: MultipartFile? = null, - val thumb: MultipartFile? = null + val thumbnail: MultipartFile? = null ) : Files by mapOfNotNull( animationField to animation, - thumbField to thumb + thumbnailField to thumbnail ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt index b819e076af..dcb1d268f5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt @@ -126,8 +126,8 @@ data class SendAudioData internal constructor( override val chatId: ChatIdentifier, @SerialName(audioField) val audio: String? = null, - @SerialName(thumbField) - override val thumb: String? = null, + @SerialName(thumbnailField) + override val thumbnail: String? = null, @SerialName(captionField) override val text: String? = null, @SerialName(parseModeField) @@ -182,8 +182,8 @@ data class SendAudioData internal constructor( data class SendAudioFiles internal constructor( val audio: MultipartFile? = null, - val thumb: MultipartFile? = null + val thumbnail: MultipartFile? = null ) : Files by mapOfNotNull( audioField to audio, - thumbField to thumb + thumbnailField to thumbnail ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt index 35b2ab3d93..8ff04c4aca 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt @@ -144,8 +144,8 @@ data class SendDocumentData internal constructor( override val chatId: ChatIdentifier, @SerialName(documentField) val document: String? = null, - @SerialName(thumbField) - override val thumb: String? = null, + @SerialName(thumbnailField) + override val thumbnail: String? = null, @SerialName(captionField) override val text: String? = null, @SerialName(parseModeField) @@ -193,8 +193,8 @@ data class SendDocumentData internal constructor( data class SendDocumentFiles internal constructor( val document: MultipartFile? = null, - val thumb: MultipartFile? = null + val thumbnail: MultipartFile? = null ) : Files by mapOfNotNull( documentField to document, - thumbField to thumb + thumbnailField to thumbnail ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt index 0b749649d2..e427c4f10a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt @@ -133,8 +133,8 @@ data class SendVideoData internal constructor( override val chatId: ChatIdentifier, @SerialName(videoField) val video: String? = null, - @SerialName(thumbField) - override val thumb: String? = null, + @SerialName(thumbnailField) + override val thumbnail: String? = null, @SerialName(captionField) override val text: String? = null, @SerialName(parseModeField) @@ -193,8 +193,8 @@ data class SendVideoData internal constructor( data class SendVideoFiles internal constructor( val video: MultipartFile? = null, - val thumb: MultipartFile? = null + val thumbnail: MultipartFile? = null ) : Files by mapOfNotNull( videoField to video, - thumbField to thumb + thumbnailField to thumbnail ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt index d80bd0679b..914e50eafa 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt @@ -62,8 +62,8 @@ data class SendVideoNoteData internal constructor( override val chatId: ChatIdentifier, @SerialName(videoNoteField) val videoNote: String? = null, - @SerialName(thumbField) - override val thumb: String? = null, + @SerialName(thumbnailField) + override val thumbnail: String? = null, @SerialName(durationField) override val duration: Long? = null, @SerialName(lengthField) @@ -99,8 +99,8 @@ data class SendVideoNoteData internal constructor( data class SendVideoNoteFiles internal constructor( val videoNote: MultipartFile? = null, - val thumb: MultipartFile? = null + val thumbnail: MultipartFile? = null ) : Files by mapOfNotNull( videoNoteField to videoNote, - thumbField to thumb + thumbnailField to thumbnail ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt index 900632aea1..0b914246fb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt @@ -156,8 +156,8 @@ data class SendVoiceData internal constructor( data class SendVoiceFiles internal constructor( val voice: MultipartFile? = null, - val thumb: MultipartFile? = null + val thumbnail: MultipartFile? = null ) : Files by mapOfNotNull( voiceField to voice, - thumbField to thumb + thumbnailField to thumbnail ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/SetStickerSetThumb.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/SetStickerSetThumb.kt index a35f2a2b87..821f005b64 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/SetStickerSetThumb.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/SetStickerSetThumb.kt @@ -3,18 +3,17 @@ package dev.inmo.tgbotapi.requests.stickers import dev.inmo.tgbotapi.requests.abstracts.* import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest import dev.inmo.tgbotapi.requests.stickers.abstracts.OwnerStickerSetAction -import dev.inmo.tgbotapi.requests.stickers.abstracts.StickerSetAction import dev.inmo.tgbotapi.types.* import kotlinx.serialization.* fun SetStickerSetThumb( userId: UserId, stickerSetName: String, - thumb: MultipartFile + thumbnail: MultipartFile ): Request { return CommonMultipartFileRequest( SetStickerSetThumb(userId, stickerSetName), - mapOf(thumbField to thumb) + mapOf(thumbnailField to thumbnail) ) } @@ -24,7 +23,7 @@ data class SetStickerSetThumb ( override val userId: UserId, @SerialName(nameField) override val name: StickerSetName, - @SerialName(thumbField) + @SerialName(thumbnailField) val thumb: FileId? = null ) : OwnerStickerSetAction { override val requestSerializer: SerializationStrategy<*> diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt index b06249e225..be3c2992b3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt @@ -387,6 +387,8 @@ const val explanationField = "explanation" const val idField = "id" const val pollIdField = "poll_id" const val textField = "text" +const val thumbnailField = "thumbnail" +@Deprecated("Renamed (in telegram bot api)", ReplaceWith("thumbnailField", "dev.inmo.tgbotapi.types.thumbnailField")) const val thumbField = "thumb" const val emojiField = "emoji" const val emojisField = "emojis" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt index 7293d908cf..6492f43f39 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt @@ -16,7 +16,7 @@ data class AnimationFile( override val width: Int, override val height: Int, override val duration: Long? = null, - override val thumb: PhotoSize? = null, + override val thumbnail: PhotoSize? = null, @SerialName(fileNameField) override val fileName: String? = null, @SerialName(mimeTypeField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt index 8a3f4ebd28..e8a85ac00b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt @@ -25,8 +25,8 @@ data class AudioFile( override val mimeType: MimeType? = null, @SerialName(fileSizeField) override val fileSize: Long? = null, - @SerialName(thumbField) - override val thumb: PhotoSize? = null + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null ) : TelegramMediaFile, CustomNamedMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, TitledMediaFile, Performerable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt index c477da4b4f..f2b57fe6a7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt @@ -15,7 +15,7 @@ data class DocumentFile( override val fileUniqueId: FileUniqueId, @SerialName(fileSizeField) override val fileSize: Long? = null, - override val thumb: PhotoSize? = null, + override val thumbnail: PhotoSize? = null, @SerialName(mimeTypeField) override val mimeType: MimeType? = null, @SerialName(fileNameField) @@ -30,7 +30,7 @@ inline fun TelegramMediaFile.asDocumentFile() = if (this is DocumentFile) { fileId, fileUniqueId, fileSize, - (this as? ThumbedMediaFile) ?.thumb, + (this as? ThumbedMediaFile) ?.thumbnail, (this as? MimedMediaFile) ?.mimeType, (this as? CustomNamedMediaFile) ?.fileName ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt index 26a66f446f..e017de9a20 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt @@ -202,8 +202,8 @@ data class RegularSimpleSticker( override val width: Int, @SerialName(heightField) override val height: Int, - @SerialName(thumbField) - override val thumb: PhotoSize? = null, + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null, @SerialName(emojiField) override val emoji: String? = null, @SerialName(stickerSetNameField) @@ -225,8 +225,8 @@ data class RegularAnimatedSticker( override val width: Int, @SerialName(heightField) override val height: Int, - @SerialName(thumbField) - override val thumb: PhotoSize? = null, + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null, @SerialName(emojiField) override val emoji: String? = null, @SerialName(stickerSetNameField) @@ -246,8 +246,8 @@ data class RegularVideoSticker( override val width: Int, @SerialName(heightField) override val height: Int, - @SerialName(thumbField) - override val thumb: PhotoSize? = null, + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null, @SerialName(emojiField) override val emoji: String? = null, @SerialName(stickerSetNameField) @@ -275,8 +275,8 @@ data class MaskSimpleSticker( override val height: Int, @SerialName(maskPositionField) override val maskPosition: MaskPosition, - @SerialName(thumbField) - override val thumb: PhotoSize? = null, + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null, @SerialName(emojiField) override val emoji: String? = null, @SerialName(stickerSetNameField) @@ -296,8 +296,8 @@ data class MaskAnimatedSticker( override val height: Int, @SerialName(maskPositionField) override val maskPosition: MaskPosition, - @SerialName(thumbField) - override val thumb: PhotoSize? = null, + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null, @SerialName(emojiField) override val emoji: String? = null, @SerialName(stickerSetNameField) @@ -317,8 +317,8 @@ data class MaskVideoSticker( override val height: Int, @SerialName(maskPositionField) override val maskPosition: MaskPosition, - @SerialName(thumbField) - override val thumb: PhotoSize? = null, + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null, @SerialName(emojiField) override val emoji: String? = null, @SerialName(stickerSetNameField) @@ -344,8 +344,8 @@ data class CustomEmojiSimpleSticker( override val height: Int, @SerialName(customEmojiIdField) override val customEmojiId: CustomEmojiId, - @SerialName(thumbField) - override val thumb: PhotoSize? = null, + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null, @SerialName(emojiField) override val emoji: String? = null, @SerialName(stickerSetNameField) @@ -365,8 +365,8 @@ data class CustomEmojiAnimatedSticker( override val height: Int, @SerialName(customEmojiIdField) override val customEmojiId: CustomEmojiId, - @SerialName(thumbField) - override val thumb: PhotoSize? = null, + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null, @SerialName(emojiField) override val emoji: String? = null, @SerialName(stickerSetNameField) @@ -386,8 +386,8 @@ data class CustomEmojiVideoSticker( override val height: Int, @SerialName(customEmojiIdField) override val customEmojiId: CustomEmojiId, - @SerialName(thumbField) - override val thumb: PhotoSize? = null, + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null, @SerialName(emojiField) override val emoji: String? = null, @SerialName(stickerSetNameField) @@ -406,8 +406,8 @@ data class UnknownSticker( override val width: Int, @SerialName(heightField) override val height: Int, - @SerialName(thumbField) - override val thumb: PhotoSize? = null, + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null, @SerialName(emojiField) override val emoji: String? = null, @SerialName(stickerSetNameField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/ThumbedMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/ThumbedMediaFile.kt index b988901009..456519d3bb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/ThumbedMediaFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/ThumbedMediaFile.kt @@ -1,8 +1,9 @@ package dev.inmo.tgbotapi.types.files -import dev.inmo.tgbotapi.types.files.PhotoSize -import dev.inmo.tgbotapi.types.files.TelegramMediaFile - sealed interface ThumbedMediaFile : TelegramMediaFile { + val thumbnail: PhotoSize? + + @Deprecated("Renamed (in telegram bot api)", ReplaceWith("thumbnail")) val thumb: PhotoSize? + get() = thumbnail } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt index 7aaf0bf72d..3fbc99a402 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt @@ -21,8 +21,8 @@ data class VideoFile( override val height: Int, @SerialName(durationField) override val duration: Long? = null, - @SerialName(thumbField) - override val thumb: PhotoSize? = null, + @SerialName(thumbnailField) + override val thumbnail: PhotoSize? = null, @SerialName(fileNameField) override val fileName: String? = null, @SerialName(mimeTypeField) @@ -44,7 +44,7 @@ inline fun VideoFile.toTelegramMediaVideo( width, height, duration, - thumb ?.fileId + thumbnail ?.fileId ) @Suppress("NOTHING_TO_INLINE") @@ -58,5 +58,5 @@ inline fun VideoFile.toTelegramMediaVideo( width, height, duration, - thumb ?.fileId + thumbnail ?.fileId ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt index 04b65e14fa..d98d872261 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt @@ -15,7 +15,7 @@ data class VideoNoteFile( @SerialName("length") override val width: Int, override val duration: Long? = null, - override val thumb: PhotoSize? = null, + override val thumbnail: PhotoSize? = null, @SerialName(fileSizeField) override val fileSize: Long? = null ) : TelegramMediaFile, ThumbedMediaFile, PlayableMediaFile, SizedMediaFile { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAudio.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAudio.kt index bb9efe8f07..9a21b6ca1d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAudio.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAudio.kt @@ -77,7 +77,7 @@ fun AudioFile.toTelegramMediaAudio( duration, performer, title, - thumb ?.fileId + thumbnail ?.fileId ) fun AudioFile.toTelegramMediaAudio( @@ -89,5 +89,5 @@ fun AudioFile.toTelegramMediaAudio( duration, performer, title, - thumb ?.fileId + thumbnail ?.fileId ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaDocument.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaDocument.kt index 8f4e4d8df1..8049a4b692 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaDocument.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaDocument.kt @@ -78,7 +78,7 @@ fun DocumentFile.toTelegramMediaDocument( fileId, text, parseMode, - thumb ?.fileId + thumbnail ?.fileId ) fun DocumentFile.toTelegramMediaDocument( @@ -86,5 +86,5 @@ fun DocumentFile.toTelegramMediaDocument( ) = TelegramMediaDocument( fileId, textSources, - thumb ?.fileId + thumbnail ?.fileId ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/AnimationContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/AnimationContent.kt index cd7df6d9f1..1552b97f54 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/AnimationContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/AnimationContent.kt @@ -32,7 +32,7 @@ data class AnimationContent( ): Request> = SendAnimation( chatId, media.fileId, - media.thumb ?.fileId, + media.thumbnail ?.fileId, textSources, spoilered, media.duration, @@ -53,6 +53,6 @@ data class AnimationContent( media.width, media.height, media.duration, - media.thumb ?.fileId + media.thumbnail ?.fileId ) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/AudioContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/AudioContent.kt index 5ac88ae625..0b56455154 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/AudioContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/AudioContent.kt @@ -30,7 +30,7 @@ data class AudioContent( ): Request> = SendAudio( chatId, media.fileId, - media.thumb ?.fileId, + media.thumbnail ?.fileId, textSources, media.duration, media.performer, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/DocumentContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/DocumentContent.kt index 5c27ebbf9f..1b2720bcc8 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/DocumentContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/DocumentContent.kt @@ -32,7 +32,7 @@ data class DocumentContent( ): Request> = SendDocument( chatId, media.fileId, - media.thumb ?.fileId, + media.thumbnail ?.fileId, textSources, messageThreadId, disableNotification, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/StickerContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/StickerContent.kt index 635f855d5a..dfb21e7942 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/StickerContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/StickerContent.kt @@ -37,6 +37,6 @@ data class StickerContent( override fun asTelegramMedia(): TelegramMediaDocument = TelegramMediaDocument( media.fileId, null, - thumb = media.thumb ?.fileId + thumb = media.thumbnail ?.fileId ) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/VideoContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/VideoContent.kt index 15d877b916..7b8ed78713 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/VideoContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/VideoContent.kt @@ -31,7 +31,7 @@ data class VideoContent( ): Request> = SendVideo( chatId, media.fileId, - media.thumb ?.fileId, + media.thumbnail ?.fileId, textSources, spoilered, media.duration, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/VideoNoteContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/VideoNoteContent.kt index 047f0203e5..8e47237fd0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/VideoNoteContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/VideoNoteContent.kt @@ -26,7 +26,7 @@ data class VideoNoteContent( ): Request> = SendVideoNote( chatId, media.fileId, - media.thumb ?.fileId, + media.thumbnail ?.fileId, media.duration, media.width, messageThreadId, @@ -42,6 +42,6 @@ data class VideoNoteContent( width = media.width, height = media.height, duration = media.duration, - thumb = media.thumb ?.fileId + thumb = media.thumbnail ?.fileId ) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt index 922c6c6b52..fc53396886 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt @@ -7,7 +7,6 @@ import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonElement @Serializable @@ -146,7 +145,7 @@ data class RegularSimpleStickerSet( override val title: String, @SerialName(stickersField) override val stickers: List, - @SerialName(thumbField) + @SerialName(thumbnailField) override val thumb: PhotoSize? = null ) : RegularStickerSet { @SerialName(stickerTypeField) @@ -162,7 +161,7 @@ data class RegularAnimatedStickerSet( override val title: String, @SerialName(stickersField) override val stickers: List, - @SerialName(thumbField) + @SerialName(thumbnailField) override val thumb: PhotoSize? = null ) : RegularStickerSet, AnimatedStickerSet { @SerialName(stickerTypeField) @@ -178,7 +177,7 @@ data class RegularVideoStickerSet( override val title: String, @SerialName(stickersField) override val stickers: List, - @SerialName(thumbField) + @SerialName(thumbnailField) override val thumb: PhotoSize? = null ) : RegularStickerSet, VideoStickerSet { @SerialName(stickerTypeField) @@ -194,7 +193,7 @@ data class MaskSimpleStickerSet( override val title: String, @SerialName(stickersField) override val stickers: List, - @SerialName(thumbField) + @SerialName(thumbnailField) override val thumb: PhotoSize? = null ) : MaskStickerSet { @SerialName(stickerTypeField) @@ -210,7 +209,7 @@ data class MaskAnimatedStickerSet( override val title: String, @SerialName(stickersField) override val stickers: List, - @SerialName(thumbField) + @SerialName(thumbnailField) override val thumb: PhotoSize? = null ) : MaskStickerSet, AnimatedStickerSet { @SerialName(stickerTypeField) @@ -226,7 +225,7 @@ data class MaskVideoStickerSet( override val title: String, @SerialName(stickersField) override val stickers: List, - @SerialName(thumbField) + @SerialName(thumbnailField) override val thumb: PhotoSize? = null ) : MaskStickerSet, VideoStickerSet { @SerialName(stickerTypeField) @@ -242,7 +241,7 @@ data class CustomEmojiSimpleStickerSet( override val title: String, @SerialName(stickersField) override val stickers: List, - @SerialName(thumbField) + @SerialName(thumbnailField) override val thumb: PhotoSize? = null ) : CustomEmojiStickerSet { @SerialName(stickerTypeField) @@ -258,7 +257,7 @@ data class CustomEmojiAnimatedStickerSet( override val title: String, @SerialName(stickersField) override val stickers: List, - @SerialName(thumbField) + @SerialName(thumbnailField) override val thumb: PhotoSize? = null ) : CustomEmojiStickerSet, AnimatedStickerSet { @SerialName(stickerTypeField) @@ -274,7 +273,7 @@ data class CustomEmojiVideoStickerSet( override val title: String, @SerialName(stickersField) override val stickers: List, - @SerialName(thumbField) + @SerialName(thumbnailField) override val thumb: PhotoSize? = null ) : CustomEmojiStickerSet, VideoStickerSet { @SerialName(stickerTypeField) @@ -292,7 +291,7 @@ data class UnknownStickerSet( override val stickers: List, @SerialName(stickerTypeField) override val stickerType: StickerType, - @SerialName(thumbField) + @SerialName(thumbnailField) override val thumb: PhotoSize? = null, val raw: JsonElement ) : CustomEmojiStickerSet, VideoStickerSet