import { APIClient } from "https://deno.land/x/revolt_api@0.4.0/mod.ts";
API Client
Examples
Example 1
Example 1
const api = new Revolt.APIClient({
base: "https://api.revolt.chat",
headers: {
"x-bot-token": REVOLT_TOKEN,
"content-type": "application/json",
},
});
api.get("Query Node", "/").then(console.log);
Constructors
new
APIClient(config: ClientInit)Methods
_fetch(path: string, init?: ExtendRequestInit)
Send an untyped arbitrary request.
Similar to a standard fetch
.
fetch<Name extends APIRoutes["name"], Routes extends APIRoutes & { name: Name; }, Path extends Routes["path"], Route extends Routes & { path: Path; }, RequiredInit extends RequireNonNull<Pick<Route, "query" | "body">>, Init extends Omit<ExtendRequestInit<RequiredInit>, "method">>(...unnamed 0: Route extends { method: "get"; query: never; body: never; } ? [Name, Path, Init] : [Name, Path, Init]): Promise<TypedResponse<Route["response"]>>
Send a typed arbitrary request.