Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
feat: example for list inventory supply
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado authored and moltar committed Jun 28, 2020
1 parent 171b4c6 commit 426695d
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 4 deletions.
73 changes: 73 additions & 0 deletions examples/fulfillment-inventory/list-inventory-supply.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/no-unused-vars */

/**
* More usage examples at
* /test/integration/fulfillment-inventory.test.ts
* /test/unit/fulfillment-inventory.test.ts
*/

/**
* import from 'amazon-mws-api-sdk'
*/
import {
amazonMarketplaces,
FulfillmentInventory,
HttpClient,
InventorySupplyList,
ListInventorySupplyRequestParameters,
MWSOptions,
RequestMeta,
ResponseGroup,
} from '../../src'

/**
* Configure the HttpClient
*/

const mwsOptions: MWSOptions = {
marketplace: amazonMarketplaces.US,
awsAccessKeyId: '',
mwsAuthToken: '',
sellerId: '',
secretKey: '',
}

const http = new HttpClient(mwsOptions)
const fulfillmentInventory = new FulfillmentInventory(http)

const main = async () => {
const responseGroup: ResponseGroup = 'Basic'
const date = new Date(Date.now() - 150 * 24 * 60 * 60 * 1000) // Date from 150 days ago

const parameters: ListInventorySupplyRequestParameters = {
/**
* REQUIRED
*/

/**
* Either `MarketplaceId` or `QueryStartDateTime` not both
*/
MarketplaceId: amazonMarketplaces.US.id,
// QueryStartDateTime: date,

/**
* OPTIONAL
*/

// SellerSku: ['SKU123']
// ResponseGroup: responseGroup
}

const [listInventorySupply, requestMeta]: [
InventorySupplyList,
RequestMeta,
] = await fulfillmentInventory.listInventorySupply(parameters)

/**
* Check out Amazon's official docs for other available endpoints
* and definitions of possible request and response parameters
* http://docs.developer.amazonservices.com/en_CA/dev_guide/index.html
* Under the folder API References
*/
}
10 changes: 6 additions & 4 deletions examples/orders/list-orders.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/no-unused-vars */

/**
* More usage examples at
* /test/integration/orders.test.ts
* /test/unit/orders.test.ts
*/

/**
* import from 'amazon-mws-api-sdk'
*/
Expand Down Expand Up @@ -30,10 +36,6 @@ const mwsOptions: MWSOptions = {
}

const http = new HttpClient(mwsOptions)
/**
* Configure which API you need
* Sellers, Orders, Fulfillment Inventory, Products, Reports, Subscriptions, Finances, Feeds
*/
const orders = new Orders(http)

const main = async () => {
Expand Down

0 comments on commit 426695d

Please sign in to comment.