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`
* `QuizPoll` type was added to represent polls with type `quiz`
* `UnknownPollType` type was added to represent polls which are unknown in current version
* `AnonymousPollOption` was renamed to `SimplePollOption`
* `SendPoll` was rewritten as sealed class
* `SendRegularPoll` was created and represent `sendPoll` method with type `regular`
* `SendQuizPoll` was created and represent `sendPoll` method with type `quiz`

View File

@ -12,7 +12,7 @@ sealed class PollOption {
}
@Serializable
data class AnonymousPollOption (
data class SimplePollOption (
@SerialName(textField)
override val text: String,
@SerialName(votesCountField)
@ -22,13 +22,13 @@ data class AnonymousPollOption (
internal object PollOptionSerializer : KSerializer<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
)
override fun serialize(encoder: Encoder, obj: PollOption) {
when (obj) {
is AnonymousPollOption -> AnonymousPollOption.serializer().serialize(
is SimplePollOption -> SimplePollOption.serializer().serialize(
encoder,
obj
)