UNPKG

garyapi

Version:

A simple Node.js client for the Gary the Cat API ๐Ÿพ

45 lines (32 loc) โ€ข 1.73 kB
# garyapi ๐Ÿพ 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. ## ๐Ÿ“ฆ Installation ```bash npm install garyapi ``` ## ๐Ÿงช Usage ```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. })(); ``` ## ๐Ÿ“š API | 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).