mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
add several abstractions of business chats
This commit is contained in:
parent
dbc69def0b
commit
6ac6ad0c0a
@ -451,6 +451,10 @@ const val explanationEntitiesField = "explanation_entities"
|
|||||||
const val explanationParseModeField = "explanation_parse_mode"
|
const val explanationParseModeField = "explanation_parse_mode"
|
||||||
const val openPeriodField = "open_period"
|
const val openPeriodField = "open_period"
|
||||||
const val closeDateField = "close_date"
|
const val closeDateField = "close_date"
|
||||||
|
const val openingMinuteField = "opening_minute"
|
||||||
|
const val closingMinuteField = "closing_minute"
|
||||||
|
const val openingHoursField = "opening_hours"
|
||||||
|
const val timeZoneNameField = "time_zone_name"
|
||||||
|
|
||||||
const val smallFileIdField = "small_file_id"
|
const val smallFileIdField = "small_file_id"
|
||||||
const val bigFileIdField = "big_file_id"
|
const val bigFileIdField = "big_file_id"
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.business_connection
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
|
import dev.inmo.tgbotapi.types.messageField
|
||||||
|
import dev.inmo.tgbotapi.types.stickerField
|
||||||
|
import dev.inmo.tgbotapi.types.titleField
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BusinessIntro(
|
||||||
|
@SerialName(titleField)
|
||||||
|
val title: String? = null,
|
||||||
|
@SerialName(messageField)
|
||||||
|
val message: String? = null,
|
||||||
|
@SerialName(stickerField)
|
||||||
|
val sticker: Sticker? = null,
|
||||||
|
)
|
@ -0,0 +1,15 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.business_connection
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.addressField
|
||||||
|
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||||
|
import dev.inmo.tgbotapi.types.locationField
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BusinessLocation(
|
||||||
|
@SerialName(addressField)
|
||||||
|
val address: String,
|
||||||
|
@SerialName(locationField)
|
||||||
|
val location: StaticLocation
|
||||||
|
)
|
@ -0,0 +1,18 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.business_connection
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.openingHoursField
|
||||||
|
import dev.inmo.tgbotapi.types.timeZoneNameField
|
||||||
|
import korlibs.time.Timezone
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BusinessOpeningHours(
|
||||||
|
@SerialName(timeZoneNameField)
|
||||||
|
val timeZoneName: String,
|
||||||
|
@SerialName(openingHoursField)
|
||||||
|
val openingHours: List<BusinessOpeningHoursInterval>
|
||||||
|
) {
|
||||||
|
val timezone: Timezone
|
||||||
|
get() = Timezone.valueOf(timeZoneName)
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.business_connection
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.closingMinuteField
|
||||||
|
import dev.inmo.tgbotapi.types.openingMinuteField
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BusinessOpeningHoursInterval(
|
||||||
|
@SerialName(openingMinuteField)
|
||||||
|
val opening: MinutesInterval,
|
||||||
|
@SerialName(closingMinuteField)
|
||||||
|
val closing: MinutesInterval
|
||||||
|
)
|
@ -0,0 +1,17 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.business_connection
|
||||||
|
|
||||||
|
import korlibs.time.TimeSpan
|
||||||
|
import korlibs.time.minutes
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlin.jvm.JvmInline
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
@JvmInline
|
||||||
|
value class MinutesInterval(
|
||||||
|
val int: Int
|
||||||
|
) {
|
||||||
|
val dayTimeSpan: TimeSpan
|
||||||
|
get() = int.minutes
|
||||||
|
val weekDay0: Int
|
||||||
|
get() = dayTimeSpan.inWholeDays.toInt()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user