diff --git a/CHANGELOG.md b/CHANGELOG.md index ec26d1aef5..137240d8d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 0.21.0 TelegramBotAPI 4.5 +* All `TelegramMediaFile` instances now have field `fileUniqueId`, which represents `file_unique_id` field from API * Now `ChatPhoto` have two additional fields: `smallFileUniqueId` and `bigFileUniqueId` * Now any administrator object instance have `customTitle` nullable field * Added the new request `SetChatAdministratorCustomTitle` to manage the custom titles of administrators promoted by the diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt index e2ec69dca0..873e7c49de 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt @@ -227,6 +227,8 @@ const val bigFileIdField = "big_file_id" const val smallFileUniqueIdField = "small_file_unique_id" const val bigFileUniqueIdField = "big_file_unique_id" +const val fileUniqueIdField = "file_unique_id" + const val currencyField = "currency" const val startParameterField = "start_parameter" diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AnimationFile.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AnimationFile.kt index 2894fb044e..ced764d938 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AnimationFile.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AnimationFile.kt @@ -1,6 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId +import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId +import com.github.insanusmokrassar.TelegramBotAPI.types.fileUniqueIdField import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable data class AnimationFile( @SerialName(fileIdField) override val fileId: FileId, + @SerialName(fileUniqueIdField) + override val fileUniqueId: FileUniqueId, override val width: Int, override val height: Int, override val duration: Long? = null, diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AudioFile.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AudioFile.kt index eeff93e261..70681158ac 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AudioFile.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AudioFile.kt @@ -2,6 +2,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Performerable import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId +import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId +import com.github.insanusmokrassar.TelegramBotAPI.types.fileUniqueIdField import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -10,6 +12,8 @@ import kotlinx.serialization.Serializable data class AudioFile( @SerialName(fileIdField) override val fileId: FileId, + @SerialName(fileUniqueIdField) + override val fileUniqueId: FileUniqueId, override val duration: Long? = null, override val performer: String? = null, override val title: String? = null, diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/DocumentFile.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/DocumentFile.kt index 4235c29696..80034393c5 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/DocumentFile.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/DocumentFile.kt @@ -1,6 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId +import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId +import com.github.insanusmokrassar.TelegramBotAPI.types.fileUniqueIdField import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable data class DocumentFile( @SerialName(fileIdField) override val fileId: FileId, + @SerialName(fileUniqueIdField) + override val fileUniqueId: FileUniqueId, @SerialName(fileSizeField) override val fileSize: Long? = null, override val thumb: PhotoSize? = null, diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/File.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/File.kt index 6badacd212..812daa78b7 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/File.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/File.kt @@ -1,6 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId +import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId +import com.github.insanusmokrassar.TelegramBotAPI.types.fileUniqueIdField import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable data class File( @SerialName(fileIdField) override val fileId: FileId, + @SerialName(fileUniqueIdField) + override val fileUniqueId: FileUniqueId, @SerialName(fileSizeField) override val fileSize: Long? = null ): TelegramMediaFile diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt index 6b85ec49ed..c2a01cab85 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt @@ -1,6 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId +import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId +import com.github.insanusmokrassar.TelegramBotAPI.types.fileUniqueIdField import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper import kotlinx.serialization.SerialName @@ -10,6 +12,8 @@ import kotlinx.serialization.Serializable data class PathedFile( @SerialName(fileIdField) override val fileId: FileId, + @SerialName(fileUniqueIdField) + override val fileUniqueId: FileUniqueId, @SerialName(filePathField) val filePath: String, @SerialName(fileSizeField) diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt index 6b977bf1c3..d42e3c4669 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt @@ -1,6 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId +import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId +import com.github.insanusmokrassar.TelegramBotAPI.types.fileUniqueIdField import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.* import kotlinx.serialization.* import kotlinx.serialization.internal.ArrayListSerializer @@ -19,6 +21,8 @@ object PhotoSerializer : KSerializer by ArrayListSerializer( data class PhotoSize( @SerialName(fileIdField) override val fileId: FileId, + @SerialName(fileUniqueIdField) + override val fileUniqueId: FileUniqueId, @SerialName(fileSizeField) override val fileSize: Long? = null, override val width: Int, diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/Sticker.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/Sticker.kt index fd779dad0e..21eeb15cce 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/Sticker.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/Sticker.kt @@ -11,6 +11,8 @@ import kotlinx.serialization.Serializable data class Sticker( @SerialName(fileIdField) override val fileId: FileId, + @SerialName(fileUniqueIdField) + override val fileUniqueId: FileUniqueId, @SerialName(widthField) override val width: Int, @SerialName(heightField) diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoFile.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoFile.kt index f9e7d74e87..a232dafc7a 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoFile.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoFile.kt @@ -1,6 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId +import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId +import com.github.insanusmokrassar.TelegramBotAPI.types.fileUniqueIdField import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable data class VideoFile( @SerialName(fileIdField) override val fileId: FileId, + @SerialName(fileUniqueIdField) + override val fileUniqueId: FileUniqueId, override val width: Int, override val height: Int, override val duration: Long? = null, diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoNoteFile.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoNoteFile.kt index 90bfb35239..98b058acfb 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoNoteFile.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoNoteFile.kt @@ -1,6 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId +import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId +import com.github.insanusmokrassar.TelegramBotAPI.types.fileUniqueIdField import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable data class VideoNoteFile( @SerialName(fileIdField) override val fileId: FileId, + @SerialName(fileUniqueIdField) + override val fileUniqueId: FileUniqueId, @SerialName("length") override val width: Int, override val duration: Long? = null, diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VoiceFile.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VoiceFile.kt index b0ee5a26a7..6bcc6226f8 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VoiceFile.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VoiceFile.kt @@ -1,6 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId +import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId +import com.github.insanusmokrassar.TelegramBotAPI.types.fileUniqueIdField import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable data class VoiceFile( @SerialName(fileIdField) override val fileId: FileId, + @SerialName(fileUniqueIdField) + override val fileUniqueId: FileUniqueId, override val duration: Long? = null, @SerialName(mimeTypeField) override val mimeType: String? = null, diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TelegramMediaFile.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TelegramMediaFile.kt index c4749caa59..67a34b9457 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TelegramMediaFile.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TelegramMediaFile.kt @@ -1,6 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId +import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId internal const val fileIdField = "file_id" internal const val fileSizeField = "file_size" @@ -11,5 +12,6 @@ internal const val filePathField = "file_path" */ interface TelegramMediaFile { val fileId: FileId + val fileUniqueId: FileUniqueId val fileSize: Long? }