2020-10-04 11:06:30 +00:00
|
|
|
package dev.inmo.tgbotapi.types
|
2019-02-05 04:51:52 +00:00
|
|
|
|
2023-05-27 12:19:14 +00:00
|
|
|
import korlibs.time.DateTime
|
2019-02-05 04:51:52 +00:00
|
|
|
import kotlinx.serialization.*
|
|
|
|
|
|
|
|
@Serializable
|
|
|
|
data class ResponseParametersRaw(
|
|
|
|
@SerialName("migrate_to_chat_id")
|
2022-11-10 09:56:38 +00:00
|
|
|
private val migrateToChatId: IdChatIdentifier? = null,
|
2019-02-05 04:51:52 +00:00
|
|
|
@SerialName("retry_after")
|
2020-11-11 04:23:20 +00:00
|
|
|
private val retryAfter: Seconds? = null
|
2019-02-05 04:51:52 +00:00
|
|
|
) {
|
|
|
|
@Transient
|
2019-12-03 05:07:25 +00:00
|
|
|
private val createTime: Long = DateTime.now().unixMillisLong
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|