com.github.insanusmokrassar.TelegramBotAPI.requests.answers.AnswerCallbackQuery.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of TelegramBotAPI Show documentation
Show all versions of TelegramBotAPI Show documentation
It is one more project which wish to be useful and full Telegram Bots API bridge for Kotlin
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQuery.CallbackQuery
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
@Serializable
data class AnswerCallbackQuery(
@SerialName(callbackQueryIdField)
val callbackQueryId: CallbackQueryIdentifier,
@SerialName(textField)
@Optional
val text: String? = null,
@SerialName(showAlertField)
@Optional
val showAlert: Boolean? = null,
@SerialName(urlField)
@Optional
val url: String? = null,
@SerialName(cachedTimeField)
@Optional
val cachedTimeSeconds: Int? = null
) : SimpleRequest {
override fun method(): String = "answerCallbackQuery"
override fun resultSerializer(): KSerializer = BooleanSerializer
}
fun CallbackQuery.createAnswer(
text: String? = null,
showAlert: Boolean? = null,
url: String? = null,
cachedTimeSeconds: Int? = null
): AnswerCallbackQuery = AnswerCallbackQuery(id, text, showAlert, url, cachedTimeSeconds)