# imws

> Amazon Marketplace Web Services client with support for all api calls, using ES6 Promises with clever output.

Latest version **0.0.7** (published 2018-05-04) · 0 weekly downloads

## Install

```sh
npm install imws
pnpm add imws
yarn add imws
bun add imws
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2018-05-04 |
| First published | 2018-02-14 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 66.1 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Eibbor Srenduas |
| Maintainers | dominhhai |
| Keywords | mws, amazon, marketplace, fba, sellers |

## Links

- npm: https://www.npmjs.com/package/imws
- Repository: https://github.com/dominhhai/mws-sdk
- Issues: https://github.com/dominhhai/mws-sdk/issues
- npm.io page: https://npm.io/package/imws

## Dependencies (3)

- [xml2js](https://npm.io/package/xml2js.md) ^0.4.12
- [request](https://npm.io/package/request.md) ^2.60.0
- [underscore](https://npm.io/package/underscore.md) ^1.8.3

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.7 (latest) — 2018-05-04
- 0.0.6 — 2018-02-16
- 0.0.5 — 2018-02-15
- 0.0.4 — 2018-02-15
- 0.0.3 — 2018-02-15
- 0.0.2 — 2018-02-14
- 0.0.1 — 2018-02-14

## README

imws
======

Originally forked from [vedmalex/mws-sdk](https://github.com/vedmalex/mws-sdk).

Why forked?
-------------
The response object made by `xml2js` is
 - So looooooong
 - Un-clean `~~~~`
 - Hard to track ...00.aa444
 - Tired to access =>.=>.=>.=>

What is done:
-------------

 - I fix it with better response format!!!


Installation
--------
```
$ npm i -S imws
```

Examples
--------

Initialize

```javascript
var MWS = require('imws'),
    client = new MWS.Client(
      'accessKeyId',
      'secretAccessKey',
      'merchantId',
      {
        // target mws host. Default: 'mws.amazonservices.com'
        host: MWS.Endpoint.jp,
        // Optional Auth Token when using delegated Developer access.
        authToken: 'amzn.mws...',
        // request options (https://github.com/request/request#requestoptions-callback)
        requestOpts: {
          proxy: 'http://PROXY_HOST:PROXY_PORT',
          encoding: null
        }
      }
    ),
    MarketplaceId = "ATVPDKIKX0DER";
```

now you can use it

```javascript
function getListOrders(client, args) {
  var req = MWS.Orders.requests.ListOrders();
  req.set('CreatedAfter', args.CreatedAfter);
  req.set('CreatedBefore', args.CreatedBefore);
  req.set('LastUpdatedAfter', args.LastUpdatedAfter);
  req.set('MarketplaceId', args.MarketplaceId);
  req.set('LastUpdatedBefore', args.LastUpdatedBefore);
  req.set('OrderStatus', args.OrderStatus);
  req.set('FulfillmentChannel', args.FulfillmentChannel);
  req.set('PaymentMethod', args.PaymentMethod);
  req.set('BuyerEmail', args.BuyerEmail);
  req.set('SellerOrderId', args.SellerOrderId);
  req.set('MaxResultsPerPage', args.MaxResultsPerPage);
  return client.invoke(req);
}
// or you can do like this
function getListOrders(client, args) {
  var req = MWS.Orders.requests.ListOrders();
  req.set(args);
  return client.invoke(req);
}

```

Use it.

```javascript
var date = new Date();
getListOrders(client, {
  MarketplaceId: MarketplaceId,
  MaxResultsPerPage: 10,
  CreatedAfter: new Date(2015, 1, 1),
  CreatedBefore: new Date(2015, 1, 31)
})
// convert to clean JS Object
.then(MWS.Orders.responses.ListOrders)
.catch(function(error) {
  console.error(error);
})
.then(function(RESULT){
  console.log("--------");
  console.log(JSON.stringify(RESULT));
  console.log("--------");
});
```

Tests
-----

1. Fill in the values for `env.sh` and run tests:

  ```
  cd cloneOfThisProject
  . ./env.sh
  npm test
  ```
2. To see more logs while running tests, choose from:

  ```
  NODE_DEBUG=request npm test
  NODE_ENV=development npm test
  NODE_ENV=development NODE_DEBUG=request npm test
  ```

---
_Source: https://npm.io/package/imws · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
