mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
SetWebhook#secretToken
This commit is contained in:
parent
8dfaca7648
commit
1df653f428
@ -5,6 +5,7 @@
|
||||
* Add support of functionality for `WebApp`s from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
||||
* Add support of functionality for premium feature from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
||||
* Add support of `addedToAttachmentMenu` in `CommonUser` from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
||||
* Add support of `secret_token` in `SetWebhook` request from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
||||
|
||||
## 2.0.3
|
||||
|
||||
|
@ -13,10 +13,11 @@ suspend fun TelegramBot.setWebhookInfo(
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
dropPendingUpdates: Boolean? = null
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) = execute(
|
||||
SetWebhook(
|
||||
url, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates
|
||||
url, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken
|
||||
)
|
||||
)
|
||||
|
||||
@ -29,10 +30,11 @@ suspend fun TelegramBot.setWebhookInfo(
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
dropPendingUpdates: Boolean? = null
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) = execute(
|
||||
SetWebhook(
|
||||
url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates
|
||||
url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken
|
||||
)
|
||||
)
|
||||
|
||||
@ -45,9 +47,10 @@ suspend fun TelegramBot.setWebhookInfo(
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
dropPendingUpdates: Boolean? = null
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) = execute(
|
||||
SetWebhook(
|
||||
url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates
|
||||
url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken
|
||||
)
|
||||
)
|
||||
|
@ -20,7 +20,8 @@ class MultipartSetWebhookRequest(
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
dropPendingUpdates: Boolean? = null
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) : SetWebhookRequest(), MultipartRequest<Boolean> by MultipartRequestImpl(
|
||||
SetWebhook(
|
||||
correctWebhookUrl(url),
|
||||
@ -28,7 +29,8 @@ class MultipartSetWebhookRequest(
|
||||
ipAddress,
|
||||
maxAllowedConnections,
|
||||
allowedUpdates,
|
||||
dropPendingUpdates
|
||||
dropPendingUpdates,
|
||||
secretToken
|
||||
),
|
||||
mapOf(certificateField to certificate)
|
||||
)
|
||||
@ -39,14 +41,16 @@ fun SetWebhook(
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
dropPendingUpdates: Boolean? = null
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
): MultipartSetWebhookRequest = MultipartSetWebhookRequest(
|
||||
correctWebhookUrl(url),
|
||||
certificate,
|
||||
ipAddress,
|
||||
maxAllowedConnections,
|
||||
allowedUpdates,
|
||||
dropPendingUpdates
|
||||
dropPendingUpdates,
|
||||
secretToken
|
||||
)
|
||||
|
||||
fun SetWebhook(
|
||||
@ -55,14 +59,16 @@ fun SetWebhook(
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
dropPendingUpdates: Boolean? = null
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
): SetWebhook = SetWebhook(
|
||||
correctWebhookUrl(url),
|
||||
certificate.fileId,
|
||||
ipAddress,
|
||||
maxAllowedConnections,
|
||||
allowedUpdates,
|
||||
dropPendingUpdates
|
||||
dropPendingUpdates,
|
||||
secretToken
|
||||
)
|
||||
|
||||
/**
|
||||
@ -79,10 +85,11 @@ fun SetWebhook(
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
dropPendingUpdates: Boolean? = null
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) = when (certificate) {
|
||||
is MultipartFile -> SetWebhook(correctWebhookUrl(url), certificate as MultipartFile, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates)
|
||||
is FileId -> SetWebhook(correctWebhookUrl(url), certificate as FileId, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates)
|
||||
is MultipartFile -> SetWebhook(correctWebhookUrl(url), certificate as MultipartFile, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken)
|
||||
is FileId -> SetWebhook(correctWebhookUrl(url), certificate as FileId, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,14 +105,16 @@ fun SetWebhook(
|
||||
ipAddress: String? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
dropPendingUpdates: Boolean? = null
|
||||
dropPendingUpdates: Boolean? = null,
|
||||
secretToken: String? = null
|
||||
) = SetWebhook(
|
||||
correctWebhookUrl(url),
|
||||
null,
|
||||
ipAddress,
|
||||
maxAllowedConnections,
|
||||
allowedUpdates,
|
||||
dropPendingUpdates
|
||||
dropPendingUpdates,
|
||||
secretToken
|
||||
)
|
||||
|
||||
/**
|
||||
@ -128,7 +137,9 @@ data class SetWebhook internal constructor(
|
||||
@SerialName(allowedUpdatesField)
|
||||
val allowedUpdates: List<String>? = null,
|
||||
@SerialName(dropPendingUpdatesField)
|
||||
val dropPendingUpdates: Boolean? = null
|
||||
val dropPendingUpdates: Boolean? = null,
|
||||
@SerialName(secretTokenField)
|
||||
val secretToken: String? = null
|
||||
) : SetWebhookRequest(), DataRequest<Boolean> {
|
||||
override fun method(): String = "setWebhook"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
|
@ -158,6 +158,7 @@ const val switchPmParameterField = "switch_pm_parameter"
|
||||
const val maxAllowedConnectionsField = "max_connections"
|
||||
const val allowedUpdatesField = "allowed_updates"
|
||||
const val dropPendingUpdatesField = "drop_pending_updates"
|
||||
const val secretTokenField = "secret_token"
|
||||
const val hasCustomCertificateField = "has_custom_certificate"
|
||||
const val pendingUpdateCountField = "pending_update_count"
|
||||
const val lastErrorDateField = "last_error_date"
|
||||
|
Loading…
Reference in New Issue
Block a user