1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-04 15:33:47 +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 com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultAudioCachedImpl( data class InlineQueryResultAudioCachedImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultAudioImpl( data class InlineQueryResultAudioImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultContact( data class InlineQueryResultContact(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultDocumentCachedImpl( data class InlineQueryResultDocumentCachedImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultDocumentImpl( data class InlineQueryResultDocumentImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultGifCachedImpl( data class InlineQueryResultGifCachedImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultGifImpl( data class InlineQueryResultGifImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultLocation( data class InlineQueryResultLocation(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultMpeg4GifCachedImpl( data class InlineQueryResultMpeg4GifCachedImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultMpeg4GifImpl( data class InlineQueryResultMpeg4GifImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultStickerCached( data class InlineQueryResultStickerCached(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVenue( data class InlineQueryResultVenue(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVideoCachedImpl( data class InlineQueryResultVideoCachedImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVideoImpl( data class InlineQueryResultVideoImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVoiceCachedImpl( data class InlineQueryResultVoiceCachedImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, 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 com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import kotlinx.serialization.Optional import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVoiceImpl( data class InlineQueryResultVoiceImpl(
@SerialName(idField) @SerialName(idField)
override val id: String, override val id: String,

View File

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