From d963cdae3580b7fca96369510bb9615699502b52 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 16 Mar 2024 22:53:01 +0600 Subject: [PATCH] PollId now is value class --- CHANGELOG.md | 1 + .../api/tgbotapi.behaviour_builder.api | 4 +- tgbotapi.core/api/tgbotapi.core.api | 85 +++++++++++++------ .../kotlin/dev/inmo/tgbotapi/types/Common.kt | 1 - .../dev/inmo/tgbotapi/types/PollIdentifier.kt | 16 ++++ .../dev/inmo/tgbotapi/types/polls/Poll.kt | 10 +-- .../inmo/tgbotapi/types/polls/PollAnswer.kt | 10 +-- .../utils/extensions/raw/PollAnswer.kt | 4 +- 8 files changed, 89 insertions(+), 42 deletions(-) create mode 100644 tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/PollIdentifier.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index fd93433ae7..761ff9e5f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ * `ShippingQueryIdentifier` has been renamed to `ShippingQueryId` and now is `value class` * `Identifier` has been renamed to `RawChatId` and now is `value class` * `ShippingOptionIdentifier` has been renamed to `ShippingOptionId` and now is `value class` + * `PollIdentifier` has been renamed to `PollId` and now is `value class` ## 10.1.2 diff --git a/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api b/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api index f60406bed6..934c7c77f1 100644 --- a/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api +++ b/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api @@ -1327,14 +1327,14 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_f public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdPollAnswerMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory { public static final field INSTANCE Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdPollAnswerMarkerFactory; - public fun invoke (Ldev/inmo/tgbotapi/types/polls/PollAnswer;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public synthetic fun invoke (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun invoke-ErVIubg (Ldev/inmo/tgbotapi/types/polls/PollAnswer;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdPollMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory { public static final field INSTANCE Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByIdPollMarkerFactory; - public fun invoke (Ldev/inmo/tgbotapi/types/polls/Poll;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public synthetic fun invoke (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public fun invoke-ErVIubg (Ldev/inmo/tgbotapi/types/polls/Poll;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/ByUserCallbackQueryMarkerFactory : dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory { diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index a023bd4ebd..b2b2b3ac91 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -10048,6 +10048,36 @@ public final class dev/inmo/tgbotapi/types/MigrateChatId : dev/inmo/tgbotapi/typ public fun toString ()Ljava/lang/String; } +public final class dev/inmo/tgbotapi/types/PollId { + public static final field Companion Ldev/inmo/tgbotapi/types/PollId$Companion; + public static final synthetic fun box-impl (Ljava/lang/String;)Ldev/inmo/tgbotapi/types/PollId; + public static fun constructor-impl (Ljava/lang/String;)Ljava/lang/String; + public fun equals (Ljava/lang/Object;)Z + public static fun equals-impl (Ljava/lang/String;Ljava/lang/Object;)Z + public static final fun equals-impl0 (Ljava/lang/String;Ljava/lang/String;)Z + public final fun getString ()Ljava/lang/String; + public fun hashCode ()I + public static fun hashCode-impl (Ljava/lang/String;)I + public fun toString ()Ljava/lang/String; + public static fun toString-impl (Ljava/lang/String;)Ljava/lang/String; + public final synthetic fun unbox-impl ()Ljava/lang/String; +} + +public final class dev/inmo/tgbotapi/types/PollId$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/types/PollId$$serializer; + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun deserialize-rQzybd8 (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/String; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun serialize-9UUi0os (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/String;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/types/PollId$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + public final class dev/inmo/tgbotapi/types/PreCheckoutQueryId { public static final field Companion Ldev/inmo/tgbotapi/types/PreCheckoutQueryId$Companion; public static final synthetic fun box-impl (Ljava/lang/String;)Ldev/inmo/tgbotapi/types/PreCheckoutQueryId; @@ -21910,7 +21940,7 @@ public final class dev/inmo/tgbotapi/types/polls/MultipleAnswersPoll$Companion { public abstract interface class dev/inmo/tgbotapi/types/polls/Poll : dev/inmo/tgbotapi/types/ReplyInfo$External$ContentVariant { public static final field Companion Ldev/inmo/tgbotapi/types/polls/Poll$Companion; - public abstract fun getId ()Ljava/lang/String; + public abstract fun getId-S5FO_mE ()Ljava/lang/String; public abstract fun getOptions ()Ljava/util/List; public abstract fun getQuestion ()Ljava/lang/String; public abstract fun getScheduledCloseInfo ()Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo; @@ -21927,22 +21957,22 @@ public abstract interface class dev/inmo/tgbotapi/types/polls/PollAnswer : dev/i public static final field Companion Ldev/inmo/tgbotapi/types/polls/PollAnswer$Companion; public abstract fun getChosen ()Ljava/util/List; public abstract fun getFrom ()Ldev/inmo/tgbotapi/types/chat/User; - public abstract fun getPollId ()Ljava/lang/String; + public abstract fun getPollId-S5FO_mE ()Ljava/lang/String; public abstract fun getUser ()Ldev/inmo/tgbotapi/types/chat/User; } public final class dev/inmo/tgbotapi/types/polls/PollAnswer$Anonymous : dev/inmo/tgbotapi/types/polls/PollAnswer { public static final field Companion Ldev/inmo/tgbotapi/types/polls/PollAnswer$Anonymous$Companion; - public fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/ChannelChat;Ljava/util/List;)V - public final fun component1 ()Ljava/lang/String; + public synthetic fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/ChannelChat;Ljava/util/List;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-S5FO_mE ()Ljava/lang/String; public final fun component2 ()Ldev/inmo/tgbotapi/types/chat/ChannelChat; public final fun component3 ()Ljava/util/List; - public final fun copy (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/ChannelChat;Ljava/util/List;)Ldev/inmo/tgbotapi/types/polls/PollAnswer$Anonymous; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/polls/PollAnswer$Anonymous;Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/ChannelChat;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/PollAnswer$Anonymous; + public final fun copy-kNAtUQk (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/ChannelChat;Ljava/util/List;)Ldev/inmo/tgbotapi/types/polls/PollAnswer$Anonymous; + public static synthetic fun copy-kNAtUQk$default (Ldev/inmo/tgbotapi/types/polls/PollAnswer$Anonymous;Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/ChannelChat;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/PollAnswer$Anonymous; public fun equals (Ljava/lang/Object;)Z public fun getChosen ()Ljava/util/List; public fun getFrom ()Ldev/inmo/tgbotapi/types/chat/User; - public fun getPollId ()Ljava/lang/String; + public fun getPollId-S5FO_mE ()Ljava/lang/String; public fun getUser ()Ldev/inmo/tgbotapi/types/chat/User; public final fun getVoterChat ()Ldev/inmo/tgbotapi/types/chat/ChannelChat; public fun hashCode ()I @@ -21969,7 +21999,7 @@ public final class dev/inmo/tgbotapi/types/polls/PollAnswer$Companion : kotlinx/ public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/types/polls/PollAnswer; public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; - public final fun invoke (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/User;Ljava/util/List;)Ldev/inmo/tgbotapi/types/polls/PollAnswer$Public; + public final fun invoke-kNAtUQk (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/User;Ljava/util/List;)Ldev/inmo/tgbotapi/types/polls/PollAnswer$Public; public fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/types/polls/PollAnswer;)V public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V public final fun serializer ()Lkotlinx/serialization/KSerializer; @@ -21981,16 +22011,16 @@ public final class dev/inmo/tgbotapi/types/polls/PollAnswer$DefaultImpls { public final class dev/inmo/tgbotapi/types/polls/PollAnswer$Public : dev/inmo/tgbotapi/types/polls/PollAnswer { public static final field Companion Ldev/inmo/tgbotapi/types/polls/PollAnswer$Public$Companion; - public fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/User;Ljava/util/List;)V - public final fun component1 ()Ljava/lang/String; + public synthetic fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/User;Ljava/util/List;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-S5FO_mE ()Ljava/lang/String; public final fun component2 ()Ldev/inmo/tgbotapi/types/chat/User; public final fun component3 ()Ljava/util/List; - public final fun copy (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/User;Ljava/util/List;)Ldev/inmo/tgbotapi/types/polls/PollAnswer$Public; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/polls/PollAnswer$Public;Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/User;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/PollAnswer$Public; + public final fun copy-kNAtUQk (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/User;Ljava/util/List;)Ldev/inmo/tgbotapi/types/polls/PollAnswer$Public; + public static synthetic fun copy-kNAtUQk$default (Ldev/inmo/tgbotapi/types/polls/PollAnswer$Public;Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/User;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/PollAnswer$Public; public fun equals (Ljava/lang/Object;)Z public fun getChosen ()Ljava/util/List; public fun getFrom ()Ldev/inmo/tgbotapi/types/chat/User; - public fun getPollId ()Ljava/lang/String; + public fun getPollId-S5FO_mE ()Ljava/lang/String; public fun getUser ()Ldev/inmo/tgbotapi/types/chat/User; public fun hashCode ()I public fun toString ()Ljava/lang/String; @@ -22049,9 +22079,9 @@ public final class dev/inmo/tgbotapi/types/polls/PollSerializer : kotlinx/serial public final class dev/inmo/tgbotapi/types/polls/QuizPoll : dev/inmo/tgbotapi/abstracts/TextedInput, dev/inmo/tgbotapi/types/polls/Poll { public static final field Companion Ldev/inmo/tgbotapi/types/polls/QuizPoll$Companion; - public fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILjava/lang/Integer;Ljava/lang/String;Ljava/util/List;ZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;)V public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILjava/lang/Integer;Ljava/lang/String;Ljava/util/List;ZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()Ljava/lang/String; + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILjava/lang/Integer;Ljava/lang/String;Ljava/util/List;ZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-S5FO_mE ()Ljava/lang/String; public final fun component10 ()Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo; public final fun component2 ()Ljava/lang/String; public final fun component3 ()Ljava/util/List; @@ -22061,11 +22091,11 @@ public final class dev/inmo/tgbotapi/types/polls/QuizPoll : dev/inmo/tgbotapi/ab public final fun component7 ()Ljava/util/List; public final fun component8 ()Z public final fun component9 ()Z - public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILjava/lang/Integer;Ljava/lang/String;Ljava/util/List;ZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;)Ldev/inmo/tgbotapi/types/polls/QuizPoll; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/polls/QuizPoll;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILjava/lang/Integer;Ljava/lang/String;Ljava/util/List;ZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/QuizPoll; + public final fun copy-5LOS23Y (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILjava/lang/Integer;Ljava/lang/String;Ljava/util/List;ZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;)Ldev/inmo/tgbotapi/types/polls/QuizPoll; + public static synthetic fun copy-5LOS23Y$default (Ldev/inmo/tgbotapi/types/polls/QuizPoll;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILjava/lang/Integer;Ljava/lang/String;Ljava/util/List;ZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/QuizPoll; public fun equals (Ljava/lang/Object;)Z public final fun getCorrectOptionId ()Ljava/lang/Integer; - public fun getId ()Ljava/lang/String; + public fun getId-S5FO_mE ()Ljava/lang/String; public fun getOptions ()Ljava/util/List; public fun getQuestion ()Ljava/lang/String; public fun getScheduledCloseInfo ()Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo; @@ -22084,9 +22114,9 @@ public final class dev/inmo/tgbotapi/types/polls/QuizPoll$Companion { public final class dev/inmo/tgbotapi/types/polls/RegularPoll : dev/inmo/tgbotapi/types/polls/MultipleAnswersPoll { public static final field Companion Ldev/inmo/tgbotapi/types/polls/RegularPoll$Companion; - public fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;)V public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1 ()Ljava/lang/String; + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-S5FO_mE ()Ljava/lang/String; public final fun component2 ()Ljava/lang/String; public final fun component3 ()Ljava/util/List; public final fun component4 ()I @@ -22094,11 +22124,11 @@ public final class dev/inmo/tgbotapi/types/polls/RegularPoll : dev/inmo/tgbotapi public final fun component6 ()Z public final fun component7 ()Z public final fun component8 ()Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo; - public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;)Ldev/inmo/tgbotapi/types/polls/RegularPoll; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/polls/RegularPoll;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/RegularPoll; + public final fun copy-KILYFNk (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;)Ldev/inmo/tgbotapi/types/polls/RegularPoll; + public static synthetic fun copy-KILYFNk$default (Ldev/inmo/tgbotapi/types/polls/RegularPoll;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZZLdev/inmo/tgbotapi/types/polls/ScheduledCloseInfo;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/RegularPoll; public fun equals (Ljava/lang/Object;)Z public fun getAllowMultipleAnswers ()Z - public fun getId ()Ljava/lang/String; + public fun getId-S5FO_mE ()Ljava/lang/String; public fun getOptions ()Ljava/util/List; public fun getQuestion ()Ljava/lang/String; public fun getScheduledCloseInfo ()Ldev/inmo/tgbotapi/types/polls/ScheduledCloseInfo; @@ -22149,17 +22179,18 @@ public final class dev/inmo/tgbotapi/types/polls/SimplePollOption$Companion { public final class dev/inmo/tgbotapi/types/polls/UnknownPollType : dev/inmo/tgbotapi/types/polls/Poll { public static final field Companion Ldev/inmo/tgbotapi/types/polls/UnknownPollType$Companion; - public final fun component1 ()Ljava/lang/String; + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZLkotlinx/serialization/json/JsonObject;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-S5FO_mE ()Ljava/lang/String; public final fun component2 ()Ljava/lang/String; public final fun component3 ()Ljava/util/List; public final fun component4 ()I public final fun component5 ()Z public final fun component6 ()Z public final fun component7 ()Lkotlinx/serialization/json/JsonObject; - public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZLkotlinx/serialization/json/JsonObject;)Ldev/inmo/tgbotapi/types/polls/UnknownPollType; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/polls/UnknownPollType;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZLkotlinx/serialization/json/JsonObject;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/UnknownPollType; + public final fun copy-lVWo1a4 (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZLkotlinx/serialization/json/JsonObject;)Ldev/inmo/tgbotapi/types/polls/UnknownPollType; + public static synthetic fun copy-lVWo1a4$default (Ldev/inmo/tgbotapi/types/polls/UnknownPollType;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;IZZLkotlinx/serialization/json/JsonObject;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/UnknownPollType; public fun equals (Ljava/lang/Object;)Z - public fun getId ()Ljava/lang/String; + public fun getId-S5FO_mE ()Ljava/lang/String; public fun getOptions ()Ljava/util/List; public fun getQuestion ()Ljava/lang/String; public final fun getRaw ()Lkotlinx/serialization/json/JsonObject; diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt index 0bcd83beb1..fce14ff952 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt @@ -15,7 +15,6 @@ typealias AuthorSignature = ForwardSignature typealias PaymentQueryIdentifier = String typealias InvoicePayload = String typealias StartParameter = String -typealias PollIdentifier = String typealias StickerSetName = String typealias DiceResult = Int typealias FoursquareId = String diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/PollIdentifier.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/PollIdentifier.kt new file mode 100644 index 0000000000..a3993ddca8 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/PollIdentifier.kt @@ -0,0 +1,16 @@ +package dev.inmo.tgbotapi.types + +import kotlinx.serialization.Serializable +import kotlin.jvm.JvmInline + +@Serializable +@JvmInline +value class PollId( + val string: String +) { + override fun toString(): String { + return string + } +} +@Deprecated("Renamed", ReplaceWith("PollId", "dev.inmo.tgbotapi.types.PollId")) +typealias PollIdentifier = String diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt index 182e379dd9..d43734a013 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt @@ -50,7 +50,7 @@ val LongSeconds.asExactScheduledCloseInfo @Serializable(PollSerializer::class) @ClassCastsIncluded sealed interface Poll : ReplyInfo.External.ContentVariant { - val id: PollIdentifier + val id: PollId val question: String val options: List val votesCount: Int @@ -67,7 +67,7 @@ sealed interface MultipleAnswersPoll : Poll { @Serializable private class RawPoll( @SerialName(idField) - val id: PollIdentifier, + val id: PollId, @SerialName(questionField) val question: String, @SerialName(optionsField) @@ -101,7 +101,7 @@ private class RawPoll( @Serializable data class UnknownPollType internal constructor( @SerialName(idField) - override val id: PollIdentifier, + override val id: PollId, @SerialName(questionField) override val question: String, @SerialName(optionsField) @@ -124,7 +124,7 @@ data class UnknownPollType internal constructor( @Serializable(PollSerializer::class) data class RegularPoll( - override val id: PollIdentifier, + override val id: PollId, override val question: String, override val options: List, override val votesCount: Int, @@ -136,7 +136,7 @@ data class RegularPoll( @Serializable(PollSerializer::class) data class QuizPoll( - override val id: PollIdentifier, + override val id: PollId, override val question: String, override val options: List, override val votesCount: Int, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollAnswer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollAnswer.kt index 50822a7ebc..bb0cf406ae 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollAnswer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollAnswer.kt @@ -12,7 +12,7 @@ import kotlinx.serialization.encoding.Encoder @Serializable(PollAnswer.Companion::class) sealed interface PollAnswer: FromUser { - val pollId: PollIdentifier + val pollId: PollId override val user: User val chosen: List @Transient @@ -22,7 +22,7 @@ sealed interface PollAnswer: FromUser { @Serializable data class Public( @SerialName(pollIdField) - override val pollId: PollIdentifier, + override val pollId: PollId, @SerialName(userField) override val user: User, @SerialName(optionIdsField) @@ -32,7 +32,7 @@ sealed interface PollAnswer: FromUser { @Serializable data class Anonymous( @SerialName(pollIdField) - override val pollId: PollIdentifier, + override val pollId: PollId, @SerialName(voterChatField) val voterChat: ChannelChat, @SerialName(optionIdsField) @@ -55,7 +55,7 @@ sealed interface PollAnswer: FromUser { @Serializable private data class PollAnswerSurrogate( @SerialName(pollIdField) - val pollId: PollIdentifier, + val pollId: PollId, @SerialName(optionIdsField) val chosen: List, @SerialName(userField) @@ -64,7 +64,7 @@ sealed interface PollAnswer: FromUser { val voterChat: ChannelChat? = null ) operator fun invoke( - pollId: PollIdentifier, + pollId: PollId, user: User, chosen: List, ) = Public(pollId, user, chosen) diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/PollAnswer.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/PollAnswer.kt index 3b0fcba264..8034277cd1 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/PollAnswer.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/raw/PollAnswer.kt @@ -1,11 +1,11 @@ package dev.inmo.tgbotapi.extensions.utils.extensions.raw -import dev.inmo.tgbotapi.types.PollIdentifier +import dev.inmo.tgbotapi.types.PollId import dev.inmo.tgbotapi.types.polls.PollAnswer import dev.inmo.tgbotapi.utils.RiskFeature @RiskFeature(RawFieldsUsageWarning) -val PollAnswer.poll_id: PollIdentifier +val PollAnswer.poll_id: PollId get() = pollId @RiskFeature(RawFieldsUsageWarning) val PollAnswer.option_ids: List