From 58dcbe875135d3f246417c70eeda3ac8d9495724 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 13 Aug 2021 11:45:21 +0600 Subject: [PATCH] StorageFile#asMultipartFile --- CHANGELOG.md | 1 + .../kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c69f05405..0ea7fb9a66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Several new extensions `ByteReadChannel#asStorageFile` and `ByteReadChannelAllocator#asStorageFile` * Several new extensions `ByteArray#asMultipartFile`, `ByteReadChannel#asMultipartFile` and `ByteReadChannelAllocator#asMultipartFile` + * New extension `StorageFile#asMultipartFile` * `API`: * New extensions `TelegramBot#downloadFile` for writing of incoming bytes to the file * New extensions `TelegramBot#downloadFileStream` and `TelegramBot#downloadFileStreamAllocator` for getting of input diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt index 986510d47b..a024cdbcac 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt @@ -54,6 +54,8 @@ data class MultipartFile ( override val fileId: String = file.storageFileInfo.generateCustomName() } +@Suppress("NOTHING_TO_INLINE", "unused") +inline fun StorageFile.asMultipartFile() = MultipartFile(this) @Suppress("NOTHING_TO_INLINE", "unused") inline fun ByteArray.asMultipartFile(