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.
npm install zinc-fetch --save
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.
returns a Promise that resolves to a zinc product object or an error
returns a Promise that resolves to a zinc product offers object or an error
returns a Promise that resolves to a zinc order request_id
that you can use to retrieve the order's status
returns a Promise that resolves to an order_response
or error
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
.
MIT
I used Evan Tann's wrapper as a reference.