RequestsExecutor

interface RequestsExecutor : Closeable

Interface for making requests to Telegram Bot API. Currently, there is only one built-in implementation - dev.inmo.tgbotapi.bot.Ktor.KtorRequestsExecutor

See also

dev.inmo.tgbotapi.bot.Ktor.KtorRequestsExecutor

Functions

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
abstract suspend fun <T : Any> execute(request: Request<T>): T

Unsafe execution of incoming request. Can throw almost any exception. So, it is better to use something like dev.inmo.tgbotapi.extensions.utils.shortcuts.executeAsync or dev.inmo.tgbotapi.extensions.utils.shortcuts.executeUnsafe

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
fun <T : Any> RequestsExecutor.executeAsync(request: Request<T>, scope: CoroutineScope): Deferred<T>
suspend fun <T : Any> RequestsExecutor.executeAsync(request: Request<T>): Deferred<T>
Link copied to clipboard
suspend fun <T : Any> RequestsExecutor.executeUnsafe(    request: Request<T>,     retries: Int = 0,     retriesDelay: Long = 1000,     onAllFailed: suspend (exceptions: Array<Throwable>) -> Unit? = null): T?
Link copied to clipboard
suspend fun RequestsExecutor.setWebhookInfoAndStartListenWebhooks(    listenPort: Int,     engineFactory: ApplicationEngineFactory<*, *>,     setWebhookRequest: SetWebhookRequest,     exceptionsHandler: ExceptionHandler<Unit> = {},     listenHost: String = "0.0.0.0",     listenRoute: String = "/",     privateKeyConfig: WebhookPrivateKeyConfig? = null,     scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()),     mediaGroupsDebounceTimeMillis: Long = 1000,     additionalApplicationEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {},     block: UpdateReceiver<Update>): ApplicationEngine

Setting up ktor server, set webhook info via SetWebhookRequest request.

Link copied to clipboard
fun RequestsExecutor.startGettingOfUpdatesByLongPolling(    updatesFilter: UpdatesFilter,     timeoutSeconds: Seconds = 30,     exceptionsHandler: ExceptionHandler<Unit>? = null,     scope: CoroutineScope = CoroutineScope(Dispatchers.Default)): Job