@cordis/rest
Cordis' REST utilities for the Discord API
Note: Props to https://github.com/spec-tacles/spectacles.js for the Mutex logic.
Installation
npm install @cordis/rest
pnpm install @cordis/rest
yarn add @cordis/rest
Example Usage
const { Rest, buildRestRouter } = require('@cordis/rest');
const main = async () => {
const rest = new Rest('token');
const router = buildRestRouter(rest);
// using the rest manager itself
const someUser = await rest.get('/users/223703707118731264');
const someOtherUser = await rest.make({
path: '/users/198536269586890752',
method: 'get'
});
// using the router utility
const someOtherOtherUser = await router.users["223703707118731264"].get();
console.log(someUser, someOtherUser, someOtherOtherUser);
};
main();
Documentation
You can find documentation for the whole project over at https://cordis.js.org
Contributing
Please see the main README.md for info on how to contribute to this package or the other @cordis
packages.
LICENSE
Licensed under the Apache 2.0 license.