@neocord/rest
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

banner


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.


Licensed under the Apache 2.0 License

Readme

Keywords

none

Package Sidebar

Install

npm i @neocord/rest

Weekly Downloads

1

Version

2.0.0

License

Apache-2.0

Unpacked Size

41.7 kB

Total Files

12

Last publish

Collaborators

  • the2dperson