mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +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 `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 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 `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
|
## 2.0.3
|
||||||
|
|
||||||
|
@ -13,10 +13,11 @@ suspend fun TelegramBot.setWebhookInfo(
|
|||||||
ipAddress: String? = null,
|
ipAddress: String? = null,
|
||||||
maxAllowedConnections: Int? = null,
|
maxAllowedConnections: Int? = null,
|
||||||
allowedUpdates: List<String>? = null,
|
allowedUpdates: List<String>? = null,
|
||||||
dropPendingUpdates: Boolean? = null
|
dropPendingUpdates: Boolean? = null,
|
||||||
|
secretToken: String? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SetWebhook(
|
SetWebhook(
|
||||||
url, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates
|
url, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,10 +30,11 @@ suspend fun TelegramBot.setWebhookInfo(
|
|||||||
ipAddress: String? = null,
|
ipAddress: String? = null,
|
||||||
maxAllowedConnections: Int? = null,
|
maxAllowedConnections: Int? = null,
|
||||||
allowedUpdates: List<String>? = null,
|
allowedUpdates: List<String>? = null,
|
||||||
dropPendingUpdates: Boolean? = null
|
dropPendingUpdates: Boolean? = null,
|
||||||
|
secretToken: String? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SetWebhook(
|
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,
|
ipAddress: String? = null,
|
||||||
maxAllowedConnections: Int? = null,
|
maxAllowedConnections: Int? = null,
|
||||||
allowedUpdates: List<String>? = null,
|
allowedUpdates: List<String>? = null,
|
||||||
dropPendingUpdates: Boolean? = null
|
dropPendingUpdates: Boolean? = null,
|
||||||
|
secretToken: String? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SetWebhook(
|
SetWebhook(
|
||||||
url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates
|
url, certificate, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -20,7 +20,8 @@ class MultipartSetWebhookRequest(
|
|||||||
ipAddress: String? = null,
|
ipAddress: String? = null,
|
||||||
maxAllowedConnections: Int? = null,
|
maxAllowedConnections: Int? = null,
|
||||||
allowedUpdates: List<String>? = null,
|
allowedUpdates: List<String>? = null,
|
||||||
dropPendingUpdates: Boolean? = null
|
dropPendingUpdates: Boolean? = null,
|
||||||
|
secretToken: String? = null
|
||||||
) : SetWebhookRequest(), MultipartRequest<Boolean> by MultipartRequestImpl(
|
) : SetWebhookRequest(), MultipartRequest<Boolean> by MultipartRequestImpl(
|
||||||
SetWebhook(
|
SetWebhook(
|
||||||
correctWebhookUrl(url),
|
correctWebhookUrl(url),
|
||||||
@ -28,7 +29,8 @@ class MultipartSetWebhookRequest(
|
|||||||
ipAddress,
|
ipAddress,
|
||||||
maxAllowedConnections,
|
maxAllowedConnections,
|
||||||
allowedUpdates,
|
allowedUpdates,
|
||||||
dropPendingUpdates
|
dropPendingUpdates,
|
||||||
|
secretToken
|
||||||
),
|
),
|
||||||
mapOf(certificateField to certificate)
|
mapOf(certificateField to certificate)
|
||||||
)
|
)
|
||||||
@ -39,14 +41,16 @@ fun SetWebhook(
|
|||||||
ipAddress: String? = null,
|
ipAddress: String? = null,
|
||||||
maxAllowedConnections: Int? = null,
|
maxAllowedConnections: Int? = null,
|
||||||
allowedUpdates: List<String>? = null,
|
allowedUpdates: List<String>? = null,
|
||||||
dropPendingUpdates: Boolean? = null
|
dropPendingUpdates: Boolean? = null,
|
||||||
|
secretToken: String? = null
|
||||||
): MultipartSetWebhookRequest = MultipartSetWebhookRequest(
|
): MultipartSetWebhookRequest = MultipartSetWebhookRequest(
|
||||||
correctWebhookUrl(url),
|
correctWebhookUrl(url),
|
||||||
certificate,
|
certificate,
|
||||||
ipAddress,
|
ipAddress,
|
||||||
maxAllowedConnections,
|
maxAllowedConnections,
|
||||||
allowedUpdates,
|
allowedUpdates,
|
||||||
dropPendingUpdates
|
dropPendingUpdates,
|
||||||
|
secretToken
|
||||||
)
|
)
|
||||||
|
|
||||||
fun SetWebhook(
|
fun SetWebhook(
|
||||||
@ -55,14 +59,16 @@ fun SetWebhook(
|
|||||||
ipAddress: String? = null,
|
ipAddress: String? = null,
|
||||||
maxAllowedConnections: Int? = null,
|
maxAllowedConnections: Int? = null,
|
||||||
allowedUpdates: List<String>? = null,
|
allowedUpdates: List<String>? = null,
|
||||||
dropPendingUpdates: Boolean? = null
|
dropPendingUpdates: Boolean? = null,
|
||||||
|
secretToken: String? = null
|
||||||
): SetWebhook = SetWebhook(
|
): SetWebhook = SetWebhook(
|
||||||
correctWebhookUrl(url),
|
correctWebhookUrl(url),
|
||||||
certificate.fileId,
|
certificate.fileId,
|
||||||
ipAddress,
|
ipAddress,
|
||||||
maxAllowedConnections,
|
maxAllowedConnections,
|
||||||
allowedUpdates,
|
allowedUpdates,
|
||||||
dropPendingUpdates
|
dropPendingUpdates,
|
||||||
|
secretToken
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,10 +85,11 @@ fun SetWebhook(
|
|||||||
ipAddress: String? = null,
|
ipAddress: String? = null,
|
||||||
maxAllowedConnections: Int? = null,
|
maxAllowedConnections: Int? = null,
|
||||||
allowedUpdates: List<String>? = null,
|
allowedUpdates: List<String>? = null,
|
||||||
dropPendingUpdates: Boolean? = null
|
dropPendingUpdates: Boolean? = null,
|
||||||
|
secretToken: String? = null
|
||||||
) = when (certificate) {
|
) = when (certificate) {
|
||||||
is MultipartFile -> SetWebhook(correctWebhookUrl(url), certificate as MultipartFile, 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)
|
is FileId -> SetWebhook(correctWebhookUrl(url), certificate as FileId, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates, secretToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,14 +105,16 @@ fun SetWebhook(
|
|||||||
ipAddress: String? = null,
|
ipAddress: String? = null,
|
||||||
maxAllowedConnections: Int? = null,
|
maxAllowedConnections: Int? = null,
|
||||||
allowedUpdates: List<String>? = null,
|
allowedUpdates: List<String>? = null,
|
||||||
dropPendingUpdates: Boolean? = null
|
dropPendingUpdates: Boolean? = null,
|
||||||
|
secretToken: String? = null
|
||||||
) = SetWebhook(
|
) = SetWebhook(
|
||||||
correctWebhookUrl(url),
|
correctWebhookUrl(url),
|
||||||
null,
|
null,
|
||||||
ipAddress,
|
ipAddress,
|
||||||
maxAllowedConnections,
|
maxAllowedConnections,
|
||||||
allowedUpdates,
|
allowedUpdates,
|
||||||
dropPendingUpdates
|
dropPendingUpdates,
|
||||||
|
secretToken
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,7 +137,9 @@ data class SetWebhook internal constructor(
|
|||||||
@SerialName(allowedUpdatesField)
|
@SerialName(allowedUpdatesField)
|
||||||
val allowedUpdates: List<String>? = null,
|
val allowedUpdates: List<String>? = null,
|
||||||
@SerialName(dropPendingUpdatesField)
|
@SerialName(dropPendingUpdatesField)
|
||||||
val dropPendingUpdates: Boolean? = null
|
val dropPendingUpdates: Boolean? = null,
|
||||||
|
@SerialName(secretTokenField)
|
||||||
|
val secretToken: String? = null
|
||||||
) : SetWebhookRequest(), DataRequest<Boolean> {
|
) : SetWebhookRequest(), DataRequest<Boolean> {
|
||||||
override fun method(): String = "setWebhook"
|
override fun method(): String = "setWebhook"
|
||||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
@ -158,6 +158,7 @@ const val switchPmParameterField = "switch_pm_parameter"
|
|||||||
const val maxAllowedConnectionsField = "max_connections"
|
const val maxAllowedConnectionsField = "max_connections"
|
||||||
const val allowedUpdatesField = "allowed_updates"
|
const val allowedUpdatesField = "allowed_updates"
|
||||||
const val dropPendingUpdatesField = "drop_pending_updates"
|
const val dropPendingUpdatesField = "drop_pending_updates"
|
||||||
|
const val secretTokenField = "secret_token"
|
||||||
const val hasCustomCertificateField = "has_custom_certificate"
|
const val hasCustomCertificateField = "has_custom_certificate"
|
||||||
const val pendingUpdateCountField = "pending_update_count"
|
const val pendingUpdateCountField = "pending_update_count"
|
||||||
const val lastErrorDateField = "last_error_date"
|
const val lastErrorDateField = "last_error_date"
|
||||||
|
Loading…
Reference in New Issue
Block a user