mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
InputFile kdocs improvements
This commit is contained in:
parent
ed2c447730
commit
f07a179448
@ -5,6 +5,8 @@
|
|||||||
* `Versions`:
|
* `Versions`:
|
||||||
* `Serialization`: `1.5.0` -> `1.5.1`
|
* `Serialization`: `1.5.0` -> `1.5.1`
|
||||||
* `MicroUtils`: `0.18.1` -> `0.18.4`
|
* `MicroUtils`: `0.18.1` -> `0.18.4`
|
||||||
|
* `Core`:
|
||||||
|
* Actualize kdocs in `InputFile`
|
||||||
* `BehaviourBuilder`:
|
* `BehaviourBuilder`:
|
||||||
* Now it is possible to use `waitMediaContent`/`waitMediaContentMessage`/`onMediaContent`
|
* Now it is possible to use `waitMediaContent`/`waitMediaContentMessage`/`onMediaContent`
|
||||||
* Add `onMention`/`waitMention` functionality
|
* Add `onMention`/`waitMention` functionality
|
||||||
|
@ -21,6 +21,11 @@ import kotlinx.serialization.encoding.Encoder
|
|||||||
* @see ByteArray.asMultipartFile
|
* @see ByteArray.asMultipartFile
|
||||||
* @see ByteReadChannel.asMultipartFile
|
* @see ByteReadChannel.asMultipartFile
|
||||||
* @see ByteReadChannelAllocator.asMultipartFile
|
* @see ByteReadChannelAllocator.asMultipartFile
|
||||||
|
*
|
||||||
|
* @see fromInput
|
||||||
|
* @see fromFile
|
||||||
|
* @see fromId
|
||||||
|
* @see fromUrl
|
||||||
*/
|
*/
|
||||||
@Serializable(InputFileSerializer::class)
|
@Serializable(InputFileSerializer::class)
|
||||||
sealed class InputFile {
|
sealed class InputFile {
|
||||||
@ -29,9 +34,24 @@ sealed class InputFile {
|
|||||||
companion object {
|
companion object {
|
||||||
operator fun invoke(file: MPPFile) = file.asMultipartFile()
|
operator fun invoke(file: MPPFile) = file.asMultipartFile()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates [MultipartFile] based on incoming [filename] and [inputSource]
|
||||||
|
*/
|
||||||
fun fromInput(filename: String, inputSource: () -> Input) = MultipartFile(filename, inputSource)
|
fun fromInput(filename: String, inputSource: () -> Input) = MultipartFile(filename, inputSource)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates [MultipartFile] based on incoming [MPPFile] (common File in java, for example)
|
||||||
|
*/
|
||||||
fun fromFile(file: MPPFile) = invoke(file)
|
fun fromFile(file: MPPFile) = invoke(file)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates [FileId] from the incomming [id] [String] with believe that it is [FileId]
|
||||||
|
*/
|
||||||
fun fromId(id: String) = FileId(id)
|
fun fromId(id: String) = FileId(id)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates [FileUrl] from the incomming [url] [String]
|
||||||
|
*/
|
||||||
fun fromUrl(url: String) = FileUrl(url)
|
fun fromUrl(url: String) = FileUrl(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user