UNPKG

@scaleleap/selling-partner-api-sdk

Version:

📦 A fully typed TypeScript and Node.js SDK library for Amazon Selling Partner API

293 lines • 23.5 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * Selling Partner API for Catalog Items * The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon catalog. For more information, see the [Catalog Items API Use Case Guide](doc:catalog-items-api-v2020-12-01-use-case-guide). * * The version of the OpenAPI document: 2020-12-01 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CatalogApi = exports.CatalogApiFactory = exports.CatalogApiFp = exports.CatalogApiAxiosParamCreator = exports.ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum = exports.ItemVariationsByMarketplaceVariationTypeEnum = exports.ItemImageVariantEnum = void 0; const axios_1 = __importDefault(require("axios")); // Some imports not used depending on template conditions // @ts-ignore const common_1 = require("./common"); // @ts-ignore const base_1 = require("./base"); /** * @export * @enum {string} */ var ItemImageVariantEnum; (function (ItemImageVariantEnum) { ItemImageVariantEnum["Main"] = "MAIN"; ItemImageVariantEnum["Pt01"] = "PT01"; ItemImageVariantEnum["Pt02"] = "PT02"; ItemImageVariantEnum["Pt03"] = "PT03"; ItemImageVariantEnum["Pt04"] = "PT04"; ItemImageVariantEnum["Pt05"] = "PT05"; ItemImageVariantEnum["Pt06"] = "PT06"; ItemImageVariantEnum["Pt07"] = "PT07"; ItemImageVariantEnum["Pt08"] = "PT08"; ItemImageVariantEnum["Swch"] = "SWCH"; })(ItemImageVariantEnum || (exports.ItemImageVariantEnum = ItemImageVariantEnum = {})); /** * @export * @enum {string} */ var ItemVariationsByMarketplaceVariationTypeEnum; (function (ItemVariationsByMarketplaceVariationTypeEnum) { ItemVariationsByMarketplaceVariationTypeEnum["Parent"] = "PARENT"; ItemVariationsByMarketplaceVariationTypeEnum["Child"] = "CHILD"; })(ItemVariationsByMarketplaceVariationTypeEnum || (exports.ItemVariationsByMarketplaceVariationTypeEnum = ItemVariationsByMarketplaceVariationTypeEnum = {})); /** * @export * @enum {string} */ var ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum; (function (ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum) { ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum["Allocated"] = "ALLOCATED"; ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum["BasicReplenishment"] = "BASIC_REPLENISHMENT"; ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum["InSeason"] = "IN_SEASON"; ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum["LimitedReplenishment"] = "LIMITED_REPLENISHMENT"; ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum["ManufacturerOutOfStock"] = "MANUFACTURER_OUT_OF_STOCK"; ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum["NewProduct"] = "NEW_PRODUCT"; ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum["NonReplenishable"] = "NON_REPLENISHABLE"; ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum["NonStockupable"] = "NON_STOCKUPABLE"; ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum["Obsolete"] = "OBSOLETE"; ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum["PlannedReplenishment"] = "PLANNED_REPLENISHMENT"; })(ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum || (exports.ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum = ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum = {})); /** * CatalogApi - axios parameter creator * @export */ const CatalogApiAxiosParamCreator = function (configuration) { return { /** * Retrieves details for an item in the Amazon catalog. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 2 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api). * @param {string} asin The Amazon Standard Identification Number (ASIN) of the item. * @param {Array<string>} marketplaceIds A comma-delimited list of Amazon marketplace identifiers. Data sets in the response contain data only for the specified marketplaces. * @param {Array<'attributes' | 'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>} [includedData] A comma-delimited list of data sets to include in the response. Default: summaries. * @param {string} [locale] Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getCatalogItem: async (asin, marketplaceIds, includedData, locale, options = {}) => { // verify required parameter 'asin' is not null or undefined (0, common_1.assertParamExists)('getCatalogItem', 'asin', asin); // verify required parameter 'marketplaceIds' is not null or undefined (0, common_1.assertParamExists)('getCatalogItem', 'marketplaceIds', marketplaceIds); const localVarPath = `/catalog/2020-12-01/items/{asin}` .replace(`{${"asin"}}`, encodeURIComponent(String(asin))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {}; const localVarQueryParameter = {}; if (marketplaceIds) { localVarQueryParameter['marketplaceIds'] = marketplaceIds.join(base_1.COLLECTION_FORMATS.csv); } if (includedData) { localVarQueryParameter['includedData'] = includedData.join(base_1.COLLECTION_FORMATS.csv); } if (locale !== undefined) { localVarQueryParameter['locale'] = locale; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Search for and return a list of Amazon catalog items and associated information. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 2 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api). * @param {Array<string>} keywords A comma-delimited list of words or item identifiers to search the Amazon catalog for. * @param {Array<string>} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. * @param {Array<'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>} [includedData] A comma-delimited list of data sets to include in the response. Default: summaries. * @param {Array<string>} [brandNames] A comma-delimited list of brand names to limit the search to. * @param {Array<string>} [classificationIds] A comma-delimited list of classification identifiers to limit the search to. * @param {number} [pageSize] Number of results to be returned per page. * @param {string} [pageToken] A token to fetch a certain page when there are multiple pages worth of results. * @param {string} [keywordsLocale] The language the keywords are provided in. Defaults to the primary locale of the marketplace. * @param {string} [locale] Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace. * @param {*} [options] Override http request option. * @throws {RequiredError} */ searchCatalogItems: async (keywords, marketplaceIds, includedData, brandNames, classificationIds, pageSize, pageToken, keywordsLocale, locale, options = {}) => { // verify required parameter 'keywords' is not null or undefined (0, common_1.assertParamExists)('searchCatalogItems', 'keywords', keywords); // verify required parameter 'marketplaceIds' is not null or undefined (0, common_1.assertParamExists)('searchCatalogItems', 'marketplaceIds', marketplaceIds); const localVarPath = `/catalog/2020-12-01/items`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {}; const localVarQueryParameter = {}; if (keywords) { localVarQueryParameter['keywords'] = keywords.join(base_1.COLLECTION_FORMATS.csv); } if (marketplaceIds) { localVarQueryParameter['marketplaceIds'] = marketplaceIds.join(base_1.COLLECTION_FORMATS.csv); } if (includedData) { localVarQueryParameter['includedData'] = includedData.join(base_1.COLLECTION_FORMATS.csv); } if (brandNames) { localVarQueryParameter['brandNames'] = brandNames.join(base_1.COLLECTION_FORMATS.csv); } if (classificationIds) { localVarQueryParameter['classificationIds'] = classificationIds.join(base_1.COLLECTION_FORMATS.csv); } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (pageToken !== undefined) { localVarQueryParameter['pageToken'] = pageToken; } if (keywordsLocale !== undefined) { localVarQueryParameter['keywordsLocale'] = keywordsLocale; } if (locale !== undefined) { localVarQueryParameter['locale'] = locale; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; exports.CatalogApiAxiosParamCreator = CatalogApiAxiosParamCreator; /** * CatalogApi - functional programming interface * @export */ const CatalogApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.CatalogApiAxiosParamCreator)(configuration); return { /** * Retrieves details for an item in the Amazon catalog. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 2 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api). * @param {string} asin The Amazon Standard Identification Number (ASIN) of the item. * @param {Array<string>} marketplaceIds A comma-delimited list of Amazon marketplace identifiers. Data sets in the response contain data only for the specified marketplaces. * @param {Array<'attributes' | 'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>} [includedData] A comma-delimited list of data sets to include in the response. Default: summaries. * @param {string} [locale] Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getCatalogItem(asin, marketplaceIds, includedData, locale, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.getCatalogItem(asin, marketplaceIds, includedData, locale, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, /** * Search for and return a list of Amazon catalog items and associated information. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 2 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api). * @param {Array<string>} keywords A comma-delimited list of words or item identifiers to search the Amazon catalog for. * @param {Array<string>} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. * @param {Array<'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>} [includedData] A comma-delimited list of data sets to include in the response. Default: summaries. * @param {Array<string>} [brandNames] A comma-delimited list of brand names to limit the search to. * @param {Array<string>} [classificationIds] A comma-delimited list of classification identifiers to limit the search to. * @param {number} [pageSize] Number of results to be returned per page. * @param {string} [pageToken] A token to fetch a certain page when there are multiple pages worth of results. * @param {string} [keywordsLocale] The language the keywords are provided in. Defaults to the primary locale of the marketplace. * @param {string} [locale] Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async searchCatalogItems(keywords, marketplaceIds, includedData, brandNames, classificationIds, pageSize, pageToken, keywordsLocale, locale, options) { const localVarAxiosArgs = await localVarAxiosParamCreator.searchCatalogItems(keywords, marketplaceIds, includedData, brandNames, classificationIds, pageSize, pageToken, keywordsLocale, locale, options); return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration); }, }; }; exports.CatalogApiFp = CatalogApiFp; /** * CatalogApi - factory interface * @export */ const CatalogApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.CatalogApiFp)(configuration); return { /** * Retrieves details for an item in the Amazon catalog. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 2 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api). * @param {string} asin The Amazon Standard Identification Number (ASIN) of the item. * @param {Array<string>} marketplaceIds A comma-delimited list of Amazon marketplace identifiers. Data sets in the response contain data only for the specified marketplaces. * @param {Array<'attributes' | 'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>} [includedData] A comma-delimited list of data sets to include in the response. Default: summaries. * @param {string} [locale] Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getCatalogItem(asin, marketplaceIds, includedData, locale, options) { return localVarFp.getCatalogItem(asin, marketplaceIds, includedData, locale, options).then((request) => request(axios, basePath)); }, /** * Search for and return a list of Amazon catalog items and associated information. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 2 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api). * @param {Array<string>} keywords A comma-delimited list of words or item identifiers to search the Amazon catalog for. * @param {Array<string>} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. * @param {Array<'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>} [includedData] A comma-delimited list of data sets to include in the response. Default: summaries. * @param {Array<string>} [brandNames] A comma-delimited list of brand names to limit the search to. * @param {Array<string>} [classificationIds] A comma-delimited list of classification identifiers to limit the search to. * @param {number} [pageSize] Number of results to be returned per page. * @param {string} [pageToken] A token to fetch a certain page when there are multiple pages worth of results. * @param {string} [keywordsLocale] The language the keywords are provided in. Defaults to the primary locale of the marketplace. * @param {string} [locale] Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace. * @param {*} [options] Override http request option. * @throws {RequiredError} */ searchCatalogItems(keywords, marketplaceIds, includedData, brandNames, classificationIds, pageSize, pageToken, keywordsLocale, locale, options) { return localVarFp.searchCatalogItems(keywords, marketplaceIds, includedData, brandNames, classificationIds, pageSize, pageToken, keywordsLocale, locale, options).then((request) => request(axios, basePath)); }, }; }; exports.CatalogApiFactory = CatalogApiFactory; /** * CatalogApi - object-oriented interface * @export * @class CatalogApi * @extends {BaseAPI} */ class CatalogApi extends base_1.BaseAPI { /** * Retrieves details for an item in the Amazon catalog. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 2 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api). * @param {CatalogApiGetCatalogItemRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CatalogApi */ getCatalogItem(requestParameters, options) { return (0, exports.CatalogApiFp)(this.configuration).getCatalogItem(requestParameters.asin, requestParameters.marketplaceIds, requestParameters.includedData, requestParameters.locale, options).then((request) => request(this.axios, this.basePath)); } /** * Search for and return a list of Amazon catalog items and associated information. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 2 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api). * @param {CatalogApiSearchCatalogItemsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CatalogApi */ searchCatalogItems(requestParameters, options) { return (0, exports.CatalogApiFp)(this.configuration).searchCatalogItems(requestParameters.keywords, requestParameters.marketplaceIds, requestParameters.includedData, requestParameters.brandNames, requestParameters.classificationIds, requestParameters.pageSize, requestParameters.pageToken, requestParameters.keywordsLocale, requestParameters.locale, options).then((request) => request(this.axios, this.basePath)); } } exports.CatalogApi = CatalogApi; //# sourceMappingURL=api.js.map