1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-29 21:48:43 +00:00

all TelegramMediaFile instances now have field fileUniqueId, which represents file_unique_id field from API

This commit is contained in:
InsanusMokrassar 2020-01-01 22:26:19 +06:00
parent 198e15a937
commit bba37d8889
13 changed files with 43 additions and 0 deletions

View File

@ -2,6 +2,7 @@
## 0.21.0 TelegramBotAPI 4.5 ## 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 `ChatPhoto` have two additional fields: `smallFileUniqueId` and `bigFileUniqueId`
* Now any administrator object instance have `customTitle` nullable field * Now any administrator object instance have `customTitle` nullable field
* Added the new request `SetChatAdministratorCustomTitle` to manage the custom titles of administrators promoted by the * Added the new request `SetChatAdministratorCustomTitle` to manage the custom titles of administrators promoted by the

View File

@ -227,6 +227,8 @@ const val bigFileIdField = "big_file_id"
const val smallFileUniqueIdField = "small_file_unique_id" const val smallFileUniqueIdField = "small_file_unique_id"
const val bigFileUniqueIdField = "big_file_unique_id" const val bigFileUniqueIdField = "big_file_unique_id"
const val fileUniqueIdField = "file_unique_id"
const val currencyField = "currency" const val currencyField = "currency"
const val startParameterField = "start_parameter" const val startParameterField = "start_parameter"

View File

@ -1,6 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.files package com.github.insanusmokrassar.TelegramBotAPI.types.files
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId 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.types.files.abstracts.*
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable
data class AnimationFile( data class AnimationFile(
@SerialName(fileIdField) @SerialName(fileIdField)
override val fileId: FileId, override val fileId: FileId,
@SerialName(fileUniqueIdField)
override val fileUniqueId: FileUniqueId,
override val width: Int, override val width: Int,
override val height: Int, override val height: Int,
override val duration: Long? = null, override val duration: Long? = null,

View File

@ -2,6 +2,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Performerable import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Performerable
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId 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.types.files.abstracts.*
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -10,6 +12,8 @@ import kotlinx.serialization.Serializable
data class AudioFile( data class AudioFile(
@SerialName(fileIdField) @SerialName(fileIdField)
override val fileId: FileId, override val fileId: FileId,
@SerialName(fileUniqueIdField)
override val fileUniqueId: FileUniqueId,
override val duration: Long? = null, override val duration: Long? = null,
override val performer: String? = null, override val performer: String? = null,
override val title: String? = null, override val title: String? = null,

View File

@ -1,6 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.files package com.github.insanusmokrassar.TelegramBotAPI.types.files
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId 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.types.files.abstracts.*
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable
data class DocumentFile( data class DocumentFile(
@SerialName(fileIdField) @SerialName(fileIdField)
override val fileId: FileId, override val fileId: FileId,
@SerialName(fileUniqueIdField)
override val fileUniqueId: FileUniqueId,
@SerialName(fileSizeField) @SerialName(fileSizeField)
override val fileSize: Long? = null, override val fileSize: Long? = null,
override val thumb: PhotoSize? = null, override val thumb: PhotoSize? = null,

View File

@ -1,6 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.files package com.github.insanusmokrassar.TelegramBotAPI.types.files
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId 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.types.files.abstracts.*
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable
data class File( data class File(
@SerialName(fileIdField) @SerialName(fileIdField)
override val fileId: FileId, override val fileId: FileId,
@SerialName(fileUniqueIdField)
override val fileUniqueId: FileUniqueId,
@SerialName(fileSizeField) @SerialName(fileSizeField)
override val fileSize: Long? = null override val fileSize: Long? = null
): TelegramMediaFile ): TelegramMediaFile

View File

@ -1,6 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.files package com.github.insanusmokrassar.TelegramBotAPI.types.files
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId 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.types.files.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
@ -10,6 +12,8 @@ import kotlinx.serialization.Serializable
data class PathedFile( data class PathedFile(
@SerialName(fileIdField) @SerialName(fileIdField)
override val fileId: FileId, override val fileId: FileId,
@SerialName(fileUniqueIdField)
override val fileUniqueId: FileUniqueId,
@SerialName(filePathField) @SerialName(filePathField)
val filePath: String, val filePath: String,
@SerialName(fileSizeField) @SerialName(fileSizeField)

View File

@ -1,6 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.files package com.github.insanusmokrassar.TelegramBotAPI.types.files
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId 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.types.files.abstracts.*
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer import kotlinx.serialization.internal.ArrayListSerializer
@ -19,6 +21,8 @@ object PhotoSerializer : KSerializer<Photo> by ArrayListSerializer(
data class PhotoSize( data class PhotoSize(
@SerialName(fileIdField) @SerialName(fileIdField)
override val fileId: FileId, override val fileId: FileId,
@SerialName(fileUniqueIdField)
override val fileUniqueId: FileUniqueId,
@SerialName(fileSizeField) @SerialName(fileSizeField)
override val fileSize: Long? = null, override val fileSize: Long? = null,
override val width: Int, override val width: Int,

View File

@ -11,6 +11,8 @@ import kotlinx.serialization.Serializable
data class Sticker( data class Sticker(
@SerialName(fileIdField) @SerialName(fileIdField)
override val fileId: FileId, override val fileId: FileId,
@SerialName(fileUniqueIdField)
override val fileUniqueId: FileUniqueId,
@SerialName(widthField) @SerialName(widthField)
override val width: Int, override val width: Int,
@SerialName(heightField) @SerialName(heightField)

View File

@ -1,6 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.files package com.github.insanusmokrassar.TelegramBotAPI.types.files
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId 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.types.files.abstracts.*
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable
data class VideoFile( data class VideoFile(
@SerialName(fileIdField) @SerialName(fileIdField)
override val fileId: FileId, override val fileId: FileId,
@SerialName(fileUniqueIdField)
override val fileUniqueId: FileUniqueId,
override val width: Int, override val width: Int,
override val height: Int, override val height: Int,
override val duration: Long? = null, override val duration: Long? = null,

View File

@ -1,6 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.files package com.github.insanusmokrassar.TelegramBotAPI.types.files
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId 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.types.files.abstracts.*
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable
data class VideoNoteFile( data class VideoNoteFile(
@SerialName(fileIdField) @SerialName(fileIdField)
override val fileId: FileId, override val fileId: FileId,
@SerialName(fileUniqueIdField)
override val fileUniqueId: FileUniqueId,
@SerialName("length") @SerialName("length")
override val width: Int, override val width: Int,
override val duration: Long? = null, override val duration: Long? = null,

View File

@ -1,6 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.files package com.github.insanusmokrassar.TelegramBotAPI.types.files
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId 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.types.files.abstracts.*
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -9,6 +11,8 @@ import kotlinx.serialization.Serializable
data class VoiceFile( data class VoiceFile(
@SerialName(fileIdField) @SerialName(fileIdField)
override val fileId: FileId, override val fileId: FileId,
@SerialName(fileUniqueIdField)
override val fileUniqueId: FileUniqueId,
override val duration: Long? = null, override val duration: Long? = null,
@SerialName(mimeTypeField) @SerialName(mimeTypeField)
override val mimeType: String? = null, override val mimeType: String? = null,

View File

@ -1,6 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts package com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
import com.github.insanusmokrassar.TelegramBotAPI.types.FileUniqueId
internal const val fileIdField = "file_id" internal const val fileIdField = "file_id"
internal const val fileSizeField = "file_size" internal const val fileSizeField = "file_size"
@ -11,5 +12,6 @@ internal const val filePathField = "file_path"
*/ */
interface TelegramMediaFile { interface TelegramMediaFile {
val fileId: FileId val fileId: FileId
val fileUniqueId: FileUniqueId
val fileSize: Long? val fileSize: Long?
} }