Skip to content

Commit c0908c4

Browse files
author
BL
committed
update README for typescript confirmation and example of usage
1 parent b9ad4cf commit c0908c4

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,24 @@ export AWS_ACCESS_KEY_ID=KEY
3636
export AWS_SECRET_ACCESS_KEY=SECRET
3737
```
3838

39-
## Configuration
39+
## Configuration Using JavaScript
4040

4141
Set your Access Key and Access Secret.
4242

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

47+
## Configuration Using TypeScript
48+
49+
```
50+
import * as MwsApi from 'amazon-mws';
51+
52+
const amazonMws = new MwsApi();
53+
amazonMws.setApiKey(accessKey, accessSecret);
54+
```
55+
56+
4757
### Feeds
4858

4959
#### Submit Feed
@@ -523,6 +533,31 @@ var amazonMws = require('amazon-mws')('AWS_ACCESS_KEY_ID','AWS_SECRET_ACCESS_KEY
523533
});
524534
```
525535

536+
#### Get Report
537+
###### Using TypeScript.
538+
```
539+
const accessKey = process.env.AWS_ACCESS_KEY_ID || 'YOUR_KEY';
540+
const accessSecret = process.env.AWS_SECRET_ACCESS_KEY || 'YOUR_SECRET';
541+
542+
import * as MwsApi from 'amazon-mws';
543+
544+
const amazonMws = new MwsApi();
545+
amazonMws.setApiKey(accessKey, accessSecret);
546+
547+
try {
548+
const response: any = await amazonMws.reports.search({
549+
'Version': '2009-01-01',
550+
'Action': 'GetReport',
551+
'SellerId': 'SELLER_ID',
552+
'MWSAuthToken': 'MWS_AUTH_TOKEN',
553+
'ReportId': 'REPORT_ID'
554+
});
555+
console.log('response', response);
556+
} catch (error: any) {
557+
console.log('error ', error);
558+
}
559+
```
560+
526561
#### Additionally all api returns Throttling: Limits to how often you can submit requests
527562
Reference : http://docs.developer.amazonservices.com/en_CA/dev_guide/DG_Throttling.html
528563
```json

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"Amazon MWS Sellers",
1515
"node-mws",
1616
"amazon-mws-node-api",
17+
"amazon-mws-typescript",
18+
"amazon-mws-await",
19+
"amazon-mws-async",
20+
"amazon-mws-promises",
1721
"Amazon Marketplace Web Service",
1822
"mws",
1923
"mws-products",

0 commit comments

Comments
 (0)