1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

replaces of live location editing requests

This commit is contained in:
InsanusMokrassar 2022-05-01 21:20:31 +06:00
parent 19ddff2999
commit dd893b14d3
13 changed files with 145 additions and 122 deletions

View File

@ -30,6 +30,7 @@ __All the `tgbotapi.extensions.*` packages have been removed__
* **Replaces of `MediaGroupUpdate`s. Migrations:** `dev.inmo.tgbotapi.types.update.MediaGroupUpdates` -> `dev.inmo.tgbotapi.types.update.media_group`
* **`InvoiceContent` has been replaced: `dev.inmo.tgbotapi.types.message.payments.InvoiceContent` -> `dev.inmo.tgbotapi.types.message.content.InvoiceContent`**
* **`PossiblySentViaBotCommonMessage` has been replaced: `dev.inmo.tgbotapi.types.message.content.abstracts.PossiblySentViaBotCommonMessage` -> `dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage`**
* **Edit live location requests have been replaced: `dev.inmo.tgbotapi.requests.edit.LiveLocation` -> `dev.inmo.tgbotapi.requests.edit.location.live`**
* Constructor of `UnknownInlineKeyboardButton` is not internal and can be created with any `json` ([#563](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/563))
* All the interfaces from `dev.inmo.tgbotapi.types.files.abstracts` have been replaced to `dev.inmo.tgbotapi.types.files` and converted to sealed ([#550](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/550))
* `PassportFile` has been replaced to `dev.inmo.tgbotapi.types.files`

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.LiveLocation.EditChatMessageLiveLocation
import dev.inmo.tgbotapi.requests.edit.location.live.EditChatMessageLiveLocation
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.LiveLocation.EditInlineMessageLiveLocation
import dev.inmo.tgbotapi.requests.edit.location.live.EditInlineMessageLiveLocation
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.location.LiveLocation

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.LiveLocation.StopChatMessageLiveLocation
import dev.inmo.tgbotapi.requests.edit.location.live.StopChatMessageLiveLocation
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageIdentifier
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.LiveLocation.StopInlineMessageLiveLocation
import dev.inmo.tgbotapi.requests.edit.location.live.StopInlineMessageLiveLocation
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup

View File

@ -1,45 +1,7 @@
package dev.inmo.tgbotapi.requests.edit.LiveLocation
import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.LocationContent
import dev.inmo.tgbotapi.utils.throwRangeError
import kotlinx.serialization.*
@Deprecated("Replaced", ReplaceWith("editMessageLiveLocationMethod", "dev.inmo.tgbotapi.requests.edit.location.live.editMessageLiveLocationMethod"))
const val editMessageLiveLocationMethod = dev.inmo.tgbotapi.requests.edit.location.live.editMessageLiveLocationMethod
private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<ContentMessage<LocationContent>>()
const val editMessageLiveLocationMethod = "editMessageLiveLocation"
@Serializable
data class EditChatMessageLiveLocation(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(messageIdField)
override val messageId: MessageIdentifier,
@SerialName(latitudeField)
override val latitude: Double,
@SerialName(longitudeField)
override val longitude: Double,
@SerialName(horizontalAccuracyField)
override val horizontalAccuracy: Meters? = null,
@SerialName(headingField)
override val heading: Degrees? = null,
@SerialName(proximityAlertRadiusField)
override val proximityAlertRadius: Meters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage<LocationContent>, EditReplyMessage, EditLocationMessage {
override fun method(): String = editMessageLiveLocationMethod
override val resultDeserializer: DeserializationStrategy<ContentMessage<LocationContent>>
get() = commonResultDeserializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
init {
if (horizontalAccuracy != null && horizontalAccuracy !in horizontalAccuracyLimit) {
throwRangeError("horizontalAccuracy", horizontalAccuracyLimit, horizontalAccuracy)
}
}
}
@Deprecated("Replaced", ReplaceWith("EditChatMessageLiveLocation", "dev.inmo.tgbotapi.requests.edit.location.live.EditChatMessageLiveLocation"))
typealias EditChatMessageLiveLocation = dev.inmo.tgbotapi.requests.edit.location.live.EditChatMessageLiveLocation

View File

@ -1,35 +1,4 @@
package dev.inmo.tgbotapi.requests.edit.LiveLocation
import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.utils.throwRangeError
import kotlinx.serialization.*
@Serializable
data class EditInlineMessageLiveLocation(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
@SerialName(latitudeField)
override val latitude: Double,
@SerialName(longitudeField)
override val longitude: Double,
@SerialName(horizontalAccuracyField)
override val horizontalAccuracy: Meters? = null,
@SerialName(headingField)
override val heading: Degrees? = null,
@SerialName(proximityAlertRadiusField)
override val proximityAlertRadius: Meters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage, EditLocationMessage {
override fun method(): String = editMessageLiveLocationMethod
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
init {
if (horizontalAccuracy != null && horizontalAccuracy !in horizontalAccuracyLimit) {
throwRangeError("horizontalAccuracy", horizontalAccuracyLimit, horizontalAccuracy)
}
}
}
@Deprecated("Replaced", ReplaceWith("EditInlineMessageLiveLocation", "dev.inmo.tgbotapi.requests.edit.location.live.EditInlineMessageLiveLocation"))
typealias EditInlineMessageLiveLocation = dev.inmo.tgbotapi.requests.edit.location.live.EditInlineMessageLiveLocation

View File

@ -1,29 +1,7 @@
package dev.inmo.tgbotapi.requests.edit.LiveLocation
import dev.inmo.tgbotapi.requests.edit.abstracts.EditChatMessage
import dev.inmo.tgbotapi.requests.edit.abstracts.EditReplyMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.LocationContent
import kotlinx.serialization.*
@Deprecated("Replaced", ReplaceWith("stopMessageLiveLocationMethod", "dev.inmo.tgbotapi.requests.edit.location.live.stopMessageLiveLocationMethod"))
const val stopMessageLiveLocationMethod = dev.inmo.tgbotapi.requests.edit.location.live.stopMessageLiveLocationMethod
private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<ContentMessage<LocationContent>>()
const val stopMessageLiveLocationMethod = "stopMessageLiveLocation"
@Serializable
data class StopChatMessageLiveLocation(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(messageIdField)
override val messageId: MessageIdentifier,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage<LocationContent>, EditReplyMessage {
override fun method(): String = stopMessageLiveLocationMethod
override val resultDeserializer: DeserializationStrategy<ContentMessage<LocationContent>>
get() = commonResultDeserializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
@Deprecated("Replaced", ReplaceWith("StopChatMessageLiveLocation", "dev.inmo.tgbotapi.requests.edit.location.live.StopChatMessageLiveLocation"))
typealias StopChatMessageLiveLocation = dev.inmo.tgbotapi.requests.edit.location.live.StopChatMessageLiveLocation

View File

@ -1,19 +1,4 @@
package dev.inmo.tgbotapi.requests.edit.LiveLocation
import dev.inmo.tgbotapi.requests.edit.abstracts.EditInlineMessage
import dev.inmo.tgbotapi.requests.edit.abstracts.EditReplyMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
@Serializable
data class StopInlineMessageLiveLocation(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage {
override fun method(): String = stopMessageLiveLocationMethod
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
@Deprecated("Replaced", ReplaceWith("StopInlineMessageLiveLocation", "dev.inmo.tgbotapi.requests.edit.location.live.StopInlineMessageLiveLocation"))
typealias StopInlineMessageLiveLocation = dev.inmo.tgbotapi.requests.edit.location.live.StopInlineMessageLiveLocation

View File

@ -0,0 +1,45 @@
package dev.inmo.tgbotapi.requests.edit.location.live
import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.LocationContent
import dev.inmo.tgbotapi.utils.throwRangeError
import kotlinx.serialization.*
private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<ContentMessage<LocationContent>>()
const val editMessageLiveLocationMethod = "editMessageLiveLocation"
@Serializable
data class EditChatMessageLiveLocation(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(messageIdField)
override val messageId: MessageIdentifier,
@SerialName(latitudeField)
override val latitude: Double,
@SerialName(longitudeField)
override val longitude: Double,
@SerialName(horizontalAccuracyField)
override val horizontalAccuracy: Meters? = null,
@SerialName(headingField)
override val heading: Degrees? = null,
@SerialName(proximityAlertRadiusField)
override val proximityAlertRadius: Meters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage<LocationContent>, EditReplyMessage, EditLocationMessage {
override fun method(): String = editMessageLiveLocationMethod
override val resultDeserializer: DeserializationStrategy<ContentMessage<LocationContent>>
get() = commonResultDeserializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
init {
if (horizontalAccuracy != null && horizontalAccuracy !in horizontalAccuracyLimit) {
throwRangeError("horizontalAccuracy", horizontalAccuracyLimit, horizontalAccuracy)
}
}
}

View File

@ -0,0 +1,35 @@
package dev.inmo.tgbotapi.requests.edit.location.live
import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.utils.throwRangeError
import kotlinx.serialization.*
@Serializable
data class EditInlineMessageLiveLocation(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
@SerialName(latitudeField)
override val latitude: Double,
@SerialName(longitudeField)
override val longitude: Double,
@SerialName(horizontalAccuracyField)
override val horizontalAccuracy: Meters? = null,
@SerialName(headingField)
override val heading: Degrees? = null,
@SerialName(proximityAlertRadiusField)
override val proximityAlertRadius: Meters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage, EditLocationMessage {
override fun method(): String = editMessageLiveLocationMethod
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
init {
if (horizontalAccuracy != null && horizontalAccuracy !in horizontalAccuracyLimit) {
throwRangeError("horizontalAccuracy", horizontalAccuracyLimit, horizontalAccuracy)
}
}
}

View File

@ -0,0 +1,29 @@
package dev.inmo.tgbotapi.requests.edit.location.live
import dev.inmo.tgbotapi.requests.edit.abstracts.EditChatMessage
import dev.inmo.tgbotapi.requests.edit.abstracts.EditReplyMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.LocationContent
import kotlinx.serialization.*
private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<ContentMessage<LocationContent>>()
const val stopMessageLiveLocationMethod = "stopMessageLiveLocation"
@Serializable
data class StopChatMessageLiveLocation(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(messageIdField)
override val messageId: MessageIdentifier,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage<LocationContent>, EditReplyMessage {
override fun method(): String = stopMessageLiveLocationMethod
override val resultDeserializer: DeserializationStrategy<ContentMessage<LocationContent>>
get() = commonResultDeserializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@ -0,0 +1,19 @@
package dev.inmo.tgbotapi.requests.edit.location.live
import dev.inmo.tgbotapi.requests.edit.abstracts.EditInlineMessage
import dev.inmo.tgbotapi.requests.edit.abstracts.EditReplyMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
@Serializable
data class StopInlineMessageLiveLocation(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage {
override fun method(): String = stopMessageLiveLocationMethod
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}