项目作者: ScaleLeap

项目描述 :
Amazon MWS API TypeScript and Node.js Unofficial SDK
高级语言: TypeScript
项目地址: git://github.com/ScaleLeap/amazon-mws-api-sdk.git
创建时间: 2020-04-27T14:05:34Z
项目社区:https://github.com/ScaleLeap/amazon-mws-api-sdk

开源协议:MIT License

下载


Amazon MWS API for Node.js

@scaleleap/amazon-mws-api-sdk"">NPM
License
GitHub Workflow Status
Codecov
Snyk
Semantic Release
FOSSA Status

📦 @scaleleap/amazon-mws-api-sdk


A fully typed TypeScript and Node.js SDK library for Amazon MWS API

Download & Installation

  1. npm i -s @scaleleap/amazon-mws-api-sdk

Click here for the full Documentation

Example


  1. import {
  2. amazonMarketplaces,
  3. HttpClient,
  4. Sellers,
  5. Orders,
  6. MWS
  7. } from '@scaleleap/amazon-mws-api-sdk'
  8. const mwsOptions = {
  9. marketplace: amazonMarketplaces.US,
  10. awsAccessKeyId: '',
  11. mwsAuthToken: '',
  12. sellerId: '',
  13. secretKey: '',
  14. }
  15. // Using sections directly
  16. const main = async () => {
  17. const http = new HttpClient(mwsOptions)
  18. /**
  19. * Get status for Sellers API
  20. */
  21. const sellers = new Sellers(http)
  22. const [serviceStatus] = await sellers.getServiceStatus()
  23. if (serviceStatus.Status === 'GREEN') {
  24. console.log(`Sellers API is up on ${serviceStatus.Timestamp}!`)
  25. }
  26. /**
  27. * List Orders
  28. */
  29. const orders = new Orders(http)
  30. // or
  31. const [ordersList, requestMeta] = await orders.listOrders({
  32. MarketplaceId: [amazonMarketplaces.US.id],
  33. CreatedAfter: new Date(Date.now() - 100 * 24 * 60 * 60 * 1000)
  34. })
  35. ordersList.Orders.forEach((order) => {
  36. console.log(`Order ID is ${order.AmazonOrderId}`)
  37. })
  38. }
  39. // Using MWS client
  40. const main = async () => {
  41. const http = new HttpClient(mwsOptions)
  42. const mws = new MWS(http)
  43. /**
  44. * Get status for Sellers API
  45. */
  46. const [serviceStatus] = await mws.sellers.getServiceStatus()
  47. if (serviceStatus.Status === 'GREEN') {
  48. console.log(`Sellers API is up on ${serviceStatus.Timestamp}!`)
  49. }
  50. /**
  51. * List Orders
  52. */
  53. const [ordersList, requestMeta] = await mws.orders.listOrders({
  54. MarketplaceId: [amazonMarketplaces.US.id],
  55. CreatedAfter: new Date(Date.now() - 100 * 24 * 60 * 60 * 1000)
  56. })
  57. ordersList.Orders.forEach((order) => {
  58. console.log(`Order ID is ${order.AmazonOrderId}`)
  59. })
  60. }

More examples in the /examples folder!

Contributing

Authors or Acknowledgments

License

This project is licensed under the MIT License.

FOSSA Status