codebottle
v2.0.0
Published
🍾 API wrapper for codebottle.io
Downloads
22
Readme
Install
npm i codebottle
yarn add codebottle
Usage
All requests return Promise
For examples see test/index.mjs
import bottle from 'codebottle';
// ...
const data = await bottle.latest;
const { id, code, title, username } = await bottle.fetch('f063cc6e0b');
// advanced api wrapper (without docs)
// recommended to not use it unless you know how to use it
const data = await bottle.api.snippets('f063cc6e0b').get();
All library methods and getters
// Fetch specific snippet by key
bottle.fetch(key)
// Fetch language or category by key
bottle.language(key);
bottle.category(key);
// Find snippets with query and with optional language id
bottle.search({ query, language })
// Fetch latest snippets
codebottle.latest;
// Fetch all languages or categories
codebottle.languages;
codebottle.categories;