mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
make ByteReadChannelAllocatorSerializer -> ByteReadChannelAllocatorDeserializationStrategy
This commit is contained in:
parent
c66d64adbc
commit
c8ad68ea69
@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.requests
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.utils.ByteReadChannelAllocator
|
||||
import dev.inmo.tgbotapi.utils.ByteReadChannelAllocatorSerializer
|
||||
import dev.inmo.tgbotapi.utils.ByteReadChannelAllocatorDeserializationStrategy
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
|
||||
class DownloadFileStream(
|
||||
@ -10,6 +10,6 @@ class DownloadFileStream(
|
||||
) : Request<ByteReadChannelAllocator> {
|
||||
override fun method(): String = filePath
|
||||
override val resultDeserializer: DeserializationStrategy<ByteReadChannelAllocator>
|
||||
get() = ByteReadChannelAllocatorSerializer
|
||||
get() = ByteReadChannelAllocatorDeserializationStrategy
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.utils
|
||||
|
||||
import dev.inmo.micro_utils.common.ByteArrayAllocatorSerializer
|
||||
import io.ktor.utils.io.ByteReadChannel
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
@ -11,17 +12,9 @@ fun interface ByteReadChannelAllocator {
|
||||
suspend operator fun invoke(): ByteReadChannel
|
||||
}
|
||||
|
||||
object ByteReadChannelAllocatorSerializer : KSerializer<ByteReadChannelAllocator> {
|
||||
object ByteReadChannelAllocatorDeserializationStrategy : DeserializationStrategy<ByteReadChannelAllocator> {
|
||||
override val descriptor: SerialDescriptor = ByteArrayAllocatorSerializer.descriptor
|
||||
|
||||
override fun serialize(encoder: Encoder, value: ByteReadChannelAllocator) {
|
||||
TODO("Not yet implemented")
|
||||
// ByteArrayAllocatorSerializer.serialize(
|
||||
// encoder
|
||||
// ) {
|
||||
// }
|
||||
}
|
||||
|
||||
override fun deserialize(decoder: Decoder): ByteReadChannelAllocator {
|
||||
val byteArrayAllocator = ByteArrayAllocatorSerializer.deserialize(decoder)
|
||||
return ByteReadChannelAllocator { ByteReadChannel(byteArrayAllocator()) }
|
||||
|
Loading…
Reference in New Issue
Block a user