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
| Parameter | Type | Default value |
|---|---|---|
baseURL | string | undefined |
apiKey | string | undefined |
debug | boolean | false |
fetchFunction | (url, init?) => Promise<Response> | fetch |
Returns
Properties
| Property | Type |
|---|---|
apiKey | string |
baseURL | string |
debug | boolean |
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
| Parameter | Type | Default value |
|---|---|---|
endpoint | string | undefined |
method | "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "GET" |
query | Record<string, string | number | boolean> | {} |
body | Record<string, unknown> | {} |
noError | boolean | false |
customBaseUrl? | string | undefined |
Returns
Promise<T>