From 909a7fd26ac5290c2d846c9aa93c351cb49e365e Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 22 Mar 2020 22:37:26 +0600 Subject: [PATCH] add ExtendedUser --- CHANGELOG.md | 1 + .../insanusmokrassar/TelegramBotAPI/types/User.kt | 5 +++++ .../TelegramBotAPI/utils/Annotations.kt | 14 +++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e32be3b51a..bc8de64214 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ * `PathedFile#fullUrl` now is not `inline` function * `SimpleRequest#json` now is not `inline` and `internal` function * `FlowsUpdatesFilter` now have two additional flows: `pollAnswerFlow`, `unknownUpdateTypeFlow` + * `ExtendedUser` (`typealias`) was added as a `PreviewFeature` ## 0.24.0 diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt index 2410f6fad0..05f82c362a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt @@ -1,6 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat +import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedPrivateChat +import com.github.insanusmokrassar.TelegramBotAPI.utils.PreviewFeature import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* import kotlinx.serialization.json.JsonObjectSerializer @@ -21,6 +23,9 @@ data class CommonUser( val languageCode: String? = null ) : User() +@PreviewFeature +typealias ExtendedUser = ExtendedPrivateChat + @Serializable(UserSerializer::class) sealed class Bot : User() { abstract override val username: Username diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt index a2a11b80ba..8091ba9794 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt @@ -1,7 +1,19 @@ package com.github.insanusmokrassar.TelegramBotAPI.utils @RequiresOptIn( - "It is possible, that bevahiour of this thing will be changed later", + "It is possible, that behaviour of this thing will be changed later", RequiresOptIn.Level.WARNING ) +@Target( + AnnotationTarget.CLASS, + AnnotationTarget.CONSTRUCTOR, + AnnotationTarget.FIELD, + AnnotationTarget.PROPERTY, + AnnotationTarget.PROPERTY_GETTER, + AnnotationTarget.PROPERTY_SETTER, + AnnotationTarget.FUNCTION, + AnnotationTarget.TYPE, + AnnotationTarget.TYPEALIAS, + AnnotationTarget.TYPE_PARAMETER +) annotation class PreviewFeature