This package has been deprecated

Author message:

see https://github.com/cordis-lib/cordis#deprecation

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

1.2.0 • Public • Published

@cordis/rest

GitHub npm TypeScript

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @cordis/rest

Weekly Downloads

2

Version

1.2.0

License

none

Unpacked Size

23.1 kB

Total Files

23

Last publish

Collaborators

  • didinele