KtorRequestHandler

class KtorRequestHandler(client: HttpClient, requestRateLimiter: RequestRateLimiter = ExclusionRequestRateLimiter(), clock: Clock = Clock.System, parser: Json = jsonDefault, val token: String) : RequestHandler(source)

A RequestHandler that uses ktor's HttpClient to execute requests and accepts a requestRateLimiter to schedule requests.

Parameters

client

A HttpClient configured with the required headers for identification.

clock

A Clock to calculate bucket reset times, exposed for testing.

parser

Serializer used to parse payloads.

Constructors

Link copied to clipboard
constructor(client: HttpClient, requestRateLimiter: RequestRateLimiter = ExclusionRequestRateLimiter(), clock: Clock = Clock.System, parser: Json = jsonDefault, token: String)

Properties

Link copied to clipboard
open override val token: String

The Discord bot authorization token used on requests.

Functions

Link copied to clipboard
open suspend tailrec override fun <B : Any, R> handle(request: Request<B, R>): R

Executes the request, abiding by the active rate limits and returning the response R.

Link copied to clipboard
open suspend fun <T> intercept(builder: RequestBuilder<T>)
Link copied to clipboard