@sp-api-sdk/sales-api-v1 3.0.5 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api-model/api/sales-api.js +14 -22
- package/dist/cjs/api-model/base.js +0 -19
- package/dist/cjs/api-model/common.js +0 -37
- package/dist/cjs/api-model/configuration.js +0 -17
- package/dist/es/api-model/api/sales-api.js +13 -21
- package/dist/es/api-model/base.js +0 -19
- package/dist/es/api-model/common.js +0 -37
- package/dist/es/api-model/configuration.js +0 -17
- package/dist/types/api-model/api/sales-api.d.ts +12 -38
- package/dist/types/api-model/base.d.ts +0 -24
- package/dist/types/api-model/common.d.ts +0 -37
- package/dist/types/api-model/configuration.d.ts +0 -17
- package/dist/types/api-model/models/get-order-metrics-response.d.ts +0 -6
- package/dist/types/api-model/models/model-error.d.ts +0 -8
- package/dist/types/api-model/models/money.d.ts +0 -6
- package/dist/types/api-model/models/order-metrics-interval.d.ts +0 -20
- package/package.json +25 -4
|
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.GetOrderMetricsFirstDayOfWeekEnum = exports.GetOrderMetricsBuyerTypeEnum = exports.GetOrderMetricsGranularityEnum = exports.SalesApi = exports.SalesApiFactory = exports.SalesApiFp = exports.SalesApiAxiosParamCreator = void 0;
|
|
19
|
+
exports.GetOrderMetricsAmazonProgramEnum = exports.GetOrderMetricsFirstDayOfWeekEnum = exports.GetOrderMetricsBuyerTypeEnum = exports.GetOrderMetricsGranularityEnum = exports.SalesApi = exports.SalesApiFactory = exports.SalesApiFp = exports.SalesApiAxiosParamCreator = void 0;
|
|
20
20
|
const axios_1 = __importDefault(require("axios"));
|
|
21
21
|
// Some imports not used depending on template conditions
|
|
22
22
|
// @ts-ignore
|
|
@@ -25,7 +25,6 @@ const common_1 = require("../common");
|
|
|
25
25
|
const base_1 = require("../base");
|
|
26
26
|
/**
|
|
27
27
|
* SalesApi - axios parameter creator
|
|
28
|
-
* @export
|
|
29
28
|
*/
|
|
30
29
|
const SalesApiAxiosParamCreator = function (configuration) {
|
|
31
30
|
return {
|
|
@@ -40,10 +39,11 @@ const SalesApiAxiosParamCreator = function (configuration) {
|
|
|
40
39
|
* @param {GetOrderMetricsFirstDayOfWeekEnum} [firstDayOfWeek] Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.
|
|
41
40
|
* @param {string} [asin] Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.
|
|
42
41
|
* @param {string} [sku] Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU.
|
|
42
|
+
* @param {GetOrderMetricsAmazonProgramEnum} [amazonProgram] Filters the results by the Amazon program that you specify. Do not include this filter if you want the response to include order metrics for all programs. **Example:** `AmazonHaul` returns order metrics for the Amazon Haul program only.
|
|
43
43
|
* @param {*} [options] Override http request option.
|
|
44
44
|
* @throws {RequiredError}
|
|
45
45
|
*/
|
|
46
|
-
getOrderMetrics: async (marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, options = {}) => {
|
|
46
|
+
getOrderMetrics: async (marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, amazonProgram, options = {}) => {
|
|
47
47
|
// verify required parameter 'marketplaceIds' is not null or undefined
|
|
48
48
|
(0, common_1.assertParamExists)('getOrderMetrics', 'marketplaceIds', marketplaceIds);
|
|
49
49
|
// verify required parameter 'interval' is not null or undefined
|
|
@@ -87,6 +87,9 @@ const SalesApiAxiosParamCreator = function (configuration) {
|
|
|
87
87
|
if (sku !== undefined) {
|
|
88
88
|
localVarQueryParameter['sku'] = sku;
|
|
89
89
|
}
|
|
90
|
+
if (amazonProgram !== undefined) {
|
|
91
|
+
localVarQueryParameter['amazonProgram'] = amazonProgram;
|
|
92
|
+
}
|
|
90
93
|
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
|
|
91
94
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
92
95
|
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
@@ -100,7 +103,6 @@ const SalesApiAxiosParamCreator = function (configuration) {
|
|
|
100
103
|
exports.SalesApiAxiosParamCreator = SalesApiAxiosParamCreator;
|
|
101
104
|
/**
|
|
102
105
|
* SalesApi - functional programming interface
|
|
103
|
-
* @export
|
|
104
106
|
*/
|
|
105
107
|
const SalesApiFp = function (configuration) {
|
|
106
108
|
const localVarAxiosParamCreator = (0, exports.SalesApiAxiosParamCreator)(configuration);
|
|
@@ -116,11 +118,12 @@ const SalesApiFp = function (configuration) {
|
|
|
116
118
|
* @param {GetOrderMetricsFirstDayOfWeekEnum} [firstDayOfWeek] Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.
|
|
117
119
|
* @param {string} [asin] Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.
|
|
118
120
|
* @param {string} [sku] Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU.
|
|
121
|
+
* @param {GetOrderMetricsAmazonProgramEnum} [amazonProgram] Filters the results by the Amazon program that you specify. Do not include this filter if you want the response to include order metrics for all programs. **Example:** `AmazonHaul` returns order metrics for the Amazon Haul program only.
|
|
119
122
|
* @param {*} [options] Override http request option.
|
|
120
123
|
* @throws {RequiredError}
|
|
121
124
|
*/
|
|
122
|
-
async getOrderMetrics(marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, options) {
|
|
123
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderMetrics(marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, options);
|
|
125
|
+
async getOrderMetrics(marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, amazonProgram, options) {
|
|
126
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderMetrics(marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, amazonProgram, options);
|
|
124
127
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
125
128
|
const localVarOperationServerBasePath = base_1.operationServerMap['SalesApi.getOrderMetrics']?.[localVarOperationServerIndex]?.url;
|
|
126
129
|
return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
@@ -130,7 +133,6 @@ const SalesApiFp = function (configuration) {
|
|
|
130
133
|
exports.SalesApiFp = SalesApiFp;
|
|
131
134
|
/**
|
|
132
135
|
* SalesApi - factory interface
|
|
133
|
-
* @export
|
|
134
136
|
*/
|
|
135
137
|
const SalesApiFactory = function (configuration, basePath, axios) {
|
|
136
138
|
const localVarFp = (0, exports.SalesApiFp)(configuration);
|
|
@@ -142,16 +144,13 @@ const SalesApiFactory = function (configuration, basePath, axios) {
|
|
|
142
144
|
* @throws {RequiredError}
|
|
143
145
|
*/
|
|
144
146
|
getOrderMetrics(requestParameters, options) {
|
|
145
|
-
return localVarFp.getOrderMetrics(requestParameters.marketplaceIds, requestParameters.interval, requestParameters.granularity, requestParameters.granularityTimeZone, requestParameters.buyerType, requestParameters.fulfillmentNetwork, requestParameters.firstDayOfWeek, requestParameters.asin, requestParameters.sku, options).then((request) => request(axios, basePath));
|
|
147
|
+
return localVarFp.getOrderMetrics(requestParameters.marketplaceIds, requestParameters.interval, requestParameters.granularity, requestParameters.granularityTimeZone, requestParameters.buyerType, requestParameters.fulfillmentNetwork, requestParameters.firstDayOfWeek, requestParameters.asin, requestParameters.sku, requestParameters.amazonProgram, options).then((request) => request(axios, basePath));
|
|
146
148
|
},
|
|
147
149
|
};
|
|
148
150
|
};
|
|
149
151
|
exports.SalesApiFactory = SalesApiFactory;
|
|
150
152
|
/**
|
|
151
153
|
* SalesApi - object-oriented interface
|
|
152
|
-
* @export
|
|
153
|
-
* @class SalesApi
|
|
154
|
-
* @extends {BaseAPI}
|
|
155
154
|
*/
|
|
156
155
|
class SalesApi extends base_1.BaseAPI {
|
|
157
156
|
/**
|
|
@@ -159,16 +158,12 @@ class SalesApi extends base_1.BaseAPI {
|
|
|
159
158
|
* @param {SalesApiGetOrderMetricsRequest} requestParameters Request parameters.
|
|
160
159
|
* @param {*} [options] Override http request option.
|
|
161
160
|
* @throws {RequiredError}
|
|
162
|
-
* @memberof SalesApi
|
|
163
161
|
*/
|
|
164
162
|
getOrderMetrics(requestParameters, options) {
|
|
165
|
-
return (0, exports.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));
|
|
163
|
+
return (0, exports.SalesApiFp)(this.configuration).getOrderMetrics(requestParameters.marketplaceIds, requestParameters.interval, requestParameters.granularity, requestParameters.granularityTimeZone, requestParameters.buyerType, requestParameters.fulfillmentNetwork, requestParameters.firstDayOfWeek, requestParameters.asin, requestParameters.sku, requestParameters.amazonProgram, options).then((request) => request(this.axios, this.basePath));
|
|
166
164
|
}
|
|
167
165
|
}
|
|
168
166
|
exports.SalesApi = SalesApi;
|
|
169
|
-
/**
|
|
170
|
-
* @export
|
|
171
|
-
*/
|
|
172
167
|
exports.GetOrderMetricsGranularityEnum = {
|
|
173
168
|
Hour: 'Hour',
|
|
174
169
|
Day: 'Day',
|
|
@@ -177,18 +172,15 @@ exports.GetOrderMetricsGranularityEnum = {
|
|
|
177
172
|
Year: 'Year',
|
|
178
173
|
Total: 'Total'
|
|
179
174
|
};
|
|
180
|
-
/**
|
|
181
|
-
* @export
|
|
182
|
-
*/
|
|
183
175
|
exports.GetOrderMetricsBuyerTypeEnum = {
|
|
184
176
|
B2B: 'B2B',
|
|
185
177
|
B2C: 'B2C',
|
|
186
178
|
All: 'All'
|
|
187
179
|
};
|
|
188
|
-
/**
|
|
189
|
-
* @export
|
|
190
|
-
*/
|
|
191
180
|
exports.GetOrderMetricsFirstDayOfWeekEnum = {
|
|
192
181
|
Monday: 'Monday',
|
|
193
182
|
Sunday: 'Sunday'
|
|
194
183
|
};
|
|
184
|
+
exports.GetOrderMetricsAmazonProgramEnum = {
|
|
185
|
+
AmazonHaul: 'AmazonHaul'
|
|
186
|
+
};
|
|
@@ -19,21 +19,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.operationServerMap = exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
|
|
20
20
|
const axios_1 = __importDefault(require("axios"));
|
|
21
21
|
exports.BASE_PATH = "https://sellingpartnerapi-na.amazon.com".replace(/\/+$/, "");
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @export
|
|
25
|
-
*/
|
|
26
22
|
exports.COLLECTION_FORMATS = {
|
|
27
23
|
csv: ",",
|
|
28
24
|
ssv: " ",
|
|
29
25
|
tsv: "\t",
|
|
30
26
|
pipes: "|",
|
|
31
27
|
};
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* @export
|
|
35
|
-
* @class BaseAPI
|
|
36
|
-
*/
|
|
37
28
|
class BaseAPI {
|
|
38
29
|
basePath;
|
|
39
30
|
axios;
|
|
@@ -49,12 +40,6 @@ class BaseAPI {
|
|
|
49
40
|
}
|
|
50
41
|
exports.BaseAPI = BaseAPI;
|
|
51
42
|
;
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* @export
|
|
55
|
-
* @class RequiredError
|
|
56
|
-
* @extends {Error}
|
|
57
|
-
*/
|
|
58
43
|
class RequiredError extends Error {
|
|
59
44
|
field;
|
|
60
45
|
constructor(field, msg) {
|
|
@@ -64,8 +49,4 @@ class RequiredError extends Error {
|
|
|
64
49
|
}
|
|
65
50
|
}
|
|
66
51
|
exports.RequiredError = RequiredError;
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
69
|
-
* @export
|
|
70
|
-
*/
|
|
71
52
|
exports.operationServerMap = {};
|
|
@@ -15,15 +15,10 @@
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
|
|
17
17
|
const base_1 = require("./base");
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @export
|
|
21
|
-
*/
|
|
22
18
|
exports.DUMMY_BASE_URL = 'https://example.com';
|
|
23
19
|
/**
|
|
24
20
|
*
|
|
25
21
|
* @throws {RequiredError}
|
|
26
|
-
* @export
|
|
27
22
|
*/
|
|
28
23
|
const assertParamExists = function (functionName, paramName, paramValue) {
|
|
29
24
|
if (paramValue === null || paramValue === undefined) {
|
|
@@ -31,10 +26,6 @@ const assertParamExists = function (functionName, paramName, paramValue) {
|
|
|
31
26
|
}
|
|
32
27
|
};
|
|
33
28
|
exports.assertParamExists = assertParamExists;
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* @export
|
|
37
|
-
*/
|
|
38
29
|
const setApiKeyToObject = async function (object, keyParamName, configuration) {
|
|
39
30
|
if (configuration && configuration.apiKey) {
|
|
40
31
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
@@ -44,20 +35,12 @@ const setApiKeyToObject = async function (object, keyParamName, configuration) {
|
|
|
44
35
|
}
|
|
45
36
|
};
|
|
46
37
|
exports.setApiKeyToObject = setApiKeyToObject;
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @export
|
|
50
|
-
*/
|
|
51
38
|
const setBasicAuthToObject = function (object, configuration) {
|
|
52
39
|
if (configuration && (configuration.username || configuration.password)) {
|
|
53
40
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
54
41
|
}
|
|
55
42
|
};
|
|
56
43
|
exports.setBasicAuthToObject = setBasicAuthToObject;
|
|
57
|
-
/**
|
|
58
|
-
*
|
|
59
|
-
* @export
|
|
60
|
-
*/
|
|
61
44
|
const setBearerAuthToObject = async function (object, configuration) {
|
|
62
45
|
if (configuration && configuration.accessToken) {
|
|
63
46
|
const accessToken = typeof configuration.accessToken === 'function'
|
|
@@ -67,10 +50,6 @@ const setBearerAuthToObject = async function (object, configuration) {
|
|
|
67
50
|
}
|
|
68
51
|
};
|
|
69
52
|
exports.setBearerAuthToObject = setBearerAuthToObject;
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @export
|
|
73
|
-
*/
|
|
74
53
|
const setOAuthToObject = async function (object, name, scopes, configuration) {
|
|
75
54
|
if (configuration && configuration.accessToken) {
|
|
76
55
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
@@ -100,20 +79,12 @@ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
|
|
|
100
79
|
}
|
|
101
80
|
}
|
|
102
81
|
}
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
105
|
-
* @export
|
|
106
|
-
*/
|
|
107
82
|
const setSearchParams = function (url, ...objects) {
|
|
108
83
|
const searchParams = new URLSearchParams(url.search);
|
|
109
84
|
setFlattenedQueryParams(searchParams, objects);
|
|
110
85
|
url.search = searchParams.toString();
|
|
111
86
|
};
|
|
112
87
|
exports.setSearchParams = setSearchParams;
|
|
113
|
-
/**
|
|
114
|
-
*
|
|
115
|
-
* @export
|
|
116
|
-
*/
|
|
117
88
|
const serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
118
89
|
const nonString = typeof value !== 'string';
|
|
119
90
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
@@ -124,18 +95,10 @@ const serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
|
124
95
|
: (value || "");
|
|
125
96
|
};
|
|
126
97
|
exports.serializeDataIfNeeded = serializeDataIfNeeded;
|
|
127
|
-
/**
|
|
128
|
-
*
|
|
129
|
-
* @export
|
|
130
|
-
*/
|
|
131
98
|
const toPathString = function (url) {
|
|
132
99
|
return url.pathname + url.search + url.hash;
|
|
133
100
|
};
|
|
134
101
|
exports.toPathString = toPathString;
|
|
135
|
-
/**
|
|
136
|
-
*
|
|
137
|
-
* @export
|
|
138
|
-
*/
|
|
139
102
|
const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
140
103
|
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
141
104
|
const axiosRequestArgs = { ...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url };
|
|
@@ -18,49 +18,32 @@ class Configuration {
|
|
|
18
18
|
/**
|
|
19
19
|
* parameter for apiKey security
|
|
20
20
|
* @param name security name
|
|
21
|
-
* @memberof Configuration
|
|
22
21
|
*/
|
|
23
22
|
apiKey;
|
|
24
23
|
/**
|
|
25
24
|
* parameter for basic security
|
|
26
|
-
*
|
|
27
|
-
* @type {string}
|
|
28
|
-
* @memberof Configuration
|
|
29
25
|
*/
|
|
30
26
|
username;
|
|
31
27
|
/**
|
|
32
28
|
* parameter for basic security
|
|
33
|
-
*
|
|
34
|
-
* @type {string}
|
|
35
|
-
* @memberof Configuration
|
|
36
29
|
*/
|
|
37
30
|
password;
|
|
38
31
|
/**
|
|
39
32
|
* parameter for oauth2 security
|
|
40
33
|
* @param name security name
|
|
41
34
|
* @param scopes oauth2 scope
|
|
42
|
-
* @memberof Configuration
|
|
43
35
|
*/
|
|
44
36
|
accessToken;
|
|
45
37
|
/**
|
|
46
38
|
* override base path
|
|
47
|
-
*
|
|
48
|
-
* @type {string}
|
|
49
|
-
* @memberof Configuration
|
|
50
39
|
*/
|
|
51
40
|
basePath;
|
|
52
41
|
/**
|
|
53
42
|
* override server index
|
|
54
|
-
*
|
|
55
|
-
* @type {number}
|
|
56
|
-
* @memberof Configuration
|
|
57
43
|
*/
|
|
58
44
|
serverIndex;
|
|
59
45
|
/**
|
|
60
46
|
* base options for axios calls
|
|
61
|
-
*
|
|
62
|
-
* @type {any}
|
|
63
|
-
* @memberof Configuration
|
|
64
47
|
*/
|
|
65
48
|
baseOptions;
|
|
66
49
|
/**
|
|
@@ -19,7 +19,6 @@ import { DUMMY_BASE_URL, assertParamExists, setSearchParams, toPathString, creat
|
|
|
19
19
|
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, operationServerMap } from '../base';
|
|
20
20
|
/**
|
|
21
21
|
* SalesApi - axios parameter creator
|
|
22
|
-
* @export
|
|
23
22
|
*/
|
|
24
23
|
export const SalesApiAxiosParamCreator = function (configuration) {
|
|
25
24
|
return {
|
|
@@ -34,10 +33,11 @@ export const SalesApiAxiosParamCreator = function (configuration) {
|
|
|
34
33
|
* @param {GetOrderMetricsFirstDayOfWeekEnum} [firstDayOfWeek] Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.
|
|
35
34
|
* @param {string} [asin] Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.
|
|
36
35
|
* @param {string} [sku] Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU.
|
|
36
|
+
* @param {GetOrderMetricsAmazonProgramEnum} [amazonProgram] Filters the results by the Amazon program that you specify. Do not include this filter if you want the response to include order metrics for all programs. **Example:** `AmazonHaul` returns order metrics for the Amazon Haul program only.
|
|
37
37
|
* @param {*} [options] Override http request option.
|
|
38
38
|
* @throws {RequiredError}
|
|
39
39
|
*/
|
|
40
|
-
getOrderMetrics: async (marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, options = {}) => {
|
|
40
|
+
getOrderMetrics: async (marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, amazonProgram, options = {}) => {
|
|
41
41
|
// verify required parameter 'marketplaceIds' is not null or undefined
|
|
42
42
|
assertParamExists('getOrderMetrics', 'marketplaceIds', marketplaceIds);
|
|
43
43
|
// verify required parameter 'interval' is not null or undefined
|
|
@@ -81,6 +81,9 @@ export const SalesApiAxiosParamCreator = function (configuration) {
|
|
|
81
81
|
if (sku !== undefined) {
|
|
82
82
|
localVarQueryParameter['sku'] = sku;
|
|
83
83
|
}
|
|
84
|
+
if (amazonProgram !== undefined) {
|
|
85
|
+
localVarQueryParameter['amazonProgram'] = amazonProgram;
|
|
86
|
+
}
|
|
84
87
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
85
88
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
86
89
|
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
@@ -93,7 +96,6 @@ export const SalesApiAxiosParamCreator = function (configuration) {
|
|
|
93
96
|
};
|
|
94
97
|
/**
|
|
95
98
|
* SalesApi - functional programming interface
|
|
96
|
-
* @export
|
|
97
99
|
*/
|
|
98
100
|
export const SalesApiFp = function (configuration) {
|
|
99
101
|
const localVarAxiosParamCreator = SalesApiAxiosParamCreator(configuration);
|
|
@@ -109,11 +111,12 @@ export const SalesApiFp = function (configuration) {
|
|
|
109
111
|
* @param {GetOrderMetricsFirstDayOfWeekEnum} [firstDayOfWeek] Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.
|
|
110
112
|
* @param {string} [asin] Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.
|
|
111
113
|
* @param {string} [sku] Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU.
|
|
114
|
+
* @param {GetOrderMetricsAmazonProgramEnum} [amazonProgram] Filters the results by the Amazon program that you specify. Do not include this filter if you want the response to include order metrics for all programs. **Example:** `AmazonHaul` returns order metrics for the Amazon Haul program only.
|
|
112
115
|
* @param {*} [options] Override http request option.
|
|
113
116
|
* @throws {RequiredError}
|
|
114
117
|
*/
|
|
115
|
-
async getOrderMetrics(marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, options) {
|
|
116
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderMetrics(marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, options);
|
|
118
|
+
async getOrderMetrics(marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, amazonProgram, options) {
|
|
119
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getOrderMetrics(marketplaceIds, interval, granularity, granularityTimeZone, buyerType, fulfillmentNetwork, firstDayOfWeek, asin, sku, amazonProgram, options);
|
|
117
120
|
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
118
121
|
const localVarOperationServerBasePath = operationServerMap['SalesApi.getOrderMetrics']?.[localVarOperationServerIndex]?.url;
|
|
119
122
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
@@ -122,7 +125,6 @@ export const SalesApiFp = function (configuration) {
|
|
|
122
125
|
};
|
|
123
126
|
/**
|
|
124
127
|
* SalesApi - factory interface
|
|
125
|
-
* @export
|
|
126
128
|
*/
|
|
127
129
|
export const SalesApiFactory = function (configuration, basePath, axios) {
|
|
128
130
|
const localVarFp = SalesApiFp(configuration);
|
|
@@ -134,15 +136,12 @@ export const SalesApiFactory = function (configuration, basePath, axios) {
|
|
|
134
136
|
* @throws {RequiredError}
|
|
135
137
|
*/
|
|
136
138
|
getOrderMetrics(requestParameters, options) {
|
|
137
|
-
return localVarFp.getOrderMetrics(requestParameters.marketplaceIds, requestParameters.interval, requestParameters.granularity, requestParameters.granularityTimeZone, requestParameters.buyerType, requestParameters.fulfillmentNetwork, requestParameters.firstDayOfWeek, requestParameters.asin, requestParameters.sku, options).then((request) => request(axios, basePath));
|
|
139
|
+
return localVarFp.getOrderMetrics(requestParameters.marketplaceIds, requestParameters.interval, requestParameters.granularity, requestParameters.granularityTimeZone, requestParameters.buyerType, requestParameters.fulfillmentNetwork, requestParameters.firstDayOfWeek, requestParameters.asin, requestParameters.sku, requestParameters.amazonProgram, options).then((request) => request(axios, basePath));
|
|
138
140
|
},
|
|
139
141
|
};
|
|
140
142
|
};
|
|
141
143
|
/**
|
|
142
144
|
* SalesApi - object-oriented interface
|
|
143
|
-
* @export
|
|
144
|
-
* @class SalesApi
|
|
145
|
-
* @extends {BaseAPI}
|
|
146
145
|
*/
|
|
147
146
|
export class SalesApi extends BaseAPI {
|
|
148
147
|
/**
|
|
@@ -150,15 +149,11 @@ export class SalesApi extends BaseAPI {
|
|
|
150
149
|
* @param {SalesApiGetOrderMetricsRequest} requestParameters Request parameters.
|
|
151
150
|
* @param {*} [options] Override http request option.
|
|
152
151
|
* @throws {RequiredError}
|
|
153
|
-
* @memberof SalesApi
|
|
154
152
|
*/
|
|
155
153
|
getOrderMetrics(requestParameters, options) {
|
|
156
|
-
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));
|
|
154
|
+
return SalesApiFp(this.configuration).getOrderMetrics(requestParameters.marketplaceIds, requestParameters.interval, requestParameters.granularity, requestParameters.granularityTimeZone, requestParameters.buyerType, requestParameters.fulfillmentNetwork, requestParameters.firstDayOfWeek, requestParameters.asin, requestParameters.sku, requestParameters.amazonProgram, options).then((request) => request(this.axios, this.basePath));
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
|
-
/**
|
|
160
|
-
* @export
|
|
161
|
-
*/
|
|
162
157
|
export const GetOrderMetricsGranularityEnum = {
|
|
163
158
|
Hour: 'Hour',
|
|
164
159
|
Day: 'Day',
|
|
@@ -167,18 +162,15 @@ export const GetOrderMetricsGranularityEnum = {
|
|
|
167
162
|
Year: 'Year',
|
|
168
163
|
Total: 'Total'
|
|
169
164
|
};
|
|
170
|
-
/**
|
|
171
|
-
* @export
|
|
172
|
-
*/
|
|
173
165
|
export const GetOrderMetricsBuyerTypeEnum = {
|
|
174
166
|
B2B: 'B2B',
|
|
175
167
|
B2C: 'B2C',
|
|
176
168
|
All: 'All'
|
|
177
169
|
};
|
|
178
|
-
/**
|
|
179
|
-
* @export
|
|
180
|
-
*/
|
|
181
170
|
export const GetOrderMetricsFirstDayOfWeekEnum = {
|
|
182
171
|
Monday: 'Monday',
|
|
183
172
|
Sunday: 'Sunday'
|
|
184
173
|
};
|
|
174
|
+
export const GetOrderMetricsAmazonProgramEnum = {
|
|
175
|
+
AmazonHaul: 'AmazonHaul'
|
|
176
|
+
};
|
|
@@ -13,21 +13,12 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import globalAxios from 'axios';
|
|
15
15
|
export const BASE_PATH = "https://sellingpartnerapi-na.amazon.com".replace(/\/+$/, "");
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @export
|
|
19
|
-
*/
|
|
20
16
|
export const COLLECTION_FORMATS = {
|
|
21
17
|
csv: ",",
|
|
22
18
|
ssv: " ",
|
|
23
19
|
tsv: "\t",
|
|
24
20
|
pipes: "|",
|
|
25
21
|
};
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @export
|
|
29
|
-
* @class BaseAPI
|
|
30
|
-
*/
|
|
31
22
|
export class BaseAPI {
|
|
32
23
|
basePath;
|
|
33
24
|
axios;
|
|
@@ -42,12 +33,6 @@ export class BaseAPI {
|
|
|
42
33
|
}
|
|
43
34
|
}
|
|
44
35
|
;
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* @export
|
|
48
|
-
* @class RequiredError
|
|
49
|
-
* @extends {Error}
|
|
50
|
-
*/
|
|
51
36
|
export class RequiredError extends Error {
|
|
52
37
|
field;
|
|
53
38
|
constructor(field, msg) {
|
|
@@ -56,8 +41,4 @@ export class RequiredError extends Error {
|
|
|
56
41
|
this.name = "RequiredError";
|
|
57
42
|
}
|
|
58
43
|
}
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
61
|
-
* @export
|
|
62
|
-
*/
|
|
63
44
|
export const operationServerMap = {};
|
|
@@ -12,25 +12,16 @@
|
|
|
12
12
|
* Do not edit the class manually.
|
|
13
13
|
*/
|
|
14
14
|
import { RequiredError } from "./base";
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @export
|
|
18
|
-
*/
|
|
19
15
|
export const DUMMY_BASE_URL = 'https://example.com';
|
|
20
16
|
/**
|
|
21
17
|
*
|
|
22
18
|
* @throws {RequiredError}
|
|
23
|
-
* @export
|
|
24
19
|
*/
|
|
25
20
|
export const assertParamExists = function (functionName, paramName, paramValue) {
|
|
26
21
|
if (paramValue === null || paramValue === undefined) {
|
|
27
22
|
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
|
|
28
23
|
}
|
|
29
24
|
};
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @export
|
|
33
|
-
*/
|
|
34
25
|
export const setApiKeyToObject = async function (object, keyParamName, configuration) {
|
|
35
26
|
if (configuration && configuration.apiKey) {
|
|
36
27
|
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
|
|
@@ -39,19 +30,11 @@ export const setApiKeyToObject = async function (object, keyParamName, configura
|
|
|
39
30
|
object[keyParamName] = localVarApiKeyValue;
|
|
40
31
|
}
|
|
41
32
|
};
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @export
|
|
45
|
-
*/
|
|
46
33
|
export const setBasicAuthToObject = function (object, configuration) {
|
|
47
34
|
if (configuration && (configuration.username || configuration.password)) {
|
|
48
35
|
object["auth"] = { username: configuration.username, password: configuration.password };
|
|
49
36
|
}
|
|
50
37
|
};
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* @export
|
|
54
|
-
*/
|
|
55
38
|
export const setBearerAuthToObject = async function (object, configuration) {
|
|
56
39
|
if (configuration && configuration.accessToken) {
|
|
57
40
|
const accessToken = typeof configuration.accessToken === 'function'
|
|
@@ -60,10 +43,6 @@ export const setBearerAuthToObject = async function (object, configuration) {
|
|
|
60
43
|
object["Authorization"] = "Bearer " + accessToken;
|
|
61
44
|
}
|
|
62
45
|
};
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
* @export
|
|
66
|
-
*/
|
|
67
46
|
export const setOAuthToObject = async function (object, name, scopes, configuration) {
|
|
68
47
|
if (configuration && configuration.accessToken) {
|
|
69
48
|
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
|
|
@@ -92,19 +71,11 @@ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
|
|
|
92
71
|
}
|
|
93
72
|
}
|
|
94
73
|
}
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
* @export
|
|
98
|
-
*/
|
|
99
74
|
export const setSearchParams = function (url, ...objects) {
|
|
100
75
|
const searchParams = new URLSearchParams(url.search);
|
|
101
76
|
setFlattenedQueryParams(searchParams, objects);
|
|
102
77
|
url.search = searchParams.toString();
|
|
103
78
|
};
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
106
|
-
* @export
|
|
107
|
-
*/
|
|
108
79
|
export const serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
109
80
|
const nonString = typeof value !== 'string';
|
|
110
81
|
const needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
@@ -114,17 +85,9 @@ export const serializeDataIfNeeded = function (value, requestOptions, configurat
|
|
|
114
85
|
? JSON.stringify(value !== undefined ? value : {})
|
|
115
86
|
: (value || "");
|
|
116
87
|
};
|
|
117
|
-
/**
|
|
118
|
-
*
|
|
119
|
-
* @export
|
|
120
|
-
*/
|
|
121
88
|
export const toPathString = function (url) {
|
|
122
89
|
return url.pathname + url.search + url.hash;
|
|
123
90
|
};
|
|
124
|
-
/**
|
|
125
|
-
*
|
|
126
|
-
* @export
|
|
127
|
-
*/
|
|
128
91
|
export const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
129
92
|
return (axios = globalAxios, basePath = BASE_PATH) => {
|
|
130
93
|
const axiosRequestArgs = { ...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url };
|
|
@@ -15,49 +15,32 @@ export class Configuration {
|
|
|
15
15
|
/**
|
|
16
16
|
* parameter for apiKey security
|
|
17
17
|
* @param name security name
|
|
18
|
-
* @memberof Configuration
|
|
19
18
|
*/
|
|
20
19
|
apiKey;
|
|
21
20
|
/**
|
|
22
21
|
* parameter for basic security
|
|
23
|
-
*
|
|
24
|
-
* @type {string}
|
|
25
|
-
* @memberof Configuration
|
|
26
22
|
*/
|
|
27
23
|
username;
|
|
28
24
|
/**
|
|
29
25
|
* parameter for basic security
|
|
30
|
-
*
|
|
31
|
-
* @type {string}
|
|
32
|
-
* @memberof Configuration
|
|
33
26
|
*/
|
|
34
27
|
password;
|
|
35
28
|
/**
|
|
36
29
|
* parameter for oauth2 security
|
|
37
30
|
* @param name security name
|
|
38
31
|
* @param scopes oauth2 scope
|
|
39
|
-
* @memberof Configuration
|
|
40
32
|
*/
|
|
41
33
|
accessToken;
|
|
42
34
|
/**
|
|
43
35
|
* override base path
|
|
44
|
-
*
|
|
45
|
-
* @type {string}
|
|
46
|
-
* @memberof Configuration
|
|
47
36
|
*/
|
|
48
37
|
basePath;
|
|
49
38
|
/**
|
|
50
39
|
* override server index
|
|
51
|
-
*
|
|
52
|
-
* @type {number}
|
|
53
|
-
* @memberof Configuration
|
|
54
40
|
*/
|
|
55
41
|
serverIndex;
|
|
56
42
|
/**
|
|
57
43
|
* base options for axios calls
|
|
58
|
-
*
|
|
59
|
-
* @type {any}
|
|
60
|
-
* @memberof Configuration
|
|
61
44
|
*/
|
|
62
45
|
baseOptions;
|
|
63
46
|
/**
|
|
@@ -16,7 +16,6 @@ import { type RequestArgs, BaseAPI } from '../base';
|
|
|
16
16
|
import type { GetOrderMetricsResponse } from '../models';
|
|
17
17
|
/**
|
|
18
18
|
* SalesApi - axios parameter creator
|
|
19
|
-
* @export
|
|
20
19
|
*/
|
|
21
20
|
export declare const SalesApiAxiosParamCreator: (configuration?: Configuration) => {
|
|
22
21
|
/**
|
|
@@ -30,14 +29,14 @@ export declare const SalesApiAxiosParamCreator: (configuration?: Configuration)
|
|
|
30
29
|
* @param {GetOrderMetricsFirstDayOfWeekEnum} [firstDayOfWeek] Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.
|
|
31
30
|
* @param {string} [asin] Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.
|
|
32
31
|
* @param {string} [sku] Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU.
|
|
32
|
+
* @param {GetOrderMetricsAmazonProgramEnum} [amazonProgram] Filters the results by the Amazon program that you specify. Do not include this filter if you want the response to include order metrics for all programs. **Example:** `AmazonHaul` returns order metrics for the Amazon Haul program only.
|
|
33
33
|
* @param {*} [options] Override http request option.
|
|
34
34
|
* @throws {RequiredError}
|
|
35
35
|
*/
|
|
36
|
-
getOrderMetrics: (marketplaceIds: Array<string>, interval: string, granularity: GetOrderMetricsGranularityEnum, granularityTimeZone?: string, buyerType?: GetOrderMetricsBuyerTypeEnum, fulfillmentNetwork?: string, firstDayOfWeek?: GetOrderMetricsFirstDayOfWeekEnum, asin?: string, sku?: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
|
|
36
|
+
getOrderMetrics: (marketplaceIds: Array<string>, interval: string, granularity: GetOrderMetricsGranularityEnum, granularityTimeZone?: string, buyerType?: GetOrderMetricsBuyerTypeEnum, fulfillmentNetwork?: string, firstDayOfWeek?: GetOrderMetricsFirstDayOfWeekEnum, asin?: string, sku?: string, amazonProgram?: GetOrderMetricsAmazonProgramEnum, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
39
39
|
* SalesApi - functional programming interface
|
|
40
|
-
* @export
|
|
41
40
|
*/
|
|
42
41
|
export declare const SalesApiFp: (configuration?: Configuration) => {
|
|
43
42
|
/**
|
|
@@ -51,14 +50,14 @@ export declare const SalesApiFp: (configuration?: Configuration) => {
|
|
|
51
50
|
* @param {GetOrderMetricsFirstDayOfWeekEnum} [firstDayOfWeek] Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.
|
|
52
51
|
* @param {string} [asin] Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.
|
|
53
52
|
* @param {string} [sku] Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU.
|
|
53
|
+
* @param {GetOrderMetricsAmazonProgramEnum} [amazonProgram] Filters the results by the Amazon program that you specify. Do not include this filter if you want the response to include order metrics for all programs. **Example:** `AmazonHaul` returns order metrics for the Amazon Haul program only.
|
|
54
54
|
* @param {*} [options] Override http request option.
|
|
55
55
|
* @throws {RequiredError}
|
|
56
56
|
*/
|
|
57
|
-
getOrderMetrics(marketplaceIds: Array<string>, interval: string, granularity: GetOrderMetricsGranularityEnum, granularityTimeZone?: string, buyerType?: GetOrderMetricsBuyerTypeEnum, fulfillmentNetwork?: string, firstDayOfWeek?: GetOrderMetricsFirstDayOfWeekEnum, asin?: string, sku?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetOrderMetricsResponse>>;
|
|
57
|
+
getOrderMetrics(marketplaceIds: Array<string>, interval: string, granularity: GetOrderMetricsGranularityEnum, granularityTimeZone?: string, buyerType?: GetOrderMetricsBuyerTypeEnum, fulfillmentNetwork?: string, firstDayOfWeek?: GetOrderMetricsFirstDayOfWeekEnum, asin?: string, sku?: string, amazonProgram?: GetOrderMetricsAmazonProgramEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetOrderMetricsResponse>>;
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
60
60
|
* SalesApi - factory interface
|
|
61
|
-
* @export
|
|
62
61
|
*/
|
|
63
62
|
export declare const SalesApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
|
|
64
63
|
/**
|
|
@@ -71,70 +70,51 @@ export declare const SalesApiFactory: (configuration?: Configuration, basePath?:
|
|
|
71
70
|
};
|
|
72
71
|
/**
|
|
73
72
|
* Request parameters for getOrderMetrics operation in SalesApi.
|
|
74
|
-
* @export
|
|
75
|
-
* @interface SalesApiGetOrderMetricsRequest
|
|
76
73
|
*/
|
|
77
74
|
export interface SalesApiGetOrderMetricsRequest {
|
|
78
75
|
/**
|
|
79
76
|
* A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. For example, ATVPDKIKX0DER indicates the US marketplace.
|
|
80
|
-
* @type {Array<string>}
|
|
81
|
-
* @memberof SalesApiGetOrderMetrics
|
|
82
77
|
*/
|
|
83
78
|
readonly marketplaceIds: Array<string>;
|
|
84
79
|
/**
|
|
85
80
|
* A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.
|
|
86
|
-
* @type {string}
|
|
87
|
-
* @memberof SalesApiGetOrderMetrics
|
|
88
81
|
*/
|
|
89
82
|
readonly interval: string;
|
|
90
83
|
/**
|
|
91
84
|
* The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity=Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date don’t align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.
|
|
92
|
-
* @type {'Hour' | 'Day' | 'Week' | 'Month' | 'Year' | 'Total'}
|
|
93
|
-
* @memberof SalesApiGetOrderMetrics
|
|
94
85
|
*/
|
|
95
86
|
readonly granularity: GetOrderMetricsGranularityEnum;
|
|
96
87
|
/**
|
|
97
88
|
* An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone.
|
|
98
|
-
* @type {string}
|
|
99
|
-
* @memberof SalesApiGetOrderMetrics
|
|
100
89
|
*/
|
|
101
90
|
readonly granularityTimeZone?: string;
|
|
102
91
|
/**
|
|
103
92
|
* Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers.
|
|
104
|
-
* @type {'B2B' | 'B2C' | 'All'}
|
|
105
|
-
* @memberof SalesApiGetOrderMetrics
|
|
106
93
|
*/
|
|
107
94
|
readonly buyerType?: GetOrderMetricsBuyerTypeEnum;
|
|
108
95
|
/**
|
|
109
96
|
* Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network.
|
|
110
|
-
* @type {string}
|
|
111
|
-
* @memberof SalesApiGetOrderMetrics
|
|
112
97
|
*/
|
|
113
98
|
readonly fulfillmentNetwork?: string;
|
|
114
99
|
/**
|
|
115
100
|
* Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.
|
|
116
|
-
* @type {'Monday' | 'Sunday'}
|
|
117
|
-
* @memberof SalesApiGetOrderMetrics
|
|
118
101
|
*/
|
|
119
102
|
readonly firstDayOfWeek?: GetOrderMetricsFirstDayOfWeekEnum;
|
|
120
103
|
/**
|
|
121
104
|
* Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.
|
|
122
|
-
* @type {string}
|
|
123
|
-
* @memberof SalesApiGetOrderMetrics
|
|
124
105
|
*/
|
|
125
106
|
readonly asin?: string;
|
|
126
107
|
/**
|
|
127
108
|
* Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU.
|
|
128
|
-
* @type {string}
|
|
129
|
-
* @memberof SalesApiGetOrderMetrics
|
|
130
109
|
*/
|
|
131
110
|
readonly sku?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Filters the results by the Amazon program that you specify. Do not include this filter if you want the response to include order metrics for all programs. **Example:** `AmazonHaul` returns order metrics for the Amazon Haul program only.
|
|
113
|
+
*/
|
|
114
|
+
readonly amazonProgram?: GetOrderMetricsAmazonProgramEnum;
|
|
132
115
|
}
|
|
133
116
|
/**
|
|
134
117
|
* SalesApi - object-oriented interface
|
|
135
|
-
* @export
|
|
136
|
-
* @class SalesApi
|
|
137
|
-
* @extends {BaseAPI}
|
|
138
118
|
*/
|
|
139
119
|
export declare class SalesApi extends BaseAPI {
|
|
140
120
|
/**
|
|
@@ -142,13 +122,9 @@ export declare class SalesApi extends BaseAPI {
|
|
|
142
122
|
* @param {SalesApiGetOrderMetricsRequest} requestParameters Request parameters.
|
|
143
123
|
* @param {*} [options] Override http request option.
|
|
144
124
|
* @throws {RequiredError}
|
|
145
|
-
* @memberof SalesApi
|
|
146
125
|
*/
|
|
147
126
|
getOrderMetrics(requestParameters: SalesApiGetOrderMetricsRequest, options?: RawAxiosRequestConfig): Promise<globalAxios.AxiosResponse<GetOrderMetricsResponse, any>>;
|
|
148
127
|
}
|
|
149
|
-
/**
|
|
150
|
-
* @export
|
|
151
|
-
*/
|
|
152
128
|
export declare const GetOrderMetricsGranularityEnum: {
|
|
153
129
|
readonly Hour: "Hour";
|
|
154
130
|
readonly Day: "Day";
|
|
@@ -158,20 +134,18 @@ export declare const GetOrderMetricsGranularityEnum: {
|
|
|
158
134
|
readonly Total: "Total";
|
|
159
135
|
};
|
|
160
136
|
export type GetOrderMetricsGranularityEnum = typeof GetOrderMetricsGranularityEnum[keyof typeof GetOrderMetricsGranularityEnum];
|
|
161
|
-
/**
|
|
162
|
-
* @export
|
|
163
|
-
*/
|
|
164
137
|
export declare const GetOrderMetricsBuyerTypeEnum: {
|
|
165
138
|
readonly B2B: "B2B";
|
|
166
139
|
readonly B2C: "B2C";
|
|
167
140
|
readonly All: "All";
|
|
168
141
|
};
|
|
169
142
|
export type GetOrderMetricsBuyerTypeEnum = typeof GetOrderMetricsBuyerTypeEnum[keyof typeof GetOrderMetricsBuyerTypeEnum];
|
|
170
|
-
/**
|
|
171
|
-
* @export
|
|
172
|
-
*/
|
|
173
143
|
export declare const GetOrderMetricsFirstDayOfWeekEnum: {
|
|
174
144
|
readonly Monday: "Monday";
|
|
175
145
|
readonly Sunday: "Sunday";
|
|
176
146
|
};
|
|
177
147
|
export type GetOrderMetricsFirstDayOfWeekEnum = typeof GetOrderMetricsFirstDayOfWeekEnum[keyof typeof GetOrderMetricsFirstDayOfWeekEnum];
|
|
148
|
+
export declare const GetOrderMetricsAmazonProgramEnum: {
|
|
149
|
+
readonly AmazonHaul: "AmazonHaul";
|
|
150
|
+
};
|
|
151
|
+
export type GetOrderMetricsAmazonProgramEnum = typeof GetOrderMetricsAmazonProgramEnum[keyof typeof GetOrderMetricsAmazonProgramEnum];
|
|
@@ -12,42 +12,22 @@
|
|
|
12
12
|
import type { Configuration } from './configuration';
|
|
13
13
|
import type { AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
|
14
14
|
export declare const BASE_PATH: string;
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @export
|
|
18
|
-
*/
|
|
19
15
|
export declare const COLLECTION_FORMATS: {
|
|
20
16
|
csv: string;
|
|
21
17
|
ssv: string;
|
|
22
18
|
tsv: string;
|
|
23
19
|
pipes: string;
|
|
24
20
|
};
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @export
|
|
28
|
-
* @interface RequestArgs
|
|
29
|
-
*/
|
|
30
21
|
export interface RequestArgs {
|
|
31
22
|
url: string;
|
|
32
23
|
options: RawAxiosRequestConfig;
|
|
33
24
|
}
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* @export
|
|
37
|
-
* @class BaseAPI
|
|
38
|
-
*/
|
|
39
25
|
export declare class BaseAPI {
|
|
40
26
|
protected basePath: string;
|
|
41
27
|
protected axios: AxiosInstance;
|
|
42
28
|
protected configuration: Configuration | undefined;
|
|
43
29
|
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
44
30
|
}
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* @export
|
|
48
|
-
* @class RequiredError
|
|
49
|
-
* @extends {Error}
|
|
50
|
-
*/
|
|
51
31
|
export declare class RequiredError extends Error {
|
|
52
32
|
field: string;
|
|
53
33
|
constructor(field: string, msg?: string);
|
|
@@ -58,9 +38,5 @@ interface ServerMap {
|
|
|
58
38
|
description: string;
|
|
59
39
|
}[];
|
|
60
40
|
}
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* @export
|
|
64
|
-
*/
|
|
65
41
|
export declare const operationServerMap: ServerMap;
|
|
66
42
|
export {};
|
|
@@ -12,54 +12,17 @@
|
|
|
12
12
|
import type { Configuration } from "./configuration";
|
|
13
13
|
import type { RequestArgs } from "./base";
|
|
14
14
|
import type { AxiosInstance, AxiosResponse } from 'axios';
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @export
|
|
18
|
-
*/
|
|
19
15
|
export declare const DUMMY_BASE_URL = "https://example.com";
|
|
20
16
|
/**
|
|
21
17
|
*
|
|
22
18
|
* @throws {RequiredError}
|
|
23
|
-
* @export
|
|
24
19
|
*/
|
|
25
20
|
export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @export
|
|
29
|
-
*/
|
|
30
21
|
export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
* @export
|
|
34
|
-
*/
|
|
35
22
|
export declare const setBasicAuthToObject: (object: any, configuration?: Configuration) => void;
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* @export
|
|
39
|
-
*/
|
|
40
23
|
export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @export
|
|
44
|
-
*/
|
|
45
24
|
export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @export
|
|
49
|
-
*/
|
|
50
25
|
export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* @export
|
|
54
|
-
*/
|
|
55
26
|
export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
* @export
|
|
59
|
-
*/
|
|
60
27
|
export declare const toPathString: (url: URL) => string;
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* @export
|
|
64
|
-
*/
|
|
65
28
|
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|
|
@@ -23,49 +23,32 @@ export declare class Configuration {
|
|
|
23
23
|
/**
|
|
24
24
|
* parameter for apiKey security
|
|
25
25
|
* @param name security name
|
|
26
|
-
* @memberof Configuration
|
|
27
26
|
*/
|
|
28
27
|
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
29
28
|
/**
|
|
30
29
|
* parameter for basic security
|
|
31
|
-
*
|
|
32
|
-
* @type {string}
|
|
33
|
-
* @memberof Configuration
|
|
34
30
|
*/
|
|
35
31
|
username?: string;
|
|
36
32
|
/**
|
|
37
33
|
* parameter for basic security
|
|
38
|
-
*
|
|
39
|
-
* @type {string}
|
|
40
|
-
* @memberof Configuration
|
|
41
34
|
*/
|
|
42
35
|
password?: string;
|
|
43
36
|
/**
|
|
44
37
|
* parameter for oauth2 security
|
|
45
38
|
* @param name security name
|
|
46
39
|
* @param scopes oauth2 scope
|
|
47
|
-
* @memberof Configuration
|
|
48
40
|
*/
|
|
49
41
|
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
50
42
|
/**
|
|
51
43
|
* override base path
|
|
52
|
-
*
|
|
53
|
-
* @type {string}
|
|
54
|
-
* @memberof Configuration
|
|
55
44
|
*/
|
|
56
45
|
basePath?: string;
|
|
57
46
|
/**
|
|
58
47
|
* override server index
|
|
59
|
-
*
|
|
60
|
-
* @type {number}
|
|
61
|
-
* @memberof Configuration
|
|
62
48
|
*/
|
|
63
49
|
serverIndex?: number;
|
|
64
50
|
/**
|
|
65
51
|
* base options for axios calls
|
|
66
|
-
*
|
|
67
|
-
* @type {any}
|
|
68
|
-
* @memberof Configuration
|
|
69
52
|
*/
|
|
70
53
|
baseOptions?: any;
|
|
71
54
|
/**
|
|
@@ -12,20 +12,14 @@
|
|
|
12
12
|
import type { OrderMetricsInterval } from './order-metrics-interval';
|
|
13
13
|
/**
|
|
14
14
|
* The response schema for the getOrderMetrics operation.
|
|
15
|
-
* @export
|
|
16
|
-
* @interface GetOrderMetricsResponse
|
|
17
15
|
*/
|
|
18
16
|
export interface GetOrderMetricsResponse {
|
|
19
17
|
/**
|
|
20
18
|
* A set of order metrics, each scoped to a particular time interval.
|
|
21
|
-
* @type {Array<OrderMetricsInterval>}
|
|
22
|
-
* @memberof GetOrderMetricsResponse
|
|
23
19
|
*/
|
|
24
20
|
'payload'?: Array<OrderMetricsInterval>;
|
|
25
21
|
/**
|
|
26
22
|
* A list of error responses returned when a request is unsuccessful.
|
|
27
|
-
* @type {Array<Error>}
|
|
28
|
-
* @memberof GetOrderMetricsResponse
|
|
29
23
|
*/
|
|
30
24
|
'errors'?: Array<Error>;
|
|
31
25
|
}
|
|
@@ -11,26 +11,18 @@
|
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
13
|
* Error response returned when the request is unsuccessful.
|
|
14
|
-
* @export
|
|
15
|
-
* @interface ModelError
|
|
16
14
|
*/
|
|
17
15
|
export interface ModelError {
|
|
18
16
|
/**
|
|
19
17
|
* An error code that identifies the type of error that occured.
|
|
20
|
-
* @type {string}
|
|
21
|
-
* @memberof ModelError
|
|
22
18
|
*/
|
|
23
19
|
'code': string;
|
|
24
20
|
/**
|
|
25
21
|
* A message that describes the error condition in a human-readable form.
|
|
26
|
-
* @type {string}
|
|
27
|
-
* @memberof ModelError
|
|
28
22
|
*/
|
|
29
23
|
'message': string;
|
|
30
24
|
/**
|
|
31
25
|
* Additional details that can help the caller understand or fix the issue.
|
|
32
|
-
* @type {string}
|
|
33
|
-
* @memberof ModelError
|
|
34
26
|
*/
|
|
35
27
|
'details'?: string;
|
|
36
28
|
}
|
|
@@ -11,20 +11,14 @@
|
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
13
|
* The currency type and the amount.
|
|
14
|
-
* @export
|
|
15
|
-
* @interface Money
|
|
16
14
|
*/
|
|
17
15
|
export interface Money {
|
|
18
16
|
/**
|
|
19
17
|
* Three-digit currency code. In ISO 4217 format.
|
|
20
|
-
* @type {string}
|
|
21
|
-
* @memberof Money
|
|
22
18
|
*/
|
|
23
19
|
'currencyCode': string;
|
|
24
20
|
/**
|
|
25
21
|
* A decimal number with no loss of precision. Useful when precision loss is unnaceptable, as with currencies. Follows RFC7159 for number representation.
|
|
26
|
-
* @type {string}
|
|
27
|
-
* @memberof Money
|
|
28
22
|
*/
|
|
29
23
|
'amount': string;
|
|
30
24
|
}
|
|
@@ -12,44 +12,24 @@
|
|
|
12
12
|
import type { Money } from './money';
|
|
13
13
|
/**
|
|
14
14
|
* Contains order metrics.
|
|
15
|
-
* @export
|
|
16
|
-
* @interface OrderMetricsInterval
|
|
17
15
|
*/
|
|
18
16
|
export interface OrderMetricsInterval {
|
|
19
17
|
/**
|
|
20
18
|
* The interval of time based on requested granularity (ex. Hour, Day, etc.) If this is the first or the last interval from the list, it might contain incomplete data if the requested interval doesn\'t align with the requested granularity (ex. request interval 2018-09-01T02:00:00Z--2018-09-04T19:00:00Z and granularity day will result in Sept 1st UTC day and Sept 4th UTC days having partial data).
|
|
21
|
-
* @type {string}
|
|
22
|
-
* @memberof OrderMetricsInterval
|
|
23
19
|
*/
|
|
24
20
|
'interval': string;
|
|
25
21
|
/**
|
|
26
22
|
* The number of units in orders based on the specified filters.
|
|
27
|
-
* @type {number}
|
|
28
|
-
* @memberof OrderMetricsInterval
|
|
29
23
|
*/
|
|
30
24
|
'unitCount': number;
|
|
31
25
|
/**
|
|
32
26
|
* The number of order items based on the specified filters.
|
|
33
|
-
* @type {number}
|
|
34
|
-
* @memberof OrderMetricsInterval
|
|
35
27
|
*/
|
|
36
28
|
'orderItemCount': number;
|
|
37
29
|
/**
|
|
38
30
|
* The number of orders based on the specified filters.
|
|
39
|
-
* @type {number}
|
|
40
|
-
* @memberof OrderMetricsInterval
|
|
41
31
|
*/
|
|
42
32
|
'orderCount': number;
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @type {Money}
|
|
46
|
-
* @memberof OrderMetricsInterval
|
|
47
|
-
*/
|
|
48
33
|
'averageUnitPrice': Money;
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
* @type {Money}
|
|
52
|
-
* @memberof OrderMetricsInterval
|
|
53
|
-
*/
|
|
54
34
|
'totalSales': Money;
|
|
55
35
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@sp-api-sdk/sales-api-v1",
|
|
3
3
|
"author": "Bertrand Marron <bertrand@bizon.solutions>",
|
|
4
4
|
"description": "The Selling Partner API for Sales provides APIs related to sales performance.",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.1.1",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
7
7
|
"module": "dist/es/index.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"dist/**/*.d.ts"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@sp-api-sdk/common": "2.1.
|
|
22
|
-
"axios": "^1.
|
|
21
|
+
"@sp-api-sdk/common": "2.1.16",
|
|
22
|
+
"axios": "^1.11.0"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -40,5 +40,26 @@
|
|
|
40
40
|
"sp sdk",
|
|
41
41
|
"sales api"
|
|
42
42
|
],
|
|
43
|
-
"
|
|
43
|
+
"xo": {
|
|
44
|
+
"extends": [
|
|
45
|
+
"xo-bizon"
|
|
46
|
+
],
|
|
47
|
+
"settings": {
|
|
48
|
+
"import/internal-regex": "^@sp-api-sdk/"
|
|
49
|
+
},
|
|
50
|
+
"semicolon": false,
|
|
51
|
+
"space": 2,
|
|
52
|
+
"prettier": true,
|
|
53
|
+
"ignores": [
|
|
54
|
+
"src/api-model/**"
|
|
55
|
+
],
|
|
56
|
+
"rules": {
|
|
57
|
+
"unicorn/prevent-abbreviations": "off"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"prettier": {
|
|
61
|
+
"printWidth": 100,
|
|
62
|
+
"jsxSingleQuote": true
|
|
63
|
+
},
|
|
64
|
+
"gitHead": "fc1b46f3bc172469e2fbbc2e0155f6fa7ce3edde"
|
|
44
65
|
}
|