Registry / http-networking / stoat-api

stoat-api

JSON →
library0.12.0jsnpmunverified

The official JavaScript/TypeScript client library for the Revolt chat API (revolt-api). Current version 0.12.0 provides fully typed API request builder and TypeScript typings for all API objects. Ships with ESM and CommonJS support, includes built-in TypeScript declarations. Key differentiator: auto-generated from OpenAPI spec via @insertish/oapi, ensuring type safety for all endpoints and parameters. Developed by the Revolt team, follows semantic versioning.

npm install stoat-api
INSTALL
IMPORT
SIG · STOAT-API
S
stoat-api
http-networkingjavascriptv0.12.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

API
import { API } from 'revolt-api'
import API from 'revolt-api'
Named export, not default. ESM/CJS compatible.
User
import type { User } from 'revolt-api'
import { User } from 'revolt-api'
Type-only export; use 'import type' in TypeScript to avoid emitting runtime code.
default export
import { API } from 'revolt-api'
const RevoltAPI = require('revolt-api')
No default export exists; the package exports named symbols only. Use destructured require.

Shows initialization with optional authentication, fetching current user, and posting a message with full TypeScript types.

import { API } from 'revolt-api'; const client = new API({ authentication: { revolt: process.env.REVOLT_TOKEN ?? '' } }); // Fetch the current user client.get('/users/@me') .then(user => { console.log(`Hello ${user.username}`); }) .catch(err => console.error('Error:', err)); // Send a message client.post('/channels/some_channel_id/messages', { content: 'Hello from stoat-api!' }).then(msg => console.log('Message sent:', msg.id));
Debug
Known issues
gotchaWhen using CommonJS (require), you must destructure the import: const { API } = require('revolt-api')
fix
Use const { API } = require('revolt-api') instead of const API = require('revolt-api')
affects: >=0.0.0
gotchaAuthentication object expects property 'revolt' with the bot token, not 'token' or 'bot'
fix
Pass { authentication: { revolt: 'your-token' } } to the API constructor
affects: >=0.0.0
gotchaPosting to endpoints that require no body (e.g., DELETE /channels/:id) still expects second argument, but you can omit it
fix
client.delete('/channels/some-id') works fine without a second argument
affects: >=0.0.0
gotchaThe package exports only types and API class; there is no message builder or WebSocket client included
fix
Use complementary packages like revolt.js for full bot development
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'revolt-api'
Package not installed or incorrect import path
fix
Install the package: npm install revolt-api
TypeError: client.get is not a function
Imported incorrectly (e.g., default import instead of named import)
fix
Ensure correct import: import { API } from 'revolt-api'
Property 'username' does not exist on type 'unknown'
Missing TypeScript type for User or improper type handling
fix
Import type { User } from 'revolt-api' and use it explicitly: const user: User = await client.get('/users/@me')
TypeError: Failed to fetch
Invalid token or network error
fix
Check that REVOLT_TOKEN is set correctly and the API URL is reachable
Upgrade
Version history
0.12.0latest on npm
Audit
Dependencies
@insertish/oapioptionalUnderlying API client generator
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources
stoat-api — npm install stoat-api · libregistry