1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +00:00

AnonymousPollOption renamed to SimplePollOption

This commit is contained in:
InsanusMokrassar 2020-01-23 20:11:24 +06:00
parent 00886dcfb7
commit b9ab7f2955
2 changed files with 4 additions and 3 deletions

View File

@ -6,6 +6,7 @@
* `RegularPoll` type was added to represent polls with type `regular` * `RegularPoll` type was added to represent polls with type `regular`
* `QuizPoll` type was added to represent polls with type `quiz` * `QuizPoll` type was added to represent polls with type `quiz`
* `UnknownPollType` type was added to represent polls which are unknown in current version * `UnknownPollType` type was added to represent polls which are unknown in current version
* `AnonymousPollOption` was renamed to `SimplePollOption`
* `SendPoll` was rewritten as sealed class * `SendPoll` was rewritten as sealed class
* `SendRegularPoll` was created and represent `sendPoll` method with type `regular` * `SendRegularPoll` was created and represent `sendPoll` method with type `regular`
* `SendQuizPoll` was created and represent `sendPoll` method with type `quiz` * `SendQuizPoll` was created and represent `sendPoll` method with type `quiz`

View File

@ -12,7 +12,7 @@ sealed class PollOption {
} }
@Serializable @Serializable
data class AnonymousPollOption ( data class SimplePollOption (
@SerialName(textField) @SerialName(textField)
override val text: String, override val text: String,
@SerialName(votesCountField) @SerialName(votesCountField)
@ -22,13 +22,13 @@ data class AnonymousPollOption (
internal object PollOptionSerializer : KSerializer<PollOption> { internal object PollOptionSerializer : KSerializer<PollOption> {
override val descriptor: SerialDescriptor = StringDescriptor.withName(PollOption::class.simpleName ?: "PollOption") override val descriptor: SerialDescriptor = StringDescriptor.withName(PollOption::class.simpleName ?: "PollOption")
override fun deserialize(decoder: Decoder): PollOption = AnonymousPollOption.serializer().deserialize( override fun deserialize(decoder: Decoder): PollOption = SimplePollOption.serializer().deserialize(
decoder decoder
) )
override fun serialize(encoder: Encoder, obj: PollOption) { override fun serialize(encoder: Encoder, obj: PollOption) {
when (obj) { when (obj) {
is AnonymousPollOption -> AnonymousPollOption.serializer().serialize( is SimplePollOption -> SimplePollOption.serializer().serialize(
encoder, encoder,
obj obj
) )