cncolder / wishapi

Wish.com api
MIT License
3 stars 0 forks source link

Build Status Coverage Status NPM version Greenkeeper badge

wishapi

Wish.com api for Node.js.

Install

npm install wishapi

Use

var wishapi = require('wishapi');
var merchant = new wishapi.Merchant({
  key: 'your merchant api key'
});

merchant.authTest()
  .then(function(success) {
    console.log(success)
  });

merchant.product('a product id')
  .then(function(product) {
    // a plain javascript object.
  })
  .catch(function(err) {
    // something wrong.
    // the err has details and error code.
  });

Don't favor promise?

Thanks Bluebird. We provide callback too.

merchant.fulfillOrder({
  id: 'order id',
  tracking_provider: 'USPS',
  tracking_number: '12345678'
}, (err, success) {
  if (err) {
    console.error(err);
  } else if (success) {
    // ...
  }
});

Document

First, you need read Official api document. To understand every model property.

About Merchant class you can read an annotated source. It write by coffee script. But you don't need install it. The code you installed by npm is compiled vanilla javascript.

This api return some wish special error type. You can find them at errors annotated source.

Issue

Our code have pass 100% test converage currently.

If you find out any issues. Please let me know.

If you have any good idea. Send me a pull request.