1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-04 23:43:47 +00:00
tgbotapi/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt

30 lines
1.2 KiB
Kotlin
Raw Normal View History

2018-12-26 08:07:24 +00:00
package com.github.insanusmokrassar.TelegramBotAPI.requests
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
2019-02-27 06:01:04 +00:00
import com.github.insanusmokrassar.TelegramBotAPI.types.ALL_UPDATES_LIST
2019-03-15 08:12:17 +00:00
import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier
2019-08-17 16:08:36 +00:00
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UpdateSerializerWithoutDeserialization
2019-12-02 08:35:37 +00:00
import kotlinx.serialization.*
2018-12-26 08:07:24 +00:00
import kotlinx.serialization.internal.ArrayListSerializer
2019-12-02 08:35:37 +00:00
private val updatesListSerializer = ArrayListSerializer(
UpdateSerializerWithoutDeserialization
)
2018-12-26 08:07:24 +00:00
@Serializable
data class GetUpdates(
val offset: UpdateIdentifier? = null,// set `last update id + 1` to receive next part of updates
val limit: Int? = null,
val timeout: Int? = null,
2019-02-27 06:01:04 +00:00
val allowed_updates: List<String>? = ALL_UPDATES_LIST
2019-08-17 16:08:36 +00:00
): SimpleRequest<List<Update>> {
2018-12-26 08:07:24 +00:00
override fun method(): String = "getUpdates"
2019-12-02 08:35:37 +00:00
override val resultDeserializer: DeserializationStrategy<List<Update>>
get() = updatesListSerializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
2018-12-26 08:07:24 +00:00
}