mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-03-09 04:12:26 +00:00
total rework of requests serialization
This commit is contained in:
@@ -5,8 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipar
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun AddStickerToSet(
|
||||
userId: UserId,
|
||||
@@ -44,5 +43,8 @@ data class AddStickerToSet internal constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "addStickerToSet"
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipar
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun CreateNewStickerSet(
|
||||
userId: UserId,
|
||||
@@ -47,5 +46,8 @@ data class CreateNewStickerSet internal constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "createNewStickerSet"
|
||||
}
|
||||
|
||||
@@ -12,5 +12,8 @@ data class DeleteStickerFromSet(
|
||||
val sticker: FileId
|
||||
) : SimpleRequest<Boolean> {
|
||||
override fun method(): String = "deleteStickerFromSet"
|
||||
override fun resultDeserializer(): KSerializer<Boolean> = BooleanSerializer
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
@@ -21,5 +21,8 @@ data class SetStickerPositionInSet(
|
||||
}
|
||||
|
||||
override fun method(): String = "setStickerPositionInSet"
|
||||
override fun resultDeserializer(): KSerializer<Boolean> = BooleanSerializer
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
@@ -24,5 +24,6 @@ data class UploadStickerFile(
|
||||
override val mediaMap: Map<String, MultipartFile> = mapOf(pngStickerField to sticker)
|
||||
@Transient
|
||||
override val paramsJson: JsonObject = toJsonWithoutNulls(serializer())
|
||||
override fun resultDeserializer(): KSerializer<File> = File.serializer()
|
||||
override val resultDeserializer: DeserializationStrategy<File>
|
||||
get() = File.serializer()
|
||||
}
|
||||
|
||||
@@ -12,5 +12,6 @@ interface StickerSetAction : SimpleRequest<Boolean> {
|
||||
val emojis: String // must be more than one
|
||||
val maskPosition: MaskPosition?
|
||||
|
||||
override fun resultDeserializer(): KSerializer<Boolean> = BooleanSerializer
|
||||
override val resultDeserializer: KSerializer<Boolean>
|
||||
get() = BooleanSerializer
|
||||
}
|
||||
Reference in New Issue
Block a user