npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mws-client

v1.2.4

Published

an api wrapper for Amazon Marketplace Webservice API

Downloads

13

Readme

GitHub Actions workflows status

Build workflow status Publish workflow status

CodeClimate


Installation

npm i mws-client

API documentation

Modules

Module | Description ------ | ----------- mws-client | Creates a new client to communicate with MWS API

Classes

Name | Description ------ | ----------- Section | A section of MWS API. Note: all sections and associated endpoints are generated automatically when instanciating a new client

Typedefs

Name | Description ------ | ----------- MWSResponse | Response received from MWS API Options | Options for the new MWS client instanciation MWS | MWS client

mws-client

Creates a new client to communicate with MWS API

Returns: MWS - MWS client

| Param | Type | Description | | --- | --- | --- | | opts | Options | Options to be passed to instanciate a new client |

Example

const MWS = require('mws-client')({
  AWSAccessKeyId: process.env.YOUR_AWS_ACCESS_KEY,
  SellerId: process.env.YOUR_SELLER_ID,
  MWSAuthToken: process.env.YOUR_MWS_AUTH_TOKEN
})

Section

A section of MWS API. Note: all sections and associated endpoints are generated automatically when instanciating a new client

Kind: global class

Section.endpoint(opts)

Send a request to the given endpoint

Kind: static method of Section
Returns: MWSResponse - Response received from MWS API

| Param | Type | Description | | --- | --- | --- | | opts | Object | Parameters for the API call. See here for details regarding parameters for every endpoints. Note: list parameters are not supporting Array type yet. You will have to build them in the same way as they appear in the query string of the signed request to MWS API (i.e. param.1=foo&param.2=bar) |

Example

// retrieves inventory from given date for the German marketplace
const list = await MWS.fulfillmentInventory.listInventorySupply({
  QueryStartDateTime: new Date(d).toISOString(),
  ResponseGroup: 'Basic',
  _marketplace: 'DE'
})

// retrieve status of the fullfillmentInventory API for the German marketplace
const status = await MWS.fulfillmentInventory.getServiceStatus({ _marketplace: 'DE' })

MWSResponse

Response received from MWS API

Kind: global typedef
Properties

| Name | Type | Description | | --- | --- | --- | | headers | Object | Headers of the response received from the MWS API. Those are typical Headers as you would find in the Fetch API. | | status | number | Response status code | | body | Object | Parsed body from MWS API response |

Options

Options for the new MWS client instanciation

Kind: global typedef
Properties

| Name | Type | Default | Description | | --- | --- | --- | --- | | AWSAccessKeyId | string | | AWS access key ID | | MWSAuthToken | string | | MWS authentication token | | SellerId | string | | Seller ID | | [SignatureVersion] | string | '2' | Signature version used for signing to request URL | | [SignatureMethod] | string | 'HmacSHA256' | Signature method used for signing to request URL | | [userAgent] | string | 'kaskadi-mws-client/VERSION (Language=node.js)' | User agent used when sending request | | [parserType] | string | 'xml' | Parser used for the response received from MWS. Accepted values: 'xml', 'text' |

MWS

MWS client

Kind: global typedef
Properties

| Name | Type | Description | | --- | --- | --- | | Section | Section | MWS API section |

Notes

Throttling

This client does not include throttling handling. The reason being that our internal implementation uses Lambda functions which are not persistent and therefore instantiate a new client at each function call. This makes a throttling handled via client irrelevant since multiple clients may be instantiated in a short period of time (or even in parallel) to call the same endpoint which leads to a client throttling state not reflecting the actual throttling state of the MWS API.

We encourage you to implement your own throttling handling in your infrastructure so that it fits your implementation. You can refer to MWS API documentation for more information on this.

Reminder: response headers are exposed via the mws-client return value so you may use those to handle an hourly capped endpoint.

Client implementation

This client uses signed requests to communicate with the MWS API. See docs here and there for more details.

Available sections & endpoints

All items listed here point to the MWS API docs