UNPKG

mws-zodane-advanced

Version:

fixed throtal resend

570 lines (389 loc) 32.8 kB
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> ### Table of Contents - [mws-advanced](#mws-advanced) - [mws-advanced](#mws-advanced-1) - [mws-advanced](#mws-advanced-2) - [mws](#mws) - [init](#init) - [endpoints](#endpoints) - [callEndpoint](#callendpoint) - [MWS_MARKETPLACES](#mws_marketplaces) - [MWS_ENDPOINTS](#mws_endpoints) - [InvalidUsage](#invalidusage) - [ServiceError](#serviceerror) - [RequestCancelled](#requestcancelled) - [ValidationError](#validationerror) - [recursionCount](#recursioncount) - [rootWasArray](#rootwasarray) - [validateInteger](#validateinteger) - [feeds](#feeds) - [REQUEST_REPORT_TYPES](#request_report_types) - [REPORT_PROCESSING_STATUS_TYPES](#report_processing_status_types) - [getMarketplaces](#getmarketplaces) - [getMarketplaces](#getmarketplaces-1) - [forceArray](#forcearray) - [listOrderItems](#listorderitems) - [listOrderItems](#listorderitems-1) - [listOrders](#listorders) - [listFinancialEvents](#listfinancialevents) - [listInventorySupply](#listinventorysupply) - [removeFromString](#removefromstring) - [transformAttributeSetKey](#transformattributesetkey) - [getMatchingProductForId](#getmatchingproductforid) - [reformatOfferCount](#reformatoffercount) - [reformatOffer](#reformatoffer) - [reformatOffer](#reformatoffer-1) - [reformatOffer](#reformatoffer-2) - [reformatOffer](#reformatoffer-3) - [reformatOffer](#reformatoffer-4) - [reformatLowestPrice](#reformatlowestprice) - [reformatBuyBoxPrice](#reformatbuyboxprice) - [reformatSummary](#reformatsummary) - [getLowestPricedOffersForASIN](#getlowestpricedoffersforasin) - [getLowestPricedOffersForASIN](#getlowestpricedoffersforasin-1) - [writeFile](#writefile) - [requestReport](#requestreport) - [requestReport](#requestreport-1) - [getReportRequestList](#getreportrequestlist) - [getReportRequestList](#getreportrequestlist-1) - [getReport](#getreport) - [getReportList](#getreportlist) - [getReportListByNextToken](#getreportlistbynexttoken) - [getReportListAll](#getreportlistall) - [requestAndDownloadReport](#requestanddownloadreport) ## mws-advanced mws-advanced module for interacting with Amazon Merchant Web Services ## mws-advanced ## mws-advanced reporting functions ## mws holds the mws-simple reference after init() is called ## init Initialize mws-advanced with your MWS access keys, merchantId, optionally authtoken, host, port If accessKeyId, secretAccessKey, and/or merchantId are not provided, they will be read from the environment variables MWS_ACESS_KEY, MWS_SECRET_ACCESS_KEY, and MWS_MERCHANT_ID respectively **Parameters** - `config` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Contains your MWS Access Keys/Tokens and options to configure the API (optional, default `{}`) - `config.region` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** One of the Amazon regions as specified in <https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html> (optional, default `'NA'`) - `config.accessKeyId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Your MWS Access Key (optional, default `process.env.MWS_ACCESS_KEY`) - `config.secretAccessKey` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Your MWS Secret Access Key (optional, default `process.env.MWS_SECRET_ACCESS_KEY`) - `config.merchantId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Your MWS Merchant ID (optional, default `process.env.MWS_MERCHANT_ID`) - `config.authToken` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** If making a call for a third party account, the Auth Token provided for the third party account - `config.host` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Set MWS host server name, see <https://docs.developer.amazonservices.com/en_US/dev_guide/DG_Endpoints.html> (optional, default `'mws.amazonservices.com'`) - `config.port` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Set MWS host port (optional, default `443`) **Examples** ```javascript const mws = MWS.init({ region: 'NA', accessKeyId: '1234', secretAccessKey: '2345', merchantId: '1234567890' }); const mws = MWS.init({ region: 'EU', accessKeyId, ... }); const mws = MWS.init({ authToken: 'qwerty', accessKeyId, ...}); const mws = MWS.init({ host: 'alternate-mws-server.com', accessKeyId, ... }); ``` Returns **mws-simple** The mws-simple instance used to communicate with the API ## endpoints simple flat list of all the endpoints required from individual modules above ## callEndpoint Call a known endpoint at MWS, returning the raw data from the function. Parameters are transformed and validated according to the rules defined in lib/endpoints **Parameters** - `name` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name of MWS API function to call - `callOptions` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** named hash object of the parameters to pass to the API (optional, default `{}`) - `opt` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** options for callEndpoint (optional, default `{}`) - `opt.noFlatten` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** do not flatten results - `opt.returnRaw` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** return only the raw data (may or may not be flattened) - `opt.saveRaw` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** filename to save raw data to (may or may not be flattened) - `opt.saveParsed` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** filename to save final parsed data to (not compatible with returnRaw, since parsing won't happen) Returns **any** Results of the call to MWS ## MWS_MARKETPLACES A list of Marketplace IDs hashed by their country code. ## MWS_ENDPOINTS A list of hosts you can use with the mws-advanced "host" option, hashed by MWS Region Name. ## InvalidUsage **Extends Error** Thrown when completely Invalid Parameters are given and we have no way of making sense of them ## ServiceError **Extends extError** Thrown when an Error response comes from the Service (not a mws-simple.ServerError though) ## RequestCancelled **Extends extError** Thrown when a request is cancelled by MWS -- we have no way of knowing automatically if we should retry or not ## ValidationError **Extends extError** Thrown when parameters fail validation locally, before being sent to MWS ## recursionCount flattenResult does some recursion. We need to act differently on the initial iteration. ## rootWasArray determine if flattenResult was called with an Array as the root ## validateInteger **Parameters** - `type` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** type of integer to validate (xs:int, xs:positiveInteger, etc) - `test` **any** value to test - `minmax` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** minimum and maximum values to test for (optional, default `{}`) - `minmax.minValue` **integer** minimum value to test for - `minmax.maxValue` **integer** maximum value to test for ## feeds pull in all the separate endpoint modules and export them together ## REQUEST_REPORT_TYPES List of all valid request report types. This should probably be a hash map from sane values into values that Amazon understands, but we don't really have reporting done very well yet. ## REPORT_PROCESSING_STATUS_TYPES status indicators for report processing status updates ## getMarketplaces Call MWS ListMarketplaceParticipations, return parsed results **Examples** ```javascript const marketplaces = (async () => await mws.getMarketplaces())(); (async function() { const result = await mws.getMarketplaces(); console.log(result); })(); ``` Returns **MarketDetail** ## getMarketplaces **Parameters** - `marketplaceId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** id of marketplace. should be same as hash index. - `defaultCountryCode` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** country code for marketplace (US, CA, etc) - `domainName` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** domain name used by customers to access this market (amazon.com, .ca, .mx) - `defaultCurrencyCode` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** currency code (USD, CAD, etc) - `defaultLanguageCode` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Language setting (en_US, en_CA, etc) - `sellerId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** your seller ID in this marketplace - `hasSellerSuspendedListings` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if there are seller suspended listings in this account on this market ## forceArray **Parameters** - `arr` ## listOrderItems Returns order items based on the AmazonOrderId that you specify. If you've pulled a list of orders using @see [ListOrders](ListOrders), or have order identifiers stored in some other fashion, then to find out what items are actually on the orders, you will need to call ListOrderItems to obtain details about the items that were ordered. The ListOrders call does not give you any information about the items, except how many of them have shipped or not shipped. If an Order is in the Pending state, ListOrderItems will not return any pricing or promotion information. Once an order has left the Pending state, the following items will be returned: ItemTax, GiftWrapPrice, ItemPrice, PromotionDiscount, GiftWrapTax, ShippingTax, ShippingPrice, ShippingDiscount **Parameters** - `AmazonOrderId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 3-7-7 Amazon Order ID formatted string Returns **OrderItemList** ## listOrderItems **Parameters** - `AmazonOrderId` - `orderId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Amazon Order ID - `nextToken` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Token to provide to ListOrderItemsByNextToken if needed (no token = no need) - `orderItems` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** Array of all the items in the order ## listOrders Return orders created or updated during a specific time frame see <https://docs.developer.amazonservices.com/en_UK/orders-2013-09-01/Orders_ListOrders.html> At least ONE of the search options (and maybe more depending on which ones you select) must be specified. Error messages may or may not return information on what parameters you are missing. If you are having trouble, see the official parameter documentation above. **Parameters** - `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** - `options.MarketplaceId` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** Array of Marketplace IDs to search @see [MWS_MARKETPLACES](#mws_marketplaces) - `options.CreatedAfter` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)?** Select orders created at or after the given Date - `options.CreatedBefore` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)?** Select orders created at or before the given Date - `options.LastUpdatedAfter` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)?** Select orders updated at or after the given Date - `options.LastUpdatedBefore` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)?** Select orders updated at or before the given Date - `options.OrderStatus` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** OrderStatus, see MWS doc page - `options.FulfillmentChannel` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** AFN for Amazon fulfillment, MFN for merchant - `options.PaymentMethod` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** All, COD, CVS, Other - `options.BuyerEmail` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Search for orders with given Email address - `options.SellerOrderId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Specified seller order ID - `options.MaxResultsPerPage` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Max number of results to return, 1 &lt;=> 100 (optional, default `100`) - `options.TFMShipmentStatus` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** See MWS doc page Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** ## listFinancialEvents <https://docs.developer.amazonservices.com/en_UK/finances/Finances_ListFinancialEvents.html> **Parameters** - `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** - `options.MaxResultsPerPage` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Maximum number of results to return (1 &lt;=> 100) - `options.AmazonOrderId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** An order number to search for - `options.FinancialEventGroupId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of Financial Event to search for - `options.PostedAfter` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)** When to search for events after - `options.PostedBefore` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)** When to search for events prior to Returns **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** ## listInventorySupply Return information about the availability of a seller's FBA inventory **Parameters** - `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** - `options.SellerSkus` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** A list of SKUs for items to get inventory info for - `options.QueryStartDateTime` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)** Date to begin searching at - `options.ResponseGroup` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 'Basic' = Do not include SupplyDetail, 'Detailed' = Do - `options.MarketplaceId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Marketplace ID to search Returns **{nextToken: [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), supplyList: [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>}** ## removeFromString remove a string pattern from a string **Parameters** - `str` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** string to remove pattern from - `pattern` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) | regex)** pattern to remove Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** string with the pattern removed ## transformAttributeSetKey Special key transformer for transformObjectKeys to strip "ns2:" from the beginning of keys, such as 'ns2:ItemAttributes' **Parameters** - `k` **any** ## getMatchingProductForId Returns a list of products and their attributes, based on a list of ASIN, GCID, SellerSKU, UPC, EAN, ISBN, or JAN values **Parameters** - `options` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** see <https://docs.developer.amazonservices.com/en_UK/products/Products_GetMatchingProductForId.html> - `options.MarketplaceId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Identifier for marketplace (see getMarketplaces) - `options.IdType` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of lookup to perform: ASIN, GCID, SellerSKU, UPC, EAN, ISBN, JAN - `options.IdList` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>** List of codes to perform lookup on Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;Product>** ## reformatOfferCount **Parameters** - `offerCount` - `count` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** - `condition` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** - `fulfillmentChannel` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ## reformatOffer **Parameters** - `offer` - `subCondition` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The subcondition of the item (New, Mint, Very Good, Good, Acceptable, Poor, Club, OEM, Warranty, Refurbished Warranty, Refurbished, Open Box, or Other) - `sellerFeedbackRating` **SellerFeedbackRating** Information about the seller's feedback - `shippingTime` **DetailedShippingTime** Maximum time within which the item will likely be shipped - `listingPrice` **Money** The price of the item - `points` **Points?** The number of Amazon Points offered with the purchase of an item - `shipping` **Money** Cost of shipping - `shipsFrom` **ShipsFrom?** State and Country where item is shipped from - `isFulfilledByAmazon` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** True if FBA, False if not - `isBuyBoxWinner` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** True if offer has buy box, False if not - `isFeaturedMerchant` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** True if seller is eligible for Buy Box, False if not ## reformatOffer **Parameters** - `offer` - `unknown` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ## reformatOffer **Parameters** - `offer` - `unknown` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ## reformatOffer **Parameters** - `offer` - `unknown` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ## reformatOffer **Parameters** - `offer` - `unknown` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ## reformatLowestPrice **Parameters** - `lp` - `condition` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** - `fulfillmentChannel` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** - `landedPrice` **Money** - `listingPrice` **Money** - `shipping` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ## reformatBuyBoxPrice **Parameters** - `bb` - `condition` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** - `landedPrice` **Money** - `listingPrice` **Money** - `shipping` **Money** ## reformatSummary **Parameters** - `summary` - `totalOfferCount` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** - `numberOfOffers` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** - `listPrice` **Money** - `lowestPrices` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;LowestPrice>** - `buyBoxPrices` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** ## getLowestPricedOffersForASIN getLowestPricedOffersForASIN Calls GetLowestPricedOffersForASIN, reformats results, and returns the data **Parameters** - `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** see <https://docs.developer.amazonservices.com/en_UK/products/Products_GetLowestPricedOffersForASIN.html> - `options.MarketplaceId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Marketplace ID to search - `options.ASIN` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ASIN to search for - `options.ItemCondition` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Listing Condition: New, Used, Collectible, Refurbished, Club Returns **LowestPricedOffers** ## getLowestPricedOffersForASIN **Parameters** - `options` - `asin` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** asin returned by request - `marketplace` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** marketplace asin is in - `itemCondition` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** condition of item requested - `summary` **OfferSummary** \- - `offers` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;Offers>** list of offers ## writeFile Promisified version of fs.writeFile We like to use Promises. writeFile does not come in a Promise variant, currently. Use util/promisify to make it work with Promises. This is better than using writeFileSync. Trust me. :-) **Parameters** - `fileName` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** path/filename to write to - `contents` **([string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) \| [Buffer](https://nodejs.org/api/buffer.html))** what to write to file ## requestReport **Parameters** - `options` - `ReportType` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of Report Requested @see [REQUEST_REPORT_TYPES](#request_report_types) - `ReportProcessingStatus` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Status of Report @see [REPORT_PROCESSING_STATUS_TYPES](#report_processing_status_types) - `EndDate` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ISO Date for Date Ending period - `Scheduled` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** True if report is scheduled, false if immediate - `ReportRequestId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Identifier to use with getReport to fetch the report when ready - `SubmittedDate` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ISO Date for Date request was submitted - `StartDate` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ISO Date for Date report begins at ## requestReport Request a report from MWS Many optional parameters may be required by MWS! Read [ReportType](https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html) for specifics! **Parameters** - `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** - `options.ReportType` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of Report to Request @see [REQUEST_REPORT_TYPES](#request_report_types) - `options.StartDate` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)?** Date to start report - `options.EndDate` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)?** Date to end report at - `options.ReportOptions` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Reports may have additional options available. Please see the [ReportType](https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html) official docs - `MarketplaceId` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>?** Array of marketplace IDs to generate reports covering Returns **ReportRequestInfo** ## getReportRequestList **Parameters** - `options` (optional, default `{}`) - `ReportType` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of Report Requested @see [REQUEST_REPORT_TYPES](#request_report_types) - `ReportProcessingStatus` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Status of Report @see [REPORT_PROCESSING_STATUS_TYPES](#report_processing_status_types) - `EndDate` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ISO Date for Report End Period - `Scheduled` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** True if report is scheduled, false if immediate - `ReportRequestId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Identifier for the Report Request - `StartedProcessingDate` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ISO Date for time MWS started processing request - `StartDate` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ISO Date for Report Start Period - `CompletedDate` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ISO Date for time MWS completed processing request - `GeneratedReportId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Identifier to use with getReport to retrieve the report ## getReportRequestList Returns a list of report requests that you can use to get the ReportRequestId for a report After calling requestReport, you should call this function occasionally to see if/when the report has been processed. **Parameters** - `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options to pass to GetReportRequestList (optional, default `{}`) - `ReportRequestIdList` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>?** List of report request IDs @see [requestReport](#requestreport) - `ReportTypeList` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>?** List of Report Types @see [REQUEST_REPORT_TYPES](#request_report_types) - `ReportProcessingStatusList` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>?** List of Report Processing Status @see [REPORT_PROCESSING_STATUS_TYPES](#report_processing_status_types) - `MaxCount` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Maximum number of report requests to return, max is 100 (optional, default `10`) - `RequestedFromDate` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)** Oldest date to search for (optional, default `90-days-past`) - `RequestedToDate` **[Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)** Newest date to search for (optional, default `Now`) Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;GetReportRequestListResult>** ## getReport Returns the contents of a report **Parameters** - `options` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options to pass to GetReport - `options.ReportId` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Report number from @see [GetReportList](GetReportList) or GeneratedReportId from @see [GetReportRequestListResult](GetReportRequestListResult) Returns **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** Contents of the report to return (format may vary WIDELY between different reports generated, see [ReportType](https://docs.developer.amazonservices.com/en_US/reports/Reports_ReportType.html)) ## getReportList TODO: write documentation for getReportList **Parameters** - `options` (optional, default `{}`) ## getReportListByNextToken TODO: write documentation for getReportListByNextToken (or just roll getReportList and getReportListByNextToken into the same wrapper) (that wrapper might be getReportListAll, and just rename it) **Parameters** - `options` ## getReportListAll TODO: write documentation for getReportListAll (or see comment on getReportListByNextToken) **Parameters** - `options` (optional, default `{}`) ## requestAndDownloadReport TODO: Document requestAndDownloadReport **Parameters** - `ReportType` - `file` - `reportParams` (optional, default `{}`)