UNPKG

mws-zodane-advanced

Version:

fixed throtal resend

589 lines (571 loc) 25.1 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <base data-ice="baseUrl" href="../../../"> <title data-ice="title">lib/endpoints/products.js | mws-advanced</title> <link type="text/css" rel="stylesheet" href="css/style.css"> <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css"> <script src="script/prettify/prettify.js"></script> <script src="script/manual.js"></script> </head> <body class="layout-container" data-ice="rootContainer"> <header> <a href="./">Home</a> <a href="identifiers.html">Reference</a> <a href="source.html">Source</a> <div class="search-box"> <span> <img src="./image/search.png"> <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span> </span> <ul class="search-result"></ul> </div> </header> <nav class="navigation" data-ice="nav"><div> <ul> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/errors.js~InvalidUsage.html">InvalidUsage</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/errors.js~RequestCancelled.html">RequestCancelled</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/errors.js~ServiceError.html">ServiceError</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/errors.js~ValidationError.html">ValidationError</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-callEndpoint">callEndpoint</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-init">init</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getLowestPricedOffersForASIN">getLowestPricedOffersForASIN</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getMarketplaces">getMarketplaces</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getMatchingProductForId">getMatchingProductForId</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-listFinancialEvents">listFinancialEvents</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-listInventorySupply">listInventorySupply</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-listOrderItems">listOrderItems</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-listOrders">listOrders</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getReport">getReport</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getReportList">getReportList</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getReportListAll">getReportListAll</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getReportListByNextToken">getReportListByNextToken</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getReportRequestList">getReportRequestList</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-requestAndDownloadReport">requestAndDownloadReport</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-requestReport">requestReport</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-MWS_ENDPOINTS">MWS_ENDPOINTS</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-MWS_MARKETPLACES">MWS_MARKETPLACES</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-BuyBoxPrice">BuyBoxPrice</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-DetailedShippingTime">DetailedShippingTime</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-LowestPrice">LowestPrice</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-LowestPricedOffers">LowestPricedOffers</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-Money">Money</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-Offer">Offer</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-OfferCount">OfferCount</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-OfferSummary">OfferSummary</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-SellerFeedbackRating">SellerFeedbackRating</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-ShipsFrom">ShipsFrom</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-MarketDetail">MarketDetail</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-OrderItemList">OrderItemList</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-GetReportRequestListResult">GetReportRequestListResult</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-GetReportRequestListResult">GetReportRequestListResult</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-ReportRequestInfo">ReportRequestInfo</a></span></span></li> <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#endpoints">endpoints</a><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-REPORT_PROCESSING_STATUS_TYPES">REPORT_PROCESSING_STATUS_TYPES</a></span></span></li> <li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-REQUEST_REPORT_TYPES">REQUEST_REPORT_TYPES</a></span></span></li> </ul> </div> </nav> <div class="content" data-ice="content"><h1 data-ice="title">lib/endpoints/products.js</h1> <pre class="source-code line-number raw-source-code"><code class="prettyprint linenums" data-ice="content">const generateEndpoints = require(&apos;./endpoints-utils&apos;); const categoryName = &apos;Products&apos;; const apiVersion = &apos;2011-10-01&apos;; const endpointList = [ &apos;ListMatchingProducts&apos;, &apos;GetMatchingProduct&apos;, &apos;GetMatchingProductForId&apos;, &apos;GetCompetitivePricingForSKU&apos;, &apos;GetCompetitivePricingForASIN&apos;, &apos;GetLowestOfferListingsForSKU&apos;, &apos;GetLowestOfferListingsForASIN&apos;, &apos;GetLowestPricedOffersForSKU&apos;, &apos;GetLowestPricedOffersForASIN&apos;, &apos;GetMyFeesEstimate&apos;, &apos;GetMyPriceForSKU&apos;, &apos;GetMyPriceForASIN&apos;, &apos;GetProductCategoriesForSKU&apos;, &apos;GetProductCategoriesForASIN&apos;, &apos;GetServiceStatus&apos;, ]; const newEndpointList = { GetMatchingProduct: { throttle: { maxInFlight: 1, restoreRate: 1, }, params: { // this will cause an error to throw if you attempt to use this function. // The official documentation says to use GetMatchingProductForId instead, so we&apos;ll // just enforce that. DEPRECATED_USE_GetMatchingProductForId_INSTEAD: { type: &apos;xs:string&apos;, required: true, }, }, }, GetMatchingProductForId: { throttle: { maxInFlight: 20, restoreRate: 300, }, params: { MarketplaceId: { type: &apos;xs:string&apos;, // TODO: doc says &quot;MarketplaceType&quot; -- should we validate as that? https://docs.developer.amazonservices.com/en_UK/products/Products_Datatypes.html#MarketplaceType required: true, }, IdType: { type: &apos;xs:string&apos;, required: true, values: [&apos;ASIN&apos;, &apos;GCID&apos;, &apos;SellerSKU&apos;, &apos;UPC&apos;, &apos;EAN&apos;, &apos;ISBN&apos;, &apos;JAN&apos;], }, IdList: { type: &apos;xs:string&apos;, required: true, list: &apos;IdList.Id&apos;, }, }, returns: { Product: { type: &apos;&apos;, // TODO: ? required: false, }, Identifiers: { type: &apos;&apos;, // TODO: ? required: false, }, Relationships: { type: &apos;&apos;, // TODO: ? required: false, }, SalesRankings: { type: &apos;&apos;, // TODO: ? required: false, }, }, }, GetLowestOfferListingsForASIN: { throttle: { maxInFlight: 20, restoreRate: 600, }, params: { MarketplaceId: { type: &apos;xs:string&apos;, // TODO: marketplaceId verification required: true, }, ASINList: { type: &apos;xs:string&apos;, required: true, list: &apos;ASINList.ASIN&apos;, }, }, returns: { AllOfferListingsConsidered: { type: &apos;&apos;, // TODO: ??? Documentation is really not clear required: false, }, Product: { type: &apos;Product&apos;, // TODO: contains product subelements Product.Identifiers and Product.LowestOfferListings required: true, }, Identifiers: { type: &apos;&apos;, // TODO: ??? Documnetation also not clear required: false, }, LowestOfferListings: { type: &apos;&apos;, // TODO: ?????? required: true, }, }, }, GetLowestOfferListingsForSKU: { throttle: { maxInFlight: 20, restoreRate: 600, }, params: { MarketplaceId: { type: &apos;xs:string&apos;, // TODO: marketplaceId verification required: true, }, SellerSKUList: { type: &apos;xs:string&apos;, required: true, list: &apos;SellerSKUList.SellerSKU&apos;, }, }, returns: { AllOfferListingsConsidered: { type: &apos;&apos;, // TODO: ??? Documentation is really not clear required: false, }, Product: { type: &apos;Product&apos;, // TODO: contains product subelements Product.Identifiers and Product.LowestOfferListings required: true, }, Identifiers: { type: &apos;&apos;, // TODO: ??? Documnetation also not clear required: false, }, LowestOfferListings: { type: &apos;&apos;, // TODO: ?????? required: true, }, }, }, GetLowestPricedOffersForASIN: { throttle: { maxInFlight: 10, restoreRate: 300, }, params: { MarketplaceId: { type: &apos;xs:string&apos;, // TODO: doc says &apos;MarketplaceType&apos; required: true, }, ASIN: { type: &apos;xs:string&apos;, required: true, }, ItemCondition: { type: &apos;xs:string&apos;, required: true, values: [&apos;New&apos;, &apos;Used&apos;, &apos;Collectible&apos;, &apos;Refurbished&apos;, &apos;Club&apos;], }, }, returns: { Identifier: { type: &apos;Identifier&apos;, required: true, }, Summary: { type: &apos;Summary&apos;, required: true, }, Offers: { type: &apos;Offers&apos;, required: false, }, }, }, GetLowestPricedOffersForSKU: { throttle: { maxInFlight: 10, restoreRate: 300, }, params: { MarketplaceId: { type: &apos;xs:string&apos;, // TODO: doc says &apos;MarketplaceType&apos; required: true, }, SellerSKU: { type: &apos;xs:string&apos;, required: true, }, ItemCondition: { type: &apos;xs:string&apos;, required: true, values: [&apos;New&apos;, &apos;Used&apos;, &apos;Collectible&apos;, &apos;Refurbished&apos;, &apos;Club&apos;], }, }, returns: { Identifier: { type: &apos;Identifier&apos;, required: true, }, Summary: { type: &apos;Summary&apos;, required: true, }, Offers: { type: &apos;Offers&apos;, required: false, }, }, }, GetCompetitivePricingForASIN: { throttle: { maxInFlight: 20, restoreRate: 600, }, params: { MarketplaceId: { type: &apos;xs:string&apos;, required: true, }, ASINList: { type: &apos;xs:string&apos;, required: true, // TODO: maximum 20 values list: &apos;ASINList.ASIN&apos;, }, }, returns: { Product: { type: &apos;Product&apos;, required: true, }, Identifiers: { type: &apos;Identifier&apos;, required: true, }, CompetitivePricing: { type: &apos;CompetitivePrice&apos;, required: true, }, SalesRankings: { type: &apos;SalesRanking&apos;, required: true, }, }, }, GetCompetitivePricingForSKU: { throttle: { maxInFlight: 20, restoreRate: 600, }, params: { MarketplaceId: { type: &apos;xs:string&apos;, required: true, }, SellerSKUList: { type: &apos;xs:string&apos;, required: true, // TODO: maximum 20 values list: &apos;SellerSKUList.SellerSKU&apos;, }, }, returns: { Product: { type: &apos;Product&apos;, required: true, }, Identifiers: { type: &apos;Identifier&apos;, required: true, }, CompetitivePricing: { type: &apos;CompetitivePrice&apos;, required: true, }, SalesRankings: { type: &apos;SalesRanking&apos;, required: true, }, }, }, GetMyPriceForASIN: { throttle: { maxInFlight: 20, restoreRate: 600, }, params: { MarketplaceId: { type: &apos;xs:string&apos;, required: true, }, ASINList: { type: &apos;xs:string&apos;, required: true, list: &apos;ASINList.ASIN&apos;, }, ItemCondition: { type: &apos;xs:string&apos;, values: [&apos;New&apos;, &apos;Used&apos;, &apos;Collectible&apos;, &apos;Refurbished&apos;, &apos;Club&apos;], }, }, returns: { Identifiers: { type: &apos;Identifier&apos;, required: true, }, BuyingPrice: { type: &apos;BuyingPrice&apos;, required: true, }, RegularPrice: { type: &apos;RegularPrice&apos;, required: true, }, FulfillmentChannel: { type: &apos;FulfillmentChannel&apos;, required: true, }, ItemCondition: { type: &apos;ItemCondition&apos;, required: true, }, ItemSubCondition: { type: &apos;ItemSubCondition&apos;, required: true, }, SellerId: { type: &apos;SellerId&apos;, required: true, }, SellerSKU: { type: &apos;SellerSKU&apos;, required: true, }, }, }, GetMyPriceForSKU: { throttle: { maxInFlight: 20, restoreRate: 600, }, params: { MarketplaceId: { type: &apos;xs:string&apos;, required: true, }, SellerSKUList: { type: &apos;xs:string&apos;, required: true, list: &apos;SellerSKUList.SellerSKU&apos;, }, ItemCondition: { type: &apos;xs:string&apos;, values: [&apos;New&apos;, &apos;Used&apos;, &apos;Collectible&apos;, &apos;Refurbished&apos;, &apos;Club&apos;], }, }, returns: { Identifiers: { type: &apos;Identifier&apos;, required: true, }, BuyingPrice: { type: &apos;BuyingPrice&apos;, required: true, }, RegularPrice: { type: &apos;RegularPrice&apos;, required: true, }, FulfillmentChannel: { type: &apos;FulfillmentChannel&apos;, required: true, }, ItemCondition: { type: &apos;ItemCondition&apos;, required: true, }, ItemSubCondition: { type: &apos;ItemSubCondition&apos;, required: true, }, SellerId: { type: &apos;SellerId&apos;, required: true, }, SellerSKU: { type: &apos;SellerSKU&apos;, required: true, }, }, }, GetProductCategoriesForASIN: { throttle: { maxInFlight: 20, restoreRate: 12, }, params: { MarketplaceId: { type: &apos;xs:string&apos;, // TODO: validate marketplaceId required: true, }, ASIN: { type: &apos;xs:string&apos;, required: true, }, }, returns: { // TODO: fill this in }, }, GetProductCategoriesForSKU: { throttle: { maxInFlight: 20, restoreRate: 12, }, params: { MarketplaceId: { type: &apos;xs:string&apos;, // TODO: validate marketplaceId required: true, }, SellerSKU: { type: &apos;xs:string&apos;, required: true, }, }, returns: { // TODO: fill this in }, }, GetServiceStatus: { throttle: { maxInFlight: 2, restoreRate: 0.20, }, }, // GetMyFeesEstimate: { // throttle: { // maxInFlight: 20, // restoreRate: 600, // }, // params: { // FeesEstimateRequestList: { // // https://docs.developer.amazonservices.com/en_UK/products/Products_Datatypes.html#FeesEstimateRequest // // TODO: we don&apos;t support custom objects. // // This looks like // // FeesEstimateRequestList.FeesEstimateRequest.1= // // { // // IdType: &apos;ASIN&apos;, // type: &apos;MarketplaceType&apos;, values: [&apos;ASIN&apos;, &apos;SellerSKU&apos;], // // IdValue: &apos;B002KT3XQM&apos;, // type: &apos;xs:string&apos; // // IsAmazonFulled: true, // type: &apos;xs:boolean&apos;, // // Identifier: &apos;request1&apos;, // type: &apos;xs:string&apos; // // PriceToEstimateFees: { // // ListingPrice: { // // CurrencyCode: &apos;USD&apos;, // // Amount: &apos;30.00&apos;, // // }, // // Shipping: { // // CurrencyCode: &apos;USD&apos;, // // Amount: &apos;3.99&apos;, // // }, // // Points: { // // PointsNumber: 0, // // }, // // }, // // } // type: &apos;FeesEstimateRequest&apos;, // required: true, // }, // }, // returns: { // }, // } }; /** * @private */ const endpoints = generateEndpoints( categoryName, apiVersion, endpointList, newEndpointList, ); module.exports = endpoints; </code></pre> </div> <footer class="footer"> Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.0.4)</span><img src="./image/esdoc-logo-mini-black.png"></a> </footer> <script src="script/search_index.js"></script> <script src="script/search.js"></script> <script src="script/pretty-print.js"></script> <script src="script/inherited-summary.js"></script> <script src="script/test-summary.js"></script> <script src="script/inner-link.js"></script> <script src="script/patch-for-local.js"></script> </body> </html>