1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-02 22:59:48 +00:00

add additional signatures for setWebhookInfoAndStartListenWebhooks

This commit is contained in:
2020-05-15 18:35:16 +06:00
parent 735ed9fd86
commit efc2681da8
3 changed files with 92 additions and 26 deletions

View File

@@ -9,30 +9,36 @@ import kotlinx.serialization.builtins.serializer
fun SetWebhook(
url: String,
certificate: InputFile,
certificate: MultipartFile,
maxAllowedConnections: Int? = null,
allowedUpdates: List<String>? = null
) : Request<Boolean> {
val data = SetWebhook(
): MultipartRequestImpl<SetWebhook, Map<String, MultipartFile>, Boolean> = MultipartRequestImpl(
SetWebhook(
url,
(certificate as? FileId) ?.fileId,
null,
maxAllowedConnections,
allowedUpdates
)
return when (certificate) {
is FileId -> data
is MultipartFile -> MultipartRequestImpl(
data,
mapOf(certificateField to certificate)
)
}
}
),
mapOf(certificateField to certificate)
)
fun SetWebhook(
url: String,
certificate: FileId,
maxAllowedConnections: Int? = null,
allowedUpdates: List<String>? = null
): SetWebhook = SetWebhook(
url,
certificate.fileId,
maxAllowedConnections,
allowedUpdates
)
fun SetWebhook(
url: String,
maxAllowedConnections: Int? = null,
allowedUpdates: List<String>? = null
) : Request<Boolean> = SetWebhook(
) = SetWebhook(
url,
null,
maxAllowedConnections,