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
|
|
|
}
|