mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-03-31 15:12:47 +00:00
Fix #190: Support for Google Places values in venue-related methods and types
This commit is contained in:
@@ -7,7 +7,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
val Venue.foursquare: Foursquare?
|
||||
get() = foursquareId ?.let {
|
||||
get() = foursquareId?.let {
|
||||
Foursquare(it, foursquareType)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ fun Venue(
|
||||
title: String,
|
||||
address: String,
|
||||
foursquare: Foursquare
|
||||
) = Venue(location, title, address, foursquare.id, foursquare.type)
|
||||
) = Venue(location, title, address, foursquareId = foursquare.id, foursquareType = foursquare.type)
|
||||
|
||||
@Serializable
|
||||
data class Foursquare(
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package dev.inmo.tgbotapi.extensions.utils.extensions.venue
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||
import dev.inmo.tgbotapi.types.venue.Venue
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
val Venue.googlePlace: GooglePlace?
|
||||
get() = googlePlaceId?.let {
|
||||
GooglePlace(it, googlePlaceType)
|
||||
}
|
||||
|
||||
fun Venue(
|
||||
location: StaticLocation,
|
||||
title: String,
|
||||
address: String,
|
||||
googlePlace: GooglePlace
|
||||
) = Venue(location, title, address, googlePlaceId = googlePlace.id, googlePlaceType = googlePlace.type)
|
||||
|
||||
@Serializable
|
||||
data class GooglePlace(
|
||||
@SerialName(googlePlaceIdField)
|
||||
val id: GooglePlaceId,
|
||||
@SerialName(googlePlaceTypeField)
|
||||
val type: GooglePlaceType? = null
|
||||
)
|
||||
Reference in New Issue
Block a user