@f3liz/rescript-misskey-api
v0.6.9
Published
ReScript bindings for Misskey API using OpenAPI code generation
Maintainers
Readme
@f3liz/rescript-misskey-api
Type-safe Misskey API bindings for ReScript and TypeScript, generated from OpenAPI specs.
Supports Misskey and Cherrypick instances. All endpoints are fully typed.
Usage
ReScript
let client = Misskey.connect("https://misskey.io", ~token="your-token")
// Post a note
await client->Misskey.Notes.create("Hello, Misskey!", ())
// Read timeline
let notes = await client->Misskey.Notes.timeline(#home, ~limit=20, ())TypeScript
import Misskey from '@f3liz/rescript-misskey-api';
const client = new Misskey('https://misskey.io', 'your-token');
await client.notes.create("Hello from TypeScript!");
const notes = await client.notes.timeline('home', { limit: 20 });Installation
npm install @f3liz/rescript-misskey-apiIf you are using ReScript, add to your rescript.json:
{
"dependencies": ["@f3liz/rescript-misskey-api"]
}Architecture
Two layers:
High-level API (
Misskey,Cherrypick): Simplified wrappers for common operations (notes, timeline, streaming).Generated API (
MisskeyIoWrapper,KokonectLinkWrapper): Complete bindings for all 400+ endpoints, auto-generated from OpenAPI specs.
Advanced Usage
Full Generated API (ReScript)
Access any endpoint not covered by the high-level wrapper:
let wrapperClient = Misskey.connect("...")->Misskey.wrapperConnect
open MisskeyIoWrapper
let result = await Admin.postAdminShowUser({userId: "..."}, ~client=wrapperClient)Cherrypick
let client = Cherrypick.connect("https://kokonect.link", ~token="...")
await client->Cherrypick.Notes.create("Hello Cherrypick!", ())Full Generated API (TypeScript)
import { MisskeyClient, Notes } from '@f3liz/rescript-misskey-api';
const client = new MisskeyClient('https://misskey.io', 'your-token');
await Notes.postNotesCreate(client, { text: 'Hello', visibility: 'public' });Regenerating Bindings
To update bindings from the latest OpenAPI specs:
npm run generateFetches specs from misskey.io and kokonect.link and regenerates src/generated/.
License
MIT
