commonMain.com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.SetChatPhoto.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of TelegramBotAPI-jvm Show documentation
Show all versions of TelegramBotAPI-jvm Show documentation
Library for Object-Oriented and type-safe work with Telegram Bot API
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJson
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.json.JsonObject
@Serializable
data class SetChatPhoto (
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
val photo: MultipartFile = throw IllegalArgumentException("Unfortunately, this type of objects can't be parsed automatically")
): ChatRequest, MultipartRequest {
override fun method(): String = "setChatPhoto"
override val resultDeserializer: DeserializationStrategy
get() = BooleanSerializer
override val mediaMap: Map = mapOf(photoField to photo)
override val paramsJson: JsonObject = toJson(serializer())
}