@neocord/rest
v2.0.0
Published
A project in the neocord family!
Downloads
6
Readme
Simple REST library used within neocord
node.js v14 or newer is required.
yarn add @neocord/rest
Basic Usage
import { REST } from "@neocord/rest";
import fetch from "petitio";
const api = new REST();
// You must set the token if you want to use the RestHandler, cdn doesn't require a authorization.
api.token = "your token here"
// All (iirc) REST routes return JSON, the CDN does not.
api.queue("/users/@me").then(console.log);
...
// If you wanna use the CDN you need to use petitio, or another http client of your choice.
const defaultAvatar = await fetch(api.cdn.defaultAvatar("5773"));
console.log(defaultAvatar.body) // => <Buffer 89 50 4e 47...>
Typescript Users
Because we make use of petitio you may have to install undici as a development dependency.