2019-02-05 04:51:52 +00:00
|
|
|
package com.github.insanusmokrassar.TelegramBotAPI.types
|
|
|
|
|
|
|
|
import kotlinx.serialization.*
|
|
|
|
|
|
|
|
@Serializable
|
|
|
|
data class ResponseParametersRaw(
|
|
|
|
@SerialName("migrate_to_chat_id")
|
|
|
|
@Optional
|
|
|
|
private val migrateToChatId: ChatId? = null,
|
|
|
|
@SerialName("retry_after")
|
|
|
|
@Optional
|
|
|
|
private val retryAfter: Long? = null
|
|
|
|
) {
|
|
|
|
@Transient
|
|
|
|
private val createTime: Long = System.currentTimeMillis()
|
2019-02-05 05:07:39 +00:00
|
|
|
@Transient
|
2019-02-05 04:51:52 +00:00
|
|
|
val error: RequestError? by lazy {
|
|
|
|
when {
|
|
|
|
migrateToChatId != null -> MigrateChatId(migrateToChatId);
|
|
|
|
retryAfter != null -> RetryAfterError(retryAfter, createTime);
|
|
|
|
else -> null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|