tgbotapi/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt

31 lines
1.1 KiB
Kotlin
Raw Normal View History

2018-12-26 08:07:24 +00:00
package com.github.insanusmokrassar.TelegramBotAPI.requests.get
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
2019-01-17 02:43:51 +00:00
import com.github.insanusmokrassar.TelegramBotAPI.types.*
2018-12-26 08:07:24 +00:00
import kotlinx.serialization.*
@Serializable
data class GetUserProfilePhotos(
@SerialName(userIdField)
val userId: UserId,
@SerialName(offsetField)
val offset: Int? = null,
@SerialName(limitField)
val limit: Int? = null
): SimpleRequest<UserProfilePhotos> {
init {
if (offset != null && offset < 0) {
throw IllegalArgumentException("Offset for getting user profile photos must be positive")
}
if (limit != null && limit !in userProfilePhotosRequestLimit) {
throw IllegalArgumentException("Limit for getting user profile photos must be in 0 .. 100 range")
}
}
override fun method(): String = "getUserProfilePhotos"
2019-12-02 08:35:37 +00:00
override val resultDeserializer: DeserializationStrategy<UserProfilePhotos>
get() = UserProfilePhotos.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
2018-12-26 08:07:24 +00:00
}