1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-03 00:15:27 +00:00
tgbotapi/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StorageFile.kt

22 lines
528 B
Kotlin
Raw Normal View History

2019-12-03 05:07:25 +00:00
package com.github.insanusmokrassar.TelegramBotAPI.utils
2020-04-03 08:22:34 +00:00
import com.benasher44.uuid.uuid4
2020-01-15 06:28:06 +00:00
import io.ktor.utils.io.core.Input
2019-12-03 05:07:25 +00:00
import kotlinx.serialization.Serializable
2020-04-03 08:22:34 +00:00
import kotlinx.serialization.Transient
2019-12-03 05:07:25 +00:00
@Serializable
2020-04-03 08:22:34 +00:00
data class StorageFileInfo(
val contentType: String,
2019-12-03 05:07:25 +00:00
val fileName: String
2020-04-03 08:22:34 +00:00
) {
fun generateCustomName() = "${uuid4()}.${fileName.fileExtension}"
}
data class StorageFile(
val storageFileInfo: StorageFileInfo,
private val inputSource: () -> Input
) {
fun asInput() = inputSource()
2019-12-03 05:07:25 +00:00
}