@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.
- package/LICENSE +21 -0
- package/README.md +29 -2
- package/dist/BaseClient.d.ts +54 -0
- package/dist/BaseClient.js +43 -0
- package/dist/Client.d.ts +41 -0
- package/dist/Client.js +60 -0
- package/dist/api/errors/BadRequestError.d.ts +5 -0
- package/dist/api/errors/BadRequestError.js +17 -0
- package/dist/api/errors/ConflictError.d.ts +5 -0
- package/dist/api/errors/ConflictError.js +17 -0
- package/dist/api/errors/ForbiddenError.d.ts +5 -0
- package/dist/api/errors/ForbiddenError.js +17 -0
- package/dist/api/errors/NotFoundError.d.ts +7 -0
- package/dist/api/errors/NotFoundError.js +17 -0
- package/dist/api/errors/PaymentRequiredError.d.ts +7 -0
- package/dist/api/errors/PaymentRequiredError.js +17 -0
- package/dist/api/errors/ServiceUnavailableError.d.ts +5 -0
- package/dist/api/errors/ServiceUnavailableError.js +17 -0
- package/dist/api/errors/TooManyRequestsError.d.ts +5 -0
- package/dist/api/errors/TooManyRequestsError.js +17 -0
- package/dist/api/errors/UnauthorizedError.d.ts +5 -0
- package/dist/api/errors/UnauthorizedError.js +17 -0
- package/dist/api/errors/index.d.ts +8 -0
- package/dist/api/errors/index.js +8 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +3 -0
- package/dist/api/resources/index.d.ts +13 -0
- package/dist/api/resources/index.js +13 -0
- package/dist/api/resources/niches/client/Client.d.ts +188 -0
- package/dist/api/resources/niches/client/Client.js +655 -0
- package/dist/api/resources/niches/client/index.d.ts +1 -0
- package/dist/api/resources/niches/client/index.js +1 -0
- package/dist/api/resources/niches/client/requests/GetNichesRequest.d.ts +17 -0
- package/dist/api/resources/niches/client/requests/GetNichesRequest.js +2 -0
- package/dist/api/resources/niches/client/requests/ListNichesRequest.d.ts +34 -0
- package/dist/api/resources/niches/client/requests/ListNichesRequest.js +2 -0
- package/dist/api/resources/niches/client/requests/ProductDistributionsNichesRequest.d.ts +13 -0
- package/dist/api/resources/niches/client/requests/ProductDistributionsNichesRequest.js +2 -0
- package/dist/api/resources/niches/client/requests/ProductsNichesRequest.d.ts +48 -0
- package/dist/api/resources/niches/client/requests/ProductsNichesRequest.js +2 -0
- package/dist/api/resources/niches/client/requests/ReviewHistoryNichesRequest.d.ts +23 -0
- package/dist/api/resources/niches/client/requests/ReviewHistoryNichesRequest.js +2 -0
- package/dist/api/resources/niches/client/requests/ReviewSummaryNichesRequest.d.ts +5 -0
- package/dist/api/resources/niches/client/requests/ReviewSummaryNichesRequest.js +2 -0
- package/dist/api/resources/niches/client/requests/ReviewsNichesRequest.d.ts +33 -0
- package/dist/api/resources/niches/client/requests/ReviewsNichesRequest.js +2 -0
- package/dist/api/resources/niches/client/requests/index.d.ts +7 -0
- package/dist/api/resources/niches/client/requests/index.js +1 -0
- package/dist/api/resources/niches/exports.d.ts +2 -0
- package/dist/api/resources/niches/exports.js +3 -0
- package/dist/api/resources/niches/index.d.ts +2 -0
- package/dist/api/resources/niches/index.js +2 -0
- package/dist/api/resources/niches/types/GetNichesRequestMarket.d.ts +6 -0
- package/dist/api/resources/niches/types/GetNichesRequestMarket.js +6 -0
- package/dist/api/resources/niches/types/GetNichesRequestPeriod.d.ts +6 -0
- package/dist/api/resources/niches/types/GetNichesRequestPeriod.js +6 -0
- package/dist/api/resources/niches/types/ListNichesRequestMarket.d.ts +6 -0
- package/dist/api/resources/niches/types/ListNichesRequestMarket.js +6 -0
- package/dist/api/resources/niches/types/ListNichesRequestPeriod.d.ts +6 -0
- package/dist/api/resources/niches/types/ListNichesRequestPeriod.js +6 -0
- package/dist/api/resources/niches/types/ListNichesRequestSort.d.ts +9 -0
- package/dist/api/resources/niches/types/ListNichesRequestSort.js +9 -0
- package/dist/api/resources/niches/types/ProductDistributionsNichesRequestPeriod.d.ts +6 -0
- package/dist/api/resources/niches/types/ProductDistributionsNichesRequestPeriod.js +6 -0
- package/dist/api/resources/niches/types/ProductsNichesRequestMarket.d.ts +6 -0
- package/dist/api/resources/niches/types/ProductsNichesRequestMarket.js +6 -0
- package/dist/api/resources/niches/types/ProductsNichesRequestPeriod.d.ts +6 -0
- package/dist/api/resources/niches/types/ProductsNichesRequestPeriod.js +6 -0
- package/dist/api/resources/niches/types/ProductsNichesRequestSort.d.ts +9 -0
- package/dist/api/resources/niches/types/ProductsNichesRequestSort.js +9 -0
- package/dist/api/resources/niches/types/ReviewHistoryNichesRequestInterval.d.ts +5 -0
- package/dist/api/resources/niches/types/ReviewHistoryNichesRequestInterval.js +5 -0
- package/dist/api/resources/niches/types/ReviewHistoryNichesRequestMarket.d.ts +4 -0
- package/dist/api/resources/niches/types/ReviewHistoryNichesRequestMarket.js +4 -0
- package/dist/api/resources/niches/types/ReviewHistoryNichesRequestPeriod.d.ts +7 -0
- package/dist/api/resources/niches/types/ReviewHistoryNichesRequestPeriod.js +7 -0
- package/dist/api/resources/niches/types/ReviewsNichesRequestMarket.d.ts +4 -0
- package/dist/api/resources/niches/types/ReviewsNichesRequestMarket.js +4 -0
- package/dist/api/resources/niches/types/ReviewsNichesRequestPeriod.d.ts +7 -0
- package/dist/api/resources/niches/types/ReviewsNichesRequestPeriod.js +7 -0
- package/dist/api/resources/niches/types/ReviewsNichesRequestSort.d.ts +7 -0
- package/dist/api/resources/niches/types/ReviewsNichesRequestSort.js +7 -0
- package/dist/api/resources/niches/types/index.d.ts +15 -0
- package/dist/api/resources/niches/types/index.js +15 -0
- package/dist/api/resources/organization/client/Client.d.ts +32 -0
- package/dist/api/resources/organization/client/Client.js +73 -0
- package/dist/api/resources/organization/client/index.d.ts +1 -0
- package/dist/api/resources/organization/client/index.js +1 -0
- package/dist/api/resources/organization/exports.d.ts +2 -0
- package/dist/api/resources/organization/exports.js +3 -0
- package/dist/api/resources/organization/index.d.ts +1 -0
- package/dist/api/resources/organization/index.js +1 -0
- package/dist/api/resources/products/client/Client.d.ts +269 -0
- package/dist/api/resources/products/client/Client.js +927 -0
- package/dist/api/resources/products/client/index.d.ts +1 -0
- package/dist/api/resources/products/client/index.js +1 -0
- package/dist/api/resources/products/client/requests/CategoryRankingsProductsRequest.d.ts +23 -0
- package/dist/api/resources/products/client/requests/CategoryRankingsProductsRequest.js +2 -0
- package/dist/api/resources/products/client/requests/GetProductsRequest.d.ts +15 -0
- package/dist/api/resources/products/client/requests/GetProductsRequest.js +2 -0
- package/dist/api/resources/products/client/requests/KeywordRankingsProductsRequest.d.ts +27 -0
- package/dist/api/resources/products/client/requests/KeywordRankingsProductsRequest.js +2 -0
- package/dist/api/resources/products/client/requests/KeywordsProductsRequest.d.ts +19 -0
- package/dist/api/resources/products/client/requests/KeywordsProductsRequest.js +2 -0
- package/dist/api/resources/products/client/requests/ListProductsRequest.d.ts +50 -0
- package/dist/api/resources/products/client/requests/ListProductsRequest.js +2 -0
- package/dist/api/resources/products/client/requests/ReviewSummaryProductsRequest.d.ts +8 -0
- package/dist/api/resources/products/client/requests/ReviewSummaryProductsRequest.js +2 -0
- package/dist/api/resources/products/client/requests/ReviewsProductsRequest.d.ts +35 -0
- package/dist/api/resources/products/client/requests/ReviewsProductsRequest.js +2 -0
- package/dist/api/resources/products/client/requests/SalesHistoryProductsRequest.d.ts +23 -0
- package/dist/api/resources/products/client/requests/SalesHistoryProductsRequest.js +2 -0
- package/dist/api/resources/products/client/requests/SellersProductsRequest.d.ts +16 -0
- package/dist/api/resources/products/client/requests/SellersProductsRequest.js +2 -0
- package/dist/api/resources/products/client/requests/VisibilityHistoryProductsRequest.d.ts +23 -0
- package/dist/api/resources/products/client/requests/VisibilityHistoryProductsRequest.js +2 -0
- package/dist/api/resources/products/client/requests/index.d.ts +10 -0
- package/dist/api/resources/products/client/requests/index.js +1 -0
- package/dist/api/resources/products/exports.d.ts +2 -0
- package/dist/api/resources/products/exports.js +3 -0
- package/dist/api/resources/products/index.d.ts +2 -0
- package/dist/api/resources/products/index.js +2 -0
- package/dist/api/resources/products/types/CategoryRankingsProductsRequestInterval.d.ts +5 -0
- package/dist/api/resources/products/types/CategoryRankingsProductsRequestInterval.js +5 -0
- package/dist/api/resources/products/types/CategoryRankingsProductsRequestMarket.d.ts +6 -0
- package/dist/api/resources/products/types/CategoryRankingsProductsRequestMarket.js +6 -0
- package/dist/api/resources/products/types/CategoryRankingsProductsRequestPeriod.d.ts +7 -0
- package/dist/api/resources/products/types/CategoryRankingsProductsRequestPeriod.js +7 -0
- package/dist/api/resources/products/types/GetProductsRequestMarket.d.ts +6 -0
- package/dist/api/resources/products/types/GetProductsRequestMarket.js +6 -0
- package/dist/api/resources/products/types/GetProductsRequestPeriod.d.ts +6 -0
- package/dist/api/resources/products/types/GetProductsRequestPeriod.js +6 -0
- package/dist/api/resources/products/types/KeywordRankingsProductsRequestInterval.d.ts +5 -0
- package/dist/api/resources/products/types/KeywordRankingsProductsRequestInterval.js +5 -0
- package/dist/api/resources/products/types/KeywordRankingsProductsRequestMarket.d.ts +6 -0
- package/dist/api/resources/products/types/KeywordRankingsProductsRequestMarket.js +6 -0
- package/dist/api/resources/products/types/KeywordRankingsProductsRequestPeriod.d.ts +7 -0
- package/dist/api/resources/products/types/KeywordRankingsProductsRequestPeriod.js +7 -0
- package/dist/api/resources/products/types/KeywordsProductsRequestMarket.d.ts +6 -0
- package/dist/api/resources/products/types/KeywordsProductsRequestMarket.js +6 -0
- package/dist/api/resources/products/types/KeywordsProductsRequestPeriod.d.ts +6 -0
- package/dist/api/resources/products/types/KeywordsProductsRequestPeriod.js +6 -0
- package/dist/api/resources/products/types/ListProductsRequestMarket.d.ts +6 -0
- package/dist/api/resources/products/types/ListProductsRequestMarket.js +6 -0
- package/dist/api/resources/products/types/ListProductsRequestPeriod.d.ts +6 -0
- package/dist/api/resources/products/types/ListProductsRequestPeriod.js +6 -0
- package/dist/api/resources/products/types/ListProductsRequestSort.d.ts +9 -0
- package/dist/api/resources/products/types/ListProductsRequestSort.js +9 -0
- package/dist/api/resources/products/types/ReviewsProductsRequestMarket.d.ts +4 -0
- package/dist/api/resources/products/types/ReviewsProductsRequestMarket.js +4 -0
- package/dist/api/resources/products/types/ReviewsProductsRequestPeriod.d.ts +7 -0
- package/dist/api/resources/products/types/ReviewsProductsRequestPeriod.js +7 -0
- package/dist/api/resources/products/types/ReviewsProductsRequestSort.d.ts +7 -0
- package/dist/api/resources/products/types/ReviewsProductsRequestSort.js +7 -0
- package/dist/api/resources/products/types/SalesHistoryProductsRequestInterval.d.ts +5 -0
- package/dist/api/resources/products/types/SalesHistoryProductsRequestInterval.js +5 -0
- package/dist/api/resources/products/types/SalesHistoryProductsRequestMarket.d.ts +6 -0
- package/dist/api/resources/products/types/SalesHistoryProductsRequestMarket.js +6 -0
- package/dist/api/resources/products/types/SalesHistoryProductsRequestPeriod.d.ts +7 -0
- package/dist/api/resources/products/types/SalesHistoryProductsRequestPeriod.js +7 -0
- package/dist/api/resources/products/types/SellersProductsRequestMarket.d.ts +6 -0
- package/dist/api/resources/products/types/SellersProductsRequestMarket.js +6 -0
- package/dist/api/resources/products/types/SellersProductsRequestPeriod.d.ts +7 -0
- package/dist/api/resources/products/types/SellersProductsRequestPeriod.js +7 -0
- package/dist/api/resources/products/types/VisibilityHistoryProductsRequestInterval.d.ts +5 -0
- package/dist/api/resources/products/types/VisibilityHistoryProductsRequestInterval.js +5 -0
- package/dist/api/resources/products/types/VisibilityHistoryProductsRequestMarket.d.ts +6 -0
- package/dist/api/resources/products/types/VisibilityHistoryProductsRequestMarket.js +6 -0
- package/dist/api/resources/products/types/VisibilityHistoryProductsRequestPeriod.d.ts +7 -0
- package/dist/api/resources/products/types/VisibilityHistoryProductsRequestPeriod.js +7 -0
- package/dist/api/resources/products/types/index.d.ts +24 -0
- package/dist/api/resources/products/types/index.js +24 -0
- package/dist/api/resources/reference/client/Client.d.ts +84 -0
- package/dist/api/resources/reference/client/Client.js +254 -0
- package/dist/api/resources/reference/client/index.d.ts +1 -0
- package/dist/api/resources/reference/client/index.js +1 -0
- package/dist/api/resources/reference/client/requests/BrandsReferenceRequest.d.ts +12 -0
- package/dist/api/resources/reference/client/requests/BrandsReferenceRequest.js +2 -0
- package/dist/api/resources/reference/client/requests/CategoriesReferenceRequest.d.ts +18 -0
- package/dist/api/resources/reference/client/requests/CategoriesReferenceRequest.js +2 -0
- package/dist/api/resources/reference/client/requests/CategoryReferenceRequest.d.ts +5 -0
- package/dist/api/resources/reference/client/requests/CategoryReferenceRequest.js +2 -0
- package/dist/api/resources/reference/client/requests/index.d.ts +3 -0
- package/dist/api/resources/reference/client/requests/index.js +1 -0
- package/dist/api/resources/reference/exports.d.ts +2 -0
- package/dist/api/resources/reference/exports.js +3 -0
- package/dist/api/resources/reference/index.d.ts +1 -0
- package/dist/api/resources/reference/index.js +1 -0
- package/dist/api/resources/store/client/Client.d.ts +82 -0
- package/dist/api/resources/store/client/Client.js +291 -0
- package/dist/api/resources/store/client/index.d.ts +1 -0
- package/dist/api/resources/store/client/index.js +1 -0
- package/dist/api/resources/store/client/requests/InventoryStoreRequest.d.ts +23 -0
- package/dist/api/resources/store/client/requests/InventoryStoreRequest.js +2 -0
- package/dist/api/resources/store/client/requests/OverviewStoreRequest.d.ts +13 -0
- package/dist/api/resources/store/client/requests/OverviewStoreRequest.js +2 -0
- package/dist/api/resources/store/client/requests/ProductsStoreRequest.d.ts +49 -0
- package/dist/api/resources/store/client/requests/ProductsStoreRequest.js +2 -0
- package/dist/api/resources/store/client/requests/index.d.ts +3 -0
- package/dist/api/resources/store/client/requests/index.js +1 -0
- package/dist/api/resources/store/exports.d.ts +2 -0
- package/dist/api/resources/store/exports.js +3 -0
- package/dist/api/resources/store/index.d.ts +2 -0
- package/dist/api/resources/store/index.js +2 -0
- package/dist/api/resources/store/types/InventoryStoreRequestStockState.d.ts +6 -0
- package/dist/api/resources/store/types/InventoryStoreRequestStockState.js +6 -0
- package/dist/api/resources/store/types/OverviewStoreRequestCountry.d.ts +6 -0
- package/dist/api/resources/store/types/OverviewStoreRequestCountry.js +6 -0
- package/dist/api/resources/store/types/ProductsStoreRequestCountry.d.ts +5 -0
- package/dist/api/resources/store/types/ProductsStoreRequestCountry.js +5 -0
- package/dist/api/resources/store/types/ProductsStoreRequestSort.d.ts +11 -0
- package/dist/api/resources/store/types/ProductsStoreRequestSort.js +11 -0
- package/dist/api/resources/store/types/index.d.ts +4 -0
- package/dist/api/resources/store/types/index.js +4 -0
- package/dist/api/resources/usage/client/Client.d.ts +32 -0
- package/dist/api/resources/usage/client/Client.js +73 -0
- package/dist/api/resources/usage/client/index.d.ts +1 -0
- package/dist/api/resources/usage/client/index.js +1 -0
- package/dist/api/resources/usage/exports.d.ts +2 -0
- package/dist/api/resources/usage/exports.js +3 -0
- package/dist/api/resources/usage/index.d.ts +1 -0
- package/dist/api/resources/usage/index.js +1 -0
- package/dist/api/types/AllowanceError.d.ts +26 -0
- package/dist/api/types/AllowanceError.js +16 -0
- package/dist/api/types/Brand.d.ts +4 -0
- package/dist/api/types/Brand.js +2 -0
- package/dist/api/types/BrandListResponse.d.ts +6 -0
- package/dist/api/types/BrandListResponse.js +2 -0
- package/dist/api/types/BundleUsage.d.ts +15 -0
- package/dist/api/types/BundleUsage.js +2 -0
- package/dist/api/types/Category.d.ts +14 -0
- package/dist/api/types/Category.js +2 -0
- package/dist/api/types/CategoryItem.d.ts +4 -0
- package/dist/api/types/CategoryItem.js +2 -0
- package/dist/api/types/CategoryListResponse.d.ts +5 -0
- package/dist/api/types/CategoryListResponse.js +2 -0
- package/dist/api/types/CategoryPathItem.d.ts +4 -0
- package/dist/api/types/CategoryPathItem.js +2 -0
- package/dist/api/types/CategoryRanking.d.ts +5 -0
- package/dist/api/types/CategoryRanking.js +2 -0
- package/dist/api/types/CategoryRankingsResponse.d.ts +7 -0
- package/dist/api/types/CategoryRankingsResponse.js +2 -0
- package/dist/api/types/CategoryResponse.d.ts +4 -0
- package/dist/api/types/CategoryResponse.js +2 -0
- package/dist/api/types/CommissionBracket.d.ts +8 -0
- package/dist/api/types/CommissionBracket.js +2 -0
- package/dist/api/types/CurrentPeriod.d.ts +8 -0
- package/dist/api/types/CurrentPeriod.js +2 -0
- package/dist/api/types/Dimensions.d.ts +8 -0
- package/dist/api/types/Dimensions.js +2 -0
- package/dist/api/types/DistributionBucket.d.ts +5 -0
- package/dist/api/types/DistributionBucket.js +2 -0
- package/dist/api/types/DistributionData.d.ts +7 -0
- package/dist/api/types/DistributionData.js +2 -0
- package/dist/api/types/FreeTierUsage.d.ts +12 -0
- package/dist/api/types/FreeTierUsage.js +2 -0
- package/dist/api/types/KeywordItem.d.ts +6 -0
- package/dist/api/types/KeywordItem.js +2 -0
- package/dist/api/types/KeywordMarkets.d.ts +5 -0
- package/dist/api/types/KeywordMarkets.js +2 -0
- package/dist/api/types/KeywordMetrics.d.ts +4 -0
- package/dist/api/types/KeywordMetrics.js +2 -0
- package/dist/api/types/KeywordRanking.d.ts +7 -0
- package/dist/api/types/KeywordRanking.js +2 -0
- package/dist/api/types/KeywordRankingsResponse.d.ts +7 -0
- package/dist/api/types/KeywordRankingsResponse.js +2 -0
- package/dist/api/types/KeywordResponse.d.ts +7 -0
- package/dist/api/types/KeywordResponse.js +2 -0
- package/dist/api/types/ListingChanges.d.ts +5 -0
- package/dist/api/types/ListingChanges.js +2 -0
- package/dist/api/types/NicheDetail.d.ts +12 -0
- package/dist/api/types/NicheDetail.js +2 -0
- package/dist/api/types/NicheDetailResponse.d.ts +6 -0
- package/dist/api/types/NicheDetailResponse.js +2 -0
- package/dist/api/types/NicheDistributionsResponse.d.ts +5 -0
- package/dist/api/types/NicheDistributionsResponse.js +2 -0
- package/dist/api/types/NicheHistoryData.d.ts +4 -0
- package/dist/api/types/NicheHistoryData.js +2 -0
- package/dist/api/types/NicheHistoryResponse.d.ts +7 -0
- package/dist/api/types/NicheHistoryResponse.js +2 -0
- package/dist/api/types/NicheItem.d.ts +11 -0
- package/dist/api/types/NicheItem.js +2 -0
- package/dist/api/types/NicheListResponse.d.ts +7 -0
- package/dist/api/types/NicheListResponse.js +2 -0
- package/dist/api/types/NicheMarkets.d.ts +5 -0
- package/dist/api/types/NicheMarkets.js +2 -0
- package/dist/api/types/NicheMetrics.d.ts +5 -0
- package/dist/api/types/NicheMetrics.js +2 -0
- package/dist/api/types/NichePeriod.d.ts +5 -0
- package/dist/api/types/NichePeriod.js +2 -0
- package/dist/api/types/OauthScope.d.ts +9 -0
- package/dist/api/types/OauthScope.js +9 -0
- package/dist/api/types/Organization.d.ts +4 -0
- package/dist/api/types/Organization.js +2 -0
- package/dist/api/types/Pagination.d.ts +6 -0
- package/dist/api/types/Pagination.js +2 -0
- package/dist/api/types/Period.d.ts +5 -0
- package/dist/api/types/Period.js +2 -0
- package/dist/api/types/PeriodRatings.d.ts +7 -0
- package/dist/api/types/PeriodRatings.js +2 -0
- package/dist/api/types/PeriodReviews.d.ts +9 -0
- package/dist/api/types/PeriodReviews.js +2 -0
- package/dist/api/types/ProductDetail.d.ts +29 -0
- package/dist/api/types/ProductDetail.js +2 -0
- package/dist/api/types/ProductDetailResponse.d.ts +24 -0
- package/dist/api/types/ProductDetailResponse.js +14 -0
- package/dist/api/types/ProductDistributions.d.ts +6 -0
- package/dist/api/types/ProductDistributions.js +2 -0
- package/dist/api/types/ProductItem.d.ts +27 -0
- package/dist/api/types/ProductItem.js +2 -0
- package/dist/api/types/ProductListResponse.d.ts +25 -0
- package/dist/api/types/ProductListResponse.js +14 -0
- package/dist/api/types/ProductMarketMetrics.d.ts +11 -0
- package/dist/api/types/ProductMarketMetrics.js +2 -0
- package/dist/api/types/ProductMarkets.d.ts +5 -0
- package/dist/api/types/ProductMarkets.js +2 -0
- package/dist/api/types/PublicApiError.d.ts +4 -0
- package/dist/api/types/PublicApiError.js +2 -0
- package/dist/api/types/RankMarkets.d.ts +4 -0
- package/dist/api/types/RankMarkets.js +2 -0
- package/dist/api/types/RankPoint.d.ts +5 -0
- package/dist/api/types/RankPoint.js +2 -0
- package/dist/api/types/RatingCount.d.ts +5 -0
- package/dist/api/types/RatingCount.js +2 -0
- package/dist/api/types/ResearchError.d.ts +6 -0
- package/dist/api/types/ResearchError.js +2 -0
- package/dist/api/types/ReviewHistoryPoint.d.ts +6 -0
- package/dist/api/types/ReviewHistoryPoint.js +2 -0
- package/dist/api/types/ReviewItem.d.ts +12 -0
- package/dist/api/types/ReviewItem.js +2 -0
- package/dist/api/types/ReviewListResponse.d.ts +7 -0
- package/dist/api/types/ReviewListResponse.js +2 -0
- package/dist/api/types/ReviewSummary.d.ts +10 -0
- package/dist/api/types/ReviewSummary.js +2 -0
- package/dist/api/types/ReviewSummaryResponse.d.ts +5 -0
- package/dist/api/types/ReviewSummaryResponse.js +2 -0
- package/dist/api/types/ReviewTopic.d.ts +4 -0
- package/dist/api/types/ReviewTopic.js +2 -0
- package/dist/api/types/SalesHistoryMarkets.d.ts +5 -0
- package/dist/api/types/SalesHistoryMarkets.js +2 -0
- package/dist/api/types/SalesHistoryMetrics.d.ts +5 -0
- package/dist/api/types/SalesHistoryMetrics.js +2 -0
- package/dist/api/types/SalesHistoryPoint.d.ts +5 -0
- package/dist/api/types/SalesHistoryPoint.js +2 -0
- package/dist/api/types/SalesHistoryResponse.d.ts +7 -0
- package/dist/api/types/SalesHistoryResponse.js +2 -0
- package/dist/api/types/SellerItem.d.ts +8 -0
- package/dist/api/types/SellerItem.js +2 -0
- package/dist/api/types/SellerMarkets.d.ts +5 -0
- package/dist/api/types/SellerMarkets.js +2 -0
- package/dist/api/types/SellerMetrics.d.ts +7 -0
- package/dist/api/types/SellerMetrics.js +2 -0
- package/dist/api/types/SellerResponse.d.ts +9 -0
- package/dist/api/types/SellerResponse.js +2 -0
- package/dist/api/types/SellerSummaryMarkets.d.ts +5 -0
- package/dist/api/types/SellerSummaryMarkets.js +2 -0
- package/dist/api/types/SellerSummaryMetrics.d.ts +6 -0
- package/dist/api/types/SellerSummaryMetrics.js +2 -0
- package/dist/api/types/StoreChange.d.ts +9 -0
- package/dist/api/types/StoreChange.js +2 -0
- package/dist/api/types/StoreError.d.ts +5 -0
- package/dist/api/types/StoreError.js +2 -0
- package/dist/api/types/StoreFilters.d.ts +3 -0
- package/dist/api/types/StoreFilters.js +2 -0
- package/dist/api/types/StoreInventoryCounts.d.ts +7 -0
- package/dist/api/types/StoreInventoryCounts.js +2 -0
- package/dist/api/types/StoreInventoryFilters.d.ts +4 -0
- package/dist/api/types/StoreInventoryFilters.js +2 -0
- package/dist/api/types/StoreInventoryPagination.d.ts +7 -0
- package/dist/api/types/StoreInventoryPagination.js +2 -0
- package/dist/api/types/StoreInventoryResponse.d.ts +28 -0
- package/dist/api/types/StoreInventoryResponse.js +14 -0
- package/dist/api/types/StoreInventoryRow.d.ts +35 -0
- package/dist/api/types/StoreInventoryRow.js +18 -0
- package/dist/api/types/StoreKpi.d.ts +12 -0
- package/dist/api/types/StoreKpi.js +2 -0
- package/dist/api/types/StoreOverviewResponse.d.ts +13 -0
- package/dist/api/types/StoreOverviewResponse.js +2 -0
- package/dist/api/types/StorePerformanceProductPerformanceItem.d.ts +48 -0
- package/dist/api/types/StorePerformanceProductPerformanceItem.js +2 -0
- package/dist/api/types/StorePerformanceReturnCostsBreakdown.d.ts +10 -0
- package/dist/api/types/StorePerformanceReturnCostsBreakdown.js +2 -0
- package/dist/api/types/StorePerformanceSalesCostsBreakdown.d.ts +10 -0
- package/dist/api/types/StorePerformanceSalesCostsBreakdown.js +2 -0
- package/dist/api/types/StorePreviousKpi.d.ts +9 -0
- package/dist/api/types/StorePreviousKpi.js +2 -0
- package/dist/api/types/StoreProductsFilters.d.ts +5 -0
- package/dist/api/types/StoreProductsFilters.js +2 -0
- package/dist/api/types/StoreProductsPagination.d.ts +9 -0
- package/dist/api/types/StoreProductsPagination.js +2 -0
- package/dist/api/types/StoreProductsResponse.d.ts +11 -0
- package/dist/api/types/StoreProductsResponse.js +2 -0
- package/dist/api/types/UnauthorizedErrorBody.d.ts +3 -0
- package/dist/api/types/UnauthorizedErrorBody.js +2 -0
- package/dist/api/types/Usage.d.ts +51 -0
- package/dist/api/types/Usage.js +28 -0
- package/dist/api/types/UsageOrganization.d.ts +4 -0
- package/dist/api/types/UsageOrganization.js +2 -0
- package/dist/api/types/VisibilityHistoryResponse.d.ts +7 -0
- package/dist/api/types/VisibilityHistoryResponse.js +2 -0
- package/dist/api/types/VisibilityMarkets.d.ts +5 -0
- package/dist/api/types/VisibilityMarkets.js +2 -0
- package/dist/api/types/VisibilityMetrics.d.ts +4 -0
- package/dist/api/types/VisibilityMetrics.js +2 -0
- package/dist/api/types/VisibilityPoint.d.ts +5 -0
- package/dist/api/types/VisibilityPoint.js +2 -0
- package/dist/api/types/index.d.ts +92 -0
- package/dist/api/types/index.js +92 -0
- package/dist/auth/BearerAuthProvider.d.ts +20 -0
- package/dist/auth/BearerAuthProvider.js +32 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +1 -0
- package/dist/core/auth/AuthProvider.d.ts +8 -0
- package/dist/core/auth/AuthProvider.js +6 -0
- package/dist/core/auth/AuthRequest.d.ts +9 -0
- package/dist/core/auth/AuthRequest.js +1 -0
- package/dist/core/auth/BasicAuth.d.ts +8 -0
- package/dist/core/auth/BasicAuth.js +29 -0
- package/dist/core/auth/BearerToken.d.ts +7 -0
- package/dist/core/auth/BearerToken.js +13 -0
- package/dist/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/core/auth/NoOpAuthProvider.js +5 -0
- package/dist/core/auth/index.d.ts +5 -0
- package/dist/core/auth/index.js +4 -0
- package/dist/core/base64.d.ts +2 -0
- package/dist/core/base64.js +22 -0
- package/dist/core/exports.d.ts +2 -0
- package/dist/core/exports.js +2 -0
- package/dist/core/fetcher/APIResponse.d.ts +20 -0
- package/dist/core/fetcher/APIResponse.js +1 -0
- package/dist/core/fetcher/BinaryResponse.d.ts +19 -0
- package/dist/core/fetcher/BinaryResponse.js +14 -0
- package/dist/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/core/fetcher/EndpointMetadata.js +1 -0
- package/dist/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/core/fetcher/EndpointSupplier.js +10 -0
- package/dist/core/fetcher/Fetcher.d.ts +56 -0
- package/dist/core/fetcher/Fetcher.js +254 -0
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +83 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +90 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +40 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +10 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +5 -0
- package/dist/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getErrorResponseBody.js +43 -0
- package/dist/core/fetcher/getFetchFn.d.ts +1 -0
- package/dist/core/fetcher/getFetchFn.js +3 -0
- package/dist/core/fetcher/getHeader.d.ts +1 -0
- package/dist/core/fetcher/getHeader.js +8 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +13 -0
- package/dist/core/fetcher/getResponseBody.d.ts +17 -0
- package/dist/core/fetcher/getResponseBody.js +70 -0
- package/dist/core/fetcher/index.d.ts +13 -0
- package/dist/core/fetcher/index.js +7 -0
- package/dist/core/fetcher/makePassthroughRequest.d.ts +49 -0
- package/dist/core/fetcher/makePassthroughRequest.js +157 -0
- package/dist/core/fetcher/makeRequest.d.ts +11 -0
- package/dist/core/fetcher/makeRequest.js +85 -0
- package/dist/core/fetcher/redactUrl.d.ts +2 -0
- package/dist/core/fetcher/redactUrl.js +84 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +77 -0
- package/dist/core/fetcher/signals.d.ts +6 -0
- package/dist/core/fetcher/signals.js +28 -0
- package/dist/core/headers.d.ts +2 -0
- package/dist/core/headers.js +27 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.js +8 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +19 -0
- package/dist/core/logging/exports.d.ts +18 -0
- package/dist/core/logging/exports.js +9 -0
- package/dist/core/logging/index.d.ts +1 -0
- package/dist/core/logging/index.js +1 -0
- package/dist/core/logging/logger.d.ts +126 -0
- package/dist/core/logging/logger.js +140 -0
- package/dist/core/pagination/Page.d.ts +33 -0
- package/dist/core/pagination/Page.js +55 -0
- package/dist/core/pagination/exports.d.ts +1 -0
- package/dist/core/pagination/exports.js +1 -0
- package/dist/core/pagination/index.d.ts +1 -0
- package/dist/core/pagination/index.js +1 -0
- package/dist/core/requestBody.d.ts +12 -0
- package/dist/core/requestBody.js +23 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +1 -0
- package/dist/core/runtime/runtime.d.ts +28 -0
- package/dist/core/runtime/runtime.js +171 -0
- package/dist/core/url/QueryStringBuilder.d.ts +47 -0
- package/dist/core/url/QueryStringBuilder.js +78 -0
- package/dist/core/url/encodePathParam.d.ts +3 -0
- package/dist/core/url/encodePathParam.js +24 -0
- package/dist/core/url/index.d.ts +4 -0
- package/dist/core/url/index.js +4 -0
- package/dist/core/url/join.d.ts +1 -0
- package/dist/core/url/join.js +65 -0
- package/dist/core/url/qs.d.ts +7 -0
- package/dist/core/url/qs.js +76 -0
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/core/utils/index.js +1 -0
- package/dist/core/utils/setObjectProperty.d.ts +12 -0
- package/dist/core/utils/setObjectProperty.js +45 -0
- package/dist/environments.d.ts +4 -0
- package/dist/environments.js +4 -0
- package/dist/errors/MarktMentorError.d.ts +15 -0
- package/dist/errors/MarktMentorError.js +52 -0
- package/dist/errors/MarktMentorTimeoutError.d.ts +6 -0
- package/dist/errors/MarktMentorTimeoutError.js +15 -0
- package/dist/errors/handleNonStatusCodeError.d.ts +2 -0
- package/dist/errors/handleNonStatusCodeError.js +32 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +2 -0
- package/dist/exports.d.ts +1 -0
- package/dist/exports.js +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/package.json +33 -4
|
@@ -0,0 +1,655 @@
|
|
|
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
|
+
* Get a niche contains the metrics of the niche. Product distributions (both markets together), products, reviews, the review summary and review history are separate calls. Each call gives one kind of data from one source. The same data as the Niche Explorer in the dashboard. Each successful request counts as one research request.
|
|
11
|
+
*/
|
|
12
|
+
export class NichesClient {
|
|
13
|
+
_options;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Search niches by text or category. A niche is a group of products that serve the same customer need. Each result has the metrics per market for the chosen period.
|
|
19
|
+
*
|
|
20
|
+
* A successful request counts as one research request.
|
|
21
|
+
*
|
|
22
|
+
* @param {MarktMentor.ListNichesRequest} request
|
|
23
|
+
* @param {NichesClient.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.niches.list({
|
|
37
|
+
* search: "drinkfles"
|
|
38
|
+
* })
|
|
39
|
+
*/
|
|
40
|
+
async list(request = {}, requestOptions) {
|
|
41
|
+
const list = core.HttpResponsePromise.interceptFunction(async (request) => {
|
|
42
|
+
const { categoryId, market, page, pageSize, period, search, sort } = request;
|
|
43
|
+
const _queryParams = {
|
|
44
|
+
categoryId,
|
|
45
|
+
market: market != null ? market : undefined,
|
|
46
|
+
page,
|
|
47
|
+
pageSize,
|
|
48
|
+
period: period != null ? period : undefined,
|
|
49
|
+
search,
|
|
50
|
+
sort: sort != null ? sort : undefined,
|
|
51
|
+
};
|
|
52
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
53
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
54
|
+
const _response = await core.fetcher({
|
|
55
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
56
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
57
|
+
environments.MarktMentorEnvironment.Production, "api/public/v1/research/niches/"),
|
|
58
|
+
method: "GET",
|
|
59
|
+
headers: _headers,
|
|
60
|
+
queryString: core.url
|
|
61
|
+
.queryBuilder()
|
|
62
|
+
.addMany(_queryParams)
|
|
63
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
64
|
+
.build(),
|
|
65
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
66
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
67
|
+
abortSignal: requestOptions?.abortSignal,
|
|
68
|
+
fetchFn: this._options?.fetch,
|
|
69
|
+
logging: this._options.logging,
|
|
70
|
+
});
|
|
71
|
+
if (_response.ok) {
|
|
72
|
+
return {
|
|
73
|
+
data: _response.body,
|
|
74
|
+
rawResponse: _response.rawResponse,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (_response.error.reason === "status-code") {
|
|
78
|
+
switch (_response.error.statusCode) {
|
|
79
|
+
case 400:
|
|
80
|
+
throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
|
|
81
|
+
case 401:
|
|
82
|
+
throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
83
|
+
case 402:
|
|
84
|
+
throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
85
|
+
case 403:
|
|
86
|
+
throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
87
|
+
case 404:
|
|
88
|
+
throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
|
|
89
|
+
case 429:
|
|
90
|
+
throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
91
|
+
case 503:
|
|
92
|
+
throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
93
|
+
default:
|
|
94
|
+
throw new errors.MarktMentorError({
|
|
95
|
+
statusCode: _response.error.statusCode,
|
|
96
|
+
body: _response.error.body,
|
|
97
|
+
rawResponse: _response.rawResponse,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/niches/");
|
|
102
|
+
});
|
|
103
|
+
let _offset = request?.page != null ? request?.page : 1;
|
|
104
|
+
const dataWithRawResponse = await list(request).withRawResponse();
|
|
105
|
+
return new core.Page({
|
|
106
|
+
response: dataWithRawResponse.data,
|
|
107
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
108
|
+
hasNextPage: (response) => response?.pagination.hasNext ?? (response?.data ?? []).length > 0,
|
|
109
|
+
getItems: (response) => response?.data ?? [],
|
|
110
|
+
loadPage: (_response) => {
|
|
111
|
+
const _nextOffset = _offset + 1;
|
|
112
|
+
return core.HttpResponsePromise.fromPromise(list(core.setObjectProperty(request, "page", _nextOffset))
|
|
113
|
+
.withRawResponse()
|
|
114
|
+
.then((_pageResponse) => {
|
|
115
|
+
_offset = _nextOffset;
|
|
116
|
+
return _pageResponse;
|
|
117
|
+
}));
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get one niche with its quality score, competition score and the metrics per market for the chosen period. With comparePeriods the response also has the core metrics for 30, 90 and 365 days.
|
|
123
|
+
*
|
|
124
|
+
* A successful request counts as one research request.
|
|
125
|
+
*
|
|
126
|
+
* @param {number} nicheId - Niche identifier returned as nicheId by Search niches.
|
|
127
|
+
* @param {MarktMentor.GetNichesRequest} request
|
|
128
|
+
* @param {NichesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
129
|
+
*
|
|
130
|
+
* @throws {@link MarktMentor.BadRequestError}
|
|
131
|
+
* @throws {@link MarktMentor.UnauthorizedError}
|
|
132
|
+
* @throws {@link MarktMentor.PaymentRequiredError}
|
|
133
|
+
* @throws {@link MarktMentor.ForbiddenError}
|
|
134
|
+
* @throws {@link MarktMentor.NotFoundError}
|
|
135
|
+
* @throws {@link MarktMentor.TooManyRequestsError}
|
|
136
|
+
* @throws {@link MarktMentor.ServiceUnavailableError}
|
|
137
|
+
* @throws {@link errors.MarktMentorError}
|
|
138
|
+
* @throws {@link errors.MarktMentorTimeoutError}
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* await client.niches.get(1)
|
|
142
|
+
*/
|
|
143
|
+
get(nicheId, request = {}, requestOptions) {
|
|
144
|
+
return core.HttpResponsePromise.fromPromise(this.__get(nicheId, request, requestOptions));
|
|
145
|
+
}
|
|
146
|
+
async __get(nicheId, request = {}, requestOptions) {
|
|
147
|
+
const { comparePeriods, market, period } = request;
|
|
148
|
+
const _queryParams = {
|
|
149
|
+
comparePeriods,
|
|
150
|
+
market: market != null ? market : undefined,
|
|
151
|
+
period: period != null ? period : undefined,
|
|
152
|
+
};
|
|
153
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
154
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
155
|
+
const _response = await core.fetcher({
|
|
156
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
157
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
158
|
+
environments.MarktMentorEnvironment.Production, `api/public/v1/research/niches/${core.url.encodePathParam(nicheId, errors.MarktMentorError)}/`),
|
|
159
|
+
method: "GET",
|
|
160
|
+
headers: _headers,
|
|
161
|
+
queryString: core.url
|
|
162
|
+
.queryBuilder()
|
|
163
|
+
.addMany(_queryParams)
|
|
164
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
165
|
+
.build(),
|
|
166
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
167
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
168
|
+
abortSignal: requestOptions?.abortSignal,
|
|
169
|
+
fetchFn: this._options?.fetch,
|
|
170
|
+
logging: this._options.logging,
|
|
171
|
+
});
|
|
172
|
+
if (_response.ok) {
|
|
173
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
174
|
+
}
|
|
175
|
+
if (_response.error.reason === "status-code") {
|
|
176
|
+
switch (_response.error.statusCode) {
|
|
177
|
+
case 400:
|
|
178
|
+
throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
|
|
179
|
+
case 401:
|
|
180
|
+
throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
181
|
+
case 402:
|
|
182
|
+
throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
183
|
+
case 403:
|
|
184
|
+
throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
185
|
+
case 404:
|
|
186
|
+
throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
|
|
187
|
+
case 429:
|
|
188
|
+
throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
189
|
+
case 503:
|
|
190
|
+
throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
191
|
+
default:
|
|
192
|
+
throw new errors.MarktMentorError({
|
|
193
|
+
statusCode: _response.error.statusCode,
|
|
194
|
+
body: _response.error.body,
|
|
195
|
+
rawResponse: _response.rawResponse,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/niches/{nicheId}/");
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get the number of reviews and the average rating of the products in a niche over time.
|
|
203
|
+
*
|
|
204
|
+
* A successful request counts as one research request.
|
|
205
|
+
*
|
|
206
|
+
* @param {number} nicheId - Niche identifier returned as nicheId by Search niches.
|
|
207
|
+
* @param {MarktMentor.ReviewHistoryNichesRequest} request
|
|
208
|
+
* @param {NichesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
209
|
+
*
|
|
210
|
+
* @throws {@link MarktMentor.BadRequestError}
|
|
211
|
+
* @throws {@link MarktMentor.UnauthorizedError}
|
|
212
|
+
* @throws {@link MarktMentor.PaymentRequiredError}
|
|
213
|
+
* @throws {@link MarktMentor.ForbiddenError}
|
|
214
|
+
* @throws {@link MarktMentor.NotFoundError}
|
|
215
|
+
* @throws {@link MarktMentor.TooManyRequestsError}
|
|
216
|
+
* @throws {@link MarktMentor.ServiceUnavailableError}
|
|
217
|
+
* @throws {@link errors.MarktMentorError}
|
|
218
|
+
* @throws {@link errors.MarktMentorTimeoutError}
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* await client.niches.reviewHistory(1)
|
|
222
|
+
*/
|
|
223
|
+
reviewHistory(nicheId, request = {}, requestOptions) {
|
|
224
|
+
return core.HttpResponsePromise.fromPromise(this.__reviewHistory(nicheId, request, requestOptions));
|
|
225
|
+
}
|
|
226
|
+
async __reviewHistory(nicheId, request = {}, requestOptions) {
|
|
227
|
+
const { interval, market, period } = request;
|
|
228
|
+
const _queryParams = {
|
|
229
|
+
interval: interval != null ? interval : undefined,
|
|
230
|
+
market: market != null ? market : undefined,
|
|
231
|
+
period: period != null ? period : undefined,
|
|
232
|
+
};
|
|
233
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
234
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
235
|
+
const _response = await core.fetcher({
|
|
236
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
237
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
238
|
+
environments.MarktMentorEnvironment.Production, `api/public/v1/research/niches/${core.url.encodePathParam(nicheId, errors.MarktMentorError)}/review-history/`),
|
|
239
|
+
method: "GET",
|
|
240
|
+
headers: _headers,
|
|
241
|
+
queryString: core.url
|
|
242
|
+
.queryBuilder()
|
|
243
|
+
.addMany(_queryParams)
|
|
244
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
245
|
+
.build(),
|
|
246
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
247
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
248
|
+
abortSignal: requestOptions?.abortSignal,
|
|
249
|
+
fetchFn: this._options?.fetch,
|
|
250
|
+
logging: this._options.logging,
|
|
251
|
+
});
|
|
252
|
+
if (_response.ok) {
|
|
253
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
254
|
+
}
|
|
255
|
+
if (_response.error.reason === "status-code") {
|
|
256
|
+
switch (_response.error.statusCode) {
|
|
257
|
+
case 400:
|
|
258
|
+
throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
|
|
259
|
+
case 401:
|
|
260
|
+
throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
261
|
+
case 402:
|
|
262
|
+
throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
263
|
+
case 403:
|
|
264
|
+
throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
265
|
+
case 404:
|
|
266
|
+
throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
|
|
267
|
+
case 429:
|
|
268
|
+
throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
269
|
+
case 503:
|
|
270
|
+
throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
271
|
+
default:
|
|
272
|
+
throw new errors.MarktMentorError({
|
|
273
|
+
statusCode: _response.error.statusCode,
|
|
274
|
+
body: _response.error.body,
|
|
275
|
+
rawResponse: _response.rawResponse,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/niches/{nicheId}/review-history/");
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Get the review totals of the products in a niche: the number of reviews, the average rating, the count per star rating and the most named positive and negative topics.
|
|
283
|
+
*
|
|
284
|
+
* A successful request counts as one research request.
|
|
285
|
+
*
|
|
286
|
+
* @param {number} nicheId - Niche identifier returned as nicheId by Search niches.
|
|
287
|
+
* @param {MarktMentor.ReviewSummaryNichesRequest} request
|
|
288
|
+
* @param {NichesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
289
|
+
*
|
|
290
|
+
* @throws {@link MarktMentor.BadRequestError}
|
|
291
|
+
* @throws {@link MarktMentor.UnauthorizedError}
|
|
292
|
+
* @throws {@link MarktMentor.PaymentRequiredError}
|
|
293
|
+
* @throws {@link MarktMentor.ForbiddenError}
|
|
294
|
+
* @throws {@link MarktMentor.NotFoundError}
|
|
295
|
+
* @throws {@link MarktMentor.TooManyRequestsError}
|
|
296
|
+
* @throws {@link MarktMentor.ServiceUnavailableError}
|
|
297
|
+
* @throws {@link errors.MarktMentorError}
|
|
298
|
+
* @throws {@link errors.MarktMentorTimeoutError}
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* await client.niches.reviewSummary(1)
|
|
302
|
+
*/
|
|
303
|
+
reviewSummary(nicheId, request = {}, requestOptions) {
|
|
304
|
+
return core.HttpResponsePromise.fromPromise(this.__reviewSummary(nicheId, request, requestOptions));
|
|
305
|
+
}
|
|
306
|
+
async __reviewSummary(nicheId, _request = {}, requestOptions) {
|
|
307
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
308
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
309
|
+
const _response = await core.fetcher({
|
|
310
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
311
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
312
|
+
environments.MarktMentorEnvironment.Production, `api/public/v1/research/niches/${core.url.encodePathParam(nicheId, errors.MarktMentorError)}/reviews/summary/`),
|
|
313
|
+
method: "GET",
|
|
314
|
+
headers: _headers,
|
|
315
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
316
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
317
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
318
|
+
abortSignal: requestOptions?.abortSignal,
|
|
319
|
+
fetchFn: this._options?.fetch,
|
|
320
|
+
logging: this._options.logging,
|
|
321
|
+
});
|
|
322
|
+
if (_response.ok) {
|
|
323
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
324
|
+
}
|
|
325
|
+
if (_response.error.reason === "status-code") {
|
|
326
|
+
switch (_response.error.statusCode) {
|
|
327
|
+
case 400:
|
|
328
|
+
throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
|
|
329
|
+
case 401:
|
|
330
|
+
throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
331
|
+
case 402:
|
|
332
|
+
throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
333
|
+
case 403:
|
|
334
|
+
throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
335
|
+
case 404:
|
|
336
|
+
throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
|
|
337
|
+
case 429:
|
|
338
|
+
throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
339
|
+
case 503:
|
|
340
|
+
throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
341
|
+
default:
|
|
342
|
+
throw new errors.MarktMentorError({
|
|
343
|
+
statusCode: _response.error.statusCode,
|
|
344
|
+
body: _response.error.body,
|
|
345
|
+
rawResponse: _response.rawResponse,
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/niches/{nicheId}/reviews/summary/");
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Get how the products of a niche are spread over price, sales and revenue, for both markets together.
|
|
353
|
+
*
|
|
354
|
+
* A successful request counts as one research request.
|
|
355
|
+
*
|
|
356
|
+
* @param {number} nicheId - Niche identifier returned as nicheId by Search niches.
|
|
357
|
+
* @param {MarktMentor.ProductDistributionsNichesRequest} request
|
|
358
|
+
* @param {NichesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
359
|
+
*
|
|
360
|
+
* @throws {@link MarktMentor.BadRequestError}
|
|
361
|
+
* @throws {@link MarktMentor.UnauthorizedError}
|
|
362
|
+
* @throws {@link MarktMentor.PaymentRequiredError}
|
|
363
|
+
* @throws {@link MarktMentor.ForbiddenError}
|
|
364
|
+
* @throws {@link MarktMentor.NotFoundError}
|
|
365
|
+
* @throws {@link MarktMentor.TooManyRequestsError}
|
|
366
|
+
* @throws {@link MarktMentor.ServiceUnavailableError}
|
|
367
|
+
* @throws {@link errors.MarktMentorError}
|
|
368
|
+
* @throws {@link errors.MarktMentorTimeoutError}
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* await client.niches.productDistributions(1)
|
|
372
|
+
*/
|
|
373
|
+
productDistributions(nicheId, request = {}, requestOptions) {
|
|
374
|
+
return core.HttpResponsePromise.fromPromise(this.__productDistributions(nicheId, request, requestOptions));
|
|
375
|
+
}
|
|
376
|
+
async __productDistributions(nicheId, request = {}, requestOptions) {
|
|
377
|
+
const { period } = request;
|
|
378
|
+
const _queryParams = {
|
|
379
|
+
period: period != null ? period : undefined,
|
|
380
|
+
};
|
|
381
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
382
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
383
|
+
const _response = await core.fetcher({
|
|
384
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
385
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
386
|
+
environments.MarktMentorEnvironment.Production, `api/public/v1/research/niches/${core.url.encodePathParam(nicheId, errors.MarktMentorError)}/product-distributions/`),
|
|
387
|
+
method: "GET",
|
|
388
|
+
headers: _headers,
|
|
389
|
+
queryString: core.url
|
|
390
|
+
.queryBuilder()
|
|
391
|
+
.addMany(_queryParams)
|
|
392
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
393
|
+
.build(),
|
|
394
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
395
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
396
|
+
abortSignal: requestOptions?.abortSignal,
|
|
397
|
+
fetchFn: this._options?.fetch,
|
|
398
|
+
logging: this._options.logging,
|
|
399
|
+
});
|
|
400
|
+
if (_response.ok) {
|
|
401
|
+
return {
|
|
402
|
+
data: _response.body,
|
|
403
|
+
rawResponse: _response.rawResponse,
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
if (_response.error.reason === "status-code") {
|
|
407
|
+
switch (_response.error.statusCode) {
|
|
408
|
+
case 400:
|
|
409
|
+
throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
|
|
410
|
+
case 401:
|
|
411
|
+
throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
412
|
+
case 402:
|
|
413
|
+
throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
414
|
+
case 403:
|
|
415
|
+
throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
416
|
+
case 404:
|
|
417
|
+
throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
|
|
418
|
+
case 429:
|
|
419
|
+
throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
420
|
+
case 503:
|
|
421
|
+
throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
422
|
+
default:
|
|
423
|
+
throw new errors.MarktMentorError({
|
|
424
|
+
statusCode: _response.error.statusCode,
|
|
425
|
+
body: _response.error.body,
|
|
426
|
+
rawResponse: _response.rawResponse,
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/niches/{nicheId}/product-distributions/");
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* List the products in a niche, with the same filters and the same product data as Search products.
|
|
434
|
+
*
|
|
435
|
+
* A successful request counts as one research request.
|
|
436
|
+
*
|
|
437
|
+
* @param {number} nicheId - Niche identifier returned as nicheId by Search niches.
|
|
438
|
+
* @param {MarktMentor.ProductsNichesRequest} request
|
|
439
|
+
* @param {NichesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
440
|
+
*
|
|
441
|
+
* @throws {@link MarktMentor.BadRequestError}
|
|
442
|
+
* @throws {@link MarktMentor.UnauthorizedError}
|
|
443
|
+
* @throws {@link MarktMentor.PaymentRequiredError}
|
|
444
|
+
* @throws {@link MarktMentor.ForbiddenError}
|
|
445
|
+
* @throws {@link MarktMentor.NotFoundError}
|
|
446
|
+
* @throws {@link MarktMentor.TooManyRequestsError}
|
|
447
|
+
* @throws {@link MarktMentor.ServiceUnavailableError}
|
|
448
|
+
* @throws {@link errors.MarktMentorError}
|
|
449
|
+
* @throws {@link errors.MarktMentorTimeoutError}
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* await client.niches.products(1, {
|
|
453
|
+
* brand: "Kambukka",
|
|
454
|
+
* ean: "5407005143414",
|
|
455
|
+
* search: "drinkfles"
|
|
456
|
+
* })
|
|
457
|
+
*/
|
|
458
|
+
async products(nicheId, request = {}, requestOptions) {
|
|
459
|
+
const list = core.HttpResponsePromise.interceptFunction(async (request) => {
|
|
460
|
+
const { brand, categoryId, ean, market, maxPrice, maxRating, maxRevenue, maxSales, minPrice, minRating, minRevenue, minSales, page, pageSize, period, search, sort, } = request;
|
|
461
|
+
const _queryParams = {
|
|
462
|
+
brand,
|
|
463
|
+
categoryId,
|
|
464
|
+
ean,
|
|
465
|
+
market: market != null ? market : undefined,
|
|
466
|
+
maxPrice,
|
|
467
|
+
maxRating,
|
|
468
|
+
maxRevenue,
|
|
469
|
+
maxSales,
|
|
470
|
+
minPrice,
|
|
471
|
+
minRating,
|
|
472
|
+
minRevenue,
|
|
473
|
+
minSales,
|
|
474
|
+
page,
|
|
475
|
+
pageSize,
|
|
476
|
+
period: period != null ? period : undefined,
|
|
477
|
+
search,
|
|
478
|
+
sort: sort != null ? sort : undefined,
|
|
479
|
+
};
|
|
480
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
481
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
482
|
+
const _response = await core.fetcher({
|
|
483
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
484
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
485
|
+
environments.MarktMentorEnvironment.Production, `api/public/v1/research/niches/${core.url.encodePathParam(nicheId, errors.MarktMentorError)}/products/`),
|
|
486
|
+
method: "GET",
|
|
487
|
+
headers: _headers,
|
|
488
|
+
queryString: core.url
|
|
489
|
+
.queryBuilder()
|
|
490
|
+
.addMany(_queryParams)
|
|
491
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
492
|
+
.build(),
|
|
493
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
494
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
495
|
+
abortSignal: requestOptions?.abortSignal,
|
|
496
|
+
fetchFn: this._options?.fetch,
|
|
497
|
+
logging: this._options.logging,
|
|
498
|
+
});
|
|
499
|
+
if (_response.ok) {
|
|
500
|
+
return {
|
|
501
|
+
data: _response.body,
|
|
502
|
+
rawResponse: _response.rawResponse,
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
if (_response.error.reason === "status-code") {
|
|
506
|
+
switch (_response.error.statusCode) {
|
|
507
|
+
case 400:
|
|
508
|
+
throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
|
|
509
|
+
case 401:
|
|
510
|
+
throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
511
|
+
case 402:
|
|
512
|
+
throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
513
|
+
case 403:
|
|
514
|
+
throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
515
|
+
case 404:
|
|
516
|
+
throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
|
|
517
|
+
case 429:
|
|
518
|
+
throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
519
|
+
case 503:
|
|
520
|
+
throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
521
|
+
default:
|
|
522
|
+
throw new errors.MarktMentorError({
|
|
523
|
+
statusCode: _response.error.statusCode,
|
|
524
|
+
body: _response.error.body,
|
|
525
|
+
rawResponse: _response.rawResponse,
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/niches/{nicheId}/products/");
|
|
530
|
+
});
|
|
531
|
+
let _offset = request?.page != null ? request?.page : 1;
|
|
532
|
+
const dataWithRawResponse = await list(request).withRawResponse();
|
|
533
|
+
return new core.Page({
|
|
534
|
+
response: dataWithRawResponse.data,
|
|
535
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
536
|
+
hasNextPage: (response) => response?.pagination.hasNext ?? (response?.data ?? []).length > 0,
|
|
537
|
+
getItems: (response) => response?.data ?? [],
|
|
538
|
+
loadPage: (_response) => {
|
|
539
|
+
const _nextOffset = _offset + 1;
|
|
540
|
+
return core.HttpResponsePromise.fromPromise(list(core.setObjectProperty(request, "page", _nextOffset))
|
|
541
|
+
.withRawResponse()
|
|
542
|
+
.then((_pageResponse) => {
|
|
543
|
+
_offset = _nextOffset;
|
|
544
|
+
return _pageResponse;
|
|
545
|
+
}));
|
|
546
|
+
},
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* List the reviews of the products in a niche. Filter on score, verified purchase and text.
|
|
551
|
+
*
|
|
552
|
+
* A successful request counts as one research request.
|
|
553
|
+
*
|
|
554
|
+
* @param {number} nicheId - Niche identifier returned as nicheId by Search niches.
|
|
555
|
+
* @param {MarktMentor.ReviewsNichesRequest} request
|
|
556
|
+
* @param {NichesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
557
|
+
*
|
|
558
|
+
* @throws {@link MarktMentor.BadRequestError}
|
|
559
|
+
* @throws {@link MarktMentor.UnauthorizedError}
|
|
560
|
+
* @throws {@link MarktMentor.PaymentRequiredError}
|
|
561
|
+
* @throws {@link MarktMentor.ForbiddenError}
|
|
562
|
+
* @throws {@link MarktMentor.NotFoundError}
|
|
563
|
+
* @throws {@link MarktMentor.TooManyRequestsError}
|
|
564
|
+
* @throws {@link MarktMentor.ServiceUnavailableError}
|
|
565
|
+
* @throws {@link errors.MarktMentorError}
|
|
566
|
+
* @throws {@link errors.MarktMentorTimeoutError}
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* await client.niches.reviews(1, {
|
|
570
|
+
* search: "drinkfles"
|
|
571
|
+
* })
|
|
572
|
+
*/
|
|
573
|
+
async reviews(nicheId, request = {}, requestOptions) {
|
|
574
|
+
const list = core.HttpResponsePromise.interceptFunction(async (request) => {
|
|
575
|
+
const { market, page, pageSize, period, score, search, sort, verified } = request;
|
|
576
|
+
const _queryParams = {
|
|
577
|
+
market: market != null ? market : undefined,
|
|
578
|
+
page,
|
|
579
|
+
pageSize,
|
|
580
|
+
period: period != null ? period : undefined,
|
|
581
|
+
score,
|
|
582
|
+
search,
|
|
583
|
+
sort: sort != null ? sort : undefined,
|
|
584
|
+
verified,
|
|
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/niches/${core.url.encodePathParam(nicheId, errors.MarktMentorError)}/reviews/`),
|
|
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 {
|
|
607
|
+
data: _response.body,
|
|
608
|
+
rawResponse: _response.rawResponse,
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
if (_response.error.reason === "status-code") {
|
|
612
|
+
switch (_response.error.statusCode) {
|
|
613
|
+
case 400:
|
|
614
|
+
throw new MarktMentor.BadRequestError(_response.error.body, _response.rawResponse);
|
|
615
|
+
case 401:
|
|
616
|
+
throw new MarktMentor.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
617
|
+
case 402:
|
|
618
|
+
throw new MarktMentor.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
619
|
+
case 403:
|
|
620
|
+
throw new MarktMentor.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
621
|
+
case 404:
|
|
622
|
+
throw new MarktMentor.NotFoundError(_response.error.body, _response.rawResponse);
|
|
623
|
+
case 429:
|
|
624
|
+
throw new MarktMentor.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
625
|
+
case 503:
|
|
626
|
+
throw new MarktMentor.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
627
|
+
default:
|
|
628
|
+
throw new errors.MarktMentorError({
|
|
629
|
+
statusCode: _response.error.statusCode,
|
|
630
|
+
body: _response.error.body,
|
|
631
|
+
rawResponse: _response.rawResponse,
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/api/public/v1/research/niches/{nicheId}/reviews/");
|
|
636
|
+
});
|
|
637
|
+
let _offset = request?.page != null ? request?.page : 1;
|
|
638
|
+
const dataWithRawResponse = await list(request).withRawResponse();
|
|
639
|
+
return new core.Page({
|
|
640
|
+
response: dataWithRawResponse.data,
|
|
641
|
+
rawResponse: dataWithRawResponse.rawResponse,
|
|
642
|
+
hasNextPage: (response) => response?.pagination.hasNext ?? (response?.data ?? []).length > 0,
|
|
643
|
+
getItems: (response) => response?.data ?? [],
|
|
644
|
+
loadPage: (_response) => {
|
|
645
|
+
const _nextOffset = _offset + 1;
|
|
646
|
+
return core.HttpResponsePromise.fromPromise(list(core.setObjectProperty(request, "page", _nextOffset))
|
|
647
|
+
.withRawResponse()
|
|
648
|
+
.then((_pageResponse) => {
|
|
649
|
+
_offset = _nextOffset;
|
|
650
|
+
return _pageResponse;
|
|
651
|
+
}));
|
|
652
|
+
},
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type * as MarktMentor from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
|
+
*/
|
|
6
|
+
export interface GetNichesRequest {
|
|
7
|
+
/** Include core niche metrics for 30d, 90d and 365d in data.periods. */
|
|
8
|
+
comparePeriods?: boolean;
|
|
9
|
+
/** NL for the Netherlands, BE for Belgium, or ALL for both markets. Reviews support ALL only. */
|
|
10
|
+
market?: MarktMentor.GetNichesRequestMarket;
|
|
11
|
+
/**
|
|
12
|
+
* * `30d` - 30d
|
|
13
|
+
* * `90d` - 90d
|
|
14
|
+
* * `365d` - 365d
|
|
15
|
+
*/
|
|
16
|
+
period?: MarktMentor.GetNichesRequestPeriod;
|
|
17
|
+
}
|