open-icecat

1.3.1 • Public • Published

Open Icecat Logo

 

Issues Last Commit License

A simple tool to access the open icecat product information API. The Package is build with modern web technologies like fetch to have a small footprint and native performance. It also has some nice features like retrying when the request fails and some interfaces to make typescript development easier.

Install

Install with npm:

$ npm i open-icecat

Declaration & Methods

class OpenIcecat {
    constructor(baseParams: {});
    getProduct(options: GetProductOptions);
    getProductReviews(options: GetProductOptions);
    getProductRelatedProducts(options: GetProductOptions);
}

Usage

1. Setup

import { OpenIcecat } from 'open-icecat';
 
const oc = new OpenIcecat({
    username: 'your-username',
    lang: 'en'
});

2. Get a Product by Brand & Product Code

(async () => {
    const res = await oc.getProduct({ Brand: 'hp', ProductCode: 'RJ459AV' });
    console.log(res);
})();

3. Get a Product by GTIN/EAN/UPC/JAN

(async () => {
    const res = await oc.getProduct({ GTIN: '0882780751682' });
    console.log(res);
})();

4. Get a Product by icecat_id

(async () => {
    const res = await oc.getProduct({ icecat_id: 1198270 });
    console.log(res);
})();

5. Change the language for a single request

(async () => {
    const res = await oc.getProduct({ lang: 'en', Brand: 'hp', ProductCode: 'RJ459AV' });
    console.log(res);
})();

License

Copyright © 2020, Tjark Kuehl Released under the MIT License.

Package Sidebar

Install

npm i open-icecat

Weekly Downloads

1

Version

1.3.1

License

MIT

Unpacked Size

27.8 kB

Total Files

29

Last publish

Collaborators

  • tjark-kuehl