commonMain.com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.SetChatDescription.kt Maven / Gradle / Ivy
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@Serializable
data class SetChatDescription (
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(descriptionField)
val description: String
): ChatRequest, SimpleRequest {
init {
if (description.length !in chatDescriptionLength) {
throw IllegalArgumentException("Chat description must be in $chatDescriptionLength range")
}
}
override fun method(): String = "setChatDescription"
override val resultDeserializer: DeserializationStrategy
get() = BooleanSerializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}