Package-level declarations
Types
Link copied to clipboard
Represents an HTTP status code and description.
Link copied to clipboard
class JsonRequest<B : Any, R>(val route: Route<R>, val routeParams: Map<Route.Key, String>, val parameters: StringValues, val headers: StringValues, val body: RequestBody<B>?, baseUrl: String = Route.baseUrl) : Request<B, R>
Link copied to clipboard
class KtorRequestException(val httpResponse: HttpResponse, val request: Request<*, *>, discordError: DiscordErrorResponse?) : RestRequestException
Implementation of the RestRequestException for RestServices using Ktor.
Link copied to clipboard
class KtorRequestHandler(client: HttpClient, requestRateLimiter: RequestRateLimiter = ExclusionRequestRateLimiter(), clock: Clock = Clock.System, parser: Json = jsonDefault, val token: String) : RequestHandler
A RequestHandler that uses ktor's HttpClient to execute requests and accepts a requestRateLimiter to schedule requests.
Link copied to clipboard
class MultipartRequest<B : Any, R>(val route: Route<R>, val routeParams: Map<Route.Key, String>, val parameters: StringValues, val headers: StringValues, val body: RequestBody<B>?, val files: List<NamedFile> = emptyList(), baseUrl: String = Route.baseUrl) : Request<B, R>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface RequestHandler
Handles Discord API requests.
Link copied to clipboard
A 'per-route' identifier for rate limiting purposes.
Link copied to clipboard
abstract class RestRequestException(val request: Request<*, *>, val status: HttpStatus, val error: DiscordErrorResponse? = null) : RequestException
Signals that an error related to interactions with the REST API occurred.
Link copied to clipboard
Extension of KtorRequestHandler which tries to recover stack trace information lost through Ktor's io.ktor.util.pipeline.SuspendFunctionGun.
Properties
Functions
Link copied to clipboard
Sets the reason that will show up in the Discord Audit Log to reason for this request.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
The unix time (in ms) when the global rate limit gets reset.
Link copied to clipboard
fun KtorRequestHandler(token: String, requestRateLimiter: RequestRateLimiter = ExclusionRequestRateLimiter(), clock: Clock = Clock.System, parser: Json = jsonDefault): KtorRequestHandler
Link copied to clipboard
Returns a new RequestHandler with stack trace recovery enabled.