0.0.12 • Published 8 years ago

jet-sdk v0.0.12

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

jet-sdk

Originally forked from vedmalex/mws-sdk.

What is done:

  • It is uses request. it is more flexible and there is no eventEmitter syntax.

  • Promises to provide generic async support.

Use it. Contriburte it.

it can be seamlesly used in ES2015/2016 way using babel.js. with new javascript code features like yield or async wait to put some sugar on your code.

Examples

Initialize

var Jet = require('jet-sdk'),
    client = new Jet.Client('user', 'pass', {});

you also can use test/jet-emulator.(for run use command)

  node test/jet-emulator/app.js

and after then can send commands to localhost(for getting available params see source code jet-emulator):

var Jet = require('jet-sdk'),
    client = new Jet.Client('user', 'pass', {host:'localhost:3021'});

Getting PRODUCTS information

PRODUCTSUsing for getting products by SKU

function GetProductBySKU(user, pass, SKU) {
  var client = new Jet.Client(user, pass, {});
  var req = Jet.Products.requests.GetProductBySKU();
  req.set('SKU', SKU);
  return client.auth().then(client=>client.invoke(req));
}

PRODUCTSUsing for getting products SKU list

function GetProductSKU(user, pass, offset, limit) {
  var client = new Jet.Client(user, pass, {});
  var req = Jet.Products.requests.GetProductSKU();
  req.set('offset', offset);
  req.set('limit', limit);
  return client.auth().then(client=>client.invoke(req));
}

PRODUCTSUsing for getting product price by SKU

function GetProductPrice(user, pass, SKU) {
  var client = new Jet.Client(user, pass, {});
  var req = Jet.Products.requests.GetProductPrice();
  req.set('SKU', SKU);
  return client.auth().then(client=>client.invoke(req));
}

PRODUCTSUsing for getting product inventory

function GetProductInventory(user, pass, SKU) {
  var client = new Jet.Client(user, pass, {});
  var req = Jet.Products.requests.GetProductInventory();
  req.set('SKU', SKU);
  return client.auth().then(client=>client.invoke(req));
}

PRODUCTSUsing for getting product shipping exception

function GetProductShippingException(user, pass, SKU) {
  var client = new Jet.Client(user, pass, {});
  var req = Jet.Products.requests.GetProductShippingException();
  req.set('SKU', SKU);
  return client.auth().then(client=>client.invoke(req));
}

Getting ORDERS information

ORDERSUsing for getting order list by stat

function GetOrderList(user, pass, status) {
  var client = new Jet.Client(user, pass, {});
  var req = Jet.Orders.requests.GetOrders();
  req.set('status', status);
  return client.auth().then(client=>client.invoke(req));
}

ORDERSUsing for getting order details

function GetOrder(user, pass, orderId) {
  var client = new Jet.Client(user, pass, {});
  var req = Jet.Orders.requests.GetOrderDetails();
  req.set('orderId', orderId);
  return client.auth().then(client=>client.invoke(req));
}
0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago