{"id":18825,"library":"stoat-api","title":"Revolt API Client & Types","description":"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.","status":"active","version":"0.12.0","language":"javascript","source_language":"en","source_url":"https://github.com/stoatchat/javascript-client-api","tags":["javascript","typescript"],"install":[{"cmd":"npm install stoat-api","lang":"bash","label":"npm"},{"cmd":"yarn add stoat-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add stoat-api","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Underlying API client generator","package":"@insertish/oapi","optional":true}],"imports":[{"note":"Named export, not default. ESM/CJS compatible.","wrong":"import API from 'revolt-api'","symbol":"API","correct":"import { API } from 'revolt-api'"},{"note":"Type-only export; use 'import type' in TypeScript to avoid emitting runtime code.","wrong":"import { User } from 'revolt-api'","symbol":"User","correct":"import type { User } from 'revolt-api'"},{"note":"No default export exists; the package exports named symbols only. Use destructured require.","wrong":"const RevoltAPI = require('revolt-api')","symbol":"default export","correct":"import { API } from 'revolt-api'"}],"quickstart":{"code":"import { API } from 'revolt-api';\n\nconst client = new API({ authentication: { revolt: process.env.REVOLT_TOKEN ?? '' } });\n\n// Fetch the current user\nclient.get('/users/@me')\n  .then(user => {\n    console.log(`Hello ${user.username}`);\n  })\n  .catch(err => console.error('Error:', err));\n\n// Send a message\nclient.post('/channels/some_channel_id/messages', {\n  content: 'Hello from stoat-api!'\n}).then(msg => console.log('Message sent:', msg.id));","lang":"typescript","description":"Shows initialization with optional authentication, fetching current user, and posting a message with full TypeScript types."},"warnings":[{"fix":"Use const { API } = require('revolt-api') instead of const API = require('revolt-api')","message":"When using CommonJS (require), you must destructure the import: const { API } = require('revolt-api')","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pass { authentication: { revolt: 'your-token' } } to the API constructor","message":"Authentication object expects property 'revolt' with the bot token, not 'token' or 'bot'","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"client.delete('/channels/some-id') works fine without a second argument","message":"Posting to endpoints that require no body (e.g., DELETE /channels/:id) still expects second argument, but you can omit it","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use complementary packages like revolt.js for full bot development","message":"The package exports only types and API class; there is no message builder or WebSocket client included","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install the package: npm install revolt-api","cause":"Package not installed or incorrect import path","error":"Error: Cannot find module 'revolt-api'"},{"fix":"Ensure correct import: import { API } from 'revolt-api'","cause":"Imported incorrectly (e.g., default import instead of named import)","error":"TypeError: client.get is not a function"},{"fix":"Import type { User } from 'revolt-api' and use it explicitly: const user: User = await client.get('/users/@me')","cause":"Missing TypeScript type for User or improper type handling","error":"Property 'username' does not exist on type 'unknown'"},{"fix":"Check that REVOLT_TOKEN is set correctly and the API URL is reachable","cause":"Invalid token or network error","error":"TypeError: Failed to fetch"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}