mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 08:37:12 +00:00
continue adding support of webapps updates
This commit is contained in:
parent
41a142addb
commit
c7d08df3bf
@ -0,0 +1,28 @@
|
||||
package dev.inmo.tgbotapi.requests.set
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.SerializationStrategy
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class SetUserEmojiStatus(
|
||||
@SerialName(userIdField)
|
||||
val userId: UserId,
|
||||
@SerialName(emojiStatusCustomEmojiIdField)
|
||||
val customEmojiId: CustomEmojiId,
|
||||
@Serializable(TelegramDateSerializer::class)
|
||||
@SerialName(emojiStatusExpirationDateField)
|
||||
val expirationDate: TelegramDate? = null
|
||||
) : SimpleRequest<Boolean> {
|
||||
override fun method(): String = "setUserEmojiStatus"
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package dev.inmo.tgbotapi.webapps
|
||||
|
||||
import kotlin.js.json
|
||||
|
||||
external interface DownloadFileParams {
|
||||
val url: String
|
||||
@JsName("file_name")
|
||||
val fileName: String
|
||||
}
|
||||
fun DownloadFileParams(
|
||||
url: String,
|
||||
fileName: String
|
||||
) = json(
|
||||
"url" to url,
|
||||
"file_name" to fileName
|
||||
).unsafeCast<DownloadFileParams>()
|
@ -0,0 +1,13 @@
|
||||
package dev.inmo.tgbotapi.webapps
|
||||
|
||||
import dev.inmo.tgbotapi.types.Seconds
|
||||
import kotlin.js.json
|
||||
|
||||
external interface EmojiStatusParams {
|
||||
val duration: Seconds?
|
||||
}
|
||||
fun EmojiStatusParams(
|
||||
duration: Seconds
|
||||
): EmojiStatusParams = json(
|
||||
"duration" to duration
|
||||
).unsafeCast<EmojiStatusParams>()
|
@ -1,5 +1,6 @@
|
||||
package dev.inmo.tgbotapi.webapps
|
||||
|
||||
import dev.inmo.tgbotapi.types.CustomEmojiId
|
||||
import dev.inmo.tgbotapi.types.PreparedMessageId
|
||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||
import dev.inmo.tgbotapi.webapps.accelerometer.Accelerometer
|
||||
@ -71,8 +72,6 @@ external class WebApp {
|
||||
fun addToHomeScreen()
|
||||
fun checkHomeScreenStatus(callback: (HomeScreenStatus) -> Unit = definedExternally)
|
||||
|
||||
fun shareMessage(messageId: PreparedMessageId, callback: (Boolean) -> Unit = definedExternally)
|
||||
|
||||
@JsName("MainButton")
|
||||
val mainButton: BottomButton
|
||||
@JsName("SecondaryButton")
|
||||
@ -144,6 +143,13 @@ external class WebApp {
|
||||
|
||||
fun shareToStory(mediaUrl: String, params: StoryShareParams? = definedExternally)
|
||||
|
||||
fun shareMessage(messageId: PreparedMessageId, callback: (Boolean) -> Unit = definedExternally)
|
||||
|
||||
fun setEmojiStatus(customEmojiId: CustomEmojiId, params: EmojiStatusParams = definedExternally, callback: (Boolean) -> Unit = definedExternally)
|
||||
fun requestEmojiStatusAccess(callback: (Boolean) -> Unit = definedExternally)
|
||||
|
||||
fun downloadFile(params: DownloadFileParams, callback: (Boolean) -> Unit = definedExternally)
|
||||
|
||||
fun requestWriteAccess(callback: ((Boolean) -> Unit)? = definedExternally)
|
||||
fun requestContact(callback: ((Boolean) -> Unit)? = definedExternally)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user