diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/DownloadFileStream.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/DownloadFileStream.kt index 5d23f0c64d..c9ba0606bf 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/DownloadFileStream.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/DownloadFileStream.kt @@ -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 { override fun method(): String = filePath override val resultDeserializer: DeserializationStrategy - get() = ByteReadChannelAllocatorSerializer + get() = ByteReadChannelAllocatorDeserializationStrategy } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/ByteReadChannelAllocator.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/ByteReadChannelAllocator.kt index 260cba6f13..7df9343cde 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/ByteReadChannelAllocator.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/ByteReadChannelAllocator.kt @@ -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 { +object ByteReadChannelAllocatorDeserializationStrategy : DeserializationStrategy { 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()) }