https://github.com/keiryojs/rest
👽️ typescript library for interacting with Discord's REST api
https://github.com/keiryojs/rest
ava discord neocord typescript unit-testing
Last synced: 4 months ago
JSON representation
👽️ typescript library for interacting with Discord's REST api
- Host: GitHub
- URL: https://github.com/keiryojs/rest
- Owner: KeiryoJS
- License: apache-2.0
- Created: 2021-04-25T19:46:18.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-27T02:54:17.000Z (about 2 years ago)
- Last Synced: 2024-04-27T16:20:24.597Z (about 1 year ago)
- Topics: ava, discord, neocord, typescript, unit-testing
- Language: TypeScript
- Homepage:
- Size: 59.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Keiryo REST
> Simple REST library used within [keiryo](https://npmjs.com/KeiryoJS/keiryo)
- [Discord Server](https://discord.gg/5WD9KhF)
- [GitHub Repository](https://github.com/KeiryoJS/rest)**node.js v14** or newer is required.
```shell script
yarn add @keiryo/rest
```## Basic Usage
```ts
import { RestClient, cdn } from "@keiryo/rest";
import { request } from "undici";const api = new RestClient();
// You must set the token if you want to use the RestHandler, cdn doesn't require authorization.
api.token = "your token here"// All (iirc) REST routes return JSON, the CDN does not.
api.get("/users/@me").then(console.log);
...// If you want to use the CDN you need to use petitio, or another http client of your choice.
const defaultAvatar = await request(cdn.defaultAvatar(5773 % 5));
const data = await defaultAvatar.body.arrayBuffer();
console.log(Buffer.from(data)) // =>
```---
Licensed under the Apache 2.0 License