mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-26 18:47:14 +00:00
AnonymousPollOption renamed to SimplePollOption
This commit is contained in:
parent
00886dcfb7
commit
b9ab7f2955
@ -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`
|
||||
|
@ -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
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user