npm i codebottle
yarn add codebottle
All requests return Promise
For examples see test/index.mjs
importbottlefrom'codebottle';// ...constdata=awaitbottle.latest;const{ id, code, title, username }=awaitbottle.fetch('f063cc6e0b');// advanced api wrapper (without docs)// recommended to not use it unless you know how to use itconstdata=awaitbottle.api.snippets('f063cc6e0b').get();All library methods and getters
// Fetch specific snippet by keybottle.fetch(key)// Fetch language or category by keybottle.language(key);bottle.category(key);// Find snippets with query and with optional language idbottle.search({ query, language })// Fetch latest snippetscodebottle.latest;// Fetch all languages or categoriescodebottle.languages;codebottle.categories;
