1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00

resolve serialization problems

This commit is contained in:
InsanusMokrassar 2019-02-07 19:32:31 +08:00
parent f83921223e
commit f6ce40b62b
18 changed files with 74 additions and 0 deletions

View File

@ -12,7 +12,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultAudioCachedImpl(
@SerialName(idField)
override val id: String,

View File

@ -10,7 +10,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultAudioImpl(
@SerialName(idField)
override val id: String,

View File

@ -11,7 +11,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultContact(
@SerialName(idField)
override val id: String,

View File

@ -12,7 +12,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultDocumentCachedImpl(
@SerialName(idField)
override val id: String,

View File

@ -10,7 +10,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultDocumentImpl(
@SerialName(idField)
override val id: String,

View File

@ -10,7 +10,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQuer
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultGifCachedImpl(
@SerialName(idField)
override val id: String,

View File

@ -8,7 +8,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultGifImpl(
@SerialName(idField)
override val id: String,

View File

@ -12,7 +12,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultLocation(
@SerialName(idField)
override val id: String,

View File

@ -11,7 +11,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQuer
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultMpeg4GifCachedImpl(
@SerialName(idField)
override val id: String,

View File

@ -8,7 +8,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQuer
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultMpeg4GifImpl(
@SerialName(idField)
override val id: String,

View File

@ -11,7 +11,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQuer
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultStickerCached(
@SerialName(idField)
override val id: String,

View File

@ -11,7 +11,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVenue(
@SerialName(idField)
override val id: String,

View File

@ -11,7 +11,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVideoCachedImpl(
@SerialName(idField)
override val id: String,

View File

@ -9,7 +9,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVideoImpl(
@SerialName(idField)
override val id: String,

View File

@ -10,7 +10,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQuer
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVoiceCachedImpl(
@SerialName(idField)
override val id: String,

View File

@ -8,7 +8,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQuer
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVoiceImpl(
@SerialName(idField)
override val id: String,

View File

@ -1,7 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
@Serializable(InlineQueryResultSerializer::class)
interface InlineQueryResult {
val type: String
val id: String

View File

@ -0,0 +1,39 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.serializers
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import kotlinx.serialization.*
import sun.reflect.generics.reflectiveObjects.NotImplementedException
@Serializer(InlineQueryResult::class)
object InlineQueryResultSerializer :
KSerializer<InlineQueryResult> {
override fun serialize(output: Encoder, obj: InlineQueryResult) {
when(obj) {
is InlineQueryResultArticle -> InlineQueryResultArticle.serializer().serialize(output, obj)
is InlineQueryResultAudioCachedImpl -> InlineQueryResultAudioCachedImpl.serializer().serialize(output, obj)
is InlineQueryResultAudioImpl -> InlineQueryResultAudioImpl.serializer().serialize(output, obj)
is InlineQueryResultContact -> InlineQueryResultContact.serializer().serialize(output, obj)
is InlineQueryResultDocumentCachedImpl -> InlineQueryResultDocumentCachedImpl.serializer().serialize(output, obj)
is InlineQueryResultDocumentImpl -> InlineQueryResultDocumentImpl.serializer().serialize(output, obj)
is InlineQueryResultGame -> InlineQueryResultGame.serializer().serialize(output, obj)
is InlineQueryResultGifCachedImpl -> InlineQueryResultGifCachedImpl.serializer().serialize(output, obj)
is InlineQueryResultGifImpl -> InlineQueryResultGifImpl.serializer().serialize(output, obj)
is InlineQueryResultLocation -> InlineQueryResultLocation.serializer().serialize(output, obj)
is InlineQueryResultMpeg4GifCachedImpl -> InlineQueryResultMpeg4GifCachedImpl.serializer().serialize(output, obj)
is InlineQueryResultMpeg4GifImpl -> InlineQueryResultMpeg4GifImpl.serializer().serialize(output, obj)
is InlineQueryResultPhotoCachedImpl -> InlineQueryResultPhotoCachedImpl.serializer().serialize(output, obj)
is InlineQueryResultPhotoImpl -> InlineQueryResultPhotoImpl.serializer().serialize(output, obj)
is InlineQueryResultStickerCached -> InlineQueryResultStickerCached.serializer().serialize(output, obj)
is InlineQueryResultVenue -> InlineQueryResultVenue.serializer().serialize(output, obj)
is InlineQueryResultVideoCachedImpl -> InlineQueryResultVideoCachedImpl.serializer().serialize(output, obj)
is InlineQueryResultVideoImpl -> InlineQueryResultVideoImpl.serializer().serialize(output, obj)
is InlineQueryResultVoiceCachedImpl -> InlineQueryResultVoiceCachedImpl.serializer().serialize(output, obj)
is InlineQueryResultVoiceImpl -> InlineQueryResultVoiceImpl.serializer().serialize(output, obj)
}
}
override fun deserialize(input: Decoder): InlineQueryResult {
throw NotImplementedException()
}
}