adafruit.js

0.1.3 • Public • Published

Adafruit.JS

The easiest way to use the Adafruit API!

With Adafruit.JS, you can easily use the Adafruit API to look up information on products, guides, and more!

Install

$ npm install --save adafruit.js

Examples

Product Information

Adafruit.JS has a simple way for returning information on products!

Code:

const adafruit = require('adafruit.js')

adafruit.getProduct('id').then(p => {
    console.log(p)
})

Console:

{ id: 'product-id',
  image: 'product-thumbnail',
  name: 'product-name',
  desc: 'product-name',
  model: 'model or undefined',
  mpn: 'product-mpn',
  category: 'category-id',
  manufacturer: 'manufacturer or null',
  price: 'price',
  currency: 'currency',
  url: 'product-page-link',
  instock: 'product-in-stock (true/false)',
  stock: 'amount in stock',
  discontinued: 'product-discontinued (true/false)',
  discount:
   [ { discounted_price: '5.95',
       discounted_percent: 0,
       show_qty: '1-9',
       min_qty: 1 },
     { discounted_price: '5.36',
       discounted_percent: '10',
       show_qty: '10-99',
       min_qty: 10 },
     { discounted_price: '4.76',
       discounted_percent: '20',
       show_qty: '100+',
       min_qty: 100 } ],
  html:
   'description-in-html' }

Errors:

  • No ID Specified: {"error": "Invalid Identifier"}
  • ID Not a Number: {"error": "NaN"}
  • Product Not Found: {"error": "Product not found"}
  • Unknown Error: {"error": "An unknown error occured"} or undefined

Package Sidebar

Install

npm i adafruit.js

Weekly Downloads

2

Version

0.1.3

License

ISC

Unpacked Size

8.56 kB

Total Files

3

Last publish

Collaborators

  • codingpro