///
import type { Buffer } from "node:buffer";
import FormData from "form-data";
import type TypedEmitter from "typed-emitter";
import type { RestOptions } from "./typings";
import { Router } from "./util/Router";
export type RequestOptions = {
body?: BodyInit | Buffer;
headers: Record;
method: HTTPMethods;
url: string;
};
export type ResponseDetails = {
body: JSONB | string;
headers: Record;
status: number;
};
export type RestManagerEvents = {
request(request: RequestOptions): void;
error(req: RequestOptions, res: ResponseDetails): void;
ratelimit(ratelimit: RequestOptions & {
responseHeaders: Record;
}): void;
};
export declare class RestManager {
readonly options: RestOptions;
/**
* The bot token to be used for making requests.
*/
token: string;
/**
* The version of the API to be used for making requests. By default, this will use the latest version that the library supports.
*/
version: 1;
/**
* The proxy url if it was set.
*/
proxyURL: string | undefined;
/**
* The router with all the helper methods.
*/
readonly router: Router;
/**
* Logging emitter
*/
readonly emitter: TypedEmitter;
constructor(options: RestOptions);
/**
* The base url to send the request to.
*/
get baseURL(): string;
/**
* Generate obfuscated token. It replaces every char in a non-even index with X. I'm not very creative.
*/
get obfuscatedToken(): string;
make(data: MakeOptions, authenticated?: boolean, retryCount?: number, { returnAsText, bodyIsJSON, }?: {
bodyIsJSON?: boolean;
returnAsText?: boolean;
}): Promise<[Response, Promise]>;
get(path: string, query?: Q, authenticated?: boolean): Promise;
post(path: string, body?: B, authenticated?: boolean): Promise;
delete(path: string, body?: B, authenticated?: boolean): Promise;
patch(path: string, body: B, authenticated?: boolean): Promise;
put(path: string, body?: B, authenticated?: boolean): Promise;
}
export type MakeOptions = {
body?: B | FormData;
headers?: Record;
isFormData?: boolean;
method: HTTPMethods;
path: string;
query?: Q;
};
export type JSONB = Record;
export type HTTPMethods = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";
export type RequestBodyObject = JSONB | undefined;
//# sourceMappingURL=RestManager.d.ts.map