Kiai Logo

Kiai Docs

kiai.jsClasses

RequestHandler

Internal

This class is used to make requests to the Kiai API, and handles rate limiting and error handling. You can technically use this class directly, but it's recommended to use the client instead.

Constructors

new RequestHandler()

new RequestHandler(baseURL, apiKey, debug, fetchFunction): RequestHandler

Parameters

ParameterTypeDefault value
baseURLstringundefined
apiKeystringundefined
debugbooleanfalse
fetchFunction(url, init?) => Promise<Response>fetch

Returns

RequestHandler

Properties

PropertyType
apiKeystring
baseURLstring
debugboolean
fetchFunction(url: string | URL, init?: RequestInit) => Promise<Response>

Methods

request()

request<T>(endpoint, method, query, body, noError, customBaseUrl?): Promise<T>

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDefault value
endpointstringundefined
method"GET" | "POST" | "PATCH" | "PUT" | "DELETE""GET"
queryRecord<string, string | number | boolean>{}
bodyRecord<string, unknown>{}
noErrorbooleanfalse
customBaseUrl?stringundefined

Returns

Promise<T>

On this page