Skip to content

Commit

Permalink
update README for typescript confirmation and example of usage
Browse files Browse the repository at this point in the history
  • Loading branch information
BL committed Jul 24, 2018
1 parent b9ad4cf commit c0908c4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,24 @@ export AWS_ACCESS_KEY_ID=KEY
export AWS_SECRET_ACCESS_KEY=SECRET
```

## Configuration
## Configuration Using JavaScript

Set your Access Key and Access Secret.

```js
var amazonMws = require('amazon-mws')('AWS_ACCESS_KEY_ID','AWS_SECRET_ACCESS_KEY');
```

## Configuration Using TypeScript

```
import * as MwsApi from 'amazon-mws';
const amazonMws = new MwsApi();
amazonMws.setApiKey(accessKey, accessSecret);
```


### Feeds

#### Submit Feed
Expand Down Expand Up @@ -523,6 +533,31 @@ var amazonMws = require('amazon-mws')('AWS_ACCESS_KEY_ID','AWS_SECRET_ACCESS_KEY
});
```

#### Get Report
###### Using TypeScript.
```
const accessKey = process.env.AWS_ACCESS_KEY_ID || 'YOUR_KEY';
const accessSecret = process.env.AWS_SECRET_ACCESS_KEY || 'YOUR_SECRET';
import * as MwsApi from 'amazon-mws';
const amazonMws = new MwsApi();
amazonMws.setApiKey(accessKey, accessSecret);
try {
const response: any = await amazonMws.reports.search({
'Version': '2009-01-01',
'Action': 'GetReport',
'SellerId': 'SELLER_ID',
'MWSAuthToken': 'MWS_AUTH_TOKEN',
'ReportId': 'REPORT_ID'
});
console.log('response', response);
} catch (error: any) {
console.log('error ', error);
}
```

#### Additionally all api returns Throttling: Limits to how often you can submit requests
Reference : http://docs.developer.amazonservices.com/en_CA/dev_guide/DG_Throttling.html
```json
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"Amazon MWS Sellers",
"node-mws",
"amazon-mws-node-api",
"amazon-mws-typescript",
"amazon-mws-await",
"amazon-mws-async",
"amazon-mws-promises",
"Amazon Marketplace Web Service",
"mws",
"mws-products",
Expand Down

0 comments on commit c0908c4

Please sign in to comment.