From 623872e97186f6b0e1ba7f17b9b079b3377f5cb4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 3 Jun 2021 08:42:39 +0700 Subject: [PATCH] feat: add shipment invoicing, product type definitions and listings items api model Co-authored-by: nguyentoanit --- src/api-clients/index.ts | 3 + src/api-clients/listings-items-api-client.ts | 14 + .../product-type-definitions-api-client.ts | 14 + .../shipment-invoicing-api-client.ts | 14 + src/api-models/index.ts | 52 ++ .../listings-items-api-model/api.ts | 664 ++++++++++++++++ .../listings-items-api-model/base.ts | 71 ++ .../listings-items-api-model/common.ts | 131 +++ .../listings-items-api-model/configuration.ts | 101 +++ .../listings-items-api-model/index.ts | 18 + .../product-type-definitions-api-model/api.ts | 566 +++++++++++++ .../base.ts | 71 ++ .../common.ts | 131 +++ .../configuration.ts | 101 +++ .../index.ts | 18 + .../shipment-invoicing-api-model/api.ts | 751 ++++++++++++++++++ .../shipment-invoicing-api-model/base.ts | 71 ++ .../shipment-invoicing-api-model/common.ts | 131 +++ .../configuration.ts | 101 +++ .../shipment-invoicing-api-model/index.ts | 18 + 20 files changed, 3041 insertions(+) create mode 100644 src/api-clients/listings-items-api-client.ts create mode 100644 src/api-clients/product-type-definitions-api-client.ts create mode 100644 src/api-clients/shipment-invoicing-api-client.ts create mode 100644 src/api-models/listings-items-api-model/api.ts create mode 100644 src/api-models/listings-items-api-model/base.ts create mode 100644 src/api-models/listings-items-api-model/common.ts create mode 100644 src/api-models/listings-items-api-model/configuration.ts create mode 100644 src/api-models/listings-items-api-model/index.ts create mode 100644 src/api-models/product-type-definitions-api-model/api.ts create mode 100644 src/api-models/product-type-definitions-api-model/base.ts create mode 100644 src/api-models/product-type-definitions-api-model/common.ts create mode 100644 src/api-models/product-type-definitions-api-model/configuration.ts create mode 100644 src/api-models/product-type-definitions-api-model/index.ts create mode 100644 src/api-models/shipment-invoicing-api-model/api.ts create mode 100644 src/api-models/shipment-invoicing-api-model/base.ts create mode 100644 src/api-models/shipment-invoicing-api-model/common.ts create mode 100644 src/api-models/shipment-invoicing-api-model/configuration.ts create mode 100644 src/api-models/shipment-invoicing-api-model/index.ts diff --git a/src/api-clients/index.ts b/src/api-clients/index.ts index 191681c4..28fbb39f 100644 --- a/src/api-clients/index.ts +++ b/src/api-clients/index.ts @@ -8,16 +8,19 @@ export * from './feeds-api-client' export * from './finances-api-client' export * from './fulfillment-inbound-api-client' export * from './fulfillment-outbound-api-client' +export * from './listings-items-api-client' export * from './merchant-fulfillment-api-client' export * from './messaging-api-client' export * from './notifications-api-client' export * from './orders-api-client' 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 './sales-api-client' export * from './sellers-api-client' export * from './services-api-client' +export * from './shipment-invoicing-api-client' export * from './shipping-api-client' export * from './solicitations-api-client' export * from './tokens-api-client' diff --git a/src/api-clients/listings-items-api-client.ts b/src/api-clients/listings-items-api-client.ts new file mode 100644 index 00000000..44b8aa96 --- /dev/null +++ b/src/api-clients/listings-items-api-client.ts @@ -0,0 +1,14 @@ +import { Configuration, ListingsApi } from '../api-models/listings-items-api-model' +import { ApiClientHelpers } from '../helpers' +import { DEFAULT_API_BASE_PATH } from '../types' +import { APIConfigurationParameters } from '../types/api-clients/api-configuration-parameters' + +export class ListingsItemsApiClient extends ListingsApi { + 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/product-type-definitions-api-client.ts b/src/api-clients/product-type-definitions-api-client.ts new file mode 100644 index 00000000..aa264f61 --- /dev/null +++ b/src/api-clients/product-type-definitions-api-client.ts @@ -0,0 +1,14 @@ +import { Configuration, DefinitionsApi } from '../api-models/product-type-definitions-api-model' +import { ApiClientHelpers } from '../helpers' +import { DEFAULT_API_BASE_PATH } from '../types' +import { APIConfigurationParameters } from '../types/api-clients/api-configuration-parameters' + +export class ProductTypeDefinitionsApiClient extends DefinitionsApi { + 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/shipment-invoicing-api-client.ts b/src/api-clients/shipment-invoicing-api-client.ts new file mode 100644 index 00000000..56b102c9 --- /dev/null +++ b/src/api-clients/shipment-invoicing-api-client.ts @@ -0,0 +1,14 @@ +import { Configuration, ShipmentInvoiceApi } from '../api-models/shipment-invoicing-api-model' +import { ApiClientHelpers } from '../helpers' +import { DEFAULT_API_BASE_PATH } from '../types' +import { APIConfigurationParameters } from '../types/api-clients/api-configuration-parameters' + +export class ShipmentInvoicingApiClient extends ShipmentInvoiceApi { + 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/index.ts b/src/api-models/index.ts index 7e4e009e..1bd5f836 100644 --- a/src/api-models/index.ts +++ b/src/api-models/index.ts @@ -423,6 +423,22 @@ export { FbaOutboundApiListReturnReasonCodesRequest as FulfillmentOutboundApiModelFbaOutboundApiListReturnReasonCodesRequest, FbaOutboundApiUpdateFulfillmentOrderRequest as FulfillmentOutboundApiModelFbaOutboundApiUpdateFulfillmentOrderRequest, } from './fulfillment-outbound-api-model' +export { + IssueSeverityEnum as ListingsItemsApiModelIssueSeverityEnum, + ListingsItemPutRequestRequirementsEnum as ListingsItemsApiModelListingsItemPutRequestRequirementsEnum, + ListingsItemSubmissionResponseStatusEnum as ListingsItemsApiModelListingsItemSubmissionResponseStatusEnum, + PatchOperationOpEnum as ListingsItemsApiModelPatchOperationOpEnum, + ErrorList as ListingsItemsApiModelErrorList, + Issue as ListingsItemsApiModelIssue, + ListingsItemPatchRequest as ListingsItemsApiModelListingsItemPatchRequest, + ListingsItemPutRequest as ListingsItemsApiModelListingsItemPutRequest, + ListingsItemSubmissionResponse as ListingsItemsApiModelListingsItemSubmissionResponse, + ModelError as ListingsItemsApiModelModelError, + PatchOperation as ListingsItemsApiModelPatchOperation, + ListingsApiDeleteListingsItemRequest as ListingsItemsApiModelListingsApiDeleteListingsItemRequest, + ListingsApiPatchListingsItemRequest as ListingsItemsApiModelListingsApiPatchListingsItemRequest, + ListingsApiPutListingsItemRequest as ListingsItemsApiModelListingsApiPutListingsItemRequest, +} from './listings-items-api-model' export { CarrierWillPickUpOption as MerchantFulfillmentApiModelCarrierWillPickUpOption, DeliveryExperienceOption as MerchantFulfillmentApiModelDeliveryExperienceOption, @@ -657,6 +673,22 @@ export { ProductPricingApiGetListingOffersRequest as ProductPricingApiModelProductPricingApiGetListingOffersRequest, ProductPricingApiGetPricingRequest as ProductPricingApiModelProductPricingApiGetPricingRequest, } from './product-pricing-api-model' +export { + ProductTypeDefinitionRequirementsEnum as ProductTypeDefinitionsApiModelProductTypeDefinitionRequirementsEnum, + ProductTypeDefinitionRequirementsEnforcedEnum as ProductTypeDefinitionsApiModelProductTypeDefinitionRequirementsEnforcedEnum, + SchemaLinkLinkVerbEnum as ProductTypeDefinitionsApiModelSchemaLinkLinkVerbEnum, + ErrorList as ProductTypeDefinitionsApiModelErrorList, + ModelError as ProductTypeDefinitionsApiModelModelError, + ProductType as ProductTypeDefinitionsApiModelProductType, + ProductTypeDefinition as ProductTypeDefinitionsApiModelProductTypeDefinition, + ProductTypeList as ProductTypeDefinitionsApiModelProductTypeList, + ProductTypeVersion as ProductTypeDefinitionsApiModelProductTypeVersion, + PropertyGroup as ProductTypeDefinitionsApiModelPropertyGroup, + SchemaLink as ProductTypeDefinitionsApiModelSchemaLink, + SchemaLinkLink as ProductTypeDefinitionsApiModelSchemaLinkLink, + DefinitionsApiGetDefinitionsProductTypeRequest as ProductTypeDefinitionsApiModelDefinitionsApiGetDefinitionsProductTypeRequest, + DefinitionsApiSearchDefinitionsProductTypesRequest as ProductTypeDefinitionsApiModelDefinitionsApiSearchDefinitionsProductTypesRequest, +} from './product-type-definitions-api-model' export { CreateReportScheduleSpecificationPeriodEnum as ReportsApiModelCreateReportScheduleSpecificationPeriodEnum, ReportProcessingStatusEnum as ReportsApiModelReportProcessingStatusEnum, @@ -743,6 +775,26 @@ export { ServiceApiGetServiceJobsRequest as ServicesApiModelServiceApiGetServiceJobsRequest, ServiceApiRescheduleAppointmentForServiceJobByServiceJobIdRequest as ServicesApiModelServiceApiRescheduleAppointmentForServiceJobByServiceJobIdRequest, } from './services-api-model' +export { + AddressTypeEnum as ShipmentInvoicingApiModelAddressTypeEnum, + ShipmentInvoiceStatus as ShipmentInvoicingApiModelShipmentInvoiceStatus, + Address as ShipmentInvoicingApiModelAddress, + BuyerTaxInfo as ShipmentInvoicingApiModelBuyerTaxInfo, + GetInvoiceStatusResponse as ShipmentInvoicingApiModelGetInvoiceStatusResponse, + GetShipmentDetailsResponse as ShipmentInvoicingApiModelGetShipmentDetailsResponse, + ModelError as ShipmentInvoicingApiModelModelError, + Money as ShipmentInvoicingApiModelMoney, + ShipmentDetail as ShipmentInvoicingApiModelShipmentDetail, + ShipmentInvoiceStatusInfo as ShipmentInvoicingApiModelShipmentInvoiceStatusInfo, + ShipmentInvoiceStatusResponse as ShipmentInvoicingApiModelShipmentInvoiceStatusResponse, + ShipmentItem as ShipmentInvoicingApiModelShipmentItem, + SubmitInvoiceRequest as ShipmentInvoicingApiModelSubmitInvoiceRequest, + SubmitInvoiceResponse as ShipmentInvoicingApiModelSubmitInvoiceResponse, + TaxClassification as ShipmentInvoicingApiModelTaxClassification, + ShipmentInvoiceApiGetInvoiceStatusRequest as ShipmentInvoicingApiModelShipmentInvoiceApiGetInvoiceStatusRequest, + ShipmentInvoiceApiGetShipmentDetailsRequest as ShipmentInvoicingApiModelShipmentInvoiceApiGetShipmentDetailsRequest, + ShipmentInvoiceApiSubmitInvoiceRequest as ShipmentInvoicingApiModelShipmentInvoiceApiSubmitInvoiceRequest, +} from './shipment-invoicing-api-model' export { ContainerContainerTypeEnum as ShippingApiModelContainerContainerTypeEnum, DimensionsUnitEnum as ShippingApiModelDimensionsUnitEnum, diff --git a/src/api-models/listings-items-api-model/api.ts b/src/api-models/listings-items-api-model/api.ts new file mode 100644 index 00000000..6f980f69 --- /dev/null +++ b/src/api-models/listings-items-api-model/api.ts @@ -0,0 +1,664 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Listings Items + * The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API. + * + * The version of the OpenAPI document: 2020-09-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'; + +/** + * A list of error responses returned when a request is unsuccessful. + * @export + * @interface ErrorList + */ +export interface ErrorList { + /** + * + * @type {Array} + * @memberof ErrorList + */ + errors: Array; +} +/** + * An issue with a listings item. + * @export + * @interface Issue + */ +export interface Issue { + /** + * An issue code that identifies the type of issue. + * @type {string} + * @memberof Issue + */ + code: string; + /** + * A message that describes the issue. + * @type {string} + * @memberof Issue + */ + message: string; + /** + * The severity of the issue. + * @type {string} + * @memberof Issue + */ + severity: IssueSeverityEnum | 'ERROR' | 'WARNING' | 'INFO'; + /** + * Name of the attribute associated with the issue, if applicable. + * @type {string} + * @memberof Issue + */ + attributeName?: string; +} + +/** + * @export + * @enum {string} + */ +export enum IssueSeverityEnum { + Error = 'ERROR', + Warning = 'WARNING', + Info = 'INFO' +} + +/** + * The request body schema for the patchListingsItem operation. + * @export + * @interface ListingsItemPatchRequest + */ +export interface ListingsItemPatchRequest { + /** + * The Amazon product type of the listings item. + * @type {string} + * @memberof ListingsItemPatchRequest + */ + productType: string; + /** + * One or more JSON Patch operations to perform on the listings item. + * @type {Array} + * @memberof ListingsItemPatchRequest + */ + patches: Array; +} +/** + * The request body schema for the putListingsItem operation. + * @export + * @interface ListingsItemPutRequest + */ +export interface ListingsItemPutRequest { + /** + * The Amazon product type of the listings item. + * @type {string} + * @memberof ListingsItemPutRequest + */ + productType: string; + /** + * The name of the requirements set for the provided data. + * @type {string} + * @memberof ListingsItemPutRequest + */ + requirements?: ListingsItemPutRequestRequirementsEnum | 'LISTING' | 'LISTING_PRODUCT_ONLY' | 'LISTING_OFFER_ONLY'; + /** + * JSON object containing structured listings item attribute data keyed by attribute name. + * @type {object} + * @memberof ListingsItemPutRequest + */ + attributes: object; +} + +/** + * @export + * @enum {string} + */ +export enum ListingsItemPutRequestRequirementsEnum { + Listing = 'LISTING', + ListingProductOnly = 'LISTING_PRODUCT_ONLY', + ListingOfferOnly = 'LISTING_OFFER_ONLY' +} + +/** + * Response containing the results of a submission to the Selling Partner API for Listings Items. + * @export + * @interface ListingsItemSubmissionResponse + */ +export interface ListingsItemSubmissionResponse { + /** + * A selling partner provided identifier for an Amazon listing. + * @type {string} + * @memberof ListingsItemSubmissionResponse + */ + sku: string; + /** + * The status of the listings item submission. + * @type {string} + * @memberof ListingsItemSubmissionResponse + */ + status: ListingsItemSubmissionResponseStatusEnum | 'ACCEPTED' | 'INVALID'; + /** + * The unique identifier of the listings item submission. + * @type {string} + * @memberof ListingsItemSubmissionResponse + */ + submissionId: string; + /** + * Listings item issues related to the listings item submission. + * @type {Array} + * @memberof ListingsItemSubmissionResponse + */ + issues?: Array; +} + +/** + * @export + * @enum {string} + */ +export enum ListingsItemSubmissionResponseStatusEnum { + Accepted = 'ACCEPTED', + Invalid = 'INVALID' +} + +/** + * 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; +} +/** + * Individual JSON Patch operation for an HTTP PATCH request. + * @export + * @interface PatchOperation + */ +export interface PatchOperation { + /** + * Type of JSON Patch operation. Supported JSON Patch operations include add, replace, and delete. See . + * @type {string} + * @memberof PatchOperation + */ + op: PatchOperationOpEnum | 'add' | 'replace' | 'delete'; + /** + * JSON Pointer path of the element to patch. See . + * @type {string} + * @memberof PatchOperation + */ + path: string; + /** + * JSON value to add, replace, or delete. + * @type {Array} + * @memberof PatchOperation + */ + value?: Array; +} + +/** + * @export + * @enum {string} + */ +export enum PatchOperationOpEnum { + Add = 'add', + Replace = 'replace', + Delete = 'delete' +} + + +/** + * ListingsApi - axios parameter creator + * @export + */ +export const ListingsApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Delete a listings item for a selling partner. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} sellerId A selling partner identifier, such as a merchant account or vendor code. + * @param {string} sku A selling partner provided identifier for an Amazon listing. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {string} [issueLocale] A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteListingsItem: async (sellerId: string, sku: string, marketplaceIds: Array, issueLocale?: string, options: any = {}): Promise => { + // verify required parameter 'sellerId' is not null or undefined + assertParamExists('deleteListingsItem', 'sellerId', sellerId) + // verify required parameter 'sku' is not null or undefined + assertParamExists('deleteListingsItem', 'sku', sku) + // verify required parameter 'marketplaceIds' is not null or undefined + assertParamExists('deleteListingsItem', 'marketplaceIds', marketplaceIds) + const localVarPath = `/listings/2020-09-01/items/{sellerId}/{sku}` + .replace(`{${"sellerId"}}`, encodeURIComponent(String(sellerId))) + .replace(`{${"sku"}}`, encodeURIComponent(String(sku))); + // 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; + + if (marketplaceIds) { + localVarQueryParameter['marketplaceIds'] = marketplaceIds.join(COLLECTION_FORMATS.csv); + } + + if (issueLocale !== undefined) { + localVarQueryParameter['issueLocale'] = issueLocale; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be patched. Patching nested attributes is not supported. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} sellerId A selling partner identifier, such as a merchant account or vendor code. + * @param {string} sku A selling partner provided identifier for an Amazon listing. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {ListingsItemPatchRequest} body The request body schema for the patchListingsItem operation. + * @param {string} [issueLocale] A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchListingsItem: async (sellerId: string, sku: string, marketplaceIds: Array, body: ListingsItemPatchRequest, issueLocale?: string, options: any = {}): Promise => { + // verify required parameter 'sellerId' is not null or undefined + assertParamExists('patchListingsItem', 'sellerId', sellerId) + // verify required parameter 'sku' is not null or undefined + assertParamExists('patchListingsItem', 'sku', sku) + // verify required parameter 'marketplaceIds' is not null or undefined + assertParamExists('patchListingsItem', 'marketplaceIds', marketplaceIds) + // verify required parameter 'body' is not null or undefined + assertParamExists('patchListingsItem', 'body', body) + const localVarPath = `/listings/2020-09-01/items/{sellerId}/{sku}` + .replace(`{${"sellerId"}}`, encodeURIComponent(String(sellerId))) + .replace(`{${"sku"}}`, encodeURIComponent(String(sku))); + // 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: 'PATCH', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (marketplaceIds) { + localVarQueryParameter['marketplaceIds'] = marketplaceIds.join(COLLECTION_FORMATS.csv); + } + + if (issueLocale !== undefined) { + localVarQueryParameter['issueLocale'] = issueLocale; + } + + + + 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 new or fully-updates an existing listings item for a selling partner. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} sellerId A selling partner identifier, such as a merchant account or vendor code. + * @param {string} sku A selling partner provided identifier for an Amazon listing. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {ListingsItemPutRequest} body The request body schema for the putListingsItem operation. + * @param {string} [issueLocale] A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putListingsItem: async (sellerId: string, sku: string, marketplaceIds: Array, body: ListingsItemPutRequest, issueLocale?: string, options: any = {}): Promise => { + // verify required parameter 'sellerId' is not null or undefined + assertParamExists('putListingsItem', 'sellerId', sellerId) + // verify required parameter 'sku' is not null or undefined + assertParamExists('putListingsItem', 'sku', sku) + // verify required parameter 'marketplaceIds' is not null or undefined + assertParamExists('putListingsItem', 'marketplaceIds', marketplaceIds) + // verify required parameter 'body' is not null or undefined + assertParamExists('putListingsItem', 'body', body) + const localVarPath = `/listings/2020-09-01/items/{sellerId}/{sku}` + .replace(`{${"sellerId"}}`, encodeURIComponent(String(sellerId))) + .replace(`{${"sku"}}`, encodeURIComponent(String(sku))); + // 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: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (marketplaceIds) { + localVarQueryParameter['marketplaceIds'] = marketplaceIds.join(COLLECTION_FORMATS.csv); + } + + if (issueLocale !== undefined) { + localVarQueryParameter['issueLocale'] = issueLocale; + } + + + + 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, + }; + }, + } +}; + +/** + * ListingsApi - functional programming interface + * @export + */ +export const ListingsApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ListingsApiAxiosParamCreator(configuration) + return { + /** + * Delete a listings item for a selling partner. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} sellerId A selling partner identifier, such as a merchant account or vendor code. + * @param {string} sku A selling partner provided identifier for an Amazon listing. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {string} [issueLocale] A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteListingsItem(sellerId: string, sku: string, marketplaceIds: Array, issueLocale?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteListingsItem(sellerId, sku, marketplaceIds, issueLocale, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be patched. Patching nested attributes is not supported. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} sellerId A selling partner identifier, such as a merchant account or vendor code. + * @param {string} sku A selling partner provided identifier for an Amazon listing. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {ListingsItemPatchRequest} body The request body schema for the patchListingsItem operation. + * @param {string} [issueLocale] A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async patchListingsItem(sellerId: string, sku: string, marketplaceIds: Array, body: ListingsItemPatchRequest, issueLocale?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.patchListingsItem(sellerId, sku, marketplaceIds, body, issueLocale, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Creates a new or fully-updates an existing listings item for a selling partner. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} sellerId A selling partner identifier, such as a merchant account or vendor code. + * @param {string} sku A selling partner provided identifier for an Amazon listing. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {ListingsItemPutRequest} body The request body schema for the putListingsItem operation. + * @param {string} [issueLocale] A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async putListingsItem(sellerId: string, sku: string, marketplaceIds: Array, body: ListingsItemPutRequest, issueLocale?: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.putListingsItem(sellerId, sku, marketplaceIds, body, issueLocale, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * ListingsApi - factory interface + * @export + */ +export const ListingsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = ListingsApiFp(configuration) + return { + /** + * Delete a listings item for a selling partner. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} sellerId A selling partner identifier, such as a merchant account or vendor code. + * @param {string} sku A selling partner provided identifier for an Amazon listing. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {string} [issueLocale] A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteListingsItem(sellerId: string, sku: string, marketplaceIds: Array, issueLocale?: string, options?: any): AxiosPromise { + return localVarFp.deleteListingsItem(sellerId, sku, marketplaceIds, issueLocale, options).then((request) => request(axios, basePath)); + }, + /** + * Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be patched. Patching nested attributes is not supported. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} sellerId A selling partner identifier, such as a merchant account or vendor code. + * @param {string} sku A selling partner provided identifier for an Amazon listing. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {ListingsItemPatchRequest} body The request body schema for the patchListingsItem operation. + * @param {string} [issueLocale] A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchListingsItem(sellerId: string, sku: string, marketplaceIds: Array, body: ListingsItemPatchRequest, issueLocale?: string, options?: any): AxiosPromise { + return localVarFp.patchListingsItem(sellerId, sku, marketplaceIds, body, issueLocale, options).then((request) => request(axios, basePath)); + }, + /** + * Creates a new or fully-updates an existing listings item for a selling partner. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} sellerId A selling partner identifier, such as a merchant account or vendor code. + * @param {string} sku A selling partner provided identifier for an Amazon listing. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {ListingsItemPutRequest} body The request body schema for the putListingsItem operation. + * @param {string} [issueLocale] A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putListingsItem(sellerId: string, sku: string, marketplaceIds: Array, body: ListingsItemPutRequest, issueLocale?: string, options?: any): AxiosPromise { + return localVarFp.putListingsItem(sellerId, sku, marketplaceIds, body, issueLocale, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * Request parameters for deleteListingsItem operation in ListingsApi. + * @export + * @interface ListingsApiDeleteListingsItemRequest + */ +export interface ListingsApiDeleteListingsItemRequest { + /** + * A selling partner identifier, such as a merchant account or vendor code. + * @type {string} + * @memberof ListingsApiDeleteListingsItem + */ + readonly sellerId: string + + /** + * A selling partner provided identifier for an Amazon listing. + * @type {string} + * @memberof ListingsApiDeleteListingsItem + */ + readonly sku: string + + /** + * A comma-delimited list of Amazon marketplace identifiers for the request. + * @type {Array} + * @memberof ListingsApiDeleteListingsItem + */ + readonly marketplaceIds: Array + + /** + * A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @type {string} + * @memberof ListingsApiDeleteListingsItem + */ + readonly issueLocale?: string +} + +/** + * Request parameters for patchListingsItem operation in ListingsApi. + * @export + * @interface ListingsApiPatchListingsItemRequest + */ +export interface ListingsApiPatchListingsItemRequest { + /** + * A selling partner identifier, such as a merchant account or vendor code. + * @type {string} + * @memberof ListingsApiPatchListingsItem + */ + readonly sellerId: string + + /** + * A selling partner provided identifier for an Amazon listing. + * @type {string} + * @memberof ListingsApiPatchListingsItem + */ + readonly sku: string + + /** + * A comma-delimited list of Amazon marketplace identifiers for the request. + * @type {Array} + * @memberof ListingsApiPatchListingsItem + */ + readonly marketplaceIds: Array + + /** + * The request body schema for the patchListingsItem operation. + * @type {ListingsItemPatchRequest} + * @memberof ListingsApiPatchListingsItem + */ + readonly body: ListingsItemPatchRequest + + /** + * A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @type {string} + * @memberof ListingsApiPatchListingsItem + */ + readonly issueLocale?: string +} + +/** + * Request parameters for putListingsItem operation in ListingsApi. + * @export + * @interface ListingsApiPutListingsItemRequest + */ +export interface ListingsApiPutListingsItemRequest { + /** + * A selling partner identifier, such as a merchant account or vendor code. + * @type {string} + * @memberof ListingsApiPutListingsItem + */ + readonly sellerId: string + + /** + * A selling partner provided identifier for an Amazon listing. + * @type {string} + * @memberof ListingsApiPutListingsItem + */ + readonly sku: string + + /** + * A comma-delimited list of Amazon marketplace identifiers for the request. + * @type {Array} + * @memberof ListingsApiPutListingsItem + */ + readonly marketplaceIds: Array + + /** + * The request body schema for the putListingsItem operation. + * @type {ListingsItemPutRequest} + * @memberof ListingsApiPutListingsItem + */ + readonly body: ListingsItemPutRequest + + /** + * A locale for localization of issues. When not provided, the default language code of the first marketplace is used. Examples: \"en_US\", \"fr_CA\", \"fr_FR\". Localized messages default to \"en_US\" when a localization is not available in the specified locale. + * @type {string} + * @memberof ListingsApiPutListingsItem + */ + readonly issueLocale?: string +} + +/** + * ListingsApi - object-oriented interface + * @export + * @class ListingsApi + * @extends {BaseAPI} + */ +export class ListingsApi extends BaseAPI { + /** + * Delete a listings item for a selling partner. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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 {ListingsApiDeleteListingsItemRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ListingsApi + */ + public deleteListingsItem(requestParameters: ListingsApiDeleteListingsItemRequest, options?: any) { + return ListingsApiFp(this.configuration).deleteListingsItem(requestParameters.sellerId, requestParameters.sku, requestParameters.marketplaceIds, requestParameters.issueLocale, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be patched. Patching nested attributes is not supported. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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 {ListingsApiPatchListingsItemRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ListingsApi + */ + public patchListingsItem(requestParameters: ListingsApiPatchListingsItemRequest, options?: any) { + return ListingsApiFp(this.configuration).patchListingsItem(requestParameters.sellerId, requestParameters.sku, requestParameters.marketplaceIds, requestParameters.body, requestParameters.issueLocale, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Creates a new or fully-updates an existing listings item for a selling partner. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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 {ListingsApiPutListingsItemRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ListingsApi + */ + public putListingsItem(requestParameters: ListingsApiPutListingsItemRequest, options?: any) { + return ListingsApiFp(this.configuration).putListingsItem(requestParameters.sellerId, requestParameters.sku, requestParameters.marketplaceIds, requestParameters.body, requestParameters.issueLocale, options).then((request) => request(this.axios, this.basePath)); + } +} + + diff --git a/src/api-models/listings-items-api-model/base.ts b/src/api-models/listings-items-api-model/base.ts new file mode 100644 index 00000000..82f53dd1 --- /dev/null +++ b/src/api-models/listings-items-api-model/base.ts @@ -0,0 +1,71 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Listings Items + * The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API. + * + * The version of the OpenAPI document: 2020-09-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/listings-items-api-model/common.ts b/src/api-models/listings-items-api-model/common.ts new file mode 100644 index 00000000..e0d16628 --- /dev/null +++ b/src/api-models/listings-items-api-model/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Listings Items + * The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API. + * + * The version of the OpenAPI document: 2020-09-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/listings-items-api-model/configuration.ts b/src/api-models/listings-items-api-model/configuration.ts new file mode 100644 index 00000000..3fa8106b --- /dev/null +++ b/src/api-models/listings-items-api-model/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Listings Items + * The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API. + * + * The version of the OpenAPI document: 2020-09-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/listings-items-api-model/index.ts b/src/api-models/listings-items-api-model/index.ts new file mode 100644 index 00000000..bc889cb1 --- /dev/null +++ b/src/api-models/listings-items-api-model/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Listings Items + * The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which you use to retrieve the information about Amazon product types needed to use the Listings Items API. + * + * The version of the OpenAPI document: 2020-09-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/product-type-definitions-api-model/api.ts b/src/api-models/product-type-definitions-api-model/api.ts new file mode 100644 index 00000000..00740613 --- /dev/null +++ b/src/api-models/product-type-definitions-api-model/api.ts @@ -0,0 +1,566 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Product Type Definitions + * The Selling Partner API for Product Type Definitions provides programmatic access to attribute and data requirements for product types in the Amazon catalog. Use this API to return the JSON Schema for a product type that you can then use with other Selling Partner APIs, such as the Selling Partner API for Listings Items, the Selling Partner API for Catalog Items, and the Selling Partner API for Feeds (for JSON-based listing feeds). + * + * The version of the OpenAPI document: 2020-09-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'; + +/** + * A list of error responses returned when a request is unsuccessful. + * @export + * @interface ErrorList + */ +export interface ErrorList { + /** + * + * @type {Array} + * @memberof ErrorList + */ + errors: Array; +} +/** + * 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; +} +/** + * An Amazon product type with a definition available. + * @export + * @interface ProductType + */ +export interface ProductType { + /** + * The name of the Amazon product type. + * @type {string} + * @memberof ProductType + */ + name: string; + /** + * The Amazon marketplace identifiers for which the product type definition is available. + * @type {Array} + * @memberof ProductType + */ + marketplaceIds: Array; +} +/** + * A product type definition represents the attributes and data requirements for a product type in the Amazon catalog. Product type definitions are used interchangeably between the Selling Partner API for Listings Items, Selling Partner API for Catalog Items, and JSON-based listings feeds in the Selling Partner API for Feeds. + * @export + * @interface ProductTypeDefinition + */ +export interface ProductTypeDefinition { + /** + * + * @type {SchemaLink} + * @memberof ProductTypeDefinition + */ + metaSchema?: SchemaLink; + /** + * + * @type {SchemaLink} + * @memberof ProductTypeDefinition + */ + schema: SchemaLink; + /** + * Name of the requirements set represented in this product type definition. + * @type {string} + * @memberof ProductTypeDefinition + */ + requirements: ProductTypeDefinitionRequirementsEnum | 'LISTING' | 'LISTING_PRODUCT_ONLY' | 'LISTING_OFFER_ONLY'; + /** + * Identifies if the required attributes for a requirements set are enforced by the product type definition schema. Non-enforced requirements enable structural validation of individual attributes without all of the required attributes being present (such as for partial updates). + * @type {string} + * @memberof ProductTypeDefinition + */ + requirementsEnforced: ProductTypeDefinitionRequirementsEnforcedEnum | 'ENFORCED' | 'NOT_ENFORCED'; + /** + * Mapping of property group names to property groups. Property groups represent logical groupings of schema properties that can be used for display or informational purposes. + * @type {{ [key: string]: PropertyGroup; }} + * @memberof ProductTypeDefinition + */ + propertyGroups: { [key: string]: PropertyGroup; }; + /** + * Locale of the display elements contained in the product type definition. + * @type {string} + * @memberof ProductTypeDefinition + */ + locale: string; + /** + * Amazon marketplace identifiers for which the product type definition is applicable. + * @type {Array} + * @memberof ProductTypeDefinition + */ + marketplaceIds: Array; + /** + * The name of the Amazon product type that this product type definition applies to. + * @type {string} + * @memberof ProductTypeDefinition + */ + productType: string; + /** + * + * @type {ProductTypeVersion} + * @memberof ProductTypeDefinition + */ + productTypeVersion: ProductTypeVersion; +} + +/** + * @export + * @enum {string} + */ +export enum ProductTypeDefinitionRequirementsEnum { + Listing = 'LISTING', + ListingProductOnly = 'LISTING_PRODUCT_ONLY', + ListingOfferOnly = 'LISTING_OFFER_ONLY' +} +/** + * @export + * @enum {string} + */ +export enum ProductTypeDefinitionRequirementsEnforcedEnum { + Enforced = 'ENFORCED', + NotEnforced = 'NOT_ENFORCED' +} + +/** + * A list of Amazon product types with definitions available. + * @export + * @interface ProductTypeList + */ +export interface ProductTypeList { + /** + * + * @type {Array} + * @memberof ProductTypeList + */ + productTypes: Array; +} +/** + * The version details for an Amazon product type. + * @export + * @interface ProductTypeVersion + */ +export interface ProductTypeVersion { + /** + * Version identifier. + * @type {string} + * @memberof ProductTypeVersion + */ + version: string; + /** + * When true, the version indicated by the version identifier is the latest available for the Amazon product type. + * @type {boolean} + * @memberof ProductTypeVersion + */ + latest: boolean; + /** + * When true, the version indicated by the version identifier is the prerelease (release candidate) for the Amazon product type. + * @type {boolean} + * @memberof ProductTypeVersion + */ + releaseCandidate?: boolean; +} +/** + * A property group represents a logical grouping of schema properties that can be used for display or informational purposes. + * @export + * @interface PropertyGroup + */ +export interface PropertyGroup { + /** + * The display label of the property group. + * @type {string} + * @memberof PropertyGroup + */ + title?: string; + /** + * The description of the property group. + * @type {string} + * @memberof PropertyGroup + */ + description?: string; + /** + * The names of the schema properties for the property group. + * @type {Array} + * @memberof PropertyGroup + */ + propertyNames?: Array; +} +/** + * + * @export + * @interface SchemaLink + */ +export interface SchemaLink { + /** + * + * @type {SchemaLinkLink} + * @memberof SchemaLink + */ + link: SchemaLinkLink; + /** + * Checksum hash of the schema (Base64 MD5). Can be used to verify schema contents, identify changes between schema versions, and for caching. + * @type {string} + * @memberof SchemaLink + */ + checksum: string; +} +/** + * Link to retrieve the schema. + * @export + * @interface SchemaLinkLink + */ +export interface SchemaLinkLink { + /** + * URI resource for the link. + * @type {string} + * @memberof SchemaLinkLink + */ + resource: string; + /** + * HTTP method for the link operation. + * @type {string} + * @memberof SchemaLinkLink + */ + verb: SchemaLinkLinkVerbEnum | 'GET'; +} + +/** + * @export + * @enum {string} + */ +export enum SchemaLinkLinkVerbEnum { + Get = 'GET' +} + + +/** + * DefinitionsApi - axios parameter creator + * @export + */ +export const DefinitionsApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Retrieve an Amazon product type definition. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} productType The Amazon product type name. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {string} [sellerId] A selling partner identifier. When provided, seller-specific requirements and values are populated within the product type definition schema, such as brand names associated with the selling partner. + * @param {string} [productTypeVersion] The version of the Amazon product type to retrieve. Defaults to \"LATEST\",. Prerelease versions of product type definitions may be retrieved with \"RELEASE_CANDIDATE\". If no prerelease version is currently available, the \"LATEST\" live version will be provided. + * @param {'LISTING' | 'LISTING_PRODUCT_ONLY' | 'LISTING_OFFER_ONLY'} [requirements] The name of the requirements set to retrieve requirements for. + * @param {'ENFORCED' | 'NOT_ENFORCED'} [requirementsEnforced] Identifies if the required attributes for a requirements set are enforced by the product type definition schema. Non-enforced requirements enable structural validation of individual attributes without all the required attributes being present (such as for partial updates). + * @param {'DEFAULT' | 'ar' | 'ar_AE' | 'de' | 'de_DE' | 'en' | 'en_AE' | 'en_AU' | 'en_CA' | 'en_GB' | 'en_IN' | 'en_SG' | 'en_US' | 'es' | 'es_ES' | 'es_MX' | 'es_US' | 'fr' | 'fr_CA' | 'fr_FR' | 'it' | 'it_IT' | 'ja' | 'ja_JP' | 'nl' | 'nl_NL' | 'pl' | 'pl_PL' | 'pt' | 'pt_BR' | 'pt_PT' | 'sv' | 'sv_SE' | 'tr' | 'tr_TR' | 'zh' | 'zh_CN' | 'zh_TW'} [locale] Locale for retrieving display labels and other presentation details. Defaults to the default language of the first marketplace in the request. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getDefinitionsProductType: async (productType: string, marketplaceIds: Array, sellerId?: string, productTypeVersion?: string, requirements?: 'LISTING' | 'LISTING_PRODUCT_ONLY' | 'LISTING_OFFER_ONLY', requirementsEnforced?: 'ENFORCED' | 'NOT_ENFORCED', locale?: 'DEFAULT' | 'ar' | 'ar_AE' | 'de' | 'de_DE' | 'en' | 'en_AE' | 'en_AU' | 'en_CA' | 'en_GB' | 'en_IN' | 'en_SG' | 'en_US' | 'es' | 'es_ES' | 'es_MX' | 'es_US' | 'fr' | 'fr_CA' | 'fr_FR' | 'it' | 'it_IT' | 'ja' | 'ja_JP' | 'nl' | 'nl_NL' | 'pl' | 'pl_PL' | 'pt' | 'pt_BR' | 'pt_PT' | 'sv' | 'sv_SE' | 'tr' | 'tr_TR' | 'zh' | 'zh_CN' | 'zh_TW', options: any = {}): Promise => { + // verify required parameter 'productType' is not null or undefined + assertParamExists('getDefinitionsProductType', 'productType', productType) + // verify required parameter 'marketplaceIds' is not null or undefined + assertParamExists('getDefinitionsProductType', 'marketplaceIds', marketplaceIds) + const localVarPath = `/definitions/2020-09-01/productTypes/{productType}` + .replace(`{${"productType"}}`, encodeURIComponent(String(productType))); + // 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 (sellerId !== undefined) { + localVarQueryParameter['sellerId'] = sellerId; + } + + if (marketplaceIds) { + localVarQueryParameter['marketplaceIds'] = marketplaceIds.join(COLLECTION_FORMATS.csv); + } + + if (productTypeVersion !== undefined) { + localVarQueryParameter['productTypeVersion'] = productTypeVersion; + } + + if (requirements !== undefined) { + localVarQueryParameter['requirements'] = requirements; + } + + if (requirementsEnforced !== undefined) { + localVarQueryParameter['requirementsEnforced'] = requirementsEnforced; + } + + 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 product types that have definitions available. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {Array} [keywords] A comma-delimited list of keywords to search product types by. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchDefinitionsProductTypes: async (marketplaceIds: Array, keywords?: Array, options: any = {}): Promise => { + // verify required parameter 'marketplaceIds' is not null or undefined + assertParamExists('searchDefinitionsProductTypes', 'marketplaceIds', marketplaceIds) + const localVarPath = `/definitions/2020-09-01/productTypes`; + // 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); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * DefinitionsApi - functional programming interface + * @export + */ +export const DefinitionsApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = DefinitionsApiAxiosParamCreator(configuration) + return { + /** + * Retrieve an Amazon product type definition. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} productType The Amazon product type name. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {string} [sellerId] A selling partner identifier. When provided, seller-specific requirements and values are populated within the product type definition schema, such as brand names associated with the selling partner. + * @param {string} [productTypeVersion] The version of the Amazon product type to retrieve. Defaults to \"LATEST\",. Prerelease versions of product type definitions may be retrieved with \"RELEASE_CANDIDATE\". If no prerelease version is currently available, the \"LATEST\" live version will be provided. + * @param {'LISTING' | 'LISTING_PRODUCT_ONLY' | 'LISTING_OFFER_ONLY'} [requirements] The name of the requirements set to retrieve requirements for. + * @param {'ENFORCED' | 'NOT_ENFORCED'} [requirementsEnforced] Identifies if the required attributes for a requirements set are enforced by the product type definition schema. Non-enforced requirements enable structural validation of individual attributes without all the required attributes being present (such as for partial updates). + * @param {'DEFAULT' | 'ar' | 'ar_AE' | 'de' | 'de_DE' | 'en' | 'en_AE' | 'en_AU' | 'en_CA' | 'en_GB' | 'en_IN' | 'en_SG' | 'en_US' | 'es' | 'es_ES' | 'es_MX' | 'es_US' | 'fr' | 'fr_CA' | 'fr_FR' | 'it' | 'it_IT' | 'ja' | 'ja_JP' | 'nl' | 'nl_NL' | 'pl' | 'pl_PL' | 'pt' | 'pt_BR' | 'pt_PT' | 'sv' | 'sv_SE' | 'tr' | 'tr_TR' | 'zh' | 'zh_CN' | 'zh_TW'} [locale] Locale for retrieving display labels and other presentation details. Defaults to the default language of the first marketplace in the request. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getDefinitionsProductType(productType: string, marketplaceIds: Array, sellerId?: string, productTypeVersion?: string, requirements?: 'LISTING' | 'LISTING_PRODUCT_ONLY' | 'LISTING_OFFER_ONLY', requirementsEnforced?: 'ENFORCED' | 'NOT_ENFORCED', locale?: 'DEFAULT' | 'ar' | 'ar_AE' | 'de' | 'de_DE' | 'en' | 'en_AE' | 'en_AU' | 'en_CA' | 'en_GB' | 'en_IN' | 'en_SG' | 'en_US' | 'es' | 'es_ES' | 'es_MX' | 'es_US' | 'fr' | 'fr_CA' | 'fr_FR' | 'it' | 'it_IT' | 'ja' | 'ja_JP' | 'nl' | 'nl_NL' | 'pl' | 'pl_PL' | 'pt' | 'pt_BR' | 'pt_PT' | 'sv' | 'sv_SE' | 'tr' | 'tr_TR' | 'zh' | 'zh_CN' | 'zh_TW', options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getDefinitionsProductType(productType, marketplaceIds, sellerId, productTypeVersion, requirements, requirementsEnforced, locale, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Search for and return a list of Amazon product types that have definitions available. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {Array} [keywords] A comma-delimited list of keywords to search product types by. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async searchDefinitionsProductTypes(marketplaceIds: Array, keywords?: Array, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.searchDefinitionsProductTypes(marketplaceIds, keywords, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * DefinitionsApi - factory interface + * @export + */ +export const DefinitionsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = DefinitionsApiFp(configuration) + return { + /** + * Retrieve an Amazon product type definition. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} productType The Amazon product type name. + * @param {Array} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {string} [sellerId] A selling partner identifier. When provided, seller-specific requirements and values are populated within the product type definition schema, such as brand names associated with the selling partner. + * @param {string} [productTypeVersion] The version of the Amazon product type to retrieve. Defaults to \"LATEST\",. Prerelease versions of product type definitions may be retrieved with \"RELEASE_CANDIDATE\". If no prerelease version is currently available, the \"LATEST\" live version will be provided. + * @param {'LISTING' | 'LISTING_PRODUCT_ONLY' | 'LISTING_OFFER_ONLY'} [requirements] The name of the requirements set to retrieve requirements for. + * @param {'ENFORCED' | 'NOT_ENFORCED'} [requirementsEnforced] Identifies if the required attributes for a requirements set are enforced by the product type definition schema. Non-enforced requirements enable structural validation of individual attributes without all the required attributes being present (such as for partial updates). + * @param {'DEFAULT' | 'ar' | 'ar_AE' | 'de' | 'de_DE' | 'en' | 'en_AE' | 'en_AU' | 'en_CA' | 'en_GB' | 'en_IN' | 'en_SG' | 'en_US' | 'es' | 'es_ES' | 'es_MX' | 'es_US' | 'fr' | 'fr_CA' | 'fr_FR' | 'it' | 'it_IT' | 'ja' | 'ja_JP' | 'nl' | 'nl_NL' | 'pl' | 'pl_PL' | 'pt' | 'pt_BR' | 'pt_PT' | 'sv' | 'sv_SE' | 'tr' | 'tr_TR' | 'zh' | 'zh_CN' | 'zh_TW'} [locale] Locale for retrieving display labels and other presentation details. Defaults to the default language of the first marketplace in the request. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getDefinitionsProductType(productType: string, marketplaceIds: Array, sellerId?: string, productTypeVersion?: string, requirements?: 'LISTING' | 'LISTING_PRODUCT_ONLY' | 'LISTING_OFFER_ONLY', requirementsEnforced?: 'ENFORCED' | 'NOT_ENFORCED', locale?: 'DEFAULT' | 'ar' | 'ar_AE' | 'de' | 'de_DE' | 'en' | 'en_AE' | 'en_AU' | 'en_CA' | 'en_GB' | 'en_IN' | 'en_SG' | 'en_US' | 'es' | 'es_ES' | 'es_MX' | 'es_US' | 'fr' | 'fr_CA' | 'fr_FR' | 'it' | 'it_IT' | 'ja' | 'ja_JP' | 'nl' | 'nl_NL' | 'pl' | 'pl_PL' | 'pt' | 'pt_BR' | 'pt_PT' | 'sv' | 'sv_SE' | 'tr' | 'tr_TR' | 'zh' | 'zh_CN' | 'zh_TW', options?: any): AxiosPromise { + return localVarFp.getDefinitionsProductType(productType, marketplaceIds, sellerId, productTypeVersion, requirements, requirementsEnforced, locale, options).then((request) => request(axios, basePath)); + }, + /** + * Search for and return a list of Amazon product types that have definitions available. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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} marketplaceIds A comma-delimited list of Amazon marketplace identifiers for the request. + * @param {Array} [keywords] A comma-delimited list of keywords to search product types by. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchDefinitionsProductTypes(marketplaceIds: Array, keywords?: Array, options?: any): AxiosPromise { + return localVarFp.searchDefinitionsProductTypes(marketplaceIds, keywords, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * Request parameters for getDefinitionsProductType operation in DefinitionsApi. + * @export + * @interface DefinitionsApiGetDefinitionsProductTypeRequest + */ +export interface DefinitionsApiGetDefinitionsProductTypeRequest { + /** + * The Amazon product type name. + * @type {string} + * @memberof DefinitionsApiGetDefinitionsProductType + */ + readonly productType: string + + /** + * A comma-delimited list of Amazon marketplace identifiers for the request. + * @type {Array} + * @memberof DefinitionsApiGetDefinitionsProductType + */ + readonly marketplaceIds: Array + + /** + * A selling partner identifier. When provided, seller-specific requirements and values are populated within the product type definition schema, such as brand names associated with the selling partner. + * @type {string} + * @memberof DefinitionsApiGetDefinitionsProductType + */ + readonly sellerId?: string + + /** + * The version of the Amazon product type to retrieve. Defaults to \"LATEST\",. Prerelease versions of product type definitions may be retrieved with \"RELEASE_CANDIDATE\". If no prerelease version is currently available, the \"LATEST\" live version will be provided. + * @type {string} + * @memberof DefinitionsApiGetDefinitionsProductType + */ + readonly productTypeVersion?: string + + /** + * The name of the requirements set to retrieve requirements for. + * @type {'LISTING' | 'LISTING_PRODUCT_ONLY' | 'LISTING_OFFER_ONLY'} + * @memberof DefinitionsApiGetDefinitionsProductType + */ + readonly requirements?: 'LISTING' | 'LISTING_PRODUCT_ONLY' | 'LISTING_OFFER_ONLY' + + /** + * Identifies if the required attributes for a requirements set are enforced by the product type definition schema. Non-enforced requirements enable structural validation of individual attributes without all the required attributes being present (such as for partial updates). + * @type {'ENFORCED' | 'NOT_ENFORCED'} + * @memberof DefinitionsApiGetDefinitionsProductType + */ + readonly requirementsEnforced?: 'ENFORCED' | 'NOT_ENFORCED' + + /** + * Locale for retrieving display labels and other presentation details. Defaults to the default language of the first marketplace in the request. + * @type {'DEFAULT' | 'ar' | 'ar_AE' | 'de' | 'de_DE' | 'en' | 'en_AE' | 'en_AU' | 'en_CA' | 'en_GB' | 'en_IN' | 'en_SG' | 'en_US' | 'es' | 'es_ES' | 'es_MX' | 'es_US' | 'fr' | 'fr_CA' | 'fr_FR' | 'it' | 'it_IT' | 'ja' | 'ja_JP' | 'nl' | 'nl_NL' | 'pl' | 'pl_PL' | 'pt' | 'pt_BR' | 'pt_PT' | 'sv' | 'sv_SE' | 'tr' | 'tr_TR' | 'zh' | 'zh_CN' | 'zh_TW'} + * @memberof DefinitionsApiGetDefinitionsProductType + */ + readonly locale?: 'DEFAULT' | 'ar' | 'ar_AE' | 'de' | 'de_DE' | 'en' | 'en_AE' | 'en_AU' | 'en_CA' | 'en_GB' | 'en_IN' | 'en_SG' | 'en_US' | 'es' | 'es_ES' | 'es_MX' | 'es_US' | 'fr' | 'fr_CA' | 'fr_FR' | 'it' | 'it_IT' | 'ja' | 'ja_JP' | 'nl' | 'nl_NL' | 'pl' | 'pl_PL' | 'pt' | 'pt_BR' | 'pt_PT' | 'sv' | 'sv_SE' | 'tr' | 'tr_TR' | 'zh' | 'zh_CN' | 'zh_TW' +} + +/** + * Request parameters for searchDefinitionsProductTypes operation in DefinitionsApi. + * @export + * @interface DefinitionsApiSearchDefinitionsProductTypesRequest + */ +export interface DefinitionsApiSearchDefinitionsProductTypesRequest { + /** + * A comma-delimited list of Amazon marketplace identifiers for the request. + * @type {Array} + * @memberof DefinitionsApiSearchDefinitionsProductTypes + */ + readonly marketplaceIds: Array + + /** + * A comma-delimited list of keywords to search product types by. + * @type {Array} + * @memberof DefinitionsApiSearchDefinitionsProductTypes + */ + readonly keywords?: Array +} + +/** + * DefinitionsApi - object-oriented interface + * @export + * @class DefinitionsApi + * @extends {BaseAPI} + */ +export class DefinitionsApi extends BaseAPI { + /** + * Retrieve an Amazon product type definition. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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 {DefinitionsApiGetDefinitionsProductTypeRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefinitionsApi + */ + public getDefinitionsProductType(requestParameters: DefinitionsApiGetDefinitionsProductTypeRequest, options?: any) { + return DefinitionsApiFp(this.configuration).getDefinitionsProductType(requestParameters.productType, requestParameters.marketplaceIds, requestParameters.sellerId, requestParameters.productTypeVersion, requestParameters.requirements, requestParameters.requirementsEnforced, requestParameters.locale, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Search for and return a list of Amazon product types that have definitions available. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 5 | 10 | |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 {DefinitionsApiSearchDefinitionsProductTypesRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefinitionsApi + */ + public searchDefinitionsProductTypes(requestParameters: DefinitionsApiSearchDefinitionsProductTypesRequest, options?: any) { + return DefinitionsApiFp(this.configuration).searchDefinitionsProductTypes(requestParameters.marketplaceIds, requestParameters.keywords, options).then((request) => request(this.axios, this.basePath)); + } +} + + diff --git a/src/api-models/product-type-definitions-api-model/base.ts b/src/api-models/product-type-definitions-api-model/base.ts new file mode 100644 index 00000000..7910a20c --- /dev/null +++ b/src/api-models/product-type-definitions-api-model/base.ts @@ -0,0 +1,71 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Product Type Definitions + * The Selling Partner API for Product Type Definitions provides programmatic access to attribute and data requirements for product types in the Amazon catalog. Use this API to return the JSON Schema for a product type that you can then use with other Selling Partner APIs, such as the Selling Partner API for Listings Items, the Selling Partner API for Catalog Items, and the Selling Partner API for Feeds (for JSON-based listing feeds). + * + * The version of the OpenAPI document: 2020-09-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/product-type-definitions-api-model/common.ts b/src/api-models/product-type-definitions-api-model/common.ts new file mode 100644 index 00000000..bfe30930 --- /dev/null +++ b/src/api-models/product-type-definitions-api-model/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Product Type Definitions + * The Selling Partner API for Product Type Definitions provides programmatic access to attribute and data requirements for product types in the Amazon catalog. Use this API to return the JSON Schema for a product type that you can then use with other Selling Partner APIs, such as the Selling Partner API for Listings Items, the Selling Partner API for Catalog Items, and the Selling Partner API for Feeds (for JSON-based listing feeds). + * + * The version of the OpenAPI document: 2020-09-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/product-type-definitions-api-model/configuration.ts b/src/api-models/product-type-definitions-api-model/configuration.ts new file mode 100644 index 00000000..7062d060 --- /dev/null +++ b/src/api-models/product-type-definitions-api-model/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Product Type Definitions + * The Selling Partner API for Product Type Definitions provides programmatic access to attribute and data requirements for product types in the Amazon catalog. Use this API to return the JSON Schema for a product type that you can then use with other Selling Partner APIs, such as the Selling Partner API for Listings Items, the Selling Partner API for Catalog Items, and the Selling Partner API for Feeds (for JSON-based listing feeds). + * + * The version of the OpenAPI document: 2020-09-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/product-type-definitions-api-model/index.ts b/src/api-models/product-type-definitions-api-model/index.ts new file mode 100644 index 00000000..e00d4727 --- /dev/null +++ b/src/api-models/product-type-definitions-api-model/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Product Type Definitions + * The Selling Partner API for Product Type Definitions provides programmatic access to attribute and data requirements for product types in the Amazon catalog. Use this API to return the JSON Schema for a product type that you can then use with other Selling Partner APIs, such as the Selling Partner API for Listings Items, the Selling Partner API for Catalog Items, and the Selling Partner API for Feeds (for JSON-based listing feeds). + * + * The version of the OpenAPI document: 2020-09-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/shipment-invoicing-api-model/api.ts b/src/api-models/shipment-invoicing-api-model/api.ts new file mode 100644 index 00000000..efccf2aa --- /dev/null +++ b/src/api-models/shipment-invoicing-api-model/api.ts @@ -0,0 +1,751 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Shipment Invoicing + * The Selling Partner API for Shipment Invoicing helps you programmatically retrieve shipment invoice information in the Brazil marketplace for a selling partner’s Fulfillment by Amazon (FBA) orders. + * + * The version of the OpenAPI document: v0 + * + * + * 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'; + +/** + * The shipping address details of the shipment. + * @export + * @interface Address + */ +export interface Address { + /** + * The name. + * @type {string} + * @memberof Address + */ + Name?: string; + /** + * The street address. + * @type {string} + * @memberof Address + */ + AddressLine1?: string; + /** + * Additional street address information, if required. + * @type {string} + * @memberof Address + */ + AddressLine2?: string; + /** + * Additional street address information, if required. + * @type {string} + * @memberof Address + */ + AddressLine3?: string; + /** + * The city. + * @type {string} + * @memberof Address + */ + City?: string; + /** + * The county. + * @type {string} + * @memberof Address + */ + County?: string; + /** + * The district. + * @type {string} + * @memberof Address + */ + District?: string; + /** + * The state or region. + * @type {string} + * @memberof Address + */ + StateOrRegion?: string; + /** + * The postal code. + * @type {string} + * @memberof Address + */ + PostalCode?: string; + /** + * The country code. + * @type {string} + * @memberof Address + */ + CountryCode?: string; + /** + * The phone number. + * @type {string} + * @memberof Address + */ + Phone?: string; + /** + * + * @type {AddressTypeEnum} + * @memberof Address + */ + AddressType?: AddressTypeEnum | 'Residential' | 'Commercial'; +} +/** + * The shipping address type. + * @export + * @enum {string} + */ +export enum AddressTypeEnum { + Residential = 'Residential', + Commercial = 'Commercial' +} + +/** + * Tax information about the buyer. + * @export + * @interface BuyerTaxInfo + */ +export interface BuyerTaxInfo { + /** + * The legal name of the company. + * @type {string} + * @memberof BuyerTaxInfo + */ + CompanyLegalName?: string; + /** + * The country or region imposing the tax. + * @type {string} + * @memberof BuyerTaxInfo + */ + TaxingRegion?: string; + /** + * The list of tax classifications. + * @type {Array} + * @memberof BuyerTaxInfo + */ + TaxClassifications?: Array; +} +/** + * The response schema for the getInvoiceStatus operation. + * @export + * @interface GetInvoiceStatusResponse + */ +export interface GetInvoiceStatusResponse { + /** + * + * @type {ShipmentInvoiceStatusResponse} + * @memberof GetInvoiceStatusResponse + */ + payload?: ShipmentInvoiceStatusResponse; + /** + * A list of error responses returned when a request is unsuccessful. + * @type {Array} + * @memberof GetInvoiceStatusResponse + */ + errors?: Array; +} +/** + * The response schema for the getShipmentDetails operation. + * @export + * @interface GetShipmentDetailsResponse + */ +export interface GetShipmentDetailsResponse { + /** + * + * @type {ShipmentDetail} + * @memberof GetShipmentDetailsResponse + */ + payload?: ShipmentDetail; + /** + * A list of error responses returned when a request is unsuccessful. + * @type {Array} + * @memberof GetShipmentDetailsResponse + */ + errors?: Array; +} +/** + * 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. + * @type {string} + * @memberof ModelError + */ + message: string; + /** + * Additional details that can help the caller understand or fix the issue. + * @type {string} + * @memberof ModelError + */ + details?: string; +} +/** + * The currency type and amount. + * @export + * @interface Money + */ +export interface Money { + /** + * Three-digit currency code in ISO 4217 format. + * @type {string} + * @memberof Money + */ + CurrencyCode?: string; + /** + * The currency amount. + * @type {string} + * @memberof Money + */ + Amount?: string; +} +/** + * The information required by a selling partner to issue a shipment invoice. + * @export + * @interface ShipmentDetail + */ +export interface ShipmentDetail { + /** + * The Amazon-defined identifier for the warehouse. + * @type {string} + * @memberof ShipmentDetail + */ + WarehouseId?: string; + /** + * The Amazon-defined identifier for the order. + * @type {string} + * @memberof ShipmentDetail + */ + AmazonOrderId?: string; + /** + * The Amazon-defined identifier for the shipment. + * @type {string} + * @memberof ShipmentDetail + */ + AmazonShipmentId?: string; + /** + * The date and time when the order was created. + * @type {string} + * @memberof ShipmentDetail + */ + PurchaseDate?: string; + /** + * + * @type {Address} + * @memberof ShipmentDetail + */ + ShippingAddress?: Address; + /** + * The list of payment method details. + * @type {Array} + * @memberof ShipmentDetail + */ + PaymentMethodDetails?: Array; + /** + * The identifier for the marketplace where the order was placed. + * @type {string} + * @memberof ShipmentDetail + */ + MarketplaceId?: string; + /** + * The seller identifier. + * @type {string} + * @memberof ShipmentDetail + */ + SellerId?: string; + /** + * The name of the buyer. + * @type {string} + * @memberof ShipmentDetail + */ + BuyerName?: string; + /** + * The county of the buyer. + * @type {string} + * @memberof ShipmentDetail + */ + BuyerCounty?: string; + /** + * + * @type {BuyerTaxInfo} + * @memberof ShipmentDetail + */ + BuyerTaxInfo?: BuyerTaxInfo; + /** + * A list of shipment items. + * @type {Array} + * @memberof ShipmentDetail + */ + ShipmentItems?: Array; +} +/** + * The shipment invoice status. + * @export + * @enum {string} + */ +export enum ShipmentInvoiceStatus { + Processing = 'Processing', + Accepted = 'Accepted', + Errored = 'Errored', + NotFound = 'NotFound' +} + +/** + * The shipment invoice status information. + * @export + * @interface ShipmentInvoiceStatusInfo + */ +export interface ShipmentInvoiceStatusInfo { + /** + * The Amazon-defined shipment identifier. + * @type {string} + * @memberof ShipmentInvoiceStatusInfo + */ + AmazonShipmentId?: string; + /** + * + * @type {ShipmentInvoiceStatus} + * @memberof ShipmentInvoiceStatusInfo + */ + InvoiceStatus?: ShipmentInvoiceStatus | 'Processing' | 'Accepted' | 'Errored' | 'NotFound'; +} +/** + * The shipment invoice status response. + * @export + * @interface ShipmentInvoiceStatusResponse + */ +export interface ShipmentInvoiceStatusResponse { + /** + * + * @type {ShipmentInvoiceStatusInfo} + * @memberof ShipmentInvoiceStatusResponse + */ + Shipments?: ShipmentInvoiceStatusInfo; +} +/** + * The shipment item information required by a seller to issue a shipment invoice. + * @export + * @interface ShipmentItem + */ +export interface ShipmentItem { + /** + * The Amazon Standard Identification Number (ASIN) of the item. + * @type {string} + * @memberof ShipmentItem + */ + ASIN?: string; + /** + * The seller SKU of the item. + * @type {string} + * @memberof ShipmentItem + */ + SellerSKU?: string; + /** + * The Amazon-defined identifier for the order item. + * @type {string} + * @memberof ShipmentItem + */ + OrderItemId?: string; + /** + * The name of the item. + * @type {string} + * @memberof ShipmentItem + */ + Title?: string; + /** + * The number of items ordered. + * @type {number} + * @memberof ShipmentItem + */ + QuantityOrdered?: number; + /** + * + * @type {Money} + * @memberof ShipmentItem + */ + ItemPrice?: Money; + /** + * + * @type {Money} + * @memberof ShipmentItem + */ + ShippingPrice?: Money; + /** + * + * @type {Money} + * @memberof ShipmentItem + */ + GiftWrapPrice?: Money; + /** + * + * @type {Money} + * @memberof ShipmentItem + */ + ShippingDiscount?: Money; + /** + * + * @type {Money} + * @memberof ShipmentItem + */ + PromotionDiscount?: Money; + /** + * The list of serial numbers. + * @type {Array} + * @memberof ShipmentItem + */ + SerialNumbers?: Array; +} +/** + * The request schema for the submitInvoice operation. + * @export + * @interface SubmitInvoiceRequest + */ +export interface SubmitInvoiceRequest { + /** + * Shipment invoice document content. + * @type {string} + * @memberof SubmitInvoiceRequest + */ + InvoiceContent: string; + /** + * MD5 sum for validating the invoice data. For more information about calculating this value, see [Working with Content-MD5 Checksums](https://docs.developer.amazonservices.com/en_US/dev_guide/DG_MD5.html). + * @type {string} + * @memberof SubmitInvoiceRequest + */ + ContentMD5Value: string; +} +/** + * The response schema for the submitInvoice operation. + * @export + * @interface SubmitInvoiceResponse + */ +export interface SubmitInvoiceResponse { + /** + * A list of error responses returned when a request is unsuccessful. + * @type {Array} + * @memberof SubmitInvoiceResponse + */ + errors?: Array; +} +/** + * The tax classification for the entity. + * @export + * @interface TaxClassification + */ +export interface TaxClassification { + /** + * The type of tax. + * @type {string} + * @memberof TaxClassification + */ + Name?: string; + /** + * The entity\'s tax identifier. + * @type {string} + * @memberof TaxClassification + */ + Value?: string; +} + +/** + * ShipmentInvoiceApi - axios parameter creator + * @export + */ +export const ShipmentInvoiceApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * Returns the invoice status for the shipment you specify. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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} shipmentId The shipment identifier for the shipment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInvoiceStatus: async (shipmentId: string, options: any = {}): Promise => { + // verify required parameter 'shipmentId' is not null or undefined + assertParamExists('getInvoiceStatus', 'shipmentId', shipmentId) + const localVarPath = `/fba/outbound/brazil/v0/shipments/{shipmentId}/invoice/status` + .replace(`{${"shipmentId"}}`, encodeURIComponent(String(shipmentId))); + // 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 shipment details required to issue an invoice for the specified shipment. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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} shipmentId The identifier for the shipment. Get this value from the FBAOutboundShipmentStatus notification. For information about subscribing to notifications, see the [Notifications API Use Case Guide](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/notifications-api-use-case-guide/notifications-use-case-guide-v1.md). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getShipmentDetails: async (shipmentId: string, options: any = {}): Promise => { + // verify required parameter 'shipmentId' is not null or undefined + assertParamExists('getShipmentDetails', 'shipmentId', shipmentId) + const localVarPath = `/fba/outbound/brazil/v0/shipments/{shipmentId}` + .replace(`{${"shipmentId"}}`, encodeURIComponent(String(shipmentId))); + // 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, + }; + }, + /** + * Submits a shipment invoice document for a given shipment. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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} shipmentId The identifier for the shipment. + * @param {SubmitInvoiceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + submitInvoice: async (shipmentId: string, body: SubmitInvoiceRequest, options: any = {}): Promise => { + // verify required parameter 'shipmentId' is not null or undefined + assertParamExists('submitInvoice', 'shipmentId', shipmentId) + // verify required parameter 'body' is not null or undefined + assertParamExists('submitInvoice', 'body', body) + const localVarPath = `/fba/outbound/brazil/v0/shipments/{shipmentId}/invoice` + .replace(`{${"shipmentId"}}`, encodeURIComponent(String(shipmentId))); + // 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, + }; + }, + } +}; + +/** + * ShipmentInvoiceApi - functional programming interface + * @export + */ +export const ShipmentInvoiceApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = ShipmentInvoiceApiAxiosParamCreator(configuration) + return { + /** + * Returns the invoice status for the shipment you specify. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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} shipmentId The shipment identifier for the shipment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getInvoiceStatus(shipmentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getInvoiceStatus(shipmentId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Returns the shipment details required to issue an invoice for the specified shipment. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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} shipmentId The identifier for the shipment. Get this value from the FBAOutboundShipmentStatus notification. For information about subscribing to notifications, see the [Notifications API Use Case Guide](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/notifications-api-use-case-guide/notifications-use-case-guide-v1.md). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getShipmentDetails(shipmentId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getShipmentDetails(shipmentId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * Submits a shipment invoice document for a given shipment. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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} shipmentId The identifier for the shipment. + * @param {SubmitInvoiceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async submitInvoice(shipmentId: string, body: SubmitInvoiceRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.submitInvoice(shipmentId, body, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * ShipmentInvoiceApi - factory interface + * @export + */ +export const ShipmentInvoiceApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = ShipmentInvoiceApiFp(configuration) + return { + /** + * Returns the invoice status for the shipment you specify. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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} shipmentId The shipment identifier for the shipment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInvoiceStatus(shipmentId: string, options?: any): AxiosPromise { + return localVarFp.getInvoiceStatus(shipmentId, options).then((request) => request(axios, basePath)); + }, + /** + * Returns the shipment details required to issue an invoice for the specified shipment. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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} shipmentId The identifier for the shipment. Get this value from the FBAOutboundShipmentStatus notification. For information about subscribing to notifications, see the [Notifications API Use Case Guide](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/notifications-api-use-case-guide/notifications-use-case-guide-v1.md). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getShipmentDetails(shipmentId: string, options?: any): AxiosPromise { + return localVarFp.getShipmentDetails(shipmentId, options).then((request) => request(axios, basePath)); + }, + /** + * Submits a shipment invoice document for a given shipment. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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} shipmentId The identifier for the shipment. + * @param {SubmitInvoiceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + submitInvoice(shipmentId: string, body: SubmitInvoiceRequest, options?: any): AxiosPromise { + return localVarFp.submitInvoice(shipmentId, body, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * Request parameters for getInvoiceStatus operation in ShipmentInvoiceApi. + * @export + * @interface ShipmentInvoiceApiGetInvoiceStatusRequest + */ +export interface ShipmentInvoiceApiGetInvoiceStatusRequest { + /** + * The shipment identifier for the shipment. + * @type {string} + * @memberof ShipmentInvoiceApiGetInvoiceStatus + */ + readonly shipmentId: string +} + +/** + * Request parameters for getShipmentDetails operation in ShipmentInvoiceApi. + * @export + * @interface ShipmentInvoiceApiGetShipmentDetailsRequest + */ +export interface ShipmentInvoiceApiGetShipmentDetailsRequest { + /** + * The identifier for the shipment. Get this value from the FBAOutboundShipmentStatus notification. For information about subscribing to notifications, see the [Notifications API Use Case Guide](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/notifications-api-use-case-guide/notifications-use-case-guide-v1.md). + * @type {string} + * @memberof ShipmentInvoiceApiGetShipmentDetails + */ + readonly shipmentId: string +} + +/** + * Request parameters for submitInvoice operation in ShipmentInvoiceApi. + * @export + * @interface ShipmentInvoiceApiSubmitInvoiceRequest + */ +export interface ShipmentInvoiceApiSubmitInvoiceRequest { + /** + * The identifier for the shipment. + * @type {string} + * @memberof ShipmentInvoiceApiSubmitInvoice + */ + readonly shipmentId: string + + /** + * + * @type {SubmitInvoiceRequest} + * @memberof ShipmentInvoiceApiSubmitInvoice + */ + readonly body: SubmitInvoiceRequest +} + +/** + * ShipmentInvoiceApi - object-oriented interface + * @export + * @class ShipmentInvoiceApi + * @extends {BaseAPI} + */ +export class ShipmentInvoiceApi extends BaseAPI { + /** + * Returns the invoice status for the shipment you specify. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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 {ShipmentInvoiceApiGetInvoiceStatusRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ShipmentInvoiceApi + */ + public getInvoiceStatus(requestParameters: ShipmentInvoiceApiGetInvoiceStatusRequest, options?: any) { + return ShipmentInvoiceApiFp(this.configuration).getInvoiceStatus(requestParameters.shipmentId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Returns the shipment details required to issue an invoice for the specified shipment. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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 {ShipmentInvoiceApiGetShipmentDetailsRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ShipmentInvoiceApi + */ + public getShipmentDetails(requestParameters: ShipmentInvoiceApiGetShipmentDetailsRequest, options?: any) { + return ShipmentInvoiceApiFp(this.configuration).getShipmentDetails(requestParameters.shipmentId, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * Submits a shipment invoice document for a given shipment. **Usage Plans:** | Plan type | Rate (requests per second) | Burst | | ---- | ---- | ---- | |Default| 1.133 | 25 | |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 {ShipmentInvoiceApiSubmitInvoiceRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ShipmentInvoiceApi + */ + public submitInvoice(requestParameters: ShipmentInvoiceApiSubmitInvoiceRequest, options?: any) { + return ShipmentInvoiceApiFp(this.configuration).submitInvoice(requestParameters.shipmentId, requestParameters.body, options).then((request) => request(this.axios, this.basePath)); + } +} + + diff --git a/src/api-models/shipment-invoicing-api-model/base.ts b/src/api-models/shipment-invoicing-api-model/base.ts new file mode 100644 index 00000000..c8c3f1e0 --- /dev/null +++ b/src/api-models/shipment-invoicing-api-model/base.ts @@ -0,0 +1,71 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Shipment Invoicing + * The Selling Partner API for Shipment Invoicing helps you programmatically retrieve shipment invoice information in the Brazil marketplace for a selling partner’s Fulfillment by Amazon (FBA) orders. + * + * The version of the OpenAPI document: v0 + * + * + * 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 = "http://localhost".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/shipment-invoicing-api-model/common.ts b/src/api-models/shipment-invoicing-api-model/common.ts new file mode 100644 index 00000000..7172dac3 --- /dev/null +++ b/src/api-models/shipment-invoicing-api-model/common.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Shipment Invoicing + * The Selling Partner API for Shipment Invoicing helps you programmatically retrieve shipment invoice information in the Brazil marketplace for a selling partner’s Fulfillment by Amazon (FBA) orders. + * + * The version of the OpenAPI document: v0 + * + * + * 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/shipment-invoicing-api-model/configuration.ts b/src/api-models/shipment-invoicing-api-model/configuration.ts new file mode 100644 index 00000000..a44e6f4a --- /dev/null +++ b/src/api-models/shipment-invoicing-api-model/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Shipment Invoicing + * The Selling Partner API for Shipment Invoicing helps you programmatically retrieve shipment invoice information in the Brazil marketplace for a selling partner’s Fulfillment by Amazon (FBA) orders. + * + * The version of the OpenAPI document: v0 + * + * + * 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/shipment-invoicing-api-model/index.ts b/src/api-models/shipment-invoicing-api-model/index.ts new file mode 100644 index 00000000..cd0eb036 --- /dev/null +++ b/src/api-models/shipment-invoicing-api-model/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Selling Partner API for Shipment Invoicing + * The Selling Partner API for Shipment Invoicing helps you programmatically retrieve shipment invoice information in the Brazil marketplace for a selling partner’s Fulfillment by Amazon (FBA) orders. + * + * The version of the OpenAPI document: v0 + * + * + * 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"; +