purrbot-api
Version:
The official API wrapper for the Purrbot.site API 100% API Coverage 100% Type-Script coverage
14 lines • 617 B
JavaScript
export const baseURL = 'https://api.purrbot.site/v2';
export const get = async (imgType, nsfw, category) => {
const res = (await fetch(`${baseURL}/img/${nsfw ? 'nsfw' : 'sfw'}/${category}/${String(imgType)}`).then((r) => r.json()));
if (res.error)
throw new Error(res.message);
return res.link;
};
export const list = async (imgType, nsfw, category) => {
const res = (await fetch(`${baseURL}/list/${nsfw ? 'nsfw' : 'sfw'}/${category}/${String(imgType)}`).then((r) => r.json()));
if (res.error)
throw new Error(res.message);
return res.links;
};
//# sourceMappingURL=util.js.map