mirror of
https://github.com/stoatchat/javascript-client-api.git
synced 2026-07-19 09:04:36 -04:00
next
Revolt API
This package contains typings for objects in the Revolt API and a fully typed API request builder using openapi-fetch.
Example Usage
If you just need access to types:
import type { User } from "revolt-api";
If you want to send requests:
import { createClient } from "./esm/index.js";
const api = createClient({
// specify bot token:
botToken: "bot-token",
// .. or a user session token:
sessionToken: "session-token",
// .. also accepts options from openapi-fetch
// such as custom middleware, baseURL, etc
});
// Fetch information about user
api.GET("/users/@me").then((res) => console.info(res.data));
// Send a message to a channel
api.POST("/channels/{target}/messages", {
params: {
path: {
target: "01F92C5ZXBQWQ8KY7J8KY917NM",
},
},
body: {
content: "Hello from Fetch/Node.js/Bun/Deno!",
},
});
Languages
TypeScript
98.1%
JavaScript
1.8%