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:
parent
00886dcfb7
commit
b9ab7f2955
@ -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`
|
||||||
|
@ -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
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user