From 5aa37d9a2fb662e15468d36ea6fdafc3169bcde3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 24 Jun 2021 08:02:58 +0700 Subject: [PATCH] feat: support preview API versions (#149) Co-authored-by: nguyentoanit --- .../catalog-items-api-client-v20201201.ts | 14 + src/api-clients/feeds-api-client-v20210630.ts | 14 + src/api-clients/index.ts | 3 + .../reports-api-client-v20210630.ts | 14 + .../catalog-items-api-model-v20201201/api.ts | 927 +++++++++++++ .../catalog-items-api-model-v20201201/base.ts | 71 + .../common.ts | 131 ++ .../configuration.ts | 101 ++ .../index.ts | 18 + .../feeds-api-model-v20210630/api.ts | 852 ++++++++++++ .../feeds-api-model-v20210630/base.ts | 71 + .../feeds-api-model-v20210630/common.ts | 131 ++ .../configuration.ts | 101 ++ .../feeds-api-model-v20210630/index.ts | 18 + src/api-models/index.ts | 69 + .../reports-api-model-v20210630/api.ts | 1210 +++++++++++++++++ .../reports-api-model-v20210630/base.ts | 71 + .../reports-api-model-v20210630/common.ts | 131 ++ .../configuration.ts | 101 ++ .../reports-api-model-v20210630/index.ts | 18 + 20 files changed, 4066 insertions(+) create mode 100644 src/api-clients/catalog-items-api-client-v20201201.ts create mode 100644 src/api-clients/feeds-api-client-v20210630.ts create mode 100644 src/api-clients/reports-api-client-v20210630.ts create mode 100644 src/api-models/catalog-items-api-model-v20201201/api.ts create mode 100644 src/api-models/catalog-items-api-model-v20201201/base.ts create mode 100644 src/api-models/catalog-items-api-model-v20201201/common.ts create mode 100644 src/api-models/catalog-items-api-model-v20201201/configuration.ts create mode 100644 src/api-models/catalog-items-api-model-v20201201/index.ts create mode 100644 src/api-models/feeds-api-model-v20210630/api.ts create mode 100644 src/api-models/feeds-api-model-v20210630/base.ts create mode 100644 src/api-models/feeds-api-model-v20210630/common.ts create mode 100644 src/api-models/feeds-api-model-v20210630/configuration.ts create mode 100644 src/api-models/feeds-api-model-v20210630/index.ts create mode 100644 src/api-models/reports-api-model-v20210630/api.ts create mode 100644 src/api-models/reports-api-model-v20210630/base.ts create mode 100644 src/api-models/reports-api-model-v20210630/common.ts create mode 100644 src/api-models/reports-api-model-v20210630/configuration.ts create mode 100644 src/api-models/reports-api-model-v20210630/index.ts diff --git a/src/api-clients/catalog-items-api-client-v20201201.ts b/src/api-clients/catalog-items-api-client-v20201201.ts new file mode 100644 index 00000000..173e4d63 --- /dev/null +++ b/src/api-clients/catalog-items-api-client-v20201201.ts @@ -0,0 +1,14 @@ +import { CatalogApi, Configuration } from '../api-models/catalog-items-api-model-v20201201' +import { ApiClientHelpers } from '../helpers' +import { DEFAULT_API_BASE_PATH } from '../types' +import { APIConfigurationParameters } from '../types/api-clients/api-configuration-parameters' + +export class CatalogItemsApiClientV20201201 extends CatalogApi { + constructor(parameters: APIConfigurationParameters) { + const axios = ApiClientHelpers.getAxiosInstance(parameters) + + const configuration = new Configuration(parameters) + + super(configuration, DEFAULT_API_BASE_PATH, axios) + } +} diff --git a/src/api-clients/feeds-api-client-v20210630.ts b/src/api-clients/feeds-api-client-v20210630.ts new file mode 100644 index 00000000..51fcc8c8 --- /dev/null +++ b/src/api-clients/feeds-api-client-v20210630.ts @@ -0,0 +1,14 @@ +import { Configuration, FeedsApi } from '../api-models/feeds-api-model-v20210630' +import { ApiClientHelpers } from '../helpers' +import { DEFAULT_API_BASE_PATH } from '../types' +import { APIConfigurationParameters } from '../types/api-clients/api-configuration-parameters' + +export class FeedsApiClientV20210630 extends FeedsApi { + constructor(parameters: APIConfigurationParameters) { + const axios = ApiClientHelpers.getAxiosInstance(parameters) + + const configuration = new Configuration(parameters) + + super(configuration, DEFAULT_API_BASE_PATH, axios) + } +} diff --git a/src/api-clients/index.ts b/src/api-clients/index.ts index 28fbb39f..0d72b164 100644 --- a/src/api-clients/index.ts +++ b/src/api-clients/index.ts @@ -1,10 +1,12 @@ export * from './aplus-content-api-client' export * from './authorization-api-client' export * from './catalog-items-api-client' +export * from './catalog-items-api-client-v20201201' export * from './fba-inbound-eligibility-api-client' export * from './fba-inventory-api-client' export * from './fba-small-and-light-api-client' export * from './feeds-api-client' +export * from './feeds-api-client-v20210630' export * from './finances-api-client' export * from './fulfillment-inbound-api-client' export * from './fulfillment-outbound-api-client' @@ -17,6 +19,7 @@ export * from './product-fees-api-client' export * from './product-pricing-api-client' export * from './product-type-definitions-api-client' export * from './reports-api-client' +export * from './reports-api-client-v20210630' export * from './sales-api-client' export * from './sellers-api-client' export * from './services-api-client' diff --git a/src/api-clients/reports-api-client-v20210630.ts b/src/api-clients/reports-api-client-v20210630.ts new file mode 100644 index 00000000..deff036b --- /dev/null +++ b/src/api-clients/reports-api-client-v20210630.ts @@ -0,0 +1,14 @@ +import { Configuration, ReportsApi } from '../api-models/reports-api-model-v20210630' +import { ApiClientHelpers } from '../helpers' +import { DEFAULT_API_BASE_PATH } from '../types' +import { APIConfigurationParameters } from '../types/api-clients/api-configuration-parameters' + +export class ReportsApiClientV20210630 extends ReportsApi { + constructor(parameters: APIConfigurationParameters) { + const axios = ApiClientHelpers.getAxiosInstance(parameters) + + const configuration = new Configuration(parameters) + + super(configuration, DEFAULT_API_BASE_PATH, axios) + } +} diff --git a/src/api-models/catalog-items-api-model-v20201201/api.ts b/src/api-models/catalog-items-api-model-v20201201/api.ts new file mode 100644 index 00000000..ca68b198 --- /dev/null +++ b/src/api-models/catalog-items-api-model-v20201201/api.ts @@ -0,0 +1,927 @@ +/* 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. + * + * 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. + */ + + +import { Configuration } from './configuration'; +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; + +/** + * Description of a brand that can be used to get more fine-grained search results. + * @export + * @interface BrandRefinement + */ +export interface BrandRefinement { + /** + * The estimated number of results that would still be returned if refinement key applied. + * @type {number} + * @memberof BrandRefinement + */ + numberOfResults: number; + /** + * Brand name. For display and can be used as a search refinement. + * @type {string} + * @memberof BrandRefinement + */ + brandName: string; +} +/** + * Description of a classification that can be used to get more fine-grained search results. + * @export + * @interface ClassificationRefinement + */ +export interface ClassificationRefinement { + /** + * The estimated number of results that would still be returned if refinement key applied. + * @type {number} + * @memberof ClassificationRefinement + */ + numberOfResults: number; + /** + * Display name for the classification. + * @type {string} + * @memberof ClassificationRefinement + */ + displayName: string; + /** + * Identifier for the classification that can be used for search refinement purposes. + * @type {string} + * @memberof ClassificationRefinement + */ + classificationId: string; +} +/** + * A list of error responses returned when a request is unsuccessful. + * @export + * @interface ErrorList + */ +export interface ErrorList { + /** + * + * @type {Array} + * @memberof ErrorList + */ + errors: Array; +} +/** + * An item in the Amazon catalog. + * @export + * @interface Item + */ +export interface Item { + /** + * Amazon Standard Identification Number (ASIN) is the unique identifier for an item in the Amazon catalog. + * @type {string} + * @memberof Item + */ + asin: string; + /** + * A JSON object that contains structured item attribute data keyed by attribute name. Catalog item attributes are available only to brand owners and conform to the related product type definitions available in the Selling Partner API for Product Type Definitions. + * @type {object} + * @memberof Item + */ + attributes?: object; + /** + * Identifiers associated with the item in the Amazon catalog, such as UPC and EAN identifiers. + * @type {Array} + * @memberof Item + */ + identifiers?: Array; + /** + * Images for an item in the Amazon catalog. All image variants are provided to brand owners. Otherwise, a thumbnail of the \"MAIN\" image variant is provided. + * @type {Array} + * @memberof Item + */ + images?: Array; + /** + * Product types associated with the Amazon catalog item. + * @type {Array} + * @memberof Item + */ + productTypes?: Array; + /** + * Sales ranks of an Amazon catalog item. + * @type {Array} + * @memberof Item + */ + salesRanks?: Array; + /** + * Summary details of an Amazon catalog item. + * @type {Array} + * @memberof Item + */ + summaries?: Array; + /** + * Variation details by marketplace for an Amazon catalog item (variation relationships). + * @type {Array} + * @memberof Item + */ + variations?: Array; + /** + * Vendor details associated with an Amazon catalog item. Vendor details are available to vendors only. + * @type {Array} + * @memberof Item + */ + vendorDetails?: Array; +} +/** + * Identifier associated with the item in the Amazon catalog, such as a UPC or EAN identifier. + * @export + * @interface ItemIdentifier + */ +export interface ItemIdentifier { + /** + * Type of identifier, such as UPC, EAN, or ISBN. + * @type {string} + * @memberof ItemIdentifier + */ + identifierType: string; + /** + * Identifier. + * @type {string} + * @memberof ItemIdentifier + */ + identifier: string; +} +/** + * Identifiers associated with the item in the Amazon catalog for the indicated Amazon marketplace. + * @export + * @interface ItemIdentifiersByMarketplace + */ +export interface ItemIdentifiersByMarketplace { + /** + * Amazon marketplace identifier. + * @type {string} + * @memberof ItemIdentifiersByMarketplace + */ + marketplaceId: string; + /** + * Identifiers associated with the item in the Amazon catalog for the indicated Amazon marketplace. + * @type {Array} + * @memberof ItemIdentifiersByMarketplace + */ + identifiers: Array; +} +/** + * Image for an item in the Amazon catalog. + * @export + * @interface ItemImage + */ +export interface ItemImage { + /** + * Variant of the image, such as MAIN or PT01. + * @type {string} + * @memberof ItemImage + */ + variant: ItemImageVariantEnum | 'MAIN' | 'PT01' | 'PT02' | 'PT03' | 'PT04' | 'PT05' | 'PT06' | 'PT07' | 'PT08' | 'SWCH'; + /** + * Link, or URL, for the image. + * @type {string} + * @memberof ItemImage + */ + link: string; + /** + * Height of the image in pixels. + * @type {number} + * @memberof ItemImage + */ + height: number; + /** + * Width of the image in pixels. + * @type {number} + * @memberof ItemImage + */ + width: number; +} + +/** + * @export + * @enum {string} + */ +export enum ItemImageVariantEnum { + Main = 'MAIN', + Pt01 = 'PT01', + Pt02 = 'PT02', + Pt03 = 'PT03', + Pt04 = 'PT04', + Pt05 = 'PT05', + Pt06 = 'PT06', + Pt07 = 'PT07', + Pt08 = 'PT08', + Swch = 'SWCH' +} + +/** + * Images for an item in the Amazon catalog for the indicated Amazon marketplace. + * @export + * @interface ItemImagesByMarketplace + */ +export interface ItemImagesByMarketplace { + /** + * Amazon marketplace identifier. + * @type {string} + * @memberof ItemImagesByMarketplace + */ + marketplaceId: string; + /** + * Images for an item in the Amazon catalog for the indicated Amazon marketplace. + * @type {Array} + * @memberof ItemImagesByMarketplace + */ + images: Array; +} +/** + * Product type associated with the Amazon catalog item for the indicated Amazon marketplace. + * @export + * @interface ItemProductTypeByMarketplace + */ +export interface ItemProductTypeByMarketplace { + /** + * Amazon marketplace identifier. + * @type {string} + * @memberof ItemProductTypeByMarketplace + */ + marketplaceId?: string; + /** + * Name of the product type associated with the Amazon catalog item. + * @type {string} + * @memberof ItemProductTypeByMarketplace + */ + productType?: string; +} +/** + * Sales rank of an Amazon catalog item. + * @export + * @interface ItemSalesRank + */ +export interface ItemSalesRank { + /** + * Title, or name, of the sales rank. + * @type {string} + * @memberof ItemSalesRank + */ + title: string; + /** + * Corresponding Amazon retail website link, or URL, for the sales rank. + * @type {string} + * @memberof ItemSalesRank + */ + link?: string; + /** + * Sales rank value. + * @type {number} + * @memberof ItemSalesRank + */ + rank: number; +} +/** + * Sales ranks of an Amazon catalog item for the indicated Amazon marketplace. + * @export + * @interface ItemSalesRanksByMarketplace + */ +export interface ItemSalesRanksByMarketplace { + /** + * Amazon marketplace identifier. + * @type {string} + * @memberof ItemSalesRanksByMarketplace + */ + marketplaceId: string; + /** + * Sales ranks of an Amazon catalog item for an Amazon marketplace. + * @type {Array} + * @memberof ItemSalesRanksByMarketplace + */ + ranks: Array; +} +/** + * Items in the Amazon catalog and search related metadata. + * @export + * @interface ItemSearchResults + */ +export interface ItemSearchResults { + /** + * The estimated total number of products matched by the search query (only results up to the page count limit will be returned per request regardless of the number found). Note: The maximum number of items (ASINs) that can be returned and paged through is 1000. + * @type {number} + * @memberof ItemSearchResults + */ + numberOfResults: number; + /** + * + * @type {Pagination} + * @memberof ItemSearchResults + */ + pagination: Pagination; + /** + * + * @type {Refinements} + * @memberof ItemSearchResults + */ + refinements: Refinements; + /** + * A list of items from the Amazon catalog. + * @type {Array} + * @memberof ItemSearchResults + */ + items: Array; +} +/** + * Summary details of an Amazon catalog item for the indicated Amazon marketplace. + * @export + * @interface ItemSummaryByMarketplace + */ +export interface ItemSummaryByMarketplace { + /** + * Amazon marketplace identifier. + * @type {string} + * @memberof ItemSummaryByMarketplace + */ + marketplaceId: string; + /** + * Name of the brand associated with an Amazon catalog item. + * @type {string} + * @memberof ItemSummaryByMarketplace + */ + brandName?: string; + /** + * Identifier of the browse node associated with an Amazon catalog item. + * @type {string} + * @memberof ItemSummaryByMarketplace + */ + browseNode?: string; + /** + * Name of the color associated with an Amazon catalog item. + * @type {string} + * @memberof ItemSummaryByMarketplace + */ + colorName?: string; + /** + * Name, or title, associated with an Amazon catalog item. + * @type {string} + * @memberof ItemSummaryByMarketplace + */ + itemName?: string; + /** + * Name of the manufacturer associated with an Amazon catalog item. + * @type {string} + * @memberof ItemSummaryByMarketplace + */ + manufacturer?: string; + /** + * Model number associated with an Amazon catalog item. + * @type {string} + * @memberof ItemSummaryByMarketplace + */ + modelNumber?: string; + /** + * Name of the size associated with an Amazon catalog item. + * @type {string} + * @memberof ItemSummaryByMarketplace + */ + sizeName?: string; + /** + * Name of the style associated with an Amazon catalog item. + * @type {string} + * @memberof ItemSummaryByMarketplace + */ + styleName?: string; +} +/** + * Variation details for the Amazon catalog item for the indicated Amazon marketplace. + * @export + * @interface ItemVariationsByMarketplace + */ +export interface ItemVariationsByMarketplace { + /** + * Amazon marketplace identifier. + * @type {string} + * @memberof ItemVariationsByMarketplace + */ + marketplaceId: string; + /** + * Identifiers (ASINs) of the related items. + * @type {Array} + * @memberof ItemVariationsByMarketplace + */ + asins: Array; + /** + * Type of variation relationship of the Amazon catalog item in the request to the related item(s): \"PARENT\" or \"CHILD\". + * @type {string} + * @memberof ItemVariationsByMarketplace + */ + variationType: ItemVariationsByMarketplaceVariationTypeEnum | 'PARENT' | 'CHILD'; +} + +/** + * @export + * @enum {string} + */ +export enum ItemVariationsByMarketplaceVariationTypeEnum { + Parent = 'PARENT', + Child = 'CHILD' +} + +/** + * Vendor details associated with an Amazon catalog item for the indicated Amazon marketplace. + * @export + * @interface ItemVendorDetailsByMarketplace + */ +export interface ItemVendorDetailsByMarketplace { + /** + * Amazon marketplace identifier. + * @type {string} + * @memberof ItemVendorDetailsByMarketplace + */ + marketplaceId: string; + /** + * Brand code associated with an Amazon catalog item. + * @type {string} + * @memberof ItemVendorDetailsByMarketplace + */ + brandCode?: string; + /** + * Product category associated with an Amazon catalog item. + * @type {string} + * @memberof ItemVendorDetailsByMarketplace + */ + categoryCode?: string; + /** + * Manufacturer code associated with an Amazon catalog item. + * @type {string} + * @memberof ItemVendorDetailsByMarketplace + */ + manufacturerCode?: string; + /** + * Parent vendor code of the manufacturer code. + * @type {string} + * @memberof ItemVendorDetailsByMarketplace + */ + manufacturerCodeParent?: string; + /** + * Product group associated with an Amazon catalog item. + * @type {string} + * @memberof ItemVendorDetailsByMarketplace + */ + productGroup?: string; + /** + * Replenishment category associated with an Amazon catalog item. + * @type {string} + * @memberof ItemVendorDetailsByMarketplace + */ + replenishmentCategory?: ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum | 'ALLOCATED' | 'BASIC_REPLENISHMENT' | 'IN_SEASON' | 'LIMITED_REPLENISHMENT' | 'MANUFACTURER_OUT_OF_STOCK' | 'NEW_PRODUCT' | 'NON_REPLENISHABLE' | 'NON_STOCKUPABLE' | 'OBSOLETE' | 'PLANNED_REPLENISHMENT'; + /** + * Product subcategory associated with an Amazon catalog item. + * @type {string} + * @memberof ItemVendorDetailsByMarketplace + */ + subcategoryCode?: string; +} + +/** + * @export + * @enum {string} + */ +export enum ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum { + Allocated = 'ALLOCATED', + BasicReplenishment = 'BASIC_REPLENISHMENT', + InSeason = 'IN_SEASON', + LimitedReplenishment = 'LIMITED_REPLENISHMENT', + ManufacturerOutOfStock = 'MANUFACTURER_OUT_OF_STOCK', + NewProduct = 'NEW_PRODUCT', + NonReplenishable = 'NON_REPLENISHABLE', + NonStockupable = 'NON_STOCKUPABLE', + Obsolete = 'OBSOLETE', + PlannedReplenishment = 'PLANNED_REPLENISHMENT' +} + +/** + * Error response returned when the request is unsuccessful. + * @export + * @interface ModelError + */ +export interface ModelError { + /** + * An error code that identifies the type of error that occurred. + * @type {string} + * @memberof ModelError + */ + code: string; + /** + * A message that describes the error condition. + * @type {string} + * @memberof ModelError + */ + message: string; + /** + * Additional details that can help the caller understand or fix the issue. + * @type {string} + * @memberof ModelError + */ + details?: string; +} +/** + * When a request produces a response that exceeds the pageSize, pagination occurs. This means the response is divided into individual pages. To retrieve the next page or the previous page, you must pass the nextToken value or the previousToken value as the pageToken parameter in the next request. When you receive the last page, there will be no nextToken key in the pagination object. + * @export + * @interface Pagination + */ +export interface Pagination { + /** + * A token that can be used to fetch the next page. + * @type {string} + * @memberof Pagination + */ + nextToken?: string; + /** + * A token that can be used to fetch the previous page. + * @type {string} + * @memberof Pagination + */ + previousToken?: string; +} +/** + * Search refinements. + * @export + * @interface Refinements + */ +export interface Refinements { + /** + * Brand search refinements. + * @type {Array} + * @memberof Refinements + */ + brands: Array; + /** + * Classification search refinements. + * @type {Array} + * @memberof Refinements + */ + classifications: Array; +} + +/** + * CatalogApi - axios parameter creator + * @export + */ +export const CatalogApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Retrieves details for an item in the Amazon catalog. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 5 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} asin The Amazon Standard Identification Number (ASIN) of the item. + * @param {Array} 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: string, marketplaceIds: Array, includedData?: Array<'attributes' | 'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>, locale?: string, options: any = {}): Promise => { + // verify required parameter 'asin' is not null or undefined + assertParamExists('getCatalogItem', 'asin', asin) + // verify required parameter 'marketplaceIds' is not null or undefined + 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, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (marketplaceIds) { + localVarQueryParameter['marketplaceIds'] = marketplaceIds.join(COLLECTION_FORMATS.csv); + } + + if (includedData) { + localVarQueryParameter['includedData'] = includedData.join(COLLECTION_FORMATS.csv); + } + + if (locale !== undefined) { + localVarQueryParameter['locale'] = locale; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Search for and return a list of Amazon catalog items and associated information. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1 | 5 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} keywords A comma-delimited list of words or item identifiers to search the Amazon catalog for. + * @param {Array} 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} [brandNames] A comma-delimited list of brand names to limit the search to. + * @param {Array} [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: Array, marketplaceIds: Array, includedData?: Array<'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>, brandNames?: Array, classificationIds?: Array, pageSize?: number, pageToken?: string, keywordsLocale?: string, locale?: string, options: any = {}): Promise => { + // verify required parameter 'keywords' is not null or undefined + assertParamExists('searchCatalogItems', 'keywords', keywords) + // verify required parameter 'marketplaceIds' is not null or undefined + 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, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (keywords) { + localVarQueryParameter['keywords'] = keywords.join(COLLECTION_FORMATS.csv); + } + + if (marketplaceIds) { + localVarQueryParameter['marketplaceIds'] = marketplaceIds.join(COLLECTION_FORMATS.csv); + } + + if (includedData) { + localVarQueryParameter['includedData'] = includedData.join(COLLECTION_FORMATS.csv); + } + + if (brandNames) { + localVarQueryParameter['brandNames'] = brandNames.join(COLLECTION_FORMATS.csv); + } + + if (classificationIds) { + localVarQueryParameter['classificationIds'] = classificationIds.join(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; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * CatalogApi - functional programming interface + * @export + */ +export const CatalogApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = CatalogApiAxiosParamCreator(configuration) + return { + /** + * Retrieves details for an item in the Amazon catalog. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 5 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} asin The Amazon Standard Identification Number (ASIN) of the item. + * @param {Array} 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: string, marketplaceIds: Array, includedData?: Array<'attributes' | 'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>, locale?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getCatalogItem(asin, marketplaceIds, includedData, locale, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Search for and return a list of Amazon catalog items and associated information. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1 | 5 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} keywords A comma-delimited list of words or item identifiers to search the Amazon catalog for. + * @param {Array} 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} [brandNames] A comma-delimited list of brand names to limit the search to. + * @param {Array} [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: Array, marketplaceIds: Array, includedData?: Array<'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>, brandNames?: Array, classificationIds?: Array, pageSize?: number, pageToken?: string, keywordsLocale?: string, locale?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.searchCatalogItems(keywords, marketplaceIds, includedData, brandNames, classificationIds, pageSize, pageToken, keywordsLocale, locale, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * CatalogApi - factory interface + * @export + */ +export const CatalogApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = CatalogApiFp(configuration) + return { + /** + * Retrieves details for an item in the Amazon catalog. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 5 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} asin The Amazon Standard Identification Number (ASIN) of the item. + * @param {Array} 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: string, marketplaceIds: Array, includedData?: Array<'attributes' | 'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>, locale?: string, options?: any): AxiosPromise { + 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 Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1 | 5 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} keywords A comma-delimited list of words or item identifiers to search the Amazon catalog for. + * @param {Array} 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} [brandNames] A comma-delimited list of brand names to limit the search to. + * @param {Array} [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: Array, marketplaceIds: Array, includedData?: Array<'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>, brandNames?: Array, classificationIds?: Array, pageSize?: number, pageToken?: string, keywordsLocale?: string, locale?: string, options?: any): AxiosPromise { + return localVarFp.searchCatalogItems(keywords, marketplaceIds, includedData, brandNames, classificationIds, pageSize, pageToken, keywordsLocale, locale, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * Request parameters for getCatalogItem operation in CatalogApi. + * @export + * @interface CatalogApiGetCatalogItemRequest + */ +export interface CatalogApiGetCatalogItemRequest { + /** + * The Amazon Standard Identification Number (ASIN) of the item. + * @type {string} + * @memberof CatalogApiGetCatalogItem + */ + readonly asin: string + + /** + * A comma-delimited list of Amazon marketplace identifiers. Data sets in the response contain data only for the specified marketplaces. + * @type {Array} + * @memberof CatalogApiGetCatalogItem + */ + readonly marketplaceIds: Array + + /** + * A comma-delimited list of data sets to include in the response. Default: summaries. + * @type {Array<'attributes' | 'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>} + * @memberof CatalogApiGetCatalogItem + */ + readonly includedData?: Array<'attributes' | 'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'> + + /** + * Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace. + * @type {string} + * @memberof CatalogApiGetCatalogItem + */ + readonly locale?: string +} + +/** + * Request parameters for searchCatalogItems operation in CatalogApi. + * @export + * @interface CatalogApiSearchCatalogItemsRequest + */ +export interface CatalogApiSearchCatalogItemsRequest { + /** + * A comma-delimited list of words or item identifiers to search the Amazon catalog for. + * @type {Array} + * @memberof CatalogApiSearchCatalogItems + */ + readonly keywords: Array + + /** + * A comma-delimited list of Amazon marketplace identifiers for the request. + * @type {Array} + * @memberof CatalogApiSearchCatalogItems + */ + readonly marketplaceIds: Array + + /** + * A comma-delimited list of data sets to include in the response. Default: summaries. + * @type {Array<'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'>} + * @memberof CatalogApiSearchCatalogItems + */ + readonly includedData?: Array<'identifiers' | 'images' | 'productTypes' | 'salesRanks' | 'summaries' | 'variations' | 'vendorDetails'> + + /** + * A comma-delimited list of brand names to limit the search to. + * @type {Array} + * @memberof CatalogApiSearchCatalogItems + */ + readonly brandNames?: Array + + /** + * A comma-delimited list of classification identifiers to limit the search to. + * @type {Array} + * @memberof CatalogApiSearchCatalogItems + */ + readonly classificationIds?: Array + + /** + * Number of results to be returned per page. + * @type {number} + * @memberof CatalogApiSearchCatalogItems + */ + readonly pageSize?: number + + /** + * A token to fetch a certain page when there are multiple pages worth of results. + * @type {string} + * @memberof CatalogApiSearchCatalogItems + */ + readonly pageToken?: string + + /** + * The language the keywords are provided in. Defaults to the primary locale of the marketplace. + * @type {string} + * @memberof CatalogApiSearchCatalogItems + */ + readonly keywordsLocale?: string + + /** + * Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace. + * @type {string} + * @memberof CatalogApiSearchCatalogItems + */ + readonly locale?: string +} + +/** + * CatalogApi - object-oriented interface + * @export + * @class CatalogApi + * @extends {BaseAPI} + */ +export class CatalogApi extends BaseAPI { + /** + * Retrieves details for an item in the Amazon catalog. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 5 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CatalogApiGetCatalogItemRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CatalogApi + */ + public getCatalogItem(requestParameters: CatalogApiGetCatalogItemRequest, options?: any) { + return 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 Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1 | 5 | |Selling partner specific| Variable | Variable | The x-amzn-RateLimit-Limit response header returns the usage plan rate limits that were applied to the requested operation. Rate limits for some selling partners will vary from the default rate and burst shown in the table above. For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CatalogApiSearchCatalogItemsRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof CatalogApi + */ + public searchCatalogItems(requestParameters: CatalogApiSearchCatalogItemsRequest, options?: any) { + return 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)); + } +} + + diff --git a/src/api-models/catalog-items-api-model-v20201201/base.ts b/src/api-models/catalog-items-api-model-v20201201/base.ts new file mode 100644 index 00000000..bf09a99f --- /dev/null +++ b/src/api-models/catalog-items-api-model-v20201201/base.ts @@ -0,0 +1,71 @@ +/* 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. + * + * 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. + */ + + +import { Configuration } from "./configuration"; +// Some imports not used depending on template conditions +// @ts-ignore +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; + +export const BASE_PATH = "https://sellingpartnerapi-na.amazon.com".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} diff --git a/src/api-models/catalog-items-api-model-v20201201/common.ts b/src/api-models/catalog-items-api-model-v20201201/common.ts new file mode 100644 index 00000000..35598ff6 --- /dev/null +++ b/src/api-models/catalog-items-api-model-v20201201/common.ts @@ -0,0 +1,131 @@ +/* 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. + * + * 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. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/src/api-models/catalog-items-api-model-v20201201/configuration.ts b/src/api-models/catalog-items-api-model-v20201201/configuration.ts new file mode 100644 index 00000000..fac6432f --- /dev/null +++ b/src/api-models/catalog-items-api-model-v20201201/configuration.ts @@ -0,0 +1,101 @@ +/* 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. + * + * 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. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/src/api-models/catalog-items-api-model-v20201201/index.ts b/src/api-models/catalog-items-api-model-v20201201/index.ts new file mode 100644 index 00000000..539813bb --- /dev/null +++ b/src/api-models/catalog-items-api-model-v20201201/index.ts @@ -0,0 +1,18 @@ +/* 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. + * + * 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. + */ + + +export * from "./api"; +export * from "./configuration"; + diff --git a/src/api-models/feeds-api-model-v20210630/api.ts b/src/api-models/feeds-api-model-v20210630/api.ts new file mode 100644 index 00000000..edea68d4 --- /dev/null +++ b/src/api-models/feeds-api-model-v20210630/api.ts @@ -0,0 +1,852 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Feeds + * The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner. + * + * The version of the OpenAPI document: 2021-06-30 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from './configuration'; +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; + +/** + * Information required to upload a feed document\'s contents. + * @export + * @interface CreateFeedDocumentResponse + */ +export interface CreateFeedDocumentResponse { + /** + * The identifier of the feed document. + * @type {string} + * @memberof CreateFeedDocumentResponse + */ + feedDocumentId: string; + /** + * The presigned URL for uploading the feed contents. This URL expires after 5 minutes. + * @type {string} + * @memberof CreateFeedDocumentResponse + */ + url: string; +} +/** + * + * @export + * @interface CreateFeedDocumentSpecification + */ +export interface CreateFeedDocumentSpecification { + /** + * The content type of the feed. + * @type {string} + * @memberof CreateFeedDocumentSpecification + */ + contentType: string; +} +/** + * + * @export + * @interface CreateFeedResponse + */ +export interface CreateFeedResponse { + /** + * The identifier for the feed. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof CreateFeedResponse + */ + feedId: string; +} +/** + * + * @export + * @interface CreateFeedSpecification + */ +export interface CreateFeedSpecification { + /** + * The feed type. + * @type {string} + * @memberof CreateFeedSpecification + */ + feedType: string; + /** + * A list of identifiers for marketplaces that you want the feed to be applied to. + * @type {Array} + * @memberof CreateFeedSpecification + */ + marketplaceIds: Array; + /** + * The document identifier returned by the createFeedDocument operation. Upload the feed document contents before calling the createFeed operation. + * @type {string} + * @memberof CreateFeedSpecification + */ + inputFeedDocumentId: string; + /** + * Additional options to control the feed. These vary by feed type. + * @type {{ [key: string]: string; }} + * @memberof CreateFeedSpecification + */ + feedOptions?: { [key: string]: string; }; +} +/** + * A list of error responses returned when a request is unsuccessful. + * @export + * @interface ErrorList + */ +export interface ErrorList { + /** + * + * @type {Array} + * @memberof ErrorList + */ + errors: Array; +} +/** + * + * @export + * @interface Feed + */ +export interface Feed { + /** + * The identifier for the feed. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof Feed + */ + feedId: string; + /** + * The feed type. + * @type {string} + * @memberof Feed + */ + feedType: string; + /** + * A list of identifiers for the marketplaces that the feed is applied to. + * @type {Array} + * @memberof Feed + */ + marketplaceIds?: Array; + /** + * The date and time when the feed was created, in ISO 8601 date time format. + * @type {string} + * @memberof Feed + */ + createdTime: string; + /** + * The processing status of the feed. + * @type {string} + * @memberof Feed + */ + processingStatus: FeedProcessingStatusEnum | 'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'; + /** + * The date and time when feed processing started, in ISO 8601 date time format. + * @type {string} + * @memberof Feed + */ + processingStartTime?: string; + /** + * The date and time when feed processing completed, in ISO 8601 date time format. + * @type {string} + * @memberof Feed + */ + processingEndTime?: string; + /** + * The identifier for the feed document. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof Feed + */ + resultFeedDocumentId?: string; +} + +/** + * @export + * @enum {string} + */ +export enum FeedProcessingStatusEnum { + Cancelled = 'CANCELLED', + Done = 'DONE', + Fatal = 'FATAL', + InProgress = 'IN_PROGRESS', + InQueue = 'IN_QUEUE' +} + +/** + * + * @export + * @interface FeedDocument + */ +export interface FeedDocument { + /** + * The identifier for the feed document. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof FeedDocument + */ + feedDocumentId: string; + /** + * A presigned URL for the feed document. This URL expires after 5 minutes. + * @type {string} + * @memberof FeedDocument + */ + url: string; + /** + * If present, the feed document contents are compressed using the indicated algorithm. + * @type {string} + * @memberof FeedDocument + */ + compressionAlgorithm?: FeedDocumentCompressionAlgorithmEnum | 'GZIP'; +} + +/** + * @export + * @enum {string} + */ +export enum FeedDocumentCompressionAlgorithmEnum { + Gzip = 'GZIP' +} + +/** + * Response schema. + * @export + * @interface GetFeedsResponse + */ +export interface GetFeedsResponse { + /** + * + * @type {Array} + * @memberof GetFeedsResponse + */ + feeds: Array; + /** + * Returned when the number of results exceeds pageSize. To get the next page of results, call the getFeeds operation with this token as the only parameter. + * @type {string} + * @memberof GetFeedsResponse + */ + nextToken?: string; +} +/** + * An error response returned when the request is unsuccessful. + * @export + * @interface ModelError + */ +export interface ModelError { + /** + * An error code that identifies the type of error that occurred. + * @type {string} + * @memberof ModelError + */ + code: string; + /** + * A message that describes the error condition in a human-readable form. + * @type {string} + * @memberof ModelError + */ + message: string; + /** + * Additional details that can help the caller understand or fix the issue. + * @type {string} + * @memberof ModelError + */ + details?: string; +} + +/** + * FeedsApi - axios parameter creator + * @export + */ +export const FeedsApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Cancels the feed that you specify. Only feeds with processingStatus=IN_QUEUE can be cancelled. Cancelled feeds are returned in subsequent calls to the getFeed and getFeeds operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} feedId The identifier for the feed. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelFeed: async (feedId: string, options: any = {}): Promise => { + // verify required parameter 'feedId' is not null or undefined + assertParamExists('cancelFeed', 'feedId', feedId) + const localVarPath = `/feeds/2021-06-30/feeds/{feedId}` + .replace(`{${"feedId"}}`, encodeURIComponent(String(feedId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Creates a feed. Upload the contents of the feed document before calling this operation. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0083 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateFeedSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createFeed: async (body: CreateFeedSpecification, options: any = {}): Promise => { + // verify required parameter 'body' is not null or undefined + assertParamExists('createFeed', 'body', body) + const localVarPath = `/feeds/2021-06-30/feeds`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading the feed document contents. It also returns a feedDocumentId value that you can pass in with a subsequent call to the createFeed operation. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0083 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateFeedDocumentSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createFeedDocument: async (body: CreateFeedDocumentSpecification, options: any = {}): Promise => { + // verify required parameter 'body' is not null or undefined + assertParamExists('createFeedDocument', 'body', body) + const localVarPath = `/feeds/2021-06-30/documents`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns feed details (including the resultDocumentId, if available) for the feed that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} feedId The identifier for the feed. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getFeed: async (feedId: string, options: any = {}): Promise => { + // verify required parameter 'feedId' is not null or undefined + assertParamExists('getFeed', 'feedId', feedId) + const localVarPath = `/feeds/2021-06-30/feeds/{feedId}` + .replace(`{${"feedId"}}`, encodeURIComponent(String(feedId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the information required for retrieving a feed document\'s contents. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} feedDocumentId The identifier of the feed document. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getFeedDocument: async (feedDocumentId: string, options: any = {}): Promise => { + // verify required parameter 'feedDocumentId' is not null or undefined + assertParamExists('getFeedDocument', 'feedDocumentId', feedDocumentId) + const localVarPath = `/feeds/2021-06-30/documents/{feedDocumentId}` + .replace(`{${"feedDocumentId"}}`, encodeURIComponent(String(feedDocumentId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns feed details for the feeds that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} [feedTypes] A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required. + * @param {Array} [marketplaceIds] A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify. + * @param {number} [pageSize] The maximum number of feeds to return in a single call. + * @param {Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>} [processingStatuses] A list of processing statuses used to filter feeds. + * @param {string} [createdSince] The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days. + * @param {string} [createdUntil] The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now. + * @param {string} [nextToken] A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getFeeds: async (feedTypes?: Array, marketplaceIds?: Array, pageSize?: number, processingStatuses?: Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>, createdSince?: string, createdUntil?: string, nextToken?: string, options: any = {}): Promise => { + const localVarPath = `/feeds/2021-06-30/feeds`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (feedTypes) { + localVarQueryParameter['feedTypes'] = feedTypes.join(COLLECTION_FORMATS.csv); + } + + if (marketplaceIds) { + localVarQueryParameter['marketplaceIds'] = marketplaceIds.join(COLLECTION_FORMATS.csv); + } + + if (pageSize !== undefined) { + localVarQueryParameter['pageSize'] = pageSize; + } + + if (processingStatuses) { + localVarQueryParameter['processingStatuses'] = processingStatuses.join(COLLECTION_FORMATS.csv); + } + + if (createdSince !== undefined) { + localVarQueryParameter['createdSince'] = (createdSince as any instanceof Date) ? + (createdSince as any).toISOString() : + createdSince; + } + + if (createdUntil !== undefined) { + localVarQueryParameter['createdUntil'] = (createdUntil as any instanceof Date) ? + (createdUntil as any).toISOString() : + createdUntil; + } + + if (nextToken !== undefined) { + localVarQueryParameter['nextToken'] = nextToken; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * FeedsApi - functional programming interface + * @export + */ +export const FeedsApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = FeedsApiAxiosParamCreator(configuration) + return { + /** + * Cancels the feed that you specify. Only feeds with processingStatus=IN_QUEUE can be cancelled. Cancelled feeds are returned in subsequent calls to the getFeed and getFeeds operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} feedId The identifier for the feed. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async cancelFeed(feedId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.cancelFeed(feedId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Creates a feed. Upload the contents of the feed document before calling this operation. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0083 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateFeedSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createFeed(body: CreateFeedSpecification, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createFeed(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading the feed document contents. It also returns a feedDocumentId value that you can pass in with a subsequent call to the createFeed operation. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0083 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateFeedDocumentSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createFeedDocument(body: CreateFeedDocumentSpecification, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createFeedDocument(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns feed details (including the resultDocumentId, if available) for the feed that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} feedId The identifier for the feed. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getFeed(feedId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getFeed(feedId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns the information required for retrieving a feed document\'s contents. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} feedDocumentId The identifier of the feed document. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getFeedDocument(feedDocumentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getFeedDocument(feedDocumentId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns feed details for the feeds that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} [feedTypes] A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required. + * @param {Array} [marketplaceIds] A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify. + * @param {number} [pageSize] The maximum number of feeds to return in a single call. + * @param {Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>} [processingStatuses] A list of processing statuses used to filter feeds. + * @param {string} [createdSince] The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days. + * @param {string} [createdUntil] The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now. + * @param {string} [nextToken] A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getFeeds(feedTypes?: Array, marketplaceIds?: Array, pageSize?: number, processingStatuses?: Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>, createdSince?: string, createdUntil?: string, nextToken?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getFeeds(feedTypes, marketplaceIds, pageSize, processingStatuses, createdSince, createdUntil, nextToken, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * FeedsApi - factory interface + * @export + */ +export const FeedsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = FeedsApiFp(configuration) + return { + /** + * Cancels the feed that you specify. Only feeds with processingStatus=IN_QUEUE can be cancelled. Cancelled feeds are returned in subsequent calls to the getFeed and getFeeds operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} feedId The identifier for the feed. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelFeed(feedId: string, options?: any): AxiosPromise { + return localVarFp.cancelFeed(feedId, options).then((request) => request(axios, basePath)); + }, + /** + * Creates a feed. Upload the contents of the feed document before calling this operation. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0083 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateFeedSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createFeed(body: CreateFeedSpecification, options?: any): AxiosPromise { + return localVarFp.createFeed(body, options).then((request) => request(axios, basePath)); + }, + /** + * Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading the feed document contents. It also returns a feedDocumentId value that you can pass in with a subsequent call to the createFeed operation. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0083 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateFeedDocumentSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createFeedDocument(body: CreateFeedDocumentSpecification, options?: any): AxiosPromise { + return localVarFp.createFeedDocument(body, options).then((request) => request(axios, basePath)); + }, + /** + * Returns feed details (including the resultDocumentId, if available) for the feed that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} feedId The identifier for the feed. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getFeed(feedId: string, options?: any): AxiosPromise { + return localVarFp.getFeed(feedId, options).then((request) => request(axios, basePath)); + }, + /** + * Returns the information required for retrieving a feed document\'s contents. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} feedDocumentId The identifier of the feed document. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getFeedDocument(feedDocumentId: string, options?: any): AxiosPromise { + return localVarFp.getFeedDocument(feedDocumentId, options).then((request) => request(axios, basePath)); + }, + /** + * Returns feed details for the feeds that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} [feedTypes] A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required. + * @param {Array} [marketplaceIds] A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify. + * @param {number} [pageSize] The maximum number of feeds to return in a single call. + * @param {Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>} [processingStatuses] A list of processing statuses used to filter feeds. + * @param {string} [createdSince] The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days. + * @param {string} [createdUntil] The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now. + * @param {string} [nextToken] A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getFeeds(feedTypes?: Array, marketplaceIds?: Array, pageSize?: number, processingStatuses?: Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>, createdSince?: string, createdUntil?: string, nextToken?: string, options?: any): AxiosPromise { + return localVarFp.getFeeds(feedTypes, marketplaceIds, pageSize, processingStatuses, createdSince, createdUntil, nextToken, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * Request parameters for cancelFeed operation in FeedsApi. + * @export + * @interface FeedsApiCancelFeedRequest + */ +export interface FeedsApiCancelFeedRequest { + /** + * The identifier for the feed. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof FeedsApiCancelFeed + */ + readonly feedId: string +} + +/** + * Request parameters for createFeed operation in FeedsApi. + * @export + * @interface FeedsApiCreateFeedRequest + */ +export interface FeedsApiCreateFeedRequest { + /** + * + * @type {CreateFeedSpecification} + * @memberof FeedsApiCreateFeed + */ + readonly body: CreateFeedSpecification +} + +/** + * Request parameters for createFeedDocument operation in FeedsApi. + * @export + * @interface FeedsApiCreateFeedDocumentRequest + */ +export interface FeedsApiCreateFeedDocumentRequest { + /** + * + * @type {CreateFeedDocumentSpecification} + * @memberof FeedsApiCreateFeedDocument + */ + readonly body: CreateFeedDocumentSpecification +} + +/** + * Request parameters for getFeed operation in FeedsApi. + * @export + * @interface FeedsApiGetFeedRequest + */ +export interface FeedsApiGetFeedRequest { + /** + * The identifier for the feed. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof FeedsApiGetFeed + */ + readonly feedId: string +} + +/** + * Request parameters for getFeedDocument operation in FeedsApi. + * @export + * @interface FeedsApiGetFeedDocumentRequest + */ +export interface FeedsApiGetFeedDocumentRequest { + /** + * The identifier of the feed document. + * @type {string} + * @memberof FeedsApiGetFeedDocument + */ + readonly feedDocumentId: string +} + +/** + * Request parameters for getFeeds operation in FeedsApi. + * @export + * @interface FeedsApiGetFeedsRequest + */ +export interface FeedsApiGetFeedsRequest { + /** + * A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required. + * @type {Array} + * @memberof FeedsApiGetFeeds + */ + readonly feedTypes?: Array + + /** + * A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify. + * @type {Array} + * @memberof FeedsApiGetFeeds + */ + readonly marketplaceIds?: Array + + /** + * The maximum number of feeds to return in a single call. + * @type {number} + * @memberof FeedsApiGetFeeds + */ + readonly pageSize?: number + + /** + * A list of processing statuses used to filter feeds. + * @type {Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>} + * @memberof FeedsApiGetFeeds + */ + readonly processingStatuses?: Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'> + + /** + * The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days. + * @type {string} + * @memberof FeedsApiGetFeeds + */ + readonly createdSince?: string + + /** + * The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now. + * @type {string} + * @memberof FeedsApiGetFeeds + */ + readonly createdUntil?: string + + /** + * A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. + * @type {string} + * @memberof FeedsApiGetFeeds + */ + readonly nextToken?: string +} + +/** + * FeedsApi - object-oriented interface + * @export + * @class FeedsApi + * @extends {BaseAPI} + */ +export class FeedsApi extends BaseAPI { + /** + * Cancels the feed that you specify. Only feeds with processingStatus=IN_QUEUE can be cancelled. Cancelled feeds are returned in subsequent calls to the getFeed and getFeeds operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {FeedsApiCancelFeedRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FeedsApi + */ + public cancelFeed(requestParameters: FeedsApiCancelFeedRequest, options?: any) { + return FeedsApiFp(this.configuration).cancelFeed(requestParameters.feedId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Creates a feed. Upload the contents of the feed document before calling this operation. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0083 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {FeedsApiCreateFeedRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FeedsApi + */ + public createFeed(requestParameters: FeedsApiCreateFeedRequest, options?: any) { + return FeedsApiFp(this.configuration).createFeed(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading the feed document contents. It also returns a feedDocumentId value that you can pass in with a subsequent call to the createFeed operation. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0083 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {FeedsApiCreateFeedDocumentRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FeedsApi + */ + public createFeedDocument(requestParameters: FeedsApiCreateFeedDocumentRequest, options?: any) { + return FeedsApiFp(this.configuration).createFeedDocument(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns feed details (including the resultDocumentId, if available) for the feed that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {FeedsApiGetFeedRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FeedsApi + */ + public getFeed(requestParameters: FeedsApiGetFeedRequest, options?: any) { + return FeedsApiFp(this.configuration).getFeed(requestParameters.feedId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns the information required for retrieving a feed document\'s contents. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {FeedsApiGetFeedDocumentRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FeedsApi + */ + public getFeedDocument(requestParameters: FeedsApiGetFeedDocumentRequest, options?: any) { + return FeedsApiFp(this.configuration).getFeedDocument(requestParameters.feedDocumentId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns feed details for the feeds that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {FeedsApiGetFeedsRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof FeedsApi + */ + public getFeeds(requestParameters: FeedsApiGetFeedsRequest = {}, options?: any) { + return FeedsApiFp(this.configuration).getFeeds(requestParameters.feedTypes, requestParameters.marketplaceIds, requestParameters.pageSize, requestParameters.processingStatuses, requestParameters.createdSince, requestParameters.createdUntil, requestParameters.nextToken, options).then((request) => request(this.axios, this.basePath)); + } +} + + diff --git a/src/api-models/feeds-api-model-v20210630/base.ts b/src/api-models/feeds-api-model-v20210630/base.ts new file mode 100644 index 00000000..bd88f358 --- /dev/null +++ b/src/api-models/feeds-api-model-v20210630/base.ts @@ -0,0 +1,71 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Feeds + * The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner. + * + * The version of the OpenAPI document: 2021-06-30 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +// Some imports not used depending on template conditions +// @ts-ignore +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; + +export const BASE_PATH = "https://sellingpartnerapi-na.amazon.com".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} diff --git a/src/api-models/feeds-api-model-v20210630/common.ts b/src/api-models/feeds-api-model-v20210630/common.ts new file mode 100644 index 00000000..c689037a --- /dev/null +++ b/src/api-models/feeds-api-model-v20210630/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Feeds + * The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner. + * + * The version of the OpenAPI document: 2021-06-30 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/src/api-models/feeds-api-model-v20210630/configuration.ts b/src/api-models/feeds-api-model-v20210630/configuration.ts new file mode 100644 index 00000000..9a71e427 --- /dev/null +++ b/src/api-models/feeds-api-model-v20210630/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Feeds + * The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner. + * + * The version of the OpenAPI document: 2021-06-30 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/src/api-models/feeds-api-model-v20210630/index.ts b/src/api-models/feeds-api-model-v20210630/index.ts new file mode 100644 index 00000000..d4b8feb3 --- /dev/null +++ b/src/api-models/feeds-api-model-v20210630/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Feeds + * The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner. + * + * The version of the OpenAPI document: 2021-06-30 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; + diff --git a/src/api-models/index.ts b/src/api-models/index.ts index 1bd5f836..468168de 100644 --- a/src/api-models/index.ts +++ b/src/api-models/index.ts @@ -114,6 +114,31 @@ export { CatalogApiListCatalogCategoriesRequest as CatalogItemsApiModelCatalogApiListCatalogCategoriesRequest, CatalogApiListCatalogItemsRequest as CatalogItemsApiModelCatalogApiListCatalogItemsRequest, } from './catalog-items-api-model' +export { + ItemImageVariantEnum as CatalogItemsApiModelV20201201ItemImageVariantEnum, + ItemVariationsByMarketplaceVariationTypeEnum as CatalogItemsApiModelV20201201ItemVariationsByMarketplaceVariationTypeEnum, + ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum as CatalogItemsApiModelV20201201ItemVendorDetailsByMarketplaceReplenishmentCategoryEnum, + BrandRefinement as CatalogItemsApiModelV20201201BrandRefinement, + ClassificationRefinement as CatalogItemsApiModelV20201201ClassificationRefinement, + ErrorList as CatalogItemsApiModelV20201201ErrorList, + Item as CatalogItemsApiModelV20201201Item, + ItemIdentifier as CatalogItemsApiModelV20201201ItemIdentifier, + ItemIdentifiersByMarketplace as CatalogItemsApiModelV20201201ItemIdentifiersByMarketplace, + ItemImage as CatalogItemsApiModelV20201201ItemImage, + ItemImagesByMarketplace as CatalogItemsApiModelV20201201ItemImagesByMarketplace, + ItemProductTypeByMarketplace as CatalogItemsApiModelV20201201ItemProductTypeByMarketplace, + ItemSalesRank as CatalogItemsApiModelV20201201ItemSalesRank, + ItemSalesRanksByMarketplace as CatalogItemsApiModelV20201201ItemSalesRanksByMarketplace, + ItemSearchResults as CatalogItemsApiModelV20201201ItemSearchResults, + ItemSummaryByMarketplace as CatalogItemsApiModelV20201201ItemSummaryByMarketplace, + ItemVariationsByMarketplace as CatalogItemsApiModelV20201201ItemVariationsByMarketplace, + ItemVendorDetailsByMarketplace as CatalogItemsApiModelV20201201ItemVendorDetailsByMarketplace, + ModelError as CatalogItemsApiModelV20201201ModelError, + Pagination as CatalogItemsApiModelV20201201Pagination, + Refinements as CatalogItemsApiModelV20201201Refinements, + CatalogApiGetCatalogItemRequest as CatalogItemsApiModelV20201201CatalogApiGetCatalogItemRequest, + CatalogApiSearchCatalogItemsRequest as CatalogItemsApiModelV20201201CatalogApiSearchCatalogItemsRequest, +} from './catalog-items-api-model-v20201201' export { ItemEligibilityPreviewProgramEnum as FbaInboundEligibilityApiModelItemEligibilityPreviewProgramEnum, ItemEligibilityPreviewIneligibilityReasonListEnum as FbaInboundEligibilityApiModelItemEligibilityPreviewIneligibilityReasonListEnum, @@ -183,6 +208,25 @@ export { FeedsApiGetFeedDocumentRequest as FeedsApiModelFeedsApiGetFeedDocumentRequest, FeedsApiGetFeedsRequest as FeedsApiModelFeedsApiGetFeedsRequest, } from './feeds-api-model' +export { + FeedProcessingStatusEnum as FeedsApiModelV20210630FeedProcessingStatusEnum, + FeedDocumentCompressionAlgorithmEnum as FeedsApiModelV20210630FeedDocumentCompressionAlgorithmEnum, + CreateFeedDocumentResponse as FeedsApiModelV20210630CreateFeedDocumentResponse, + CreateFeedDocumentSpecification as FeedsApiModelV20210630CreateFeedDocumentSpecification, + CreateFeedResponse as FeedsApiModelV20210630CreateFeedResponse, + CreateFeedSpecification as FeedsApiModelV20210630CreateFeedSpecification, + ErrorList as FeedsApiModelV20210630ErrorList, + Feed as FeedsApiModelV20210630Feed, + FeedDocument as FeedsApiModelV20210630FeedDocument, + GetFeedsResponse as FeedsApiModelV20210630GetFeedsResponse, + ModelError as FeedsApiModelV20210630ModelError, + FeedsApiCancelFeedRequest as FeedsApiModelV20210630FeedsApiCancelFeedRequest, + FeedsApiCreateFeedRequest as FeedsApiModelV20210630FeedsApiCreateFeedRequest, + FeedsApiCreateFeedDocumentRequest as FeedsApiModelV20210630FeedsApiCreateFeedDocumentRequest, + FeedsApiGetFeedRequest as FeedsApiModelV20210630FeedsApiGetFeedRequest, + FeedsApiGetFeedDocumentRequest as FeedsApiModelV20210630FeedsApiGetFeedDocumentRequest, + FeedsApiGetFeedsRequest as FeedsApiModelV20210630FeedsApiGetFeedsRequest, +} from './feeds-api-model-v20210630' export { AdjustmentEvent as FinancesApiModelAdjustmentEvent, AdjustmentItem as FinancesApiModelAdjustmentItem, @@ -722,6 +766,31 @@ export { ReportsApiGetReportSchedulesRequest as ReportsApiModelReportsApiGetReportSchedulesRequest, ReportsApiGetReportsRequest as ReportsApiModelReportsApiGetReportsRequest, } from './reports-api-model' +export { + CreateReportScheduleSpecificationPeriodEnum as ReportsApiModelV20210630CreateReportScheduleSpecificationPeriodEnum, + ReportProcessingStatusEnum as ReportsApiModelV20210630ReportProcessingStatusEnum, + ReportDocumentCompressionAlgorithmEnum as ReportsApiModelV20210630ReportDocumentCompressionAlgorithmEnum, + CreateReportResponse as ReportsApiModelV20210630CreateReportResponse, + CreateReportScheduleResponse as ReportsApiModelV20210630CreateReportScheduleResponse, + CreateReportScheduleSpecification as ReportsApiModelV20210630CreateReportScheduleSpecification, + CreateReportSpecification as ReportsApiModelV20210630CreateReportSpecification, + ErrorList as ReportsApiModelV20210630ErrorList, + GetReportsResponse as ReportsApiModelV20210630GetReportsResponse, + ModelError as ReportsApiModelV20210630ModelError, + Report as ReportsApiModelV20210630Report, + ReportDocument as ReportsApiModelV20210630ReportDocument, + ReportSchedule as ReportsApiModelV20210630ReportSchedule, + ReportScheduleList as ReportsApiModelV20210630ReportScheduleList, + ReportsApiCancelReportRequest as ReportsApiModelV20210630ReportsApiCancelReportRequest, + ReportsApiCancelReportScheduleRequest as ReportsApiModelV20210630ReportsApiCancelReportScheduleRequest, + ReportsApiCreateReportRequest as ReportsApiModelV20210630ReportsApiCreateReportRequest, + ReportsApiCreateReportScheduleRequest as ReportsApiModelV20210630ReportsApiCreateReportScheduleRequest, + ReportsApiGetReportRequest as ReportsApiModelV20210630ReportsApiGetReportRequest, + ReportsApiGetReportDocumentRequest as ReportsApiModelV20210630ReportsApiGetReportDocumentRequest, + ReportsApiGetReportScheduleRequest as ReportsApiModelV20210630ReportsApiGetReportScheduleRequest, + ReportsApiGetReportSchedulesRequest as ReportsApiModelV20210630ReportsApiGetReportSchedulesRequest, + ReportsApiGetReportsRequest as ReportsApiModelV20210630ReportsApiGetReportsRequest, +} from './reports-api-model-v20210630' export { GetOrderMetricsResponse as SalesApiModelGetOrderMetricsResponse, ModelError as SalesApiModelModelError, diff --git a/src/api-models/reports-api-model-v20210630/api.ts b/src/api-models/reports-api-model-v20210630/api.ts new file mode 100644 index 00000000..e6eb9a81 --- /dev/null +++ b/src/api-models/reports-api-model-v20210630/api.ts @@ -0,0 +1,1210 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Reports + * The Selling Partner API for Reports lets you retrieve and manage a variety of reports that can help selling partners manage their businesses. + * + * The version of the OpenAPI document: 2021-06-30 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from './configuration'; +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; + +/** + * + * @export + * @interface CreateReportResponse + */ +export interface CreateReportResponse { + /** + * The identifier for the report. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof CreateReportResponse + */ + reportId: string; +} +/** + * + * @export + * @interface CreateReportScheduleResponse + */ +export interface CreateReportScheduleResponse { + /** + * The identifier for the report schedule. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof CreateReportScheduleResponse + */ + reportScheduleId: string; +} +/** + * + * @export + * @interface CreateReportScheduleSpecification + */ +export interface CreateReportScheduleSpecification { + /** + * The report type. + * @type {string} + * @memberof CreateReportScheduleSpecification + */ + reportType: string; + /** + * A list of marketplace identifiers for the report schedule. + * @type {Array} + * @memberof CreateReportScheduleSpecification + */ + marketplaceIds: Array; + /** + * Additional information passed to reports. This varies by report type. + * @type {{ [key: string]: string; }} + * @memberof CreateReportScheduleSpecification + */ + reportOptions?: { [key: string]: string; }; + /** + * One of a set of predefined ISO 8601 periods that specifies how often a report should be created. + * @type {string} + * @memberof CreateReportScheduleSpecification + */ + period: CreateReportScheduleSpecificationPeriodEnum | 'PT5M' | 'PT15M' | 'PT30M' | 'PT1H' | 'PT2H' | 'PT4H' | 'PT8H' | 'PT12H' | 'P1D' | 'P2D' | 'P3D' | 'PT84H' | 'P7D' | 'P14D' | 'P15D' | 'P18D' | 'P30D' | 'P1M'; + /** + * The date and time when the schedule will create its next report, in ISO 8601 date time format. + * @type {string} + * @memberof CreateReportScheduleSpecification + */ + nextReportCreationTime?: string; +} + +/** + * @export + * @enum {string} + */ +export enum CreateReportScheduleSpecificationPeriodEnum { + Pt5M = 'PT5M', + Pt15M = 'PT15M', + Pt30M = 'PT30M', + Pt1H = 'PT1H', + Pt2H = 'PT2H', + Pt4H = 'PT4H', + Pt8H = 'PT8H', + Pt12H = 'PT12H', + P1D = 'P1D', + P2D = 'P2D', + P3D = 'P3D', + Pt84H = 'PT84H', + P7D = 'P7D', + P14D = 'P14D', + P15D = 'P15D', + P18D = 'P18D', + P30D = 'P30D', + P1M = 'P1M' +} + +/** + * + * @export + * @interface CreateReportSpecification + */ +export interface CreateReportSpecification { + /** + * Additional information passed to reports. This varies by report type. + * @type {{ [key: string]: string; }} + * @memberof CreateReportSpecification + */ + reportOptions?: { [key: string]: string; }; + /** + * The report type. + * @type {string} + * @memberof CreateReportSpecification + */ + reportType: string; + /** + * The start of a date and time range, in ISO 8601 date time format, used for selecting the data to report. The default is now. The value must be prior to or equal to the current date and time. Not all report types make use of this. + * @type {string} + * @memberof CreateReportSpecification + */ + dataStartTime?: string; + /** + * The end of a date and time range, in ISO 8601 date time format, used for selecting the data to report. The default is now. The value must be prior to or equal to the current date and time. Not all report types make use of this. + * @type {string} + * @memberof CreateReportSpecification + */ + dataEndTime?: string; + /** + * A list of marketplace identifiers. The report document\'s contents will contain data for all of the specified marketplaces, unless the report type indicates otherwise. + * @type {Array} + * @memberof CreateReportSpecification + */ + marketplaceIds: Array; +} +/** + * A list of error responses returned when a request is unsuccessful. + * @export + * @interface ErrorList + */ +export interface ErrorList { + /** + * + * @type {Array} + * @memberof ErrorList + */ + errors: Array; +} +/** + * The response for the getReports operation. + * @export + * @interface GetReportsResponse + */ +export interface GetReportsResponse { + /** + * + * @type {Array} + * @memberof GetReportsResponse + */ + reports: Array; + /** + * Returned when the number of results exceeds pageSize. To get the next page of results, call getReports with this token as the only parameter. + * @type {string} + * @memberof GetReportsResponse + */ + nextToken?: string; +} +/** + * Error response returned when the request is unsuccessful. + * @export + * @interface ModelError + */ +export interface ModelError { + /** + * An error code that identifies the type of error that occurred. + * @type {string} + * @memberof ModelError + */ + code: string; + /** + * A message that describes the error condition in a human-readable form. + * @type {string} + * @memberof ModelError + */ + message: string; + /** + * Additional details that can help the caller understand or fix the issue. + * @type {string} + * @memberof ModelError + */ + details?: string; +} +/** + * + * @export + * @interface Report + */ +export interface Report { + /** + * A list of marketplace identifiers for the report. + * @type {Array} + * @memberof Report + */ + marketplaceIds?: Array; + /** + * The identifier for the report. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof Report + */ + reportId: string; + /** + * The report type. + * @type {string} + * @memberof Report + */ + reportType: string; + /** + * The start of a date and time range used for selecting the data to report. + * @type {string} + * @memberof Report + */ + dataStartTime?: string; + /** + * The end of a date and time range used for selecting the data to report. + * @type {string} + * @memberof Report + */ + dataEndTime?: string; + /** + * The identifier of the report schedule that created this report (if any). This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof Report + */ + reportScheduleId?: string; + /** + * The date and time when the report was created. + * @type {string} + * @memberof Report + */ + createdTime: string; + /** + * The processing status of the report. + * @type {string} + * @memberof Report + */ + processingStatus: ReportProcessingStatusEnum | 'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'; + /** + * The date and time when the report processing started, in ISO 8601 date time format. + * @type {string} + * @memberof Report + */ + processingStartTime?: string; + /** + * The date and time when the report processing completed, in ISO 8601 date time format. + * @type {string} + * @memberof Report + */ + processingEndTime?: string; + /** + * The identifier for the report document. Pass this into the getReportDocument operation to get the information you will need to retrieve the report document\'s contents. + * @type {string} + * @memberof Report + */ + reportDocumentId?: string; +} + +/** + * @export + * @enum {string} + */ +export enum ReportProcessingStatusEnum { + Cancelled = 'CANCELLED', + Done = 'DONE', + Fatal = 'FATAL', + InProgress = 'IN_PROGRESS', + InQueue = 'IN_QUEUE' +} + +/** + * + * @export + * @interface ReportDocument + */ +export interface ReportDocument { + /** + * The identifier for the report document. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof ReportDocument + */ + reportDocumentId: string; + /** + * A presigned URL for the report document. This URL expires after 5 minutes. + * @type {string} + * @memberof ReportDocument + */ + url: string; + /** + * If present, the report document contents have been compressed with the provided algorithm. + * @type {string} + * @memberof ReportDocument + */ + compressionAlgorithm?: ReportDocumentCompressionAlgorithmEnum | 'GZIP'; +} + +/** + * @export + * @enum {string} + */ +export enum ReportDocumentCompressionAlgorithmEnum { + Gzip = 'GZIP' +} + +/** + * Detailed information about a report schedule. + * @export + * @interface ReportSchedule + */ +export interface ReportSchedule { + /** + * The identifier for the report schedule. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof ReportSchedule + */ + reportScheduleId: string; + /** + * The report type. + * @type {string} + * @memberof ReportSchedule + */ + reportType: string; + /** + * A list of marketplace identifiers. The report document\'s contents will contain data for all of the specified marketplaces, unless the report type indicates otherwise. + * @type {Array} + * @memberof ReportSchedule + */ + marketplaceIds?: Array; + /** + * Additional information passed to reports. This varies by report type. + * @type {{ [key: string]: string; }} + * @memberof ReportSchedule + */ + reportOptions?: { [key: string]: string; }; + /** + * An ISO 8601 period value that indicates how often a report should be created. + * @type {string} + * @memberof ReportSchedule + */ + period: string; + /** + * The date and time when the schedule will create its next report, in ISO 8601 date time format. + * @type {string} + * @memberof ReportSchedule + */ + nextReportCreationTime?: string; +} +/** + * + * @export + * @interface ReportScheduleList + */ +export interface ReportScheduleList { + /** + * + * @type {Array} + * @memberof ReportScheduleList + */ + reportSchedules: Array; +} + +/** + * ReportsApi - axios parameter creator + * @export + */ +export const ReportsApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Cancels the report that you specify. Only reports with processingStatus=IN_QUEUE can be cancelled. Cancelled reports are returned in subsequent calls to the getReport and getReports operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportId The identifier for the report. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelReport: async (reportId: string, options: any = {}): Promise => { + // verify required parameter 'reportId' is not null or undefined + assertParamExists('cancelReport', 'reportId', reportId) + const localVarPath = `/reports/2021-06-30/reports/{reportId}` + .replace(`{${"reportId"}}`, encodeURIComponent(String(reportId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Cancels the report schedule that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportScheduleId The identifier for the report schedule. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelReportSchedule: async (reportScheduleId: string, options: any = {}): Promise => { + // verify required parameter 'reportScheduleId' is not null or undefined + assertParamExists('cancelReportSchedule', 'reportScheduleId', reportScheduleId) + const localVarPath = `/reports/2021-06-30/schedules/{reportScheduleId}` + .replace(`{${"reportScheduleId"}}`, encodeURIComponent(String(reportScheduleId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Creates a report. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateReportSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createReport: async (body: CreateReportSpecification, options: any = {}): Promise => { + // verify required parameter 'body' is not null or undefined + assertParamExists('createReport', 'body', body) + const localVarPath = `/reports/2021-06-30/reports`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Creates a report schedule. If a report schedule with the same report type and marketplace IDs already exists, it will be cancelled and replaced with this one. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateReportScheduleSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createReportSchedule: async (body: CreateReportScheduleSpecification, options: any = {}): Promise => { + // verify required parameter 'body' is not null or undefined + assertParamExists('createReportSchedule', 'body', body) + const localVarPath = `/reports/2021-06-30/schedules`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns report details (including the reportDocumentId, if available) for the report that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportId The identifier for the report. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getReport: async (reportId: string, options: any = {}): Promise => { + // verify required parameter 'reportId' is not null or undefined + assertParamExists('getReport', 'reportId', reportId) + const localVarPath = `/reports/2021-06-30/reports/{reportId}` + .replace(`{${"reportId"}}`, encodeURIComponent(String(reportId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the information required for retrieving a report document\'s contents. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportDocumentId The identifier for the report document. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getReportDocument: async (reportDocumentId: string, options: any = {}): Promise => { + // verify required parameter 'reportDocumentId' is not null or undefined + assertParamExists('getReportDocument', 'reportDocumentId', reportDocumentId) + const localVarPath = `/reports/2021-06-30/documents/{reportDocumentId}` + .replace(`{${"reportDocumentId"}}`, encodeURIComponent(String(reportDocumentId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns report schedule details for the report schedule that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportScheduleId The identifier for the report schedule. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getReportSchedule: async (reportScheduleId: string, options: any = {}): Promise => { + // verify required parameter 'reportScheduleId' is not null or undefined + assertParamExists('getReportSchedule', 'reportScheduleId', reportScheduleId) + const localVarPath = `/reports/2021-06-30/schedules/{reportScheduleId}` + .replace(`{${"reportScheduleId"}}`, encodeURIComponent(String(reportScheduleId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns report schedule details that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} reportTypes A list of report types used to filter report schedules. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getReportSchedules: async (reportTypes: Array, options: any = {}): Promise => { + // verify required parameter 'reportTypes' is not null or undefined + assertParamExists('getReportSchedules', 'reportTypes', reportTypes) + const localVarPath = `/reports/2021-06-30/schedules`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (reportTypes) { + localVarQueryParameter['reportTypes'] = reportTypes.join(COLLECTION_FORMATS.csv); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns report details for the reports that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} [reportTypes] A list of report types used to filter reports. When reportTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either reportTypes or nextToken is required. + * @param {Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>} [processingStatuses] A list of processing statuses used to filter reports. + * @param {Array} [marketplaceIds] A list of marketplace identifiers used to filter reports. The reports returned will match at least one of the marketplaces that you specify. + * @param {number} [pageSize] The maximum number of reports to return in a single call. + * @param {string} [createdSince] The earliest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is 90 days ago. Reports are retained for a maximum of 90 days. + * @param {string} [createdUntil] The latest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is now. + * @param {string} [nextToken] A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getReports operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getReports: async (reportTypes?: Array, processingStatuses?: Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>, marketplaceIds?: Array, pageSize?: number, createdSince?: string, createdUntil?: string, nextToken?: string, options: any = {}): Promise => { + const localVarPath = `/reports/2021-06-30/reports`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (reportTypes) { + localVarQueryParameter['reportTypes'] = reportTypes.join(COLLECTION_FORMATS.csv); + } + + if (processingStatuses) { + localVarQueryParameter['processingStatuses'] = processingStatuses.join(COLLECTION_FORMATS.csv); + } + + if (marketplaceIds) { + localVarQueryParameter['marketplaceIds'] = marketplaceIds.join(COLLECTION_FORMATS.csv); + } + + if (pageSize !== undefined) { + localVarQueryParameter['pageSize'] = pageSize; + } + + if (createdSince !== undefined) { + localVarQueryParameter['createdSince'] = (createdSince as any instanceof Date) ? + (createdSince as any).toISOString() : + createdSince; + } + + if (createdUntil !== undefined) { + localVarQueryParameter['createdUntil'] = (createdUntil as any instanceof Date) ? + (createdUntil as any).toISOString() : + createdUntil; + } + + if (nextToken !== undefined) { + localVarQueryParameter['nextToken'] = nextToken; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ReportsApi - functional programming interface + * @export + */ +export const ReportsApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ReportsApiAxiosParamCreator(configuration) + return { + /** + * Cancels the report that you specify. Only reports with processingStatus=IN_QUEUE can be cancelled. Cancelled reports are returned in subsequent calls to the getReport and getReports operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportId The identifier for the report. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async cancelReport(reportId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.cancelReport(reportId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Cancels the report schedule that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportScheduleId The identifier for the report schedule. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async cancelReportSchedule(reportScheduleId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.cancelReportSchedule(reportScheduleId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Creates a report. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateReportSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createReport(body: CreateReportSpecification, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createReport(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Creates a report schedule. If a report schedule with the same report type and marketplace IDs already exists, it will be cancelled and replaced with this one. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateReportScheduleSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createReportSchedule(body: CreateReportScheduleSpecification, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createReportSchedule(body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns report details (including the reportDocumentId, if available) for the report that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportId The identifier for the report. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getReport(reportId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getReport(reportId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns the information required for retrieving a report document\'s contents. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportDocumentId The identifier for the report document. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getReportDocument(reportDocumentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getReportDocument(reportDocumentId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns report schedule details for the report schedule that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportScheduleId The identifier for the report schedule. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getReportSchedule(reportScheduleId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getReportSchedule(reportScheduleId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns report schedule details that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} reportTypes A list of report types used to filter report schedules. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getReportSchedules(reportTypes: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getReportSchedules(reportTypes, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns report details for the reports that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} [reportTypes] A list of report types used to filter reports. When reportTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either reportTypes or nextToken is required. + * @param {Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>} [processingStatuses] A list of processing statuses used to filter reports. + * @param {Array} [marketplaceIds] A list of marketplace identifiers used to filter reports. The reports returned will match at least one of the marketplaces that you specify. + * @param {number} [pageSize] The maximum number of reports to return in a single call. + * @param {string} [createdSince] The earliest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is 90 days ago. Reports are retained for a maximum of 90 days. + * @param {string} [createdUntil] The latest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is now. + * @param {string} [nextToken] A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getReports operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getReports(reportTypes?: Array, processingStatuses?: Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>, marketplaceIds?: Array, pageSize?: number, createdSince?: string, createdUntil?: string, nextToken?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getReports(reportTypes, processingStatuses, marketplaceIds, pageSize, createdSince, createdUntil, nextToken, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * ReportsApi - factory interface + * @export + */ +export const ReportsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = ReportsApiFp(configuration) + return { + /** + * Cancels the report that you specify. Only reports with processingStatus=IN_QUEUE can be cancelled. Cancelled reports are returned in subsequent calls to the getReport and getReports operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportId The identifier for the report. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelReport(reportId: string, options?: any): AxiosPromise { + return localVarFp.cancelReport(reportId, options).then((request) => request(axios, basePath)); + }, + /** + * Cancels the report schedule that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportScheduleId The identifier for the report schedule. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelReportSchedule(reportScheduleId: string, options?: any): AxiosPromise { + return localVarFp.cancelReportSchedule(reportScheduleId, options).then((request) => request(axios, basePath)); + }, + /** + * Creates a report. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateReportSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createReport(body: CreateReportSpecification, options?: any): AxiosPromise { + return localVarFp.createReport(body, options).then((request) => request(axios, basePath)); + }, + /** + * Creates a report schedule. If a report schedule with the same report type and marketplace IDs already exists, it will be cancelled and replaced with this one. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {CreateReportScheduleSpecification} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createReportSchedule(body: CreateReportScheduleSpecification, options?: any): AxiosPromise { + return localVarFp.createReportSchedule(body, options).then((request) => request(axios, basePath)); + }, + /** + * Returns report details (including the reportDocumentId, if available) for the report that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportId The identifier for the report. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getReport(reportId: string, options?: any): AxiosPromise { + return localVarFp.getReport(reportId, options).then((request) => request(axios, basePath)); + }, + /** + * Returns the information required for retrieving a report document\'s contents. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportDocumentId The identifier for the report document. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getReportDocument(reportDocumentId: string, options?: any): AxiosPromise { + return localVarFp.getReportDocument(reportDocumentId, options).then((request) => request(axios, basePath)); + }, + /** + * Returns report schedule details for the report schedule that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {string} reportScheduleId The identifier for the report schedule. This identifier is unique only in combination with a seller ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getReportSchedule(reportScheduleId: string, options?: any): AxiosPromise { + return localVarFp.getReportSchedule(reportScheduleId, options).then((request) => request(axios, basePath)); + }, + /** + * Returns report schedule details that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} reportTypes A list of report types used to filter report schedules. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getReportSchedules(reportTypes: Array, options?: any): AxiosPromise { + return localVarFp.getReportSchedules(reportTypes, options).then((request) => request(axios, basePath)); + }, + /** + * Returns report details for the reports that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {Array} [reportTypes] A list of report types used to filter reports. When reportTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either reportTypes or nextToken is required. + * @param {Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>} [processingStatuses] A list of processing statuses used to filter reports. + * @param {Array} [marketplaceIds] A list of marketplace identifiers used to filter reports. The reports returned will match at least one of the marketplaces that you specify. + * @param {number} [pageSize] The maximum number of reports to return in a single call. + * @param {string} [createdSince] The earliest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is 90 days ago. Reports are retained for a maximum of 90 days. + * @param {string} [createdUntil] The latest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is now. + * @param {string} [nextToken] A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getReports operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getReports(reportTypes?: Array, processingStatuses?: Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>, marketplaceIds?: Array, pageSize?: number, createdSince?: string, createdUntil?: string, nextToken?: string, options?: any): AxiosPromise { + return localVarFp.getReports(reportTypes, processingStatuses, marketplaceIds, pageSize, createdSince, createdUntil, nextToken, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * Request parameters for cancelReport operation in ReportsApi. + * @export + * @interface ReportsApiCancelReportRequest + */ +export interface ReportsApiCancelReportRequest { + /** + * The identifier for the report. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof ReportsApiCancelReport + */ + readonly reportId: string +} + +/** + * Request parameters for cancelReportSchedule operation in ReportsApi. + * @export + * @interface ReportsApiCancelReportScheduleRequest + */ +export interface ReportsApiCancelReportScheduleRequest { + /** + * The identifier for the report schedule. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof ReportsApiCancelReportSchedule + */ + readonly reportScheduleId: string +} + +/** + * Request parameters for createReport operation in ReportsApi. + * @export + * @interface ReportsApiCreateReportRequest + */ +export interface ReportsApiCreateReportRequest { + /** + * + * @type {CreateReportSpecification} + * @memberof ReportsApiCreateReport + */ + readonly body: CreateReportSpecification +} + +/** + * Request parameters for createReportSchedule operation in ReportsApi. + * @export + * @interface ReportsApiCreateReportScheduleRequest + */ +export interface ReportsApiCreateReportScheduleRequest { + /** + * + * @type {CreateReportScheduleSpecification} + * @memberof ReportsApiCreateReportSchedule + */ + readonly body: CreateReportScheduleSpecification +} + +/** + * Request parameters for getReport operation in ReportsApi. + * @export + * @interface ReportsApiGetReportRequest + */ +export interface ReportsApiGetReportRequest { + /** + * The identifier for the report. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof ReportsApiGetReport + */ + readonly reportId: string +} + +/** + * Request parameters for getReportDocument operation in ReportsApi. + * @export + * @interface ReportsApiGetReportDocumentRequest + */ +export interface ReportsApiGetReportDocumentRequest { + /** + * The identifier for the report document. + * @type {string} + * @memberof ReportsApiGetReportDocument + */ + readonly reportDocumentId: string +} + +/** + * Request parameters for getReportSchedule operation in ReportsApi. + * @export + * @interface ReportsApiGetReportScheduleRequest + */ +export interface ReportsApiGetReportScheduleRequest { + /** + * The identifier for the report schedule. This identifier is unique only in combination with a seller ID. + * @type {string} + * @memberof ReportsApiGetReportSchedule + */ + readonly reportScheduleId: string +} + +/** + * Request parameters for getReportSchedules operation in ReportsApi. + * @export + * @interface ReportsApiGetReportSchedulesRequest + */ +export interface ReportsApiGetReportSchedulesRequest { + /** + * A list of report types used to filter report schedules. + * @type {Array} + * @memberof ReportsApiGetReportSchedules + */ + readonly reportTypes: Array +} + +/** + * Request parameters for getReports operation in ReportsApi. + * @export + * @interface ReportsApiGetReportsRequest + */ +export interface ReportsApiGetReportsRequest { + /** + * A list of report types used to filter reports. When reportTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either reportTypes or nextToken is required. + * @type {Array} + * @memberof ReportsApiGetReports + */ + readonly reportTypes?: Array + + /** + * A list of processing statuses used to filter reports. + * @type {Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'>} + * @memberof ReportsApiGetReports + */ + readonly processingStatuses?: Array<'CANCELLED' | 'DONE' | 'FATAL' | 'IN_PROGRESS' | 'IN_QUEUE'> + + /** + * A list of marketplace identifiers used to filter reports. The reports returned will match at least one of the marketplaces that you specify. + * @type {Array} + * @memberof ReportsApiGetReports + */ + readonly marketplaceIds?: Array + + /** + * The maximum number of reports to return in a single call. + * @type {number} + * @memberof ReportsApiGetReports + */ + readonly pageSize?: number + + /** + * The earliest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is 90 days ago. Reports are retained for a maximum of 90 days. + * @type {string} + * @memberof ReportsApiGetReports + */ + readonly createdSince?: string + + /** + * The latest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is now. + * @type {string} + * @memberof ReportsApiGetReports + */ + readonly createdUntil?: string + + /** + * A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getReports operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. + * @type {string} + * @memberof ReportsApiGetReports + */ + readonly nextToken?: string +} + +/** + * ReportsApi - object-oriented interface + * @export + * @class ReportsApi + * @extends {BaseAPI} + */ +export class ReportsApi extends BaseAPI { + /** + * Cancels the report that you specify. Only reports with processingStatus=IN_QUEUE can be cancelled. Cancelled reports are returned in subsequent calls to the getReport and getReports operations. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {ReportsApiCancelReportRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReportsApi + */ + public cancelReport(requestParameters: ReportsApiCancelReportRequest, options?: any) { + return ReportsApiFp(this.configuration).cancelReport(requestParameters.reportId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Cancels the report schedule that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {ReportsApiCancelReportScheduleRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReportsApi + */ + public cancelReportSchedule(requestParameters: ReportsApiCancelReportScheduleRequest, options?: any) { + return ReportsApiFp(this.configuration).cancelReportSchedule(requestParameters.reportScheduleId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Creates a report. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {ReportsApiCreateReportRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReportsApi + */ + public createReport(requestParameters: ReportsApiCreateReportRequest, options?: any) { + return ReportsApiFp(this.configuration).createReport(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Creates a report schedule. If a report schedule with the same report type and marketplace IDs already exists, it will be cancelled and replaced with this one. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {ReportsApiCreateReportScheduleRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReportsApi + */ + public createReportSchedule(requestParameters: ReportsApiCreateReportScheduleRequest, options?: any) { + return ReportsApiFp(this.configuration).createReportSchedule(requestParameters.body, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns report details (including the reportDocumentId, if available) for the report that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2.0 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {ReportsApiGetReportRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReportsApi + */ + public getReport(requestParameters: ReportsApiGetReportRequest, options?: any) { + return ReportsApiFp(this.configuration).getReport(requestParameters.reportId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns the information required for retrieving a report document\'s contents. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 15 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {ReportsApiGetReportDocumentRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReportsApi + */ + public getReportDocument(requestParameters: ReportsApiGetReportDocumentRequest, options?: any) { + return ReportsApiFp(this.configuration).getReportDocument(requestParameters.reportDocumentId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns report schedule details for the report schedule that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {ReportsApiGetReportScheduleRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReportsApi + */ + public getReportSchedule(requestParameters: ReportsApiGetReportScheduleRequest, options?: any) { + return ReportsApiFp(this.configuration).getReportSchedule(requestParameters.reportScheduleId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns report schedule details that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {ReportsApiGetReportSchedulesRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReportsApi + */ + public getReportSchedules(requestParameters: ReportsApiGetReportSchedulesRequest, options?: any) { + return ReportsApiFp(this.configuration).getReportSchedules(requestParameters.reportTypes, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns report details for the reports that match the filters that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 0.0222 | 10 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation. + * @param {ReportsApiGetReportsRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ReportsApi + */ + public getReports(requestParameters: ReportsApiGetReportsRequest = {}, options?: any) { + return ReportsApiFp(this.configuration).getReports(requestParameters.reportTypes, requestParameters.processingStatuses, requestParameters.marketplaceIds, requestParameters.pageSize, requestParameters.createdSince, requestParameters.createdUntil, requestParameters.nextToken, options).then((request) => request(this.axios, this.basePath)); + } +} + + diff --git a/src/api-models/reports-api-model-v20210630/base.ts b/src/api-models/reports-api-model-v20210630/base.ts new file mode 100644 index 00000000..09b93b4a --- /dev/null +++ b/src/api-models/reports-api-model-v20210630/base.ts @@ -0,0 +1,71 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Reports + * The Selling Partner API for Reports lets you retrieve and manage a variety of reports that can help selling partners manage their businesses. + * + * The version of the OpenAPI document: 2021-06-30 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +// Some imports not used depending on template conditions +// @ts-ignore +import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; + +export const BASE_PATH = "https://sellingpartnerapi-na.amazon.com".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} diff --git a/src/api-models/reports-api-model-v20210630/common.ts b/src/api-models/reports-api-model-v20210630/common.ts new file mode 100644 index 00000000..21f354ea --- /dev/null +++ b/src/api-models/reports-api-model-v20210630/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Reports + * The Selling Partner API for Reports lets you retrieve and manage a variety of reports that can help selling partners manage their businesses. + * + * The version of the OpenAPI document: 2021-06-30 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import { Configuration } from "./configuration"; +import { RequiredError, RequestArgs } from "./base"; +import { AxiosInstance } from 'axios'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + for (const object of objects) { + for (const key in object) { + searchParams.set(key, object[key]); + } + } + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/src/api-models/reports-api-model-v20210630/configuration.ts b/src/api-models/reports-api-model-v20210630/configuration.ts new file mode 100644 index 00000000..bb5dd6cd --- /dev/null +++ b/src/api-models/reports-api-model-v20210630/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Reports + * The Selling Partner API for Reports lets you retrieve and manage a variety of reports that can help selling partners manage their businesses. + * + * The version of the OpenAPI document: 2021-06-30 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/src/api-models/reports-api-model-v20210630/index.ts b/src/api-models/reports-api-model-v20210630/index.ts new file mode 100644 index 00000000..0df69ee6 --- /dev/null +++ b/src/api-models/reports-api-model-v20210630/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Reports + * The Selling Partner API for Reports lets you retrieve and manage a variety of reports that can help selling partners manage their businesses. + * + * The version of the OpenAPI document: 2021-06-30 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; +