Skip to content

Repository files navigation

Revolt API

revolt-apideno module

This package contains typings for objects in the Revolt API and a fully typed API request builder.

Usage

You can find more info in the documentation.

import*asRevoltfrom"https://deno.land/x/revolt_api/mod.ts";constapi=newRevolt.APIClient({base: "https://api.revolt.chat",headers: {"x-bot-token": REVOLT_TOKEN,"content-type": "application/json",},});constconfig=awaitapi.get("Query Node","/");console.log(`The API is running revolt ${config.revolt}`);constme=awaitapi.get("Fetch Self","/users/@me");console.log(`My ID is ${me._id}`);constchannel_id="some channel id";awaitapi.post("Send Message",`/channels/${channel_id}/messages`,{body: {content: "Hello!",},});

Building and Updating

$ curl https://raw.githubusercontent.com/revoltchat/api/master/OpenAPI.json > OpenAPI.json % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 205k 100 205k 0 0 868k 0 --:--:-- --:--:-- --:--:-- 873k
$ npx openapi-typescript OpenAPI.json -o schema.ts✨ openapi-typescript 5.2.0🚀 OpenAPI.json -> /revolt-api/schema.ts [417ms]
$ deno run -A ./scripts/generate_routes.ts -i OpenAPI.json -o .\routes.ts
$ deno run -A ./scripts/export_types.ts -i OpenAPI.json -o .\types.ts
# build npm package
$ deno run -A ./scripts/build_npm.ts

About

a typed revolt api client

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages