mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23: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.files.PhotoSize
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.mediaField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.mediaField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.json.JsonElement
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
|
||||||
internal const val photoInputMediaType = "photo"
|
internal const val photoInputMediaType = "photo"
|
||||||
|
|
||||||
@ -27,8 +29,7 @@ data class InputMediaPhoto(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
@Deprecated("Marked as deprecated for removal in future updates", level = DeprecationLevel.ERROR)
|
override val arguments: JsonElement = buildArguments(serializer())
|
||||||
override val arguments: Map<String, Any?> = error("Unsupported operation")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun PhotoSize.toInputMediaPhoto(
|
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.ParseMode.parseModeField
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.mediaField
|
import com.github.insanusmokrassar.TelegramBotAPI.types.mediaField
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.properties.Properties
|
import kotlinx.serialization.json.JsonElement
|
||||||
|
|
||||||
internal const val videoInputMediaType = "video"
|
internal const val videoInputMediaType = "video"
|
||||||
|
|
||||||
@ -24,13 +24,13 @@ data class InputMediaVideo(
|
|||||||
|
|
||||||
override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this)
|
override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this)
|
||||||
|
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
override val arguments: JsonElement = buildArguments(serializer())
|
||||||
|
|
||||||
@SerialName(mediaField)
|
@SerialName(mediaField)
|
||||||
val media: String = when (file) {
|
val media: String = when (file) {
|
||||||
is FileId -> file.fileId
|
is FileId -> file.fileId
|
||||||
is MultipartFile -> file.fileId.toInputMediaFileAttachmentName()
|
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
|
package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedOutput
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedOutput
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.StringFormat
|
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)
|
@Serializable(MediaGroupMemberInputMediaSerializer::class)
|
||||||
interface MediaGroupMemberInputMedia : InputMedia, CaptionedOutput {
|
interface MediaGroupMemberInputMedia : InputMedia, CaptionedOutput {
|
||||||
fun serialize(format: StringFormat): String
|
fun serialize(format: StringFormat): String
|
||||||
@Deprecated("Marked as deprecated for removal in future updates", level = DeprecationLevel.ERROR)
|
val arguments: JsonElement
|
||||||
val arguments: Map<String, Any?>
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user