2018-12-26 08:07:24 +00:00
|
|
|
package com.github.insanusmokrassar.TelegramBotAPI.bot
|
|
|
|
|
|
|
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
2020-01-15 06:28:06 +00:00
|
|
|
import io.ktor.utils.io.core.Closeable
|
2018-12-26 08:07:24 +00:00
|
|
|
|
2020-05-14 06:14:38 +00:00
|
|
|
/**
|
2020-05-14 06:21:38 +00:00
|
|
|
* Interface for making requests to Telegram Bot API. Currently, there is only one built-in implementation -
|
|
|
|
* [com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.KtorRequestsExecutor]
|
2020-05-14 06:14:38 +00:00
|
|
|
*
|
|
|
|
* @see Request
|
|
|
|
* @see com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.KtorRequestsExecutor
|
|
|
|
*/
|
2019-07-22 23:46:19 +00:00
|
|
|
interface RequestsExecutor : Closeable {
|
2019-12-03 05:07:25 +00:00
|
|
|
/**
|
2020-05-14 06:14:38 +00:00
|
|
|
* Unsafe execution of incoming [request]. Can throw almost any exception. So, it is better to use
|
2020-06-02 07:39:09 +00:00
|
|
|
* something like [com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.shortcuts.executeAsync] or
|
|
|
|
* [com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.shortcuts.executeUnsafe]
|
2020-05-14 06:14:38 +00:00
|
|
|
*
|
|
|
|
* @throws Exception
|
2019-12-03 05:07:25 +00:00
|
|
|
*/
|
2018-12-26 08:07:24 +00:00
|
|
|
suspend fun <T : Any> execute(request: Request<T>): T
|
|
|
|
}
|