JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q32261F
  • License ISC

It's a node wrapper for the zinc.io API

Package Exports

  • zinc-fetch

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zinc-fetch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

zinc-fetch

It's a super lightweight module for making requests to the zinc.io API. Basically, I wanted to drop a service into my app to handle zinc requests for me, and this seemed small and easy enough to be worth putting up as a package.

Install

npm install zinc-fetch --save

Usage

const ZincFetch = require('zinc-fetch')(YOUR_ZINC_API_KEY);

ZincService.product.getPrices(someItemId) // for an item at https://www.amazon.com/dp/1101904240, it's 1101904240
    .then(response => {
        response.offers.each(candidateOffer => {
            console.log(candidateOffer.price)
            // ===> 13.37
            console.log(candidateOffer.ship_price)
            // ===> 4.22
            // plus many more fields you can find in Zinc's docs.
        }
    });
});

See test cases for more examples.

API

product.getDetails(productId)

returns a Promise that resolves to a zinc product object or an error

product.getPrices(productId)

returns a Promise that resolves to a zinc product offers object or an error

order.create(data)

returns a Promise that resolves to a zinc order request_id that you can use to retrieve the order's status

order.retrieve(requestId)

returns a Promise that resolves to an order_response or error

Testing

Just run npm test from the root directory. Make sure your api key is available on process.env or set it first, like ZINC_KEY=12xxxxxxxYZ npm test.

License

MIT

Acknowledgement

I used Evan Tann's wrapper as a reference.