mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-03 15:19:30 +00:00
fixes in new multipart api
This commit is contained in:
@@ -21,7 +21,11 @@ class MultipartRequestCallFactory(logger: KSLog? = null) : AbstractRequestCallFa
|
||||
): T? {
|
||||
return when (request) {
|
||||
!is MultipartRequest -> null
|
||||
is MultipartRequest.Common -> localSimpleRequestCallFactory.makeCall(client, urlsKeeper, request.data, jsonFormatter)
|
||||
is MultipartRequest.Common -> if (request.mediaMap.isEmpty()) {
|
||||
localSimpleRequestCallFactory.makeCall(client, urlsKeeper, request.data, jsonFormatter)
|
||||
} else {
|
||||
super.makeCall(client, urlsKeeper, request, jsonFormatter)
|
||||
}
|
||||
else -> super.makeCall(client, urlsKeeper, request, jsonFormatter)
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
@Serializable
|
||||
@Serializable(InputProfilePhoto.Companion::class)
|
||||
sealed interface InputProfilePhoto {
|
||||
val type: String
|
||||
val mediaPair: Pair<String, MultipartFile>
|
||||
@@ -27,7 +27,7 @@ sealed interface InputProfilePhoto {
|
||||
val photo: MultipartFile
|
||||
) : InputProfilePhoto {
|
||||
override val mediaPair: Pair<String, MultipartFile>
|
||||
get() = photoField to photo
|
||||
get() = photo.fileId to photo
|
||||
@EncodeDefault
|
||||
override val type: String = "static"
|
||||
}
|
||||
@@ -39,7 +39,7 @@ sealed interface InputProfilePhoto {
|
||||
val mainFrameTimestamp: DoubleSeconds? = null
|
||||
) : InputProfilePhoto {
|
||||
override val mediaPair: Pair<String, MultipartFile>
|
||||
get() = animationField to animation
|
||||
get() = animation.fileId to animation
|
||||
@EncodeDefault
|
||||
override val type: String = "animated"
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ sealed interface InputStoryContent {
|
||||
@EncodeDefault
|
||||
override val type: Type = Companion
|
||||
override val media: Pair<String, MultipartFile>
|
||||
get() = photoField to photo
|
||||
get() = photo.fileId to photo
|
||||
|
||||
companion object : Type {
|
||||
override val name: String
|
||||
@@ -50,7 +50,7 @@ sealed interface InputStoryContent {
|
||||
@EncodeDefault
|
||||
override val type: Type = Companion
|
||||
override val media: Pair<String, MultipartFile>
|
||||
get() = videoField to video
|
||||
get() = video.fileId to video
|
||||
|
||||
companion object : Type {
|
||||
override val name: String
|
||||
|
Reference in New Issue
Block a user