mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 00:03:48 +00:00
temporal update
This commit is contained in:
parent
046402454f
commit
94a35349aa
@ -6,6 +6,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.mediaField
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.json.JsonElement
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
internal const val photoInputMediaType = "photo"
|
||||
|
||||
@ -27,8 +29,7 @@ data class InputMediaPhoto(
|
||||
}
|
||||
|
||||
@Transient
|
||||
@Deprecated("Marked as deprecated for removal in future updates", level = DeprecationLevel.ERROR)
|
||||
override val arguments: Map<String, Any?> = error("Unsupported operation")
|
||||
override val arguments: JsonElement = buildArguments(serializer())
|
||||
}
|
||||
|
||||
fun PhotoSize.toInputMediaPhoto(
|
||||
|
@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.mediaField
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.properties.Properties
|
||||
import kotlinx.serialization.json.JsonElement
|
||||
|
||||
internal const val videoInputMediaType = "video"
|
||||
|
||||
@ -24,13 +24,13 @@ data class InputMediaVideo(
|
||||
|
||||
override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this)
|
||||
|
||||
|
||||
@Transient
|
||||
override val arguments: JsonElement = buildArguments(serializer())
|
||||
|
||||
@SerialName(mediaField)
|
||||
val media: String = when (file) {
|
||||
is FileId -> file.fileId
|
||||
is MultipartFile -> file.fileId.toInputMediaFileAttachmentName()
|
||||
}
|
||||
|
||||
@Transient
|
||||
@Deprecated("Marked as deprecated for removal in future updates", level = DeprecationLevel.ERROR)
|
||||
override val arguments: Map<String, Any?> = error("Unsupported operation")
|
||||
}
|
||||
|
@ -1,12 +1,21 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedOutput
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.StringFormat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.json.*
|
||||
|
||||
internal val argumentsFormatter by lazy {
|
||||
Json {
|
||||
encodeDefaults = true
|
||||
}
|
||||
}
|
||||
internal fun <T> T.buildArguments(withSerializer: SerializationStrategy<T>) = argumentsFormatter.encodeToJsonElement(
|
||||
withSerializer,
|
||||
this
|
||||
)
|
||||
|
||||
@Serializable(MediaGroupMemberInputMediaSerializer::class)
|
||||
interface MediaGroupMemberInputMedia : InputMedia, CaptionedOutput {
|
||||
fun serialize(format: StringFormat): String
|
||||
@Deprecated("Marked as deprecated for removal in future updates", level = DeprecationLevel.ERROR)
|
||||
val arguments: Map<String, Any?>
|
||||
val arguments: JsonElement
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user