New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

snipbin.js

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

snipbin.js

⚡ A TypeScript API wrapper for SnipBin

unpublished
latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

SnipBin.js

npm NPM npm

An API wrapper for SnipBin, written in TypeScript.

SnipBin is also written by me -- be sure to check it out and leave a ⭐ if you enjoyed the concept!

⚡ Getting Started

💻 Installation

# install snipbin.js@latest
yarn add snipbin.js

# or... 
# npm install snipbin.js

✏ Usage

🔒 Authorization

Set your SnipBin API key to use restricted features of this API.

Note: You don't have to be authenticated to use this library or SnipBin's API.

import { authorize } from 'snipbin.js'

authorize('myApiKey')

🔗 Fetching Snips

Note: You can't fetch encrypted snips.

import { snipbin } from 'snipbin.js'

snipbin.getSnip('abt')

🔗 Creating Snips

Note: In order to link a snip with your account, make sure to set authorize with your API key.

import { snipbin, authorize } from 'snipbin.js'

authorize('myApiKey')
snipbin.createSnip({
  slug: 'test-snip',
  content: "import { snipbin } from 'snipbin.js'",
  language: 'js',
  // password: 'secret'
})

🔗 Editing Snips

Note: Since you can only edit snips on your account, you must set authorize with your API key.

import { snipbin, authorize } from 'snipbin.js'

authorize('myApiKey')
snipbin.editSnip('test-snip', {
  slug: 'test-snip2',
  content: "we're editing this thing, whoa!",
  // password: 'secret'
})

🔗 Deleting Snips

Note: Since you can only delete snips on your account, you must set authorize with your API key. Also, it goes without saying that this action is irreversible.

import { snipbin, authorize } from 'snipbin.js'

authorize('myApiKey')
snipbin.deleteSnip('test-snip')

💡 Detecting Language

Note: This is simply a wrapper around LangMyst, which uses go-enry to detect languages.

import { detect } from 'snipbin.js'

detect.detectLanguage({ snippet: "import { snipbin } from 'snipbin.js'" })

Aside from that, the codebase is also fully documented. If you prefer, you can go through the codebase to better find your way around this project with the different return types and functions.

Additionally, you can find the different endpoints and internals of this API over on SnipBin's API documentation

🔧 Tools Used

🤞 Contributing

After setting up the project, and making changes:

git add .
git commit -m "commit message"
git push YOUR_REPO_URL YOUR_BRANCH

💙 Credits

Since I haven't written a proper API wrapper before, a big round of thanks to Ian Hornik for writing pastemyst.ts, as this library is built around it.

Keywords

snipbin

FAQs

Package last updated on 21 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts