2018-12-26 08:07:24 +00:00
|
|
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts
|
|
|
|
|
2019-12-02 08:35:37 +00:00
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJsonWithoutNulls
|
|
|
|
import kotlinx.serialization.SerializationStrategy
|
|
|
|
import kotlinx.serialization.json.JsonObject
|
2019-02-21 07:48:49 +00:00
|
|
|
|
2019-12-02 08:35:37 +00:00
|
|
|
interface SimpleRequest<T: Any> : Request<T> {
|
|
|
|
val requestSerializer: SerializationStrategy<*>
|
|
|
|
}
|
2019-02-21 07:48:49 +00:00
|
|
|
|
2019-12-02 08:35:37 +00:00
|
|
|
@Suppress("UNCHECKED_CAST")
|
|
|
|
inline fun <T: Any, K: SimpleRequest<T>> K.json(): JsonObject = toJsonWithoutNulls(requestSerializer as SerializationStrategy<K>)
|