@marktmentor/api 0.0.0-stage → 0.1.0

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.
Files changed (523) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -2
  3. package/dist/BaseClient.d.ts +54 -0
  4. package/dist/BaseClient.js +43 -0
  5. package/dist/Client.d.ts +41 -0
  6. package/dist/Client.js +60 -0
  7. package/dist/api/errors/BadRequestError.d.ts +5 -0
  8. package/dist/api/errors/BadRequestError.js +17 -0
  9. package/dist/api/errors/ConflictError.d.ts +5 -0
  10. package/dist/api/errors/ConflictError.js +17 -0
  11. package/dist/api/errors/ForbiddenError.d.ts +5 -0
  12. package/dist/api/errors/ForbiddenError.js +17 -0
  13. package/dist/api/errors/NotFoundError.d.ts +7 -0
  14. package/dist/api/errors/NotFoundError.js +17 -0
  15. package/dist/api/errors/PaymentRequiredError.d.ts +7 -0
  16. package/dist/api/errors/PaymentRequiredError.js +17 -0
  17. package/dist/api/errors/ServiceUnavailableError.d.ts +5 -0
  18. package/dist/api/errors/ServiceUnavailableError.js +17 -0
  19. package/dist/api/errors/TooManyRequestsError.d.ts +5 -0
  20. package/dist/api/errors/TooManyRequestsError.js +17 -0
  21. package/dist/api/errors/UnauthorizedError.d.ts +5 -0
  22. package/dist/api/errors/UnauthorizedError.js +17 -0
  23. package/dist/api/errors/index.d.ts +8 -0
  24. package/dist/api/errors/index.js +8 -0
  25. package/dist/api/index.d.ts +3 -0
  26. package/dist/api/index.js +3 -0
  27. package/dist/api/resources/index.d.ts +13 -0
  28. package/dist/api/resources/index.js +13 -0
  29. package/dist/api/resources/niches/client/Client.d.ts +188 -0
  30. package/dist/api/resources/niches/client/Client.js +655 -0
  31. package/dist/api/resources/niches/client/index.d.ts +1 -0
  32. package/dist/api/resources/niches/client/index.js +1 -0
  33. package/dist/api/resources/niches/client/requests/GetNichesRequest.d.ts +17 -0
  34. package/dist/api/resources/niches/client/requests/GetNichesRequest.js +2 -0
  35. package/dist/api/resources/niches/client/requests/ListNichesRequest.d.ts +34 -0
  36. package/dist/api/resources/niches/client/requests/ListNichesRequest.js +2 -0
  37. package/dist/api/resources/niches/client/requests/ProductDistributionsNichesRequest.d.ts +13 -0
  38. package/dist/api/resources/niches/client/requests/ProductDistributionsNichesRequest.js +2 -0
  39. package/dist/api/resources/niches/client/requests/ProductsNichesRequest.d.ts +48 -0
  40. package/dist/api/resources/niches/client/requests/ProductsNichesRequest.js +2 -0
  41. package/dist/api/resources/niches/client/requests/ReviewHistoryNichesRequest.d.ts +23 -0
  42. package/dist/api/resources/niches/client/requests/ReviewHistoryNichesRequest.js +2 -0
  43. package/dist/api/resources/niches/client/requests/ReviewSummaryNichesRequest.d.ts +5 -0
  44. package/dist/api/resources/niches/client/requests/ReviewSummaryNichesRequest.js +2 -0
  45. package/dist/api/resources/niches/client/requests/ReviewsNichesRequest.d.ts +33 -0
  46. package/dist/api/resources/niches/client/requests/ReviewsNichesRequest.js +2 -0
  47. package/dist/api/resources/niches/client/requests/index.d.ts +7 -0
  48. package/dist/api/resources/niches/client/requests/index.js +1 -0
  49. package/dist/api/resources/niches/exports.d.ts +2 -0
  50. package/dist/api/resources/niches/exports.js +3 -0
  51. package/dist/api/resources/niches/index.d.ts +2 -0
  52. package/dist/api/resources/niches/index.js +2 -0
  53. package/dist/api/resources/niches/types/GetNichesRequestMarket.d.ts +6 -0
  54. package/dist/api/resources/niches/types/GetNichesRequestMarket.js +6 -0
  55. package/dist/api/resources/niches/types/GetNichesRequestPeriod.d.ts +6 -0
  56. package/dist/api/resources/niches/types/GetNichesRequestPeriod.js +6 -0
  57. package/dist/api/resources/niches/types/ListNichesRequestMarket.d.ts +6 -0
  58. package/dist/api/resources/niches/types/ListNichesRequestMarket.js +6 -0
  59. package/dist/api/resources/niches/types/ListNichesRequestPeriod.d.ts +6 -0
  60. package/dist/api/resources/niches/types/ListNichesRequestPeriod.js +6 -0
  61. package/dist/api/resources/niches/types/ListNichesRequestSort.d.ts +9 -0
  62. package/dist/api/resources/niches/types/ListNichesRequestSort.js +9 -0
  63. package/dist/api/resources/niches/types/ProductDistributionsNichesRequestPeriod.d.ts +6 -0
  64. package/dist/api/resources/niches/types/ProductDistributionsNichesRequestPeriod.js +6 -0
  65. package/dist/api/resources/niches/types/ProductsNichesRequestMarket.d.ts +6 -0
  66. package/dist/api/resources/niches/types/ProductsNichesRequestMarket.js +6 -0
  67. package/dist/api/resources/niches/types/ProductsNichesRequestPeriod.d.ts +6 -0
  68. package/dist/api/resources/niches/types/ProductsNichesRequestPeriod.js +6 -0
  69. package/dist/api/resources/niches/types/ProductsNichesRequestSort.d.ts +9 -0
  70. package/dist/api/resources/niches/types/ProductsNichesRequestSort.js +9 -0
  71. package/dist/api/resources/niches/types/ReviewHistoryNichesRequestInterval.d.ts +5 -0
  72. package/dist/api/resources/niches/types/ReviewHistoryNichesRequestInterval.js +5 -0
  73. package/dist/api/resources/niches/types/ReviewHistoryNichesRequestMarket.d.ts +4 -0
  74. package/dist/api/resources/niches/types/ReviewHistoryNichesRequestMarket.js +4 -0
  75. package/dist/api/resources/niches/types/ReviewHistoryNichesRequestPeriod.d.ts +7 -0
  76. package/dist/api/resources/niches/types/ReviewHistoryNichesRequestPeriod.js +7 -0
  77. package/dist/api/resources/niches/types/ReviewsNichesRequestMarket.d.ts +4 -0
  78. package/dist/api/resources/niches/types/ReviewsNichesRequestMarket.js +4 -0
  79. package/dist/api/resources/niches/types/ReviewsNichesRequestPeriod.d.ts +7 -0
  80. package/dist/api/resources/niches/types/ReviewsNichesRequestPeriod.js +7 -0
  81. package/dist/api/resources/niches/types/ReviewsNichesRequestSort.d.ts +7 -0
  82. package/dist/api/resources/niches/types/ReviewsNichesRequestSort.js +7 -0
  83. package/dist/api/resources/niches/types/index.d.ts +15 -0
  84. package/dist/api/resources/niches/types/index.js +15 -0
  85. package/dist/api/resources/organization/client/Client.d.ts +32 -0
  86. package/dist/api/resources/organization/client/Client.js +73 -0
  87. package/dist/api/resources/organization/client/index.d.ts +1 -0
  88. package/dist/api/resources/organization/client/index.js +1 -0
  89. package/dist/api/resources/organization/exports.d.ts +2 -0
  90. package/dist/api/resources/organization/exports.js +3 -0
  91. package/dist/api/resources/organization/index.d.ts +1 -0
  92. package/dist/api/resources/organization/index.js +1 -0
  93. package/dist/api/resources/products/client/Client.d.ts +269 -0
  94. package/dist/api/resources/products/client/Client.js +927 -0
  95. package/dist/api/resources/products/client/index.d.ts +1 -0
  96. package/dist/api/resources/products/client/index.js +1 -0
  97. package/dist/api/resources/products/client/requests/CategoryRankingsProductsRequest.d.ts +23 -0
  98. package/dist/api/resources/products/client/requests/CategoryRankingsProductsRequest.js +2 -0
  99. package/dist/api/resources/products/client/requests/GetProductsRequest.d.ts +15 -0
  100. package/dist/api/resources/products/client/requests/GetProductsRequest.js +2 -0
  101. package/dist/api/resources/products/client/requests/KeywordRankingsProductsRequest.d.ts +27 -0
  102. package/dist/api/resources/products/client/requests/KeywordRankingsProductsRequest.js +2 -0
  103. package/dist/api/resources/products/client/requests/KeywordsProductsRequest.d.ts +19 -0
  104. package/dist/api/resources/products/client/requests/KeywordsProductsRequest.js +2 -0
  105. package/dist/api/resources/products/client/requests/ListProductsRequest.d.ts +50 -0
  106. package/dist/api/resources/products/client/requests/ListProductsRequest.js +2 -0
  107. package/dist/api/resources/products/client/requests/ReviewSummaryProductsRequest.d.ts +8 -0
  108. package/dist/api/resources/products/client/requests/ReviewSummaryProductsRequest.js +2 -0
  109. package/dist/api/resources/products/client/requests/ReviewsProductsRequest.d.ts +35 -0
  110. package/dist/api/resources/products/client/requests/ReviewsProductsRequest.js +2 -0
  111. package/dist/api/resources/products/client/requests/SalesHistoryProductsRequest.d.ts +23 -0
  112. package/dist/api/resources/products/client/requests/SalesHistoryProductsRequest.js +2 -0
  113. package/dist/api/resources/products/client/requests/SellersProductsRequest.d.ts +16 -0
  114. package/dist/api/resources/products/client/requests/SellersProductsRequest.js +2 -0
  115. package/dist/api/resources/products/client/requests/VisibilityHistoryProductsRequest.d.ts +23 -0
  116. package/dist/api/resources/products/client/requests/VisibilityHistoryProductsRequest.js +2 -0
  117. package/dist/api/resources/products/client/requests/index.d.ts +10 -0
  118. package/dist/api/resources/products/client/requests/index.js +1 -0
  119. package/dist/api/resources/products/exports.d.ts +2 -0
  120. package/dist/api/resources/products/exports.js +3 -0
  121. package/dist/api/resources/products/index.d.ts +2 -0
  122. package/dist/api/resources/products/index.js +2 -0
  123. package/dist/api/resources/products/types/CategoryRankingsProductsRequestInterval.d.ts +5 -0
  124. package/dist/api/resources/products/types/CategoryRankingsProductsRequestInterval.js +5 -0
  125. package/dist/api/resources/products/types/CategoryRankingsProductsRequestMarket.d.ts +6 -0
  126. package/dist/api/resources/products/types/CategoryRankingsProductsRequestMarket.js +6 -0
  127. package/dist/api/resources/products/types/CategoryRankingsProductsRequestPeriod.d.ts +7 -0
  128. package/dist/api/resources/products/types/CategoryRankingsProductsRequestPeriod.js +7 -0
  129. package/dist/api/resources/products/types/GetProductsRequestMarket.d.ts +6 -0
  130. package/dist/api/resources/products/types/GetProductsRequestMarket.js +6 -0
  131. package/dist/api/resources/products/types/GetProductsRequestPeriod.d.ts +6 -0
  132. package/dist/api/resources/products/types/GetProductsRequestPeriod.js +6 -0
  133. package/dist/api/resources/products/types/KeywordRankingsProductsRequestInterval.d.ts +5 -0
  134. package/dist/api/resources/products/types/KeywordRankingsProductsRequestInterval.js +5 -0
  135. package/dist/api/resources/products/types/KeywordRankingsProductsRequestMarket.d.ts +6 -0
  136. package/dist/api/resources/products/types/KeywordRankingsProductsRequestMarket.js +6 -0
  137. package/dist/api/resources/products/types/KeywordRankingsProductsRequestPeriod.d.ts +7 -0
  138. package/dist/api/resources/products/types/KeywordRankingsProductsRequestPeriod.js +7 -0
  139. package/dist/api/resources/products/types/KeywordsProductsRequestMarket.d.ts +6 -0
  140. package/dist/api/resources/products/types/KeywordsProductsRequestMarket.js +6 -0
  141. package/dist/api/resources/products/types/KeywordsProductsRequestPeriod.d.ts +6 -0
  142. package/dist/api/resources/products/types/KeywordsProductsRequestPeriod.js +6 -0
  143. package/dist/api/resources/products/types/ListProductsRequestMarket.d.ts +6 -0
  144. package/dist/api/resources/products/types/ListProductsRequestMarket.js +6 -0
  145. package/dist/api/resources/products/types/ListProductsRequestPeriod.d.ts +6 -0
  146. package/dist/api/resources/products/types/ListProductsRequestPeriod.js +6 -0
  147. package/dist/api/resources/products/types/ListProductsRequestSort.d.ts +9 -0
  148. package/dist/api/resources/products/types/ListProductsRequestSort.js +9 -0
  149. package/dist/api/resources/products/types/ReviewsProductsRequestMarket.d.ts +4 -0
  150. package/dist/api/resources/products/types/ReviewsProductsRequestMarket.js +4 -0
  151. package/dist/api/resources/products/types/ReviewsProductsRequestPeriod.d.ts +7 -0
  152. package/dist/api/resources/products/types/ReviewsProductsRequestPeriod.js +7 -0
  153. package/dist/api/resources/products/types/ReviewsProductsRequestSort.d.ts +7 -0
  154. package/dist/api/resources/products/types/ReviewsProductsRequestSort.js +7 -0
  155. package/dist/api/resources/products/types/SalesHistoryProductsRequestInterval.d.ts +5 -0
  156. package/dist/api/resources/products/types/SalesHistoryProductsRequestInterval.js +5 -0
  157. package/dist/api/resources/products/types/SalesHistoryProductsRequestMarket.d.ts +6 -0
  158. package/dist/api/resources/products/types/SalesHistoryProductsRequestMarket.js +6 -0
  159. package/dist/api/resources/products/types/SalesHistoryProductsRequestPeriod.d.ts +7 -0
  160. package/dist/api/resources/products/types/SalesHistoryProductsRequestPeriod.js +7 -0
  161. package/dist/api/resources/products/types/SellersProductsRequestMarket.d.ts +6 -0
  162. package/dist/api/resources/products/types/SellersProductsRequestMarket.js +6 -0
  163. package/dist/api/resources/products/types/SellersProductsRequestPeriod.d.ts +7 -0
  164. package/dist/api/resources/products/types/SellersProductsRequestPeriod.js +7 -0
  165. package/dist/api/resources/products/types/VisibilityHistoryProductsRequestInterval.d.ts +5 -0
  166. package/dist/api/resources/products/types/VisibilityHistoryProductsRequestInterval.js +5 -0
  167. package/dist/api/resources/products/types/VisibilityHistoryProductsRequestMarket.d.ts +6 -0
  168. package/dist/api/resources/products/types/VisibilityHistoryProductsRequestMarket.js +6 -0
  169. package/dist/api/resources/products/types/VisibilityHistoryProductsRequestPeriod.d.ts +7 -0
  170. package/dist/api/resources/products/types/VisibilityHistoryProductsRequestPeriod.js +7 -0
  171. package/dist/api/resources/products/types/index.d.ts +24 -0
  172. package/dist/api/resources/products/types/index.js +24 -0
  173. package/dist/api/resources/reference/client/Client.d.ts +84 -0
  174. package/dist/api/resources/reference/client/Client.js +254 -0
  175. package/dist/api/resources/reference/client/index.d.ts +1 -0
  176. package/dist/api/resources/reference/client/index.js +1 -0
  177. package/dist/api/resources/reference/client/requests/BrandsReferenceRequest.d.ts +12 -0
  178. package/dist/api/resources/reference/client/requests/BrandsReferenceRequest.js +2 -0
  179. package/dist/api/resources/reference/client/requests/CategoriesReferenceRequest.d.ts +18 -0
  180. package/dist/api/resources/reference/client/requests/CategoriesReferenceRequest.js +2 -0
  181. package/dist/api/resources/reference/client/requests/CategoryReferenceRequest.d.ts +5 -0
  182. package/dist/api/resources/reference/client/requests/CategoryReferenceRequest.js +2 -0
  183. package/dist/api/resources/reference/client/requests/index.d.ts +3 -0
  184. package/dist/api/resources/reference/client/requests/index.js +1 -0
  185. package/dist/api/resources/reference/exports.d.ts +2 -0
  186. package/dist/api/resources/reference/exports.js +3 -0
  187. package/dist/api/resources/reference/index.d.ts +1 -0
  188. package/dist/api/resources/reference/index.js +1 -0
  189. package/dist/api/resources/store/client/Client.d.ts +82 -0
  190. package/dist/api/resources/store/client/Client.js +291 -0
  191. package/dist/api/resources/store/client/index.d.ts +1 -0
  192. package/dist/api/resources/store/client/index.js +1 -0
  193. package/dist/api/resources/store/client/requests/InventoryStoreRequest.d.ts +23 -0
  194. package/dist/api/resources/store/client/requests/InventoryStoreRequest.js +2 -0
  195. package/dist/api/resources/store/client/requests/OverviewStoreRequest.d.ts +13 -0
  196. package/dist/api/resources/store/client/requests/OverviewStoreRequest.js +2 -0
  197. package/dist/api/resources/store/client/requests/ProductsStoreRequest.d.ts +49 -0
  198. package/dist/api/resources/store/client/requests/ProductsStoreRequest.js +2 -0
  199. package/dist/api/resources/store/client/requests/index.d.ts +3 -0
  200. package/dist/api/resources/store/client/requests/index.js +1 -0
  201. package/dist/api/resources/store/exports.d.ts +2 -0
  202. package/dist/api/resources/store/exports.js +3 -0
  203. package/dist/api/resources/store/index.d.ts +2 -0
  204. package/dist/api/resources/store/index.js +2 -0
  205. package/dist/api/resources/store/types/InventoryStoreRequestStockState.d.ts +6 -0
  206. package/dist/api/resources/store/types/InventoryStoreRequestStockState.js +6 -0
  207. package/dist/api/resources/store/types/OverviewStoreRequestCountry.d.ts +6 -0
  208. package/dist/api/resources/store/types/OverviewStoreRequestCountry.js +6 -0
  209. package/dist/api/resources/store/types/ProductsStoreRequestCountry.d.ts +5 -0
  210. package/dist/api/resources/store/types/ProductsStoreRequestCountry.js +5 -0
  211. package/dist/api/resources/store/types/ProductsStoreRequestSort.d.ts +11 -0
  212. package/dist/api/resources/store/types/ProductsStoreRequestSort.js +11 -0
  213. package/dist/api/resources/store/types/index.d.ts +4 -0
  214. package/dist/api/resources/store/types/index.js +4 -0
  215. package/dist/api/resources/usage/client/Client.d.ts +32 -0
  216. package/dist/api/resources/usage/client/Client.js +73 -0
  217. package/dist/api/resources/usage/client/index.d.ts +1 -0
  218. package/dist/api/resources/usage/client/index.js +1 -0
  219. package/dist/api/resources/usage/exports.d.ts +2 -0
  220. package/dist/api/resources/usage/exports.js +3 -0
  221. package/dist/api/resources/usage/index.d.ts +1 -0
  222. package/dist/api/resources/usage/index.js +1 -0
  223. package/dist/api/types/AllowanceError.d.ts +26 -0
  224. package/dist/api/types/AllowanceError.js +16 -0
  225. package/dist/api/types/Brand.d.ts +4 -0
  226. package/dist/api/types/Brand.js +2 -0
  227. package/dist/api/types/BrandListResponse.d.ts +6 -0
  228. package/dist/api/types/BrandListResponse.js +2 -0
  229. package/dist/api/types/BundleUsage.d.ts +15 -0
  230. package/dist/api/types/BundleUsage.js +2 -0
  231. package/dist/api/types/Category.d.ts +14 -0
  232. package/dist/api/types/Category.js +2 -0
  233. package/dist/api/types/CategoryItem.d.ts +4 -0
  234. package/dist/api/types/CategoryItem.js +2 -0
  235. package/dist/api/types/CategoryListResponse.d.ts +5 -0
  236. package/dist/api/types/CategoryListResponse.js +2 -0
  237. package/dist/api/types/CategoryPathItem.d.ts +4 -0
  238. package/dist/api/types/CategoryPathItem.js +2 -0
  239. package/dist/api/types/CategoryRanking.d.ts +5 -0
  240. package/dist/api/types/CategoryRanking.js +2 -0
  241. package/dist/api/types/CategoryRankingsResponse.d.ts +7 -0
  242. package/dist/api/types/CategoryRankingsResponse.js +2 -0
  243. package/dist/api/types/CategoryResponse.d.ts +4 -0
  244. package/dist/api/types/CategoryResponse.js +2 -0
  245. package/dist/api/types/CommissionBracket.d.ts +8 -0
  246. package/dist/api/types/CommissionBracket.js +2 -0
  247. package/dist/api/types/CurrentPeriod.d.ts +8 -0
  248. package/dist/api/types/CurrentPeriod.js +2 -0
  249. package/dist/api/types/Dimensions.d.ts +8 -0
  250. package/dist/api/types/Dimensions.js +2 -0
  251. package/dist/api/types/DistributionBucket.d.ts +5 -0
  252. package/dist/api/types/DistributionBucket.js +2 -0
  253. package/dist/api/types/DistributionData.d.ts +7 -0
  254. package/dist/api/types/DistributionData.js +2 -0
  255. package/dist/api/types/FreeTierUsage.d.ts +12 -0
  256. package/dist/api/types/FreeTierUsage.js +2 -0
  257. package/dist/api/types/KeywordItem.d.ts +6 -0
  258. package/dist/api/types/KeywordItem.js +2 -0
  259. package/dist/api/types/KeywordMarkets.d.ts +5 -0
  260. package/dist/api/types/KeywordMarkets.js +2 -0
  261. package/dist/api/types/KeywordMetrics.d.ts +4 -0
  262. package/dist/api/types/KeywordMetrics.js +2 -0
  263. package/dist/api/types/KeywordRanking.d.ts +7 -0
  264. package/dist/api/types/KeywordRanking.js +2 -0
  265. package/dist/api/types/KeywordRankingsResponse.d.ts +7 -0
  266. package/dist/api/types/KeywordRankingsResponse.js +2 -0
  267. package/dist/api/types/KeywordResponse.d.ts +7 -0
  268. package/dist/api/types/KeywordResponse.js +2 -0
  269. package/dist/api/types/ListingChanges.d.ts +5 -0
  270. package/dist/api/types/ListingChanges.js +2 -0
  271. package/dist/api/types/NicheDetail.d.ts +12 -0
  272. package/dist/api/types/NicheDetail.js +2 -0
  273. package/dist/api/types/NicheDetailResponse.d.ts +6 -0
  274. package/dist/api/types/NicheDetailResponse.js +2 -0
  275. package/dist/api/types/NicheDistributionsResponse.d.ts +5 -0
  276. package/dist/api/types/NicheDistributionsResponse.js +2 -0
  277. package/dist/api/types/NicheHistoryData.d.ts +4 -0
  278. package/dist/api/types/NicheHistoryData.js +2 -0
  279. package/dist/api/types/NicheHistoryResponse.d.ts +7 -0
  280. package/dist/api/types/NicheHistoryResponse.js +2 -0
  281. package/dist/api/types/NicheItem.d.ts +11 -0
  282. package/dist/api/types/NicheItem.js +2 -0
  283. package/dist/api/types/NicheListResponse.d.ts +7 -0
  284. package/dist/api/types/NicheListResponse.js +2 -0
  285. package/dist/api/types/NicheMarkets.d.ts +5 -0
  286. package/dist/api/types/NicheMarkets.js +2 -0
  287. package/dist/api/types/NicheMetrics.d.ts +5 -0
  288. package/dist/api/types/NicheMetrics.js +2 -0
  289. package/dist/api/types/NichePeriod.d.ts +5 -0
  290. package/dist/api/types/NichePeriod.js +2 -0
  291. package/dist/api/types/OauthScope.d.ts +9 -0
  292. package/dist/api/types/OauthScope.js +9 -0
  293. package/dist/api/types/Organization.d.ts +4 -0
  294. package/dist/api/types/Organization.js +2 -0
  295. package/dist/api/types/Pagination.d.ts +6 -0
  296. package/dist/api/types/Pagination.js +2 -0
  297. package/dist/api/types/Period.d.ts +5 -0
  298. package/dist/api/types/Period.js +2 -0
  299. package/dist/api/types/PeriodRatings.d.ts +7 -0
  300. package/dist/api/types/PeriodRatings.js +2 -0
  301. package/dist/api/types/PeriodReviews.d.ts +9 -0
  302. package/dist/api/types/PeriodReviews.js +2 -0
  303. package/dist/api/types/ProductDetail.d.ts +29 -0
  304. package/dist/api/types/ProductDetail.js +2 -0
  305. package/dist/api/types/ProductDetailResponse.d.ts +24 -0
  306. package/dist/api/types/ProductDetailResponse.js +14 -0
  307. package/dist/api/types/ProductDistributions.d.ts +6 -0
  308. package/dist/api/types/ProductDistributions.js +2 -0
  309. package/dist/api/types/ProductItem.d.ts +27 -0
  310. package/dist/api/types/ProductItem.js +2 -0
  311. package/dist/api/types/ProductListResponse.d.ts +25 -0
  312. package/dist/api/types/ProductListResponse.js +14 -0
  313. package/dist/api/types/ProductMarketMetrics.d.ts +11 -0
  314. package/dist/api/types/ProductMarketMetrics.js +2 -0
  315. package/dist/api/types/ProductMarkets.d.ts +5 -0
  316. package/dist/api/types/ProductMarkets.js +2 -0
  317. package/dist/api/types/PublicApiError.d.ts +4 -0
  318. package/dist/api/types/PublicApiError.js +2 -0
  319. package/dist/api/types/RankMarkets.d.ts +4 -0
  320. package/dist/api/types/RankMarkets.js +2 -0
  321. package/dist/api/types/RankPoint.d.ts +5 -0
  322. package/dist/api/types/RankPoint.js +2 -0
  323. package/dist/api/types/RatingCount.d.ts +5 -0
  324. package/dist/api/types/RatingCount.js +2 -0
  325. package/dist/api/types/ResearchError.d.ts +6 -0
  326. package/dist/api/types/ResearchError.js +2 -0
  327. package/dist/api/types/ReviewHistoryPoint.d.ts +6 -0
  328. package/dist/api/types/ReviewHistoryPoint.js +2 -0
  329. package/dist/api/types/ReviewItem.d.ts +12 -0
  330. package/dist/api/types/ReviewItem.js +2 -0
  331. package/dist/api/types/ReviewListResponse.d.ts +7 -0
  332. package/dist/api/types/ReviewListResponse.js +2 -0
  333. package/dist/api/types/ReviewSummary.d.ts +10 -0
  334. package/dist/api/types/ReviewSummary.js +2 -0
  335. package/dist/api/types/ReviewSummaryResponse.d.ts +5 -0
  336. package/dist/api/types/ReviewSummaryResponse.js +2 -0
  337. package/dist/api/types/ReviewTopic.d.ts +4 -0
  338. package/dist/api/types/ReviewTopic.js +2 -0
  339. package/dist/api/types/SalesHistoryMarkets.d.ts +5 -0
  340. package/dist/api/types/SalesHistoryMarkets.js +2 -0
  341. package/dist/api/types/SalesHistoryMetrics.d.ts +5 -0
  342. package/dist/api/types/SalesHistoryMetrics.js +2 -0
  343. package/dist/api/types/SalesHistoryPoint.d.ts +5 -0
  344. package/dist/api/types/SalesHistoryPoint.js +2 -0
  345. package/dist/api/types/SalesHistoryResponse.d.ts +7 -0
  346. package/dist/api/types/SalesHistoryResponse.js +2 -0
  347. package/dist/api/types/SellerItem.d.ts +8 -0
  348. package/dist/api/types/SellerItem.js +2 -0
  349. package/dist/api/types/SellerMarkets.d.ts +5 -0
  350. package/dist/api/types/SellerMarkets.js +2 -0
  351. package/dist/api/types/SellerMetrics.d.ts +7 -0
  352. package/dist/api/types/SellerMetrics.js +2 -0
  353. package/dist/api/types/SellerResponse.d.ts +9 -0
  354. package/dist/api/types/SellerResponse.js +2 -0
  355. package/dist/api/types/SellerSummaryMarkets.d.ts +5 -0
  356. package/dist/api/types/SellerSummaryMarkets.js +2 -0
  357. package/dist/api/types/SellerSummaryMetrics.d.ts +6 -0
  358. package/dist/api/types/SellerSummaryMetrics.js +2 -0
  359. package/dist/api/types/StoreChange.d.ts +9 -0
  360. package/dist/api/types/StoreChange.js +2 -0
  361. package/dist/api/types/StoreError.d.ts +5 -0
  362. package/dist/api/types/StoreError.js +2 -0
  363. package/dist/api/types/StoreFilters.d.ts +3 -0
  364. package/dist/api/types/StoreFilters.js +2 -0
  365. package/dist/api/types/StoreInventoryCounts.d.ts +7 -0
  366. package/dist/api/types/StoreInventoryCounts.js +2 -0
  367. package/dist/api/types/StoreInventoryFilters.d.ts +4 -0
  368. package/dist/api/types/StoreInventoryFilters.js +2 -0
  369. package/dist/api/types/StoreInventoryPagination.d.ts +7 -0
  370. package/dist/api/types/StoreInventoryPagination.js +2 -0
  371. package/dist/api/types/StoreInventoryResponse.d.ts +28 -0
  372. package/dist/api/types/StoreInventoryResponse.js +14 -0
  373. package/dist/api/types/StoreInventoryRow.d.ts +35 -0
  374. package/dist/api/types/StoreInventoryRow.js +18 -0
  375. package/dist/api/types/StoreKpi.d.ts +12 -0
  376. package/dist/api/types/StoreKpi.js +2 -0
  377. package/dist/api/types/StoreOverviewResponse.d.ts +13 -0
  378. package/dist/api/types/StoreOverviewResponse.js +2 -0
  379. package/dist/api/types/StorePerformanceProductPerformanceItem.d.ts +48 -0
  380. package/dist/api/types/StorePerformanceProductPerformanceItem.js +2 -0
  381. package/dist/api/types/StorePerformanceReturnCostsBreakdown.d.ts +10 -0
  382. package/dist/api/types/StorePerformanceReturnCostsBreakdown.js +2 -0
  383. package/dist/api/types/StorePerformanceSalesCostsBreakdown.d.ts +10 -0
  384. package/dist/api/types/StorePerformanceSalesCostsBreakdown.js +2 -0
  385. package/dist/api/types/StorePreviousKpi.d.ts +9 -0
  386. package/dist/api/types/StorePreviousKpi.js +2 -0
  387. package/dist/api/types/StoreProductsFilters.d.ts +5 -0
  388. package/dist/api/types/StoreProductsFilters.js +2 -0
  389. package/dist/api/types/StoreProductsPagination.d.ts +9 -0
  390. package/dist/api/types/StoreProductsPagination.js +2 -0
  391. package/dist/api/types/StoreProductsResponse.d.ts +11 -0
  392. package/dist/api/types/StoreProductsResponse.js +2 -0
  393. package/dist/api/types/UnauthorizedErrorBody.d.ts +3 -0
  394. package/dist/api/types/UnauthorizedErrorBody.js +2 -0
  395. package/dist/api/types/Usage.d.ts +51 -0
  396. package/dist/api/types/Usage.js +28 -0
  397. package/dist/api/types/UsageOrganization.d.ts +4 -0
  398. package/dist/api/types/UsageOrganization.js +2 -0
  399. package/dist/api/types/VisibilityHistoryResponse.d.ts +7 -0
  400. package/dist/api/types/VisibilityHistoryResponse.js +2 -0
  401. package/dist/api/types/VisibilityMarkets.d.ts +5 -0
  402. package/dist/api/types/VisibilityMarkets.js +2 -0
  403. package/dist/api/types/VisibilityMetrics.d.ts +4 -0
  404. package/dist/api/types/VisibilityMetrics.js +2 -0
  405. package/dist/api/types/VisibilityPoint.d.ts +5 -0
  406. package/dist/api/types/VisibilityPoint.js +2 -0
  407. package/dist/api/types/index.d.ts +92 -0
  408. package/dist/api/types/index.js +92 -0
  409. package/dist/auth/BearerAuthProvider.d.ts +20 -0
  410. package/dist/auth/BearerAuthProvider.js +32 -0
  411. package/dist/auth/index.d.ts +1 -0
  412. package/dist/auth/index.js +1 -0
  413. package/dist/core/auth/AuthProvider.d.ts +8 -0
  414. package/dist/core/auth/AuthProvider.js +6 -0
  415. package/dist/core/auth/AuthRequest.d.ts +9 -0
  416. package/dist/core/auth/AuthRequest.js +1 -0
  417. package/dist/core/auth/BasicAuth.d.ts +8 -0
  418. package/dist/core/auth/BasicAuth.js +29 -0
  419. package/dist/core/auth/BearerToken.d.ts +7 -0
  420. package/dist/core/auth/BearerToken.js +13 -0
  421. package/dist/core/auth/NoOpAuthProvider.d.ts +5 -0
  422. package/dist/core/auth/NoOpAuthProvider.js +5 -0
  423. package/dist/core/auth/index.d.ts +5 -0
  424. package/dist/core/auth/index.js +4 -0
  425. package/dist/core/base64.d.ts +2 -0
  426. package/dist/core/base64.js +22 -0
  427. package/dist/core/exports.d.ts +2 -0
  428. package/dist/core/exports.js +2 -0
  429. package/dist/core/fetcher/APIResponse.d.ts +20 -0
  430. package/dist/core/fetcher/APIResponse.js +1 -0
  431. package/dist/core/fetcher/BinaryResponse.d.ts +19 -0
  432. package/dist/core/fetcher/BinaryResponse.js +14 -0
  433. package/dist/core/fetcher/EndpointMetadata.d.ts +13 -0
  434. package/dist/core/fetcher/EndpointMetadata.js +1 -0
  435. package/dist/core/fetcher/EndpointSupplier.d.ts +12 -0
  436. package/dist/core/fetcher/EndpointSupplier.js +10 -0
  437. package/dist/core/fetcher/Fetcher.d.ts +56 -0
  438. package/dist/core/fetcher/Fetcher.js +254 -0
  439. package/dist/core/fetcher/Headers.d.ts +2 -0
  440. package/dist/core/fetcher/Headers.js +83 -0
  441. package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
  442. package/dist/core/fetcher/HttpResponsePromise.js +90 -0
  443. package/dist/core/fetcher/RawResponse.d.ts +29 -0
  444. package/dist/core/fetcher/RawResponse.js +40 -0
  445. package/dist/core/fetcher/Supplier.d.ts +4 -0
  446. package/dist/core/fetcher/Supplier.js +10 -0
  447. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  448. package/dist/core/fetcher/createRequestUrl.js +5 -0
  449. package/dist/core/fetcher/getErrorResponseBody.d.ts +1 -0
  450. package/dist/core/fetcher/getErrorResponseBody.js +43 -0
  451. package/dist/core/fetcher/getFetchFn.d.ts +1 -0
  452. package/dist/core/fetcher/getFetchFn.js +3 -0
  453. package/dist/core/fetcher/getHeader.d.ts +1 -0
  454. package/dist/core/fetcher/getHeader.js +8 -0
  455. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  456. package/dist/core/fetcher/getRequestBody.js +13 -0
  457. package/dist/core/fetcher/getResponseBody.d.ts +17 -0
  458. package/dist/core/fetcher/getResponseBody.js +70 -0
  459. package/dist/core/fetcher/index.d.ts +13 -0
  460. package/dist/core/fetcher/index.js +7 -0
  461. package/dist/core/fetcher/makePassthroughRequest.d.ts +49 -0
  462. package/dist/core/fetcher/makePassthroughRequest.js +157 -0
  463. package/dist/core/fetcher/makeRequest.d.ts +11 -0
  464. package/dist/core/fetcher/makeRequest.js +85 -0
  465. package/dist/core/fetcher/redactUrl.d.ts +2 -0
  466. package/dist/core/fetcher/redactUrl.js +84 -0
  467. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  468. package/dist/core/fetcher/requestWithRetries.js +77 -0
  469. package/dist/core/fetcher/signals.d.ts +6 -0
  470. package/dist/core/fetcher/signals.js +28 -0
  471. package/dist/core/headers.d.ts +2 -0
  472. package/dist/core/headers.js +27 -0
  473. package/dist/core/index.d.ts +8 -0
  474. package/dist/core/index.js +8 -0
  475. package/dist/core/json.d.ts +15 -0
  476. package/dist/core/json.js +19 -0
  477. package/dist/core/logging/exports.d.ts +18 -0
  478. package/dist/core/logging/exports.js +9 -0
  479. package/dist/core/logging/index.d.ts +1 -0
  480. package/dist/core/logging/index.js +1 -0
  481. package/dist/core/logging/logger.d.ts +126 -0
  482. package/dist/core/logging/logger.js +140 -0
  483. package/dist/core/pagination/Page.d.ts +33 -0
  484. package/dist/core/pagination/Page.js +55 -0
  485. package/dist/core/pagination/exports.d.ts +1 -0
  486. package/dist/core/pagination/exports.js +1 -0
  487. package/dist/core/pagination/index.d.ts +1 -0
  488. package/dist/core/pagination/index.js +1 -0
  489. package/dist/core/requestBody.d.ts +12 -0
  490. package/dist/core/requestBody.js +23 -0
  491. package/dist/core/runtime/index.d.ts +1 -0
  492. package/dist/core/runtime/index.js +1 -0
  493. package/dist/core/runtime/runtime.d.ts +28 -0
  494. package/dist/core/runtime/runtime.js +171 -0
  495. package/dist/core/url/QueryStringBuilder.d.ts +47 -0
  496. package/dist/core/url/QueryStringBuilder.js +78 -0
  497. package/dist/core/url/encodePathParam.d.ts +3 -0
  498. package/dist/core/url/encodePathParam.js +24 -0
  499. package/dist/core/url/index.d.ts +4 -0
  500. package/dist/core/url/index.js +4 -0
  501. package/dist/core/url/join.d.ts +1 -0
  502. package/dist/core/url/join.js +65 -0
  503. package/dist/core/url/qs.d.ts +7 -0
  504. package/dist/core/url/qs.js +76 -0
  505. package/dist/core/utils/index.d.ts +1 -0
  506. package/dist/core/utils/index.js +1 -0
  507. package/dist/core/utils/setObjectProperty.d.ts +12 -0
  508. package/dist/core/utils/setObjectProperty.js +45 -0
  509. package/dist/environments.d.ts +4 -0
  510. package/dist/environments.js +4 -0
  511. package/dist/errors/MarktMentorError.d.ts +15 -0
  512. package/dist/errors/MarktMentorError.js +52 -0
  513. package/dist/errors/MarktMentorTimeoutError.d.ts +6 -0
  514. package/dist/errors/MarktMentorTimeoutError.js +15 -0
  515. package/dist/errors/handleNonStatusCodeError.d.ts +2 -0
  516. package/dist/errors/handleNonStatusCodeError.js +32 -0
  517. package/dist/errors/index.d.ts +2 -0
  518. package/dist/errors/index.js +2 -0
  519. package/dist/exports.d.ts +1 -0
  520. package/dist/exports.js +1 -0
  521. package/dist/index.d.ts +6 -0
  522. package/dist/index.js +5 -0
  523. package/package.json +33 -4
@@ -0,0 +1,927 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import { mergeHeaders } from "../../../../core/headers.js";
4
+ import * as core from "../../../../core/index.js";
5
+ import * as environments from "../../../../environments.js";
6
+ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js";
7
+ import * as errors from "../../../../errors/index.js";
8
+ import * as MarktMentor from "../../../index.js";
9
+ /**
10
+ * The product object contains the current state: metrics per market, review counts, dimensions and commission. Get a product adds the variant codes. Sales history, visibility history, category rankings, keywords, sellers, reviews and the review summary are separate calls. Each call gives one kind of data from one source. The same data as the Product Database in the dashboard. Each successful request counts as one research request.
11
+ */
12
+ export class ProductsClient {
13
+ _options;
14
+ constructor(options) {
15
+ this._options = normalizeClientOptionsWithAuth(options);
16
+ }
17
+ /**
18
+ * Search bol products by text, EAN, brand or category, with filters on sales, revenue, price and rating. Each result has the product data and the metrics per market for the chosen period.
19
+ *
20
+ * A successful request counts as one research request.
21
+ *
22
+ * @param {MarktMentor.ListProductsRequest} request
23
+ * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
24
+ *
25
+ * @throws {@link MarktMentor.BadRequestError}
26
+ * @throws {@link MarktMentor.UnauthorizedError}
27
+ * @throws {@link MarktMentor.PaymentRequiredError}
28
+ * @throws {@link MarktMentor.ForbiddenError}
29
+ * @throws {@link MarktMentor.NotFoundError}
30
+ * @throws {@link MarktMentor.TooManyRequestsError}
31
+ * @throws {@link MarktMentor.ServiceUnavailableError}
32
+ * @throws {@link errors.MarktMentorError}
33
+ * @throws {@link errors.MarktMentorTimeoutError}
34
+ *
35
+ * @example
36
+ * await client.products.list({
37
+ * brand: "Kambukka",
38
+ * ean: "5407005143414",
39
+ * search: "drinkfles"
40
+ * })
41
+ */
42
+ async list(request = {}, requestOptions) {
43
+ const list = core.HttpResponsePromise.interceptFunction(async (request) => {
44
+ const { brand, categoryId, ean, market, maxPrice, maxRating, maxRevenue, maxSales, minPrice, minRating, minRevenue, minSales, page, pageSize, period, search, sort, variantsOf, } = request;
45
+ const _queryParams = {
46
+ brand,
47
+ categoryId,
48
+ ean,
49
+ market: market != null ? market : undefined,
50
+ maxPrice,
51
+ maxRating,
52
+ maxRevenue,
53
+ maxSales,
54
+ minPrice,
55
+ minRating,
56
+ minRevenue,
57
+ minSales,
58
+ page,
59
+ pageSize,
60
+ period: period != null ? period : undefined,
61
+ search,
62
+ sort: sort != null ? sort : undefined,
63
+ variantsOf,
64
+ };
65
+ const _authRequest = await this._options.authProvider.getAuthRequest();
66
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
67
+ const _response = await core.fetcher({
68
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
69
+ (await core.Supplier.get(this._options.environment)) ??
70
+ environments.MarktMentorEnvironment.Production, "api/public/v1/research/products/"),
71
+ method: "GET",
72
+ headers: _headers,
73
+ queryString: core.url
74
+ .queryBuilder()
75
+ .addMany(_queryParams)
76
+ .mergeAdditional(requestOptions?.queryParams)
77
+ .build(),
78
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
79
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
80
+ abortSignal: requestOptions?.abortSignal,
81
+ fetchFn: this._options?.fetch,
82
+ logging: this._options.logging,
83
+ });
84
+ if (_response.ok) {
85
+ return {
86
+ data: _response.body,
87
+ rawResponse: _response.rawResponse,
88
+ };
89
+ }
90
+ if (_response.error.reason === "status-code") {
91
+ switch (_response.error.statusCode) {
92
+ case 400:
93
+ throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
94
+ case 401:
95
+ throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
96
+ case 402:
97
+ throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
98
+ case 403:
99
+ throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
100
+ case 404:
101
+ throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
102
+ case 429:
103
+ throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
104
+ case 503:
105
+ throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
106
+ default:
107
+ throw new errors.MarktMentorError({
108
+ statusCode: _response.error.statusCode,
109
+ body: _response.error.body,
110
+ rawResponse: _response.rawResponse,
111
+ });
112
+ }
113
+ }
114
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/products/");
115
+ });
116
+ let _offset = request?.page != null ? request?.page : 1;
117
+ const dataWithRawResponse = await list(request).withRawResponse();
118
+ return new core.Page({
119
+ response: dataWithRawResponse.data,
120
+ rawResponse: dataWithRawResponse.rawResponse,
121
+ hasNextPage: (response) => response?.pagination.hasNext ?? (response?.data ?? []).length > 0,
122
+ getItems: (response) => response?.data ?? [],
123
+ loadPage: (_response) => {
124
+ const _nextOffset = _offset + 1;
125
+ return core.HttpResponsePromise.fromPromise(list(core.setObjectProperty(request, "page", _nextOffset))
126
+ .withRawResponse()
127
+ .then((_pageResponse) => {
128
+ _offset = _nextOffset;
129
+ return _pageResponse;
130
+ }));
131
+ },
132
+ });
133
+ }
134
+ /**
135
+ * Get one product by its bol product code, with the metrics per market for the chosen period, its dimensions, commission and the codes of its variants.
136
+ *
137
+ * A successful request counts as one research request.
138
+ *
139
+ * @param {string} productCode - Bol product identifier, returned as productCode. Or `ean:` with a 13-digit EAN, for example `ean:8712345678901`: the API then uses the product with that EAN. When more than one product has the EAN, the request gets HTTP 409 with the candidate product codes.
140
+ * @param {MarktMentor.GetProductsRequest} request
141
+ * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
142
+ *
143
+ * @throws {@link MarktMentor.BadRequestError}
144
+ * @throws {@link MarktMentor.UnauthorizedError}
145
+ * @throws {@link MarktMentor.PaymentRequiredError}
146
+ * @throws {@link MarktMentor.ForbiddenError}
147
+ * @throws {@link MarktMentor.NotFoundError}
148
+ * @throws {@link MarktMentor.ConflictError}
149
+ * @throws {@link MarktMentor.TooManyRequestsError}
150
+ * @throws {@link MarktMentor.ServiceUnavailableError}
151
+ * @throws {@link errors.MarktMentorError}
152
+ * @throws {@link errors.MarktMentorTimeoutError}
153
+ *
154
+ * @example
155
+ * await client.products.get("9300000138905032")
156
+ */
157
+ get(productCode, request = {}, requestOptions) {
158
+ return core.HttpResponsePromise.fromPromise(this.__get(productCode, request, requestOptions));
159
+ }
160
+ async __get(productCode, request = {}, requestOptions) {
161
+ const { market, period } = request;
162
+ const _queryParams = {
163
+ market: market != null ? market : undefined,
164
+ period: period != null ? period : undefined,
165
+ };
166
+ const _authRequest = await this._options.authProvider.getAuthRequest();
167
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
168
+ const _response = await core.fetcher({
169
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
170
+ (await core.Supplier.get(this._options.environment)) ??
171
+ environments.MarktMentorEnvironment.Production, `api/public/v1/research/products/${core.url.encodePathParam(productCode, errors.MarktMentorError)}/`),
172
+ method: "GET",
173
+ headers: _headers,
174
+ queryString: core.url
175
+ .queryBuilder()
176
+ .addMany(_queryParams)
177
+ .mergeAdditional(requestOptions?.queryParams)
178
+ .build(),
179
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
180
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
181
+ abortSignal: requestOptions?.abortSignal,
182
+ fetchFn: this._options?.fetch,
183
+ logging: this._options.logging,
184
+ });
185
+ if (_response.ok) {
186
+ return { data: _response.body, rawResponse: _response.rawResponse };
187
+ }
188
+ if (_response.error.reason === "status-code") {
189
+ switch (_response.error.statusCode) {
190
+ case 400:
191
+ throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
192
+ case 401:
193
+ throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
194
+ case 402:
195
+ throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
196
+ case 403:
197
+ throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
198
+ case 404:
199
+ throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
200
+ case 409:
201
+ throw new MarktMentor.ConflictError(_response.error.body, _response.rawResponse);
202
+ case 429:
203
+ throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
204
+ case 503:
205
+ throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
206
+ default:
207
+ throw new errors.MarktMentorError({
208
+ statusCode: _response.error.statusCode,
209
+ body: _response.error.body,
210
+ rawResponse: _response.rawResponse,
211
+ });
212
+ }
213
+ }
214
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/products/{productCode}/");
215
+ }
216
+ /**
217
+ * Get the sales figures of a product over time, per market, in calendar buckets of the chosen interval.
218
+ *
219
+ * A successful request counts as one research request.
220
+ *
221
+ * @param {string} productCode - Bol product identifier, returned as productCode. Or `ean:` with a 13-digit EAN, for example `ean:8712345678901`: the API then uses the product with that EAN. When more than one product has the EAN, the request gets HTTP 409 with the candidate product codes.
222
+ * @param {MarktMentor.SalesHistoryProductsRequest} request
223
+ * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
224
+ *
225
+ * @throws {@link MarktMentor.BadRequestError}
226
+ * @throws {@link MarktMentor.UnauthorizedError}
227
+ * @throws {@link MarktMentor.PaymentRequiredError}
228
+ * @throws {@link MarktMentor.ForbiddenError}
229
+ * @throws {@link MarktMentor.NotFoundError}
230
+ * @throws {@link MarktMentor.ConflictError}
231
+ * @throws {@link MarktMentor.TooManyRequestsError}
232
+ * @throws {@link MarktMentor.ServiceUnavailableError}
233
+ * @throws {@link errors.MarktMentorError}
234
+ * @throws {@link errors.MarktMentorTimeoutError}
235
+ *
236
+ * @example
237
+ * await client.products.salesHistory("9300000138905032")
238
+ */
239
+ salesHistory(productCode, request = {}, requestOptions) {
240
+ return core.HttpResponsePromise.fromPromise(this.__salesHistory(productCode, request, requestOptions));
241
+ }
242
+ async __salesHistory(productCode, request = {}, requestOptions) {
243
+ const { interval, market, period } = request;
244
+ const _queryParams = {
245
+ interval: interval != null ? interval : undefined,
246
+ market: market != null ? market : undefined,
247
+ period: period != null ? period : undefined,
248
+ };
249
+ const _authRequest = await this._options.authProvider.getAuthRequest();
250
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
251
+ const _response = await core.fetcher({
252
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
253
+ (await core.Supplier.get(this._options.environment)) ??
254
+ environments.MarktMentorEnvironment.Production, `api/public/v1/research/products/${core.url.encodePathParam(productCode, errors.MarktMentorError)}/sales-history/`),
255
+ method: "GET",
256
+ headers: _headers,
257
+ queryString: core.url
258
+ .queryBuilder()
259
+ .addMany(_queryParams)
260
+ .mergeAdditional(requestOptions?.queryParams)
261
+ .build(),
262
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
263
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
264
+ abortSignal: requestOptions?.abortSignal,
265
+ fetchFn: this._options?.fetch,
266
+ logging: this._options.logging,
267
+ });
268
+ if (_response.ok) {
269
+ return { data: _response.body, rawResponse: _response.rawResponse };
270
+ }
271
+ if (_response.error.reason === "status-code") {
272
+ switch (_response.error.statusCode) {
273
+ case 400:
274
+ throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
275
+ case 401:
276
+ throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
277
+ case 402:
278
+ throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
279
+ case 403:
280
+ throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
281
+ case 404:
282
+ throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
283
+ case 409:
284
+ throw new MarktMentor.ConflictError(_response.error.body, _response.rawResponse);
285
+ case 429:
286
+ throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
287
+ case 503:
288
+ throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
289
+ default:
290
+ throw new errors.MarktMentorError({
291
+ statusCode: _response.error.statusCode,
292
+ body: _response.error.body,
293
+ rawResponse: _response.rawResponse,
294
+ });
295
+ }
296
+ }
297
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/products/{productCode}/sales-history/");
298
+ }
299
+ /**
300
+ * Get the search visibility of a product over time, per market, in calendar buckets of the chosen interval.
301
+ *
302
+ * A successful request counts as one research request.
303
+ *
304
+ * @param {string} productCode - Bol product identifier, returned as productCode. Or `ean:` with a 13-digit EAN, for example `ean:8712345678901`: the API then uses the product with that EAN. When more than one product has the EAN, the request gets HTTP 409 with the candidate product codes.
305
+ * @param {MarktMentor.VisibilityHistoryProductsRequest} request
306
+ * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
307
+ *
308
+ * @throws {@link MarktMentor.BadRequestError}
309
+ * @throws {@link MarktMentor.UnauthorizedError}
310
+ * @throws {@link MarktMentor.PaymentRequiredError}
311
+ * @throws {@link MarktMentor.ForbiddenError}
312
+ * @throws {@link MarktMentor.NotFoundError}
313
+ * @throws {@link MarktMentor.ConflictError}
314
+ * @throws {@link MarktMentor.TooManyRequestsError}
315
+ * @throws {@link MarktMentor.ServiceUnavailableError}
316
+ * @throws {@link errors.MarktMentorError}
317
+ * @throws {@link errors.MarktMentorTimeoutError}
318
+ *
319
+ * @example
320
+ * await client.products.visibilityHistory("9300000138905032")
321
+ */
322
+ visibilityHistory(productCode, request = {}, requestOptions) {
323
+ return core.HttpResponsePromise.fromPromise(this.__visibilityHistory(productCode, request, requestOptions));
324
+ }
325
+ async __visibilityHistory(productCode, request = {}, requestOptions) {
326
+ const { interval, market, period } = request;
327
+ const _queryParams = {
328
+ interval: interval != null ? interval : undefined,
329
+ market: market != null ? market : undefined,
330
+ period: period != null ? period : undefined,
331
+ };
332
+ const _authRequest = await this._options.authProvider.getAuthRequest();
333
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
334
+ const _response = await core.fetcher({
335
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
336
+ (await core.Supplier.get(this._options.environment)) ??
337
+ environments.MarktMentorEnvironment.Production, `api/public/v1/research/products/${core.url.encodePathParam(productCode, errors.MarktMentorError)}/visibility-history/`),
338
+ method: "GET",
339
+ headers: _headers,
340
+ queryString: core.url
341
+ .queryBuilder()
342
+ .addMany(_queryParams)
343
+ .mergeAdditional(requestOptions?.queryParams)
344
+ .build(),
345
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
346
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
347
+ abortSignal: requestOptions?.abortSignal,
348
+ fetchFn: this._options?.fetch,
349
+ logging: this._options.logging,
350
+ });
351
+ if (_response.ok) {
352
+ return {
353
+ data: _response.body,
354
+ rawResponse: _response.rawResponse,
355
+ };
356
+ }
357
+ if (_response.error.reason === "status-code") {
358
+ switch (_response.error.statusCode) {
359
+ case 400:
360
+ throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
361
+ case 401:
362
+ throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
363
+ case 402:
364
+ throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
365
+ case 403:
366
+ throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
367
+ case 404:
368
+ throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
369
+ case 409:
370
+ throw new MarktMentor.ConflictError(_response.error.body, _response.rawResponse);
371
+ case 429:
372
+ throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
373
+ case 503:
374
+ throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
375
+ default:
376
+ throw new errors.MarktMentorError({
377
+ statusCode: _response.error.statusCode,
378
+ body: _response.error.body,
379
+ rawResponse: _response.rawResponse,
380
+ });
381
+ }
382
+ }
383
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/products/{productCode}/visibility-history/");
384
+ }
385
+ /**
386
+ * Get the positions of a product in its bol categories over time.
387
+ *
388
+ * A successful request counts as one research request.
389
+ *
390
+ * @param {string} productCode - Bol product identifier, returned as productCode. Or `ean:` with a 13-digit EAN, for example `ean:8712345678901`: the API then uses the product with that EAN. When more than one product has the EAN, the request gets HTTP 409 with the candidate product codes.
391
+ * @param {MarktMentor.CategoryRankingsProductsRequest} request
392
+ * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
393
+ *
394
+ * @throws {@link MarktMentor.BadRequestError}
395
+ * @throws {@link MarktMentor.UnauthorizedError}
396
+ * @throws {@link MarktMentor.PaymentRequiredError}
397
+ * @throws {@link MarktMentor.ForbiddenError}
398
+ * @throws {@link MarktMentor.NotFoundError}
399
+ * @throws {@link MarktMentor.ConflictError}
400
+ * @throws {@link MarktMentor.TooManyRequestsError}
401
+ * @throws {@link MarktMentor.ServiceUnavailableError}
402
+ * @throws {@link errors.MarktMentorError}
403
+ * @throws {@link errors.MarktMentorTimeoutError}
404
+ *
405
+ * @example
406
+ * await client.products.categoryRankings("9300000138905032")
407
+ */
408
+ categoryRankings(productCode, request = {}, requestOptions) {
409
+ return core.HttpResponsePromise.fromPromise(this.__categoryRankings(productCode, request, requestOptions));
410
+ }
411
+ async __categoryRankings(productCode, request = {}, requestOptions) {
412
+ const { interval, market, period } = request;
413
+ const _queryParams = {
414
+ interval: interval != null ? interval : undefined,
415
+ market: market != null ? market : undefined,
416
+ period: period != null ? period : undefined,
417
+ };
418
+ const _authRequest = await this._options.authProvider.getAuthRequest();
419
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
420
+ const _response = await core.fetcher({
421
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
422
+ (await core.Supplier.get(this._options.environment)) ??
423
+ environments.MarktMentorEnvironment.Production, `api/public/v1/research/products/${core.url.encodePathParam(productCode, errors.MarktMentorError)}/category-rankings/`),
424
+ method: "GET",
425
+ headers: _headers,
426
+ queryString: core.url
427
+ .queryBuilder()
428
+ .addMany(_queryParams)
429
+ .mergeAdditional(requestOptions?.queryParams)
430
+ .build(),
431
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
432
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
433
+ abortSignal: requestOptions?.abortSignal,
434
+ fetchFn: this._options?.fetch,
435
+ logging: this._options.logging,
436
+ });
437
+ if (_response.ok) {
438
+ return { data: _response.body, rawResponse: _response.rawResponse };
439
+ }
440
+ if (_response.error.reason === "status-code") {
441
+ switch (_response.error.statusCode) {
442
+ case 400:
443
+ throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
444
+ case 401:
445
+ throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
446
+ case 402:
447
+ throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
448
+ case 403:
449
+ throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
450
+ case 404:
451
+ throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
452
+ case 409:
453
+ throw new MarktMentor.ConflictError(_response.error.body, _response.rawResponse);
454
+ case 429:
455
+ throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
456
+ case 503:
457
+ throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
458
+ default:
459
+ throw new errors.MarktMentorError({
460
+ statusCode: _response.error.statusCode,
461
+ body: _response.error.body,
462
+ rawResponse: _response.rawResponse,
463
+ });
464
+ }
465
+ }
466
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/products/{productCode}/category-rankings/");
467
+ }
468
+ /**
469
+ * Get the positions of a product in the bol search results over time, per keyword and market. Name up to 25 keywords with keywordIds (the keywordId values of the keywords endpoint), or get the 10 keywords with the highest search volume.
470
+ *
471
+ * A successful request counts as one research request.
472
+ *
473
+ * @param {string} productCode - Bol product identifier, returned as productCode. Or `ean:` with a 13-digit EAN, for example `ean:8712345678901`: the API then uses the product with that EAN. When more than one product has the EAN, the request gets HTTP 409 with the candidate product codes.
474
+ * @param {MarktMentor.KeywordRankingsProductsRequest} request
475
+ * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
476
+ *
477
+ * @throws {@link MarktMentor.BadRequestError}
478
+ * @throws {@link MarktMentor.UnauthorizedError}
479
+ * @throws {@link MarktMentor.PaymentRequiredError}
480
+ * @throws {@link MarktMentor.ForbiddenError}
481
+ * @throws {@link MarktMentor.NotFoundError}
482
+ * @throws {@link MarktMentor.ConflictError}
483
+ * @throws {@link MarktMentor.TooManyRequestsError}
484
+ * @throws {@link MarktMentor.ServiceUnavailableError}
485
+ * @throws {@link errors.MarktMentorError}
486
+ * @throws {@link errors.MarktMentorTimeoutError}
487
+ *
488
+ * @example
489
+ * await client.products.keywordRankings("9300000138905032", {
490
+ * keywordIds: "6797,6800,5150"
491
+ * })
492
+ */
493
+ keywordRankings(productCode, request = {}, requestOptions) {
494
+ return core.HttpResponsePromise.fromPromise(this.__keywordRankings(productCode, request, requestOptions));
495
+ }
496
+ async __keywordRankings(productCode, request = {}, requestOptions) {
497
+ const { interval, keywordIds, market, period } = request;
498
+ const _queryParams = {
499
+ interval: interval != null ? interval : undefined,
500
+ keywordIds,
501
+ market: market != null ? market : undefined,
502
+ period: period != null ? period : undefined,
503
+ };
504
+ const _authRequest = await this._options.authProvider.getAuthRequest();
505
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
506
+ const _response = await core.fetcher({
507
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
508
+ (await core.Supplier.get(this._options.environment)) ??
509
+ environments.MarktMentorEnvironment.Production, `api/public/v1/research/products/${core.url.encodePathParam(productCode, errors.MarktMentorError)}/keyword-rankings/`),
510
+ method: "GET",
511
+ headers: _headers,
512
+ queryString: core.url
513
+ .queryBuilder()
514
+ .addMany(_queryParams)
515
+ .mergeAdditional(requestOptions?.queryParams)
516
+ .build(),
517
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
518
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
519
+ abortSignal: requestOptions?.abortSignal,
520
+ fetchFn: this._options?.fetch,
521
+ logging: this._options.logging,
522
+ });
523
+ if (_response.ok) {
524
+ return { data: _response.body, rawResponse: _response.rawResponse };
525
+ }
526
+ if (_response.error.reason === "status-code") {
527
+ switch (_response.error.statusCode) {
528
+ case 400:
529
+ throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
530
+ case 401:
531
+ throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
532
+ case 402:
533
+ throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
534
+ case 403:
535
+ throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
536
+ case 404:
537
+ throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
538
+ case 409:
539
+ throw new MarktMentor.ConflictError(_response.error.body, _response.rawResponse);
540
+ case 429:
541
+ throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
542
+ case 503:
543
+ throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
544
+ default:
545
+ throw new errors.MarktMentorError({
546
+ statusCode: _response.error.statusCode,
547
+ body: _response.error.body,
548
+ rawResponse: _response.rawResponse,
549
+ });
550
+ }
551
+ }
552
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/products/{productCode}/keyword-rankings/");
553
+ }
554
+ /**
555
+ * List the search terms a product ranked for in the period, with the figures per market.
556
+ *
557
+ * A successful request counts as one research request.
558
+ *
559
+ * @param {string} productCode - Bol product identifier, returned as productCode. Or `ean:` with a 13-digit EAN, for example `ean:8712345678901`: the API then uses the product with that EAN. When more than one product has the EAN, the request gets HTTP 409 with the candidate product codes.
560
+ * @param {MarktMentor.KeywordsProductsRequest} request
561
+ * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
562
+ *
563
+ * @throws {@link MarktMentor.BadRequestError}
564
+ * @throws {@link MarktMentor.UnauthorizedError}
565
+ * @throws {@link MarktMentor.PaymentRequiredError}
566
+ * @throws {@link MarktMentor.ForbiddenError}
567
+ * @throws {@link MarktMentor.NotFoundError}
568
+ * @throws {@link MarktMentor.ConflictError}
569
+ * @throws {@link MarktMentor.TooManyRequestsError}
570
+ * @throws {@link MarktMentor.ServiceUnavailableError}
571
+ * @throws {@link errors.MarktMentorError}
572
+ * @throws {@link errors.MarktMentorTimeoutError}
573
+ *
574
+ * @example
575
+ * await client.products.keywords("9300000138905032")
576
+ */
577
+ async keywords(productCode, request = {}, requestOptions) {
578
+ const list = core.HttpResponsePromise.interceptFunction(async (request) => {
579
+ const { market, page, pageSize, period } = request;
580
+ const _queryParams = {
581
+ market: market != null ? market : undefined,
582
+ page,
583
+ pageSize,
584
+ period: period != null ? period : undefined,
585
+ };
586
+ const _authRequest = await this._options.authProvider.getAuthRequest();
587
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
588
+ const _response = await core.fetcher({
589
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
590
+ (await core.Supplier.get(this._options.environment)) ??
591
+ environments.MarktMentorEnvironment.Production, `api/public/v1/research/products/${core.url.encodePathParam(productCode, errors.MarktMentorError)}/keywords/`),
592
+ method: "GET",
593
+ headers: _headers,
594
+ queryString: core.url
595
+ .queryBuilder()
596
+ .addMany(_queryParams)
597
+ .mergeAdditional(requestOptions?.queryParams)
598
+ .build(),
599
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
600
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
601
+ abortSignal: requestOptions?.abortSignal,
602
+ fetchFn: this._options?.fetch,
603
+ logging: this._options.logging,
604
+ });
605
+ if (_response.ok) {
606
+ return { data: _response.body, rawResponse: _response.rawResponse };
607
+ }
608
+ if (_response.error.reason === "status-code") {
609
+ switch (_response.error.statusCode) {
610
+ case 400:
611
+ throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
612
+ case 401:
613
+ throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
614
+ case 402:
615
+ throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
616
+ case 403:
617
+ throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
618
+ case 404:
619
+ throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
620
+ case 409:
621
+ throw new MarktMentor.ConflictError(_response.error.body, _response.rawResponse);
622
+ case 429:
623
+ throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
624
+ case 503:
625
+ throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
626
+ default:
627
+ throw new errors.MarktMentorError({
628
+ statusCode: _response.error.statusCode,
629
+ body: _response.error.body,
630
+ rawResponse: _response.rawResponse,
631
+ });
632
+ }
633
+ }
634
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/products/{productCode}/keywords/");
635
+ });
636
+ let _offset = request?.page != null ? request?.page : 1;
637
+ const dataWithRawResponse = await list(request).withRawResponse();
638
+ return new core.Page({
639
+ response: dataWithRawResponse.data,
640
+ rawResponse: dataWithRawResponse.rawResponse,
641
+ hasNextPage: (response) => response?.pagination.hasNext ?? (response?.data ?? []).length > 0,
642
+ getItems: (response) => response?.data ?? [],
643
+ loadPage: (_response) => {
644
+ const _nextOffset = _offset + 1;
645
+ return core.HttpResponsePromise.fromPromise(list(core.setObjectProperty(request, "page", _nextOffset))
646
+ .withRawResponse()
647
+ .then((_pageResponse) => {
648
+ _offset = _nextOffset;
649
+ return _pageResponse;
650
+ }));
651
+ },
652
+ });
653
+ }
654
+ /**
655
+ * List the sellers that offered a product in the period, with the figures per market, a buy box summary and the changes to the listing.
656
+ *
657
+ * A successful request counts as one research request.
658
+ *
659
+ * @param {string} productCode - Bol product identifier, returned as productCode. Or `ean:` with a 13-digit EAN, for example `ean:8712345678901`: the API then uses the product with that EAN. When more than one product has the EAN, the request gets HTTP 409 with the candidate product codes.
660
+ * @param {MarktMentor.SellersProductsRequest} request
661
+ * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
662
+ *
663
+ * @throws {@link MarktMentor.BadRequestError}
664
+ * @throws {@link MarktMentor.UnauthorizedError}
665
+ * @throws {@link MarktMentor.PaymentRequiredError}
666
+ * @throws {@link MarktMentor.ForbiddenError}
667
+ * @throws {@link MarktMentor.NotFoundError}
668
+ * @throws {@link MarktMentor.ConflictError}
669
+ * @throws {@link MarktMentor.TooManyRequestsError}
670
+ * @throws {@link MarktMentor.ServiceUnavailableError}
671
+ * @throws {@link errors.MarktMentorError}
672
+ * @throws {@link errors.MarktMentorTimeoutError}
673
+ *
674
+ * @example
675
+ * await client.products.sellers("9300000138905032")
676
+ */
677
+ sellers(productCode, request = {}, requestOptions) {
678
+ return core.HttpResponsePromise.fromPromise(this.__sellers(productCode, request, requestOptions));
679
+ }
680
+ async __sellers(productCode, request = {}, requestOptions) {
681
+ const { market, period } = request;
682
+ const _queryParams = {
683
+ market: market != null ? market : undefined,
684
+ period: period != null ? period : undefined,
685
+ };
686
+ const _authRequest = await this._options.authProvider.getAuthRequest();
687
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
688
+ const _response = await core.fetcher({
689
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
690
+ (await core.Supplier.get(this._options.environment)) ??
691
+ environments.MarktMentorEnvironment.Production, `api/public/v1/research/products/${core.url.encodePathParam(productCode, errors.MarktMentorError)}/sellers/`),
692
+ method: "GET",
693
+ headers: _headers,
694
+ queryString: core.url
695
+ .queryBuilder()
696
+ .addMany(_queryParams)
697
+ .mergeAdditional(requestOptions?.queryParams)
698
+ .build(),
699
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
700
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
701
+ abortSignal: requestOptions?.abortSignal,
702
+ fetchFn: this._options?.fetch,
703
+ logging: this._options.logging,
704
+ });
705
+ if (_response.ok) {
706
+ return { data: _response.body, rawResponse: _response.rawResponse };
707
+ }
708
+ if (_response.error.reason === "status-code") {
709
+ switch (_response.error.statusCode) {
710
+ case 400:
711
+ throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
712
+ case 401:
713
+ throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
714
+ case 402:
715
+ throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
716
+ case 403:
717
+ throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
718
+ case 404:
719
+ throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
720
+ case 409:
721
+ throw new MarktMentor.ConflictError(_response.error.body, _response.rawResponse);
722
+ case 429:
723
+ throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
724
+ case 503:
725
+ throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
726
+ default:
727
+ throw new errors.MarktMentorError({
728
+ statusCode: _response.error.statusCode,
729
+ body: _response.error.body,
730
+ rawResponse: _response.rawResponse,
731
+ });
732
+ }
733
+ }
734
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/products/{productCode}/sellers/");
735
+ }
736
+ /**
737
+ * List the reviews of a product, with rating, text and date. Filter on score, verified purchase and text. By default the list has the reviews of the whole product family, as bol shows them on the product page; includeVariants=false gives only the reviews written for this product.
738
+ *
739
+ * A successful request counts as one research request.
740
+ *
741
+ * @param {string} productCode - Bol product identifier, returned as productCode. Or `ean:` with a 13-digit EAN, for example `ean:8712345678901`: the API then uses the product with that EAN. When more than one product has the EAN, the request gets HTTP 409 with the candidate product codes.
742
+ * @param {MarktMentor.ReviewsProductsRequest} request
743
+ * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
744
+ *
745
+ * @throws {@link MarktMentor.BadRequestError}
746
+ * @throws {@link MarktMentor.UnauthorizedError}
747
+ * @throws {@link MarktMentor.PaymentRequiredError}
748
+ * @throws {@link MarktMentor.ForbiddenError}
749
+ * @throws {@link MarktMentor.NotFoundError}
750
+ * @throws {@link MarktMentor.ConflictError}
751
+ * @throws {@link MarktMentor.TooManyRequestsError}
752
+ * @throws {@link MarktMentor.ServiceUnavailableError}
753
+ * @throws {@link errors.MarktMentorError}
754
+ * @throws {@link errors.MarktMentorTimeoutError}
755
+ *
756
+ * @example
757
+ * await client.products.reviews("9300000138905032", {
758
+ * search: "drinkfles"
759
+ * })
760
+ */
761
+ async reviews(productCode, request = {}, requestOptions) {
762
+ const list = core.HttpResponsePromise.interceptFunction(async (request) => {
763
+ const { includeVariants, market, page, pageSize, period, score, search, sort, verified } = request;
764
+ const _queryParams = {
765
+ includeVariants,
766
+ market: market != null ? market : undefined,
767
+ page,
768
+ pageSize,
769
+ period: period != null ? period : undefined,
770
+ score,
771
+ search,
772
+ sort: sort != null ? sort : undefined,
773
+ verified,
774
+ };
775
+ const _authRequest = await this._options.authProvider.getAuthRequest();
776
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
777
+ const _response = await core.fetcher({
778
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
779
+ (await core.Supplier.get(this._options.environment)) ??
780
+ environments.MarktMentorEnvironment.Production, `api/public/v1/research/products/${core.url.encodePathParam(productCode, errors.MarktMentorError)}/reviews/`),
781
+ method: "GET",
782
+ headers: _headers,
783
+ queryString: core.url
784
+ .queryBuilder()
785
+ .addMany(_queryParams)
786
+ .mergeAdditional(requestOptions?.queryParams)
787
+ .build(),
788
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
789
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
790
+ abortSignal: requestOptions?.abortSignal,
791
+ fetchFn: this._options?.fetch,
792
+ logging: this._options.logging,
793
+ });
794
+ if (_response.ok) {
795
+ return {
796
+ data: _response.body,
797
+ rawResponse: _response.rawResponse,
798
+ };
799
+ }
800
+ if (_response.error.reason === "status-code") {
801
+ switch (_response.error.statusCode) {
802
+ case 400:
803
+ throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
804
+ case 401:
805
+ throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
806
+ case 402:
807
+ throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
808
+ case 403:
809
+ throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
810
+ case 404:
811
+ throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
812
+ case 409:
813
+ throw new MarktMentor.ConflictError(_response.error.body, _response.rawResponse);
814
+ case 429:
815
+ throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
816
+ case 503:
817
+ throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
818
+ default:
819
+ throw new errors.MarktMentorError({
820
+ statusCode: _response.error.statusCode,
821
+ body: _response.error.body,
822
+ rawResponse: _response.rawResponse,
823
+ });
824
+ }
825
+ }
826
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/products/{productCode}/reviews/");
827
+ });
828
+ let _offset = request?.page != null ? request?.page : 1;
829
+ const dataWithRawResponse = await list(request).withRawResponse();
830
+ return new core.Page({
831
+ response: dataWithRawResponse.data,
832
+ rawResponse: dataWithRawResponse.rawResponse,
833
+ hasNextPage: (response) => response?.pagination.hasNext ?? (response?.data ?? []).length > 0,
834
+ getItems: (response) => response?.data ?? [],
835
+ loadPage: (_response) => {
836
+ const _nextOffset = _offset + 1;
837
+ return core.HttpResponsePromise.fromPromise(list(core.setObjectProperty(request, "page", _nextOffset))
838
+ .withRawResponse()
839
+ .then((_pageResponse) => {
840
+ _offset = _nextOffset;
841
+ return _pageResponse;
842
+ }));
843
+ },
844
+ });
845
+ }
846
+ /**
847
+ * Get the review totals of a product: the number of reviews, the average rating, the count per star rating and the most named positive and negative topics. By default over the whole product family; includeVariants=false gives only the reviews written for this product.
848
+ *
849
+ * A successful request counts as one research request.
850
+ *
851
+ * @param {string} productCode - Bol product identifier, returned as productCode. Or `ean:` with a 13-digit EAN, for example `ean:8712345678901`: the API then uses the product with that EAN. When more than one product has the EAN, the request gets HTTP 409 with the candidate product codes.
852
+ * @param {MarktMentor.ReviewSummaryProductsRequest} request
853
+ * @param {ProductsClient.RequestOptions} requestOptions - Request-specific configuration.
854
+ *
855
+ * @throws {@link MarktMentor.BadRequestError}
856
+ * @throws {@link MarktMentor.UnauthorizedError}
857
+ * @throws {@link MarktMentor.PaymentRequiredError}
858
+ * @throws {@link MarktMentor.ForbiddenError}
859
+ * @throws {@link MarktMentor.NotFoundError}
860
+ * @throws {@link MarktMentor.ConflictError}
861
+ * @throws {@link MarktMentor.TooManyRequestsError}
862
+ * @throws {@link MarktMentor.ServiceUnavailableError}
863
+ * @throws {@link errors.MarktMentorError}
864
+ * @throws {@link errors.MarktMentorTimeoutError}
865
+ *
866
+ * @example
867
+ * await client.products.reviewSummary("9300000138905032")
868
+ */
869
+ reviewSummary(productCode, request = {}, requestOptions) {
870
+ return core.HttpResponsePromise.fromPromise(this.__reviewSummary(productCode, request, requestOptions));
871
+ }
872
+ async __reviewSummary(productCode, request = {}, requestOptions) {
873
+ const { includeVariants } = request;
874
+ const _queryParams = {
875
+ includeVariants,
876
+ };
877
+ const _authRequest = await this._options.authProvider.getAuthRequest();
878
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
879
+ const _response = await core.fetcher({
880
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
881
+ (await core.Supplier.get(this._options.environment)) ??
882
+ environments.MarktMentorEnvironment.Production, `api/public/v1/research/products/${core.url.encodePathParam(productCode, errors.MarktMentorError)}/reviews/summary/`),
883
+ method: "GET",
884
+ headers: _headers,
885
+ queryString: core.url
886
+ .queryBuilder()
887
+ .addMany(_queryParams)
888
+ .mergeAdditional(requestOptions?.queryParams)
889
+ .build(),
890
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
891
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
892
+ abortSignal: requestOptions?.abortSignal,
893
+ fetchFn: this._options?.fetch,
894
+ logging: this._options.logging,
895
+ });
896
+ if (_response.ok) {
897
+ return { data: _response.body, rawResponse: _response.rawResponse };
898
+ }
899
+ if (_response.error.reason === "status-code") {
900
+ switch (_response.error.statusCode) {
901
+ case 400:
902
+ throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
903
+ case 401:
904
+ throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
905
+ case 402:
906
+ throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
907
+ case 403:
908
+ throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
909
+ case 404:
910
+ throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
911
+ case 409:
912
+ throw new MarktMentor.ConflictError(_response.error.body, _response.rawResponse);
913
+ case 429:
914
+ throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
915
+ case 503:
916
+ throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
917
+ default:
918
+ throw new errors.MarktMentorError({
919
+ statusCode: _response.error.statusCode,
920
+ body: _response.error.body,
921
+ rawResponse: _response.rawResponse,
922
+ });
923
+ }
924
+ }
925
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/products/{productCode}/reviews/summary/");
926
+ }
927
+ }