Package-level declarations

The Telegram API and Telegram methods.

Types

Link copied to clipboard
abstract class EmptyBodyTelegramApi<R : Any> : TelegramApi<R>

body is always null TelegramApi. Will use a GET request directly.

Link copied to clipboard
Link copied to clipboard
data class ResponseParameters(val migrateToChatId: Long? = null, val retryAfter: Int? = null)

Describes why a request was unsuccessful.

Link copied to clipboard
abstract class SimpleBodyTelegramApi<R : Any> : TelegramApi<R>

An ordinary extensible TelegramApi. Post is used if body is not null, application/json is used if body is not MultiPartFormDataContent, and application/x-www-form-urlencoded is used otherwise.

Link copied to clipboard
object Telegram
Link copied to clipboard
sealed class TelegramApi<R : Any>
Link copied to clipboard
open class TelegramApiException(message: String? = null, cause: Throwable? = null) : RuntimeException
Link copied to clipboard
data class TelegramApiResult<T : Any>(val ok: Boolean, val result: T? = null, val description: String? = null, val errorCode: Int? = null, val parameters: ResponseParameters? = null)

The Telegram API response data.

Link copied to clipboard
open class TelegramApiResultNotOkException(val result: TelegramApiResult<*>, message: String? = "result: ", cause: Throwable? = null) : TelegramApiException
Link copied to clipboard
class UnknownUpdatedFieldException(message: String? = "Unknown updated field") : IllegalArgumentException

Inherited functions

Link copied to clipboard
suspend fun <R : Any> TelegramApi<R>.requestData(client: HttpClient, token: String, server: Url?): R
suspend fun <R : Any> TelegramApi<R>.requestData(client: HttpClient, token: String, server: String? = null): R

Request the TelegramApi by client with token.

Link copied to clipboard
suspend fun TelegramApi<*>.requestRaw(client: HttpClient, token: String, server: Url?): HttpResponse
suspend fun TelegramApi<*>.requestRaw(client: HttpClient, token: String, server: String? = null): HttpResponse

Request the TelegramApi by client with token.

Link copied to clipboard
suspend fun <R : Any> TelegramApi<R>.requestResult(client: HttpClient, token: String, server: Url?): TelegramApiResult<R>
suspend fun <R : Any> TelegramApi<R>.requestResult(client: HttpClient, token: String, server: String? = null): TelegramApiResult<R>

Request the TelegramApi by client with token.