From 975898660c49a166f9cada062f957ecaa3d8e97b Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 1 Jul 2020 23:57:20 +0600 Subject: [PATCH] TelegramBotAPI Venue and foursquare additions --- CHANGELOG.md | 3 +++ .../TelegramBotAPI/types/Common.kt | 2 ++ .../TelegramBotAPI/types/Venue.kt | 19 +++--------------- .../TelegramBotAPI/types/venue/Venue.kt | 20 +++++++++++++++++++ 4 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/venue/Venue.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c9e146bc3..f77ff85a60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,9 @@ * `TelegramBotAPI`: * `UnknownUpdateType` was renamed to `UnknownUpdate` * Refactoring and optimization of `FlowsUpdatesFilter` + * `Venue` type was replaced to a new package: `com.github.insanusmokrassar.TelegramBotAPI.types.venue.Venue` + * `Venue` type now implements `Locationed` and delegate realisation to its `location` field + * `FoursquareId` and `FoursquareType` typealiases were added * `TelegramBotAPI-extensions-utils`: * Several new functions `makeLinkToMessage` was added diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt index 2fb043f7bd..f1ad390052 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt @@ -22,6 +22,8 @@ typealias PollIdentifier = String typealias StickerSetName = String typealias FileUniqueId = String typealias DiceResult = Int +typealias FoursquareId = String +typealias FoursquareType = String typealias Seconds = Int typealias LongSeconds = Long diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Venue.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Venue.kt index ee6928b46c..6d6adef5e5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Venue.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Venue.kt @@ -1,19 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types -import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CommonVenueData -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable +import com.github.insanusmokrassar.TelegramBotAPI.types.venue.Venue -@Serializable -data class Venue( - @SerialName(locationField) - val location: Location, - @SerialName(titleField) - override val title: String, - @SerialName(addressField) - override val address: String, - @SerialName(foursquareIdField) - override val foursquareId: String? = null, - @SerialName(foursquareTypeField) - override val foursquareType: String? = null -) : CommonVenueData +@Deprecated("Replaced", ReplaceWith("Venue", "com.github.insanusmokrassar.TelegramBotAPI.types.venue.Venue")) +typealias Venue = Venue diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/venue/Venue.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/venue/Venue.kt new file mode 100644 index 0000000000..3a9a55d5a5 --- /dev/null +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/venue/Venue.kt @@ -0,0 +1,20 @@ +package com.github.insanusmokrassar.TelegramBotAPI.types.venue + +import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CommonVenueData +import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Locationed +import com.github.insanusmokrassar.TelegramBotAPI.types.* +import kotlinx.serialization.* + +@Serializable +data class Venue( + @SerialName(locationField) + val location: Location, + @SerialName(titleField) + override val title: String, + @SerialName(addressField) + override val address: String, + @SerialName(foursquareIdField) + override val foursquareId: FoursquareId? = null, + @SerialName(foursquareTypeField) + override val foursquareType: FoursquareType? = null +) : CommonVenueData, Locationed by location