/**
 * Selling Partner API for Sales
 * The Selling Partner API for Sales provides APIs related to sales performance.
 *
 * The version of the OpenAPI document: v1
 *
 *
 * 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' ; import { DUMMY_BASE_URL , assertParamExists , setApiKeyToObject , setBasicAuthToObject , setBearerAuthToObject , setOAuthToObject , setSearchParams , serializeDataIfNeeded , toPathString , createRequestFunction } from './common' ; import { BASE_PATH , COLLECTION_FORMATS , RequestArgs , BaseAPI , RequiredError } from './base' ; export interface export interface GetOrderMetricsResponse { type { Array < OrderMetricsInterval > } memberof payload ? : Array < OrderMetricsInterval > ; type { Array < Error > } memberof errors ? : Array < Error > ; } export interface export interface ModelError { type { string } memberof code : string ; type { string } memberof message : string ; type { string } memberof details ? : string ; } export interface export interface Money { type { string } memberof currencyCode : string ; type { string } memberof amount : string ; } export interface export interface OrderMetricsInterval { type { string } memberof interval : string ; type { number } memberof unitCount : number ; type { number } memberof orderItemCount : number ; type { number } memberof orderCount : number ; type { Money } memberof averageUnitPrice : Money ; type { Money } memberof totalSales : Money ; } export export const SalesApiAxiosParamCreator = function ( configuration ? ) { return { param { Array < string > } marketplaceIds param { string } interval param { 'Hour' | 'Day' | 'Week' | 'Month' | 'Year' | 'Total' } granularity param { string } granularityTimeZone param { 'B2B' | 'B2C' | 'All' } buyerType param { string } fulfillmentNetwork param { 'Monday' | 'Sunday' } firstDayOfWeek param { string } asin param { string } sku param { * } options throws getOrderMetrics : async ( marketplaceIds , interval , granularity , granularityTimeZone ? , buyerType ? , fulfillmentNetwork ? , firstDayOfWeek ? , asin ? , sku ? , options = { } ) : Promise < RequestArgs > => { assertParamExists ( 'getOrderMetrics' , 'marketplaceIds' , marketplaceIds ) ; assertParamExists ( 'getOrderMetrics' , 'interval' , interval ) ; assertParamExists ( 'getOrderMetrics' , 'granularity' , granularity ) ; const localVarPath = `/sales/v1/orderMetrics` ; const localVarUrlObj = new URL ( localVarPath , DUMMY_BASE_URL ) ; let baseOptions ; if ( configuration ) { baseOptions = configuration . baseOptions ; } const localVarRequestOptions = { method : 'GET' , ... baseOptions , ... options } ; const localVarHeaderParameter = { } as any ; const localVarQueryParameter = { } as any ; if ( marketplaceIds ) { localVarQueryParameter [ 'marketplaceIds' ] = marketplaceIds . join ( COLLECTION_FORMATS . csv ) ; } if ( interval !== undefined ) { localVarQueryParameter [ 'interval' ] = interval ; } if ( granularityTimeZone !== undefined ) { localVarQueryParameter [ 'granularityTimeZone' ] = granularityTimeZone ; } if ( granularity !== undefined ) { localVarQueryParameter [ 'granularity' ] = granularity ; } if ( buyerType !== undefined ) { localVarQueryParameter [ 'buyerType' ] = buyerType ; } if ( fulfillmentNetwork !== undefined ) { localVarQueryParameter [ 'fulfillmentNetwork' ] = fulfillmentNetwork ; } if ( firstDayOfWeek !== undefined ) { localVarQueryParameter [ 'firstDayOfWeek' ] = firstDayOfWeek ; } if ( asin !== undefined ) { localVarQueryParameter [ 'asin' ] = asin ; } if ( sku !== undefined ) { localVarQueryParameter [ 'sku' ] = sku ; } setSearchParams ( localVarUrlObj , localVarQueryParameter , options . query ) ; let headersFromBaseOptions = baseOptions && baseOptions . headers ? baseOptions . headers : { } ; localVarRequestOptions . headers = { ... localVarHeaderParameter , ... headersFromBaseOptions , ... options . headers } ; return { url : toPathString ( localVarUrlObj ) , options : localVarRequestOptions , } ; } , } ; } ; export export const SalesApiFp = function ( configuration ? ) { const localVarAxiosParamCreator = SalesApiAxiosParamCreator ( configuration ) ; return { param { Array < string > } marketplaceIds param { string } interval param { 'Hour' | 'Day' | 'Week' | 'Month' | 'Year' | 'Total' } granularity param { string } granularityTimeZone param { 'B2B' | 'B2C' | 'All' } buyerType param { string } fulfillmentNetwork param { 'Monday' | 'Sunday' } firstDayOfWeek param { string } asin param { string } sku param { * } options throws async getOrderMetrics ( marketplaceIds , interval , granularity , granularityTimeZone ? , buyerType ? , fulfillmentNetwork ? , firstDayOfWeek ? , asin ? , sku ? , options ? ) { const localVarAxiosArgs = await localVarAxiosParamCreator . getOrderMetrics ( marketplaceIds , interval , granularity , granularityTimeZone , buyerType , fulfillmentNetwork , firstDayOfWeek , asin , sku , options ) ; return createRequestFunction ( localVarAxiosArgs , globalAxios , BASE_PATH , configuration ) ; } , } ; } ; export export const SalesApiFactory = function ( configuration ? , basePath ? , axios ? ) { const localVarFp = SalesApiFp ( configuration ) ; return { param { Array < string > } marketplaceIds param { string } interval param { 'Hour' | 'Day' | 'Week' | 'Month' | 'Year' | 'Total' } granularity param { string } granularityTimeZone param { 'B2B' | 'B2C' | 'All' } buyerType param { string } fulfillmentNetwork param { 'Monday' | 'Sunday' } firstDayOfWeek param { string } asin param { string } sku param { * } options throws getOrderMetrics ( marketplaceIds , interval , granularity , granularityTimeZone ? , buyerType ? , fulfillmentNetwork ? , firstDayOfWeek ? , asin ? , sku ? , options ? ) { return localVarFp . getOrderMetrics ( marketplaceIds , interval , granularity , granularityTimeZone , buyerType , fulfillmentNetwork , firstDayOfWeek , asin , sku , options ) . then ( ( request ) => request ( axios , basePath ) ) ; } , } ; } ; export interface export interface SalesApiGetOrderMetricsRequest { type { Array < string > } memberof readonly marketplaceIds : Array < string > ; type { string } memberof readonly interval : string ; type { 'Hour' | 'Day' | 'Week' | 'Month' | 'Year' | 'Total' } memberof readonly granularity : 'Hour' | 'Day' | 'Week' | 'Month' | 'Year' | 'Total' ; type { string } memberof readonly granularityTimeZone ? : string ; type { 'B2B' | 'B2C' | 'All' } memberof readonly buyerType ? : 'B2B' | 'B2C' | 'All' ; type { string } memberof readonly fulfillmentNetwork ? : string ; type { 'Monday' | 'Sunday' } memberof readonly firstDayOfWeek ? : 'Monday' | 'Sunday' ; type { string } memberof readonly asin ? : string ; type { string } memberof readonly sku ? : string ; } export class extends BaseAPI export class SalesApi extends BaseAPI { param { SalesApiGetOrderMetricsRequest } requestParameters param { * } options throws memberof public getOrderMetrics ( requestParameters , options ? ) { return SalesApiFp ( this . configuration ) . getOrderMetrics ( requestParameters . marketplaceIds , requestParameters . interval , requestParameters . granularity , requestParameters . granularityTimeZone , requestParameters . buyerType , requestParameters . fulfillmentNetwork , requestParameters . firstDayOfWeek , requestParameters . asin , requestParameters . sku , options ) . then ( ( request ) => request ( this . axios , this . basePath ) ) ; } }