garyapi
Version:
A simple Node.js client for the Gary the Cat API ๐พ
45 lines (32 loc) โข 1.73 kB
Markdown
A tiny Node.js client for interacting with the [Gary the Cat API](https://api.garythe.cat).
Get images, quotes, jokes, and more โ all powered by Gary and Goober.
```bash
npm install garyapi
```
```js
const GaryAPI = require("garyapi");
const gary = new GaryAPI();
(async () => {
console.log(await gary.getGary()); // JSON: Random Gary image URL
console.log(await gary.getGoober()); // JSON: Random Goober image URL
console.log(await gary.getQuote()); // Quote string
console.log(await gary.getJoke()); // Joke string
const garyBuffer = await gary.getGaryImageBuffer(); // Buffer of random Gary image
const gooberBuffer = await gary.getGooberImageBuffer(); // Buffer of random Goober image
// You could save the image, send it to Discord, etc.
})();
```
| Method | Returns | Description |
|----------------------------|----------------------|-------------------------------------|
| `getGary()` | `Promise<string>` | Random Gary image URL (JSON) |
| `getGoober()` | `Promise<string>` | Random Goober image URL (JSON) |
| `getQuote()` | `Promise<string>` | Random quote |
| `getJoke()` | `Promise<string>` | Random joke |
| `getGaryImageBuffer()` | `Promise<Buffer>` | Raw Gary image data as a buffer |
| `getGooberImageBuffer()` | `Promise<Buffer>` | Raw Goober image data as a buffer |
## ๐ License
See `LICENSE` (aka The Gary License).