@amazon-sp-api-release/amazon-sp-api-sdk-js 1.0.0-rc4 → 1.0.0-rc6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -14
- package/index.js +1 -1
- package/package.json +1 -1
- package/sample-node-app/index.js +5 -6
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ npm install @amazon-sp-api-release/amazon-sp-api-sdk-js
|
|
|
39
39
|
yarn add @amazon-sp-api-release/amazon-sp-api-sdk-js
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
##### Add as
|
|
42
|
+
##### Add as a package dependency
|
|
43
43
|
Add the following line to the `dependencies` in your `package.json` file:
|
|
44
44
|
```bash
|
|
45
45
|
"@amazon-sp-api-release/amazon-sp-api-sdk-js": "^1.0.0"
|
|
@@ -56,12 +56,11 @@ In order to call one of the APIs included in the Selling Partner API, you need t
|
|
|
56
56
|
For an example, refer to the following sample code for connecting to Sellers API:
|
|
57
57
|
|
|
58
58
|
```javascript
|
|
59
|
-
import { LwaAuthClient } from '@amazon-sp-api-release/amazon-sp-api-sdk-js
|
|
59
|
+
import { LwaAuthClient } from '@amazon-sp-api-release/amazon-sp-api-sdk-js';
|
|
60
60
|
|
|
61
61
|
import {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} from '@amazon-sp-api-release/amazon-sp-api-sdk-js/sdk/sellers_v1/src/index.js';
|
|
62
|
+
SellersSpApi
|
|
63
|
+
} from '@amazon-sp-api-release/amazon-sp-api-sdk-js';
|
|
65
64
|
|
|
66
65
|
(async () => {
|
|
67
66
|
const lwaClient = new LwaAuthClient(
|
|
@@ -69,11 +68,11 @@ import {
|
|
|
69
68
|
'<YOUR_CLIENT_SECRET>',
|
|
70
69
|
'<YOUR_REFRESH_TOKEN>'
|
|
71
70
|
);
|
|
72
|
-
const sellerApiClient = new
|
|
71
|
+
const sellerApiClient = new SellersSpApi.ApiClient(
|
|
73
72
|
'https://sellingpartnerapi-na.amazon.com'
|
|
74
73
|
);
|
|
75
74
|
|
|
76
|
-
const sellerApi = new SellersApi(sellerApiClient);
|
|
75
|
+
const sellerApi = new SellersSpApi.SellersApi(sellerApiClient);
|
|
77
76
|
sellerApiClient.applyXAmzAccessTokenToRequest(
|
|
78
77
|
await lwaClient.getAccessToken()
|
|
79
78
|
);
|
|
@@ -85,21 +84,17 @@ import {
|
|
|
85
84
|
})();
|
|
86
85
|
```
|
|
87
86
|
|
|
88
|
-
Alternatively, you can go to `@amazon-sp-api-release/amazon-sp-api-sdk-js/
|
|
87
|
+
Alternatively, you can go to `@amazon-sp-api-release/amazon-sp-api-sdk-js/sample-node-app` and copy over and modify `index.js` and `app.config.mjs` files and give them a try.
|
|
89
88
|
|
|
90
89
|
##### Additional Note:
|
|
91
90
|
This Amazon Selling Partner API JavaScript SDK is fully compatible with ECMAScript modules (ESM). You can use modern ES6+ import/export syntax as demonstrated in the example code:
|
|
92
91
|
|
|
93
92
|
```javascript
|
|
94
93
|
import {
|
|
95
|
-
|
|
96
|
-
} from '@amazon-sp-api-release/amazon-sp-api-sdk-js
|
|
94
|
+
SellersSpApi,
|
|
95
|
+
} from '@amazon-sp-api-release/amazon-sp-api-sdk-js';
|
|
97
96
|
```
|
|
98
97
|
|
|
99
|
-
### Additional documentation
|
|
100
|
-
|
|
101
|
-
For detailed API documentation and examples, please refer to README file in each sdk/<API>/ folder in our NPM package. eg. For Sellers API documents, Go to [Code tab](https://www.npmjs.com/package/@amazon-sp-api-release/amazon-sp-api-sdk-js?activeTab=code), find in path `/@amazon-sp-api-release/amazon-sp-api-sdk-js/sdk/sellers_v1/README.md`
|
|
102
|
-
|
|
103
98
|
### Giving Feedback
|
|
104
99
|
|
|
105
100
|
We need your help in making this SDK great. Please participate in the community and contribute to this effort by submitting issues, participating in discussion forums and submitting pull requests through the following channels:
|
package/index.js
CHANGED
|
@@ -47,4 +47,4 @@ export * as VendorordersSpApi from './src/vendororders_v1/index.js'
|
|
|
47
47
|
export * as VendorshipmentsSpApi from './src/vendorshipments_v1/index.js'
|
|
48
48
|
export * as VendortransactionstatusSpApi from './src/vendortransactionstatus_v1/index.js'
|
|
49
49
|
|
|
50
|
-
export *
|
|
50
|
+
export * from './helper/LwaAuthClient.mjs'
|
package/package.json
CHANGED
package/sample-node-app/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { AppConfig } from './app.config.mjs';
|
|
2
|
-
import { LwaAuthClient } from '@amazon-sp-api-release/amazon-sp-api-sdk-js
|
|
2
|
+
import { LwaAuthClient } from '@amazon-sp-api-release/amazon-sp-api-sdk-js';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '@amazon-sp-api-release/amazon-sp-api-sdk-js/sdk/sellers_v1/src/index.js';
|
|
5
|
+
SellersSpApi
|
|
6
|
+
} from '@amazon-sp-api-release/amazon-sp-api-sdk-js';
|
|
8
7
|
|
|
9
8
|
(async () => {
|
|
10
9
|
const lwaClient = new LwaAuthClient(
|
|
@@ -12,11 +11,11 @@ import {
|
|
|
12
11
|
AppConfig.lwaClientSecret,
|
|
13
12
|
AppConfig.lwaRefreshToken
|
|
14
13
|
);
|
|
15
|
-
const sellerApiClient = new
|
|
14
|
+
const sellerApiClient = new SellersSpApi.ApiClient(
|
|
16
15
|
'https://sellingpartnerapi-na.amazon.com'
|
|
17
16
|
);
|
|
18
17
|
|
|
19
|
-
const sellerApi = new SellersApi(sellerApiClient);
|
|
18
|
+
const sellerApi = new SellersSpApi.SellersApi(sellerApiClient);
|
|
20
19
|
sellerApiClient.applyXAmzAccessTokenToRequest(
|
|
21
20
|
await lwaClient.getAccessToken()
|
|
22
21
|
);
|