@revenexx/sdk 0.0.4 → 0.0.6
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/sdk.js +13491 -6163
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +13464 -6162
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +13491 -6163
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/enums/address-type.ts +4 -0
- package/src/enums/cart-export-format.ts +4 -0
- package/src/enums/cart-io-apply-mode.ts +5 -0
- package/src/enums/cart-io-direction.ts +4 -0
- package/src/enums/cart-io-entity.ts +4 -0
- package/src/enums/cart-io-format.ts +4 -0
- package/src/enums/cart-item-type.ts +5 -0
- package/src/enums/channel-status.ts +4 -0
- package/src/enums/channel-type.ts +7 -0
- package/src/enums/contact-role.ts +6 -0
- package/src/enums/contact-status.ts +5 -0
- package/src/enums/location-type.ts +6 -0
- package/src/enums/market-status.ts +4 -0
- package/src/enums/order-comment-visibility.ts +4 -0
- package/src/enums/order-item-type.ts +5 -0
- package/src/enums/order-list-kind.ts +4 -0
- package/src/enums/order-payment-status.ts +9 -0
- package/src/enums/organization-status.ts +4 -0
- package/src/enums/page-status.ts +5 -0
- package/src/enums/payment-fee-type.ts +5 -0
- package/src/enums/payment-method-kind.ts +4 -0
- package/src/enums/price-entry-type.ts +4 -0
- package/src/enums/price-list-status.ts +4 -0
- package/src/enums/shipping-method-matrix-basis.ts +6 -0
- package/src/enums/shipping-method-pricing-type.ts +5 -0
- package/src/enums/store-asset-request-visibility.ts +4 -0
- package/src/enums/visibility.ts +4 -0
- package/src/index.ts +28 -2
- package/src/models.ts +5309 -1009
- package/src/services/apps.ts +154 -154
- package/src/services/avatars.ts +57 -57
- package/src/services/carts.ts +739 -104
- package/src/services/channels.ts +147 -19
- package/src/services/customers.ts +809 -69
- package/src/services/greetings.ts +18 -18
- package/src/services/inventories.ts +620 -65
- package/src/services/locale.ts +16 -16
- package/src/services/markets.ts +690 -75
- package/src/services/messaging.ts +273 -273
- package/src/services/orderlists.ts +889 -0
- package/src/services/orders.ts +692 -137
- package/src/services/pages.ts +661 -155
- package/src/services/payments.ts +591 -64
- package/src/services/prices.ts +585 -59
- package/src/services/products.ts +1908 -272
- package/src/services/search.ts +24 -24
- package/src/services/shipping.ts +451 -59
- package/src/services/sites.ts +116 -116
- package/src/services/storage.ts +933 -599
- package/src/services/tokens.ts +14 -14
- package/types/enums/address-type.d.ts +4 -0
- package/types/enums/cart-export-format.d.ts +4 -0
- package/types/enums/cart-io-apply-mode.d.ts +5 -0
- package/types/enums/cart-io-direction.d.ts +4 -0
- package/types/enums/cart-io-entity.d.ts +4 -0
- package/types/enums/cart-io-format.d.ts +4 -0
- package/types/enums/cart-item-type.d.ts +5 -0
- package/types/enums/channel-status.d.ts +4 -0
- package/types/enums/channel-type.d.ts +7 -0
- package/types/enums/contact-role.d.ts +6 -0
- package/types/enums/contact-status.d.ts +5 -0
- package/types/enums/location-type.d.ts +6 -0
- package/types/enums/market-status.d.ts +4 -0
- package/types/enums/order-comment-visibility.d.ts +4 -0
- package/types/enums/order-item-type.d.ts +5 -0
- package/types/enums/order-list-kind.d.ts +4 -0
- package/types/enums/order-payment-status.d.ts +9 -0
- package/types/enums/organization-status.d.ts +4 -0
- package/types/enums/page-status.d.ts +5 -0
- package/types/enums/payment-fee-type.d.ts +5 -0
- package/types/enums/payment-method-kind.d.ts +4 -0
- package/types/enums/price-entry-type.d.ts +4 -0
- package/types/enums/price-list-status.d.ts +4 -0
- package/types/enums/shipping-method-matrix-basis.d.ts +6 -0
- package/types/enums/shipping-method-pricing-type.d.ts +5 -0
- package/types/enums/store-asset-request-visibility.d.ts +4 -0
- package/types/enums/visibility.d.ts +4 -0
- package/types/index.d.ts +28 -2
- package/types/models.d.ts +5170 -1010
- package/types/services/carts.d.ts +271 -12
- package/types/services/channels.d.ts +54 -2
- package/types/services/customers.d.ts +298 -12
- package/types/services/inventories.d.ts +225 -11
- package/types/services/markets.d.ts +235 -6
- package/types/services/orderlists.d.ts +324 -0
- package/types/services/orders.d.ts +238 -16
- package/types/services/pages.d.ts +190 -6
- package/types/services/payments.d.ts +221 -7
- package/types/services/prices.d.ts +218 -6
- package/types/services/products.d.ts +672 -32
- package/types/services/shipping.d.ts +168 -6
- package/types/services/storage.d.ts +353 -285
package/src/services/carts.ts
CHANGED
|
@@ -2,6 +2,12 @@ import { Service } from '../service';
|
|
|
2
2
|
import { RevenexxException, Client, type Payload, UploadProgress } from '../client';
|
|
3
3
|
import type { Models } from '../models';
|
|
4
4
|
|
|
5
|
+
import { CartIoDirection } from '../enums/cart-io-direction';
|
|
6
|
+
import { CartIoApplyMode } from '../enums/cart-io-apply-mode';
|
|
7
|
+
import { CartIoEntity } from '../enums/cart-io-entity';
|
|
8
|
+
import { CartIoFormat } from '../enums/cart-io-format';
|
|
9
|
+
import { CartItemType } from '../enums/cart-item-type';
|
|
10
|
+
import { CartExportFormat } from '../enums/cart-export-format';
|
|
5
11
|
|
|
6
12
|
export class Carts {
|
|
7
13
|
client: Client;
|
|
@@ -18,7 +24,7 @@ export class Carts {
|
|
|
18
24
|
cartsList(): Promise<{}> {
|
|
19
25
|
|
|
20
26
|
const apiPath = '/v1/carts';
|
|
21
|
-
const
|
|
27
|
+
const apiPayload: Payload = {};
|
|
22
28
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
23
29
|
|
|
24
30
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -28,19 +34,96 @@ export class Carts {
|
|
|
28
34
|
'get',
|
|
29
35
|
uri,
|
|
30
36
|
apiHeaders,
|
|
31
|
-
|
|
37
|
+
apiPayload
|
|
32
38
|
);
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
/**
|
|
36
42
|
*
|
|
43
|
+
* @param {string} params.channelId -
|
|
44
|
+
* @param {string} params.contactId - Owning customer contact.
|
|
45
|
+
* @param {string} params.currency - ISO 4217 code (default EUR).
|
|
46
|
+
* @param {boolean} params.isCurrent - Make this THE current cart of its owner.
|
|
47
|
+
* @param {string} params.marketId -
|
|
48
|
+
* @param {object} params.metadata - Free-form metadata.
|
|
49
|
+
* @param {string} params.name - Display name (default 'Cart').
|
|
50
|
+
* @param {string} params.sessionKey - Owning guest session.
|
|
37
51
|
* @throws {RevenexxException}
|
|
38
52
|
* @returns {Promise<Models.Cart>}
|
|
39
53
|
*/
|
|
40
|
-
cartsCreate(): Promise<Models.Cart
|
|
54
|
+
cartsCreate(params?: { channelId?: string, contactId?: string, currency?: string, isCurrent?: boolean, marketId?: string, metadata?: object, name?: string, sessionKey?: string }): Promise<Models.Cart>;
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param {string} channelId -
|
|
58
|
+
* @param {string} contactId - Owning customer contact.
|
|
59
|
+
* @param {string} currency - ISO 4217 code (default EUR).
|
|
60
|
+
* @param {boolean} isCurrent - Make this THE current cart of its owner.
|
|
61
|
+
* @param {string} marketId -
|
|
62
|
+
* @param {object} metadata - Free-form metadata.
|
|
63
|
+
* @param {string} name - Display name (default 'Cart').
|
|
64
|
+
* @param {string} sessionKey - Owning guest session.
|
|
65
|
+
* @throws {RevenexxException}
|
|
66
|
+
* @returns {Promise<Models.Cart>}
|
|
67
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
68
|
+
*/
|
|
69
|
+
cartsCreate(channelId?: string, contactId?: string, currency?: string, isCurrent?: boolean, marketId?: string, metadata?: object, name?: string, sessionKey?: string): Promise<Models.Cart>;
|
|
70
|
+
cartsCreate(
|
|
71
|
+
paramsOrFirst?: { channelId?: string, contactId?: string, currency?: string, isCurrent?: boolean, marketId?: string, metadata?: object, name?: string, sessionKey?: string } | string,
|
|
72
|
+
...rest: [(string)?, (string)?, (boolean)?, (string)?, (object)?, (string)?, (string)?]
|
|
73
|
+
): Promise<Models.Cart> {
|
|
74
|
+
let params: { channelId?: string, contactId?: string, currency?: string, isCurrent?: boolean, marketId?: string, metadata?: object, name?: string, sessionKey?: string };
|
|
75
|
+
|
|
76
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
77
|
+
params = (paramsOrFirst || {}) as { channelId?: string, contactId?: string, currency?: string, isCurrent?: boolean, marketId?: string, metadata?: object, name?: string, sessionKey?: string };
|
|
78
|
+
} else {
|
|
79
|
+
params = {
|
|
80
|
+
channelId: paramsOrFirst as string,
|
|
81
|
+
contactId: rest[0] as string,
|
|
82
|
+
currency: rest[1] as string,
|
|
83
|
+
isCurrent: rest[2] as boolean,
|
|
84
|
+
marketId: rest[3] as string,
|
|
85
|
+
metadata: rest[4] as object,
|
|
86
|
+
name: rest[5] as string,
|
|
87
|
+
sessionKey: rest[6] as string
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const channelId = params.channelId;
|
|
92
|
+
const contactId = params.contactId;
|
|
93
|
+
const currency = params.currency;
|
|
94
|
+
const isCurrent = params.isCurrent;
|
|
95
|
+
const marketId = params.marketId;
|
|
96
|
+
const metadata = params.metadata;
|
|
97
|
+
const name = params.name;
|
|
98
|
+
const sessionKey = params.sessionKey;
|
|
99
|
+
|
|
41
100
|
|
|
42
101
|
const apiPath = '/v1/carts';
|
|
43
|
-
const
|
|
102
|
+
const apiPayload: Payload = {};
|
|
103
|
+
if (typeof channelId !== 'undefined') {
|
|
104
|
+
apiPayload['channel_id'] = channelId;
|
|
105
|
+
}
|
|
106
|
+
if (typeof contactId !== 'undefined') {
|
|
107
|
+
apiPayload['contact_id'] = contactId;
|
|
108
|
+
}
|
|
109
|
+
if (typeof currency !== 'undefined') {
|
|
110
|
+
apiPayload['currency'] = currency;
|
|
111
|
+
}
|
|
112
|
+
if (typeof isCurrent !== 'undefined') {
|
|
113
|
+
apiPayload['is_current'] = isCurrent;
|
|
114
|
+
}
|
|
115
|
+
if (typeof marketId !== 'undefined') {
|
|
116
|
+
apiPayload['market_id'] = marketId;
|
|
117
|
+
}
|
|
118
|
+
if (typeof metadata !== 'undefined') {
|
|
119
|
+
apiPayload['metadata'] = metadata;
|
|
120
|
+
}
|
|
121
|
+
if (typeof name !== 'undefined') {
|
|
122
|
+
apiPayload['name'] = name;
|
|
123
|
+
}
|
|
124
|
+
if (typeof sessionKey !== 'undefined') {
|
|
125
|
+
apiPayload['session_key'] = sessionKey;
|
|
126
|
+
}
|
|
44
127
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
45
128
|
|
|
46
129
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -51,19 +134,67 @@ export class Carts {
|
|
|
51
134
|
'post',
|
|
52
135
|
uri,
|
|
53
136
|
apiHeaders,
|
|
54
|
-
|
|
137
|
+
apiPayload
|
|
55
138
|
);
|
|
56
139
|
}
|
|
57
140
|
|
|
58
141
|
/**
|
|
59
142
|
*
|
|
143
|
+
* @param {string} params.contactId - Contact taking ownership.
|
|
144
|
+
* @param {string} params.sessionKey - Guest session whose active carts are handed over.
|
|
145
|
+
* @param {string} params.targetCartId - Merge the session carts into this cart instead of adopting them.
|
|
146
|
+
* @throws {RevenexxException}
|
|
147
|
+
* @returns {Promise<{}>}
|
|
148
|
+
*/
|
|
149
|
+
cartsClaim(params: { contactId: string, sessionKey: string, targetCartId?: string }): Promise<{}>;
|
|
150
|
+
/**
|
|
151
|
+
*
|
|
152
|
+
* @param {string} contactId - Contact taking ownership.
|
|
153
|
+
* @param {string} sessionKey - Guest session whose active carts are handed over.
|
|
154
|
+
* @param {string} targetCartId - Merge the session carts into this cart instead of adopting them.
|
|
60
155
|
* @throws {RevenexxException}
|
|
61
156
|
* @returns {Promise<{}>}
|
|
157
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
62
158
|
*/
|
|
63
|
-
cartsClaim(): Promise<{}
|
|
159
|
+
cartsClaim(contactId: string, sessionKey: string, targetCartId?: string): Promise<{}>;
|
|
160
|
+
cartsClaim(
|
|
161
|
+
paramsOrFirst: { contactId: string, sessionKey: string, targetCartId?: string } | string,
|
|
162
|
+
...rest: [(string)?, (string)?]
|
|
163
|
+
): Promise<{}> {
|
|
164
|
+
let params: { contactId: string, sessionKey: string, targetCartId?: string };
|
|
165
|
+
|
|
166
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
167
|
+
params = (paramsOrFirst || {}) as { contactId: string, sessionKey: string, targetCartId?: string };
|
|
168
|
+
} else {
|
|
169
|
+
params = {
|
|
170
|
+
contactId: paramsOrFirst as string,
|
|
171
|
+
sessionKey: rest[0] as string,
|
|
172
|
+
targetCartId: rest[1] as string
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const contactId = params.contactId;
|
|
177
|
+
const sessionKey = params.sessionKey;
|
|
178
|
+
const targetCartId = params.targetCartId;
|
|
179
|
+
|
|
180
|
+
if (typeof contactId === 'undefined') {
|
|
181
|
+
throw new RevenexxException('Missing required parameter: "contactId"');
|
|
182
|
+
}
|
|
183
|
+
if (typeof sessionKey === 'undefined') {
|
|
184
|
+
throw new RevenexxException('Missing required parameter: "sessionKey"');
|
|
185
|
+
}
|
|
64
186
|
|
|
65
187
|
const apiPath = '/v1/carts/claim';
|
|
66
|
-
const
|
|
188
|
+
const apiPayload: Payload = {};
|
|
189
|
+
if (typeof contactId !== 'undefined') {
|
|
190
|
+
apiPayload['contact_id'] = contactId;
|
|
191
|
+
}
|
|
192
|
+
if (typeof sessionKey !== 'undefined') {
|
|
193
|
+
apiPayload['session_key'] = sessionKey;
|
|
194
|
+
}
|
|
195
|
+
if (typeof targetCartId !== 'undefined') {
|
|
196
|
+
apiPayload['target_cart_id'] = targetCartId;
|
|
197
|
+
}
|
|
67
198
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
68
199
|
|
|
69
200
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -74,19 +205,89 @@ export class Carts {
|
|
|
74
205
|
'post',
|
|
75
206
|
uri,
|
|
76
207
|
apiHeaders,
|
|
77
|
-
|
|
208
|
+
apiPayload
|
|
78
209
|
);
|
|
79
210
|
}
|
|
80
211
|
|
|
81
212
|
/**
|
|
82
213
|
*
|
|
214
|
+
* @param {string} params.contactId - Owner of a newly created cart.
|
|
215
|
+
* @param {string} params.csv - Raw CSV content (alternative to payload for csv profiles).
|
|
216
|
+
* @param {string} params.name - Name for a newly created cart.
|
|
217
|
+
* @param {object} params.payload - The import payload: '{cart, items}' object, or a raw JSON/CSV string in the profile's format.
|
|
218
|
+
* @param {string} params.profileId - Import profile to run; ad-hoc import when omitted.
|
|
219
|
+
* @param {string} params.sessionKey - Guest owner of a newly created cart.
|
|
220
|
+
* @param {string} params.targetCartId - Existing active cart to import into.
|
|
83
221
|
* @throws {RevenexxException}
|
|
84
222
|
* @returns {Promise<{}>}
|
|
85
223
|
*/
|
|
86
|
-
cartsImport(): Promise<{}
|
|
224
|
+
cartsImport(params?: { contactId?: string, csv?: string, name?: string, payload?: object, profileId?: string, sessionKey?: string, targetCartId?: string }): Promise<{}>;
|
|
225
|
+
/**
|
|
226
|
+
*
|
|
227
|
+
* @param {string} contactId - Owner of a newly created cart.
|
|
228
|
+
* @param {string} csv - Raw CSV content (alternative to payload for csv profiles).
|
|
229
|
+
* @param {string} name - Name for a newly created cart.
|
|
230
|
+
* @param {object} payload - The import payload: '{cart, items}' object, or a raw JSON/CSV string in the profile's format.
|
|
231
|
+
* @param {string} profileId - Import profile to run; ad-hoc import when omitted.
|
|
232
|
+
* @param {string} sessionKey - Guest owner of a newly created cart.
|
|
233
|
+
* @param {string} targetCartId - Existing active cart to import into.
|
|
234
|
+
* @throws {RevenexxException}
|
|
235
|
+
* @returns {Promise<{}>}
|
|
236
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
237
|
+
*/
|
|
238
|
+
cartsImport(contactId?: string, csv?: string, name?: string, payload?: object, profileId?: string, sessionKey?: string, targetCartId?: string): Promise<{}>;
|
|
239
|
+
cartsImport(
|
|
240
|
+
paramsOrFirst?: { contactId?: string, csv?: string, name?: string, payload?: object, profileId?: string, sessionKey?: string, targetCartId?: string } | string,
|
|
241
|
+
...rest: [(string)?, (string)?, (object)?, (string)?, (string)?, (string)?]
|
|
242
|
+
): Promise<{}> {
|
|
243
|
+
let params: { contactId?: string, csv?: string, name?: string, payload?: object, profileId?: string, sessionKey?: string, targetCartId?: string };
|
|
244
|
+
|
|
245
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
246
|
+
params = (paramsOrFirst || {}) as { contactId?: string, csv?: string, name?: string, payload?: object, profileId?: string, sessionKey?: string, targetCartId?: string };
|
|
247
|
+
} else {
|
|
248
|
+
params = {
|
|
249
|
+
contactId: paramsOrFirst as string,
|
|
250
|
+
csv: rest[0] as string,
|
|
251
|
+
name: rest[1] as string,
|
|
252
|
+
payload: rest[2] as object,
|
|
253
|
+
profileId: rest[3] as string,
|
|
254
|
+
sessionKey: rest[4] as string,
|
|
255
|
+
targetCartId: rest[5] as string
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const contactId = params.contactId;
|
|
260
|
+
const csv = params.csv;
|
|
261
|
+
const name = params.name;
|
|
262
|
+
const payload = params.payload;
|
|
263
|
+
const profileId = params.profileId;
|
|
264
|
+
const sessionKey = params.sessionKey;
|
|
265
|
+
const targetCartId = params.targetCartId;
|
|
266
|
+
|
|
87
267
|
|
|
88
268
|
const apiPath = '/v1/carts/import';
|
|
89
|
-
const
|
|
269
|
+
const apiPayload: Payload = {};
|
|
270
|
+
if (typeof contactId !== 'undefined') {
|
|
271
|
+
apiPayload['contact_id'] = contactId;
|
|
272
|
+
}
|
|
273
|
+
if (typeof csv !== 'undefined') {
|
|
274
|
+
apiPayload['csv'] = csv;
|
|
275
|
+
}
|
|
276
|
+
if (typeof name !== 'undefined') {
|
|
277
|
+
apiPayload['name'] = name;
|
|
278
|
+
}
|
|
279
|
+
if (typeof payload !== 'undefined') {
|
|
280
|
+
apiPayload['payload'] = payload;
|
|
281
|
+
}
|
|
282
|
+
if (typeof profileId !== 'undefined') {
|
|
283
|
+
apiPayload['profile_id'] = profileId;
|
|
284
|
+
}
|
|
285
|
+
if (typeof sessionKey !== 'undefined') {
|
|
286
|
+
apiPayload['session_key'] = sessionKey;
|
|
287
|
+
}
|
|
288
|
+
if (typeof targetCartId !== 'undefined') {
|
|
289
|
+
apiPayload['target_cart_id'] = targetCartId;
|
|
290
|
+
}
|
|
90
291
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
91
292
|
|
|
92
293
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -97,7 +298,7 @@ export class Carts {
|
|
|
97
298
|
'post',
|
|
98
299
|
uri,
|
|
99
300
|
apiHeaders,
|
|
100
|
-
|
|
301
|
+
apiPayload
|
|
101
302
|
);
|
|
102
303
|
}
|
|
103
304
|
|
|
@@ -109,7 +310,7 @@ export class Carts {
|
|
|
109
310
|
cartsIoProfilesList(): Promise<{}> {
|
|
110
311
|
|
|
111
312
|
const apiPath = '/v1/carts/io/profiles';
|
|
112
|
-
const
|
|
313
|
+
const apiPayload: Payload = {};
|
|
113
314
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
114
315
|
|
|
115
316
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -119,19 +320,102 @@ export class Carts {
|
|
|
119
320
|
'get',
|
|
120
321
|
uri,
|
|
121
322
|
apiHeaders,
|
|
122
|
-
|
|
323
|
+
apiPayload
|
|
123
324
|
);
|
|
124
325
|
}
|
|
125
326
|
|
|
126
327
|
/**
|
|
127
328
|
*
|
|
329
|
+
* @param {CartIoDirection} params.direction -
|
|
330
|
+
* @param {string} params.name -
|
|
331
|
+
* @param {CartIoApplyMode} params.applyMode - Default 'insert'.
|
|
332
|
+
* @param {CartIoEntity} params.entity - Default 'carts'.
|
|
333
|
+
* @param {CartIoFormat} params.format - Default 'json'.
|
|
334
|
+
* @param {boolean} params.isTemplate -
|
|
335
|
+
* @param {object} params.mapping - Column mapping (Baseline-IO-compatible).
|
|
336
|
+
* @param {object} params.options -
|
|
128
337
|
* @throws {RevenexxException}
|
|
129
338
|
* @returns {Promise<Models.IoProfile>}
|
|
130
339
|
*/
|
|
131
|
-
cartsIoProfilesCreate(): Promise<Models.IoProfile
|
|
340
|
+
cartsIoProfilesCreate(params: { direction: CartIoDirection, name: string, applyMode?: CartIoApplyMode, entity?: CartIoEntity, format?: CartIoFormat, isTemplate?: boolean, mapping?: object, options?: object }): Promise<Models.IoProfile>;
|
|
341
|
+
/**
|
|
342
|
+
*
|
|
343
|
+
* @param {CartIoDirection} direction -
|
|
344
|
+
* @param {string} name -
|
|
345
|
+
* @param {CartIoApplyMode} applyMode - Default 'insert'.
|
|
346
|
+
* @param {CartIoEntity} entity - Default 'carts'.
|
|
347
|
+
* @param {CartIoFormat} format - Default 'json'.
|
|
348
|
+
* @param {boolean} isTemplate -
|
|
349
|
+
* @param {object} mapping - Column mapping (Baseline-IO-compatible).
|
|
350
|
+
* @param {object} options -
|
|
351
|
+
* @throws {RevenexxException}
|
|
352
|
+
* @returns {Promise<Models.IoProfile>}
|
|
353
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
354
|
+
*/
|
|
355
|
+
cartsIoProfilesCreate(direction: CartIoDirection, name: string, applyMode?: CartIoApplyMode, entity?: CartIoEntity, format?: CartIoFormat, isTemplate?: boolean, mapping?: object, options?: object): Promise<Models.IoProfile>;
|
|
356
|
+
cartsIoProfilesCreate(
|
|
357
|
+
paramsOrFirst: { direction: CartIoDirection, name: string, applyMode?: CartIoApplyMode, entity?: CartIoEntity, format?: CartIoFormat, isTemplate?: boolean, mapping?: object, options?: object } | CartIoDirection,
|
|
358
|
+
...rest: [(string)?, (CartIoApplyMode)?, (CartIoEntity)?, (CartIoFormat)?, (boolean)?, (object)?, (object)?]
|
|
359
|
+
): Promise<Models.IoProfile> {
|
|
360
|
+
let params: { direction: CartIoDirection, name: string, applyMode?: CartIoApplyMode, entity?: CartIoEntity, format?: CartIoFormat, isTemplate?: boolean, mapping?: object, options?: object };
|
|
361
|
+
|
|
362
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('direction' in paramsOrFirst || 'name' in paramsOrFirst || 'applyMode' in paramsOrFirst || 'entity' in paramsOrFirst || 'format' in paramsOrFirst || 'isTemplate' in paramsOrFirst || 'mapping' in paramsOrFirst || 'options' in paramsOrFirst))) {
|
|
363
|
+
params = (paramsOrFirst || {}) as { direction: CartIoDirection, name: string, applyMode?: CartIoApplyMode, entity?: CartIoEntity, format?: CartIoFormat, isTemplate?: boolean, mapping?: object, options?: object };
|
|
364
|
+
} else {
|
|
365
|
+
params = {
|
|
366
|
+
direction: paramsOrFirst as CartIoDirection,
|
|
367
|
+
name: rest[0] as string,
|
|
368
|
+
applyMode: rest[1] as CartIoApplyMode,
|
|
369
|
+
entity: rest[2] as CartIoEntity,
|
|
370
|
+
format: rest[3] as CartIoFormat,
|
|
371
|
+
isTemplate: rest[4] as boolean,
|
|
372
|
+
mapping: rest[5] as object,
|
|
373
|
+
options: rest[6] as object
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const direction = params.direction;
|
|
378
|
+
const name = params.name;
|
|
379
|
+
const applyMode = params.applyMode;
|
|
380
|
+
const entity = params.entity;
|
|
381
|
+
const format = params.format;
|
|
382
|
+
const isTemplate = params.isTemplate;
|
|
383
|
+
const mapping = params.mapping;
|
|
384
|
+
const options = params.options;
|
|
385
|
+
|
|
386
|
+
if (typeof direction === 'undefined') {
|
|
387
|
+
throw new RevenexxException('Missing required parameter: "direction"');
|
|
388
|
+
}
|
|
389
|
+
if (typeof name === 'undefined') {
|
|
390
|
+
throw new RevenexxException('Missing required parameter: "name"');
|
|
391
|
+
}
|
|
132
392
|
|
|
133
393
|
const apiPath = '/v1/carts/io/profiles';
|
|
134
|
-
const
|
|
394
|
+
const apiPayload: Payload = {};
|
|
395
|
+
if (typeof applyMode !== 'undefined') {
|
|
396
|
+
apiPayload['apply_mode'] = applyMode;
|
|
397
|
+
}
|
|
398
|
+
if (typeof direction !== 'undefined') {
|
|
399
|
+
apiPayload['direction'] = direction;
|
|
400
|
+
}
|
|
401
|
+
if (typeof entity !== 'undefined') {
|
|
402
|
+
apiPayload['entity'] = entity;
|
|
403
|
+
}
|
|
404
|
+
if (typeof format !== 'undefined') {
|
|
405
|
+
apiPayload['format'] = format;
|
|
406
|
+
}
|
|
407
|
+
if (typeof isTemplate !== 'undefined') {
|
|
408
|
+
apiPayload['is_template'] = isTemplate;
|
|
409
|
+
}
|
|
410
|
+
if (typeof mapping !== 'undefined') {
|
|
411
|
+
apiPayload['mapping'] = mapping;
|
|
412
|
+
}
|
|
413
|
+
if (typeof name !== 'undefined') {
|
|
414
|
+
apiPayload['name'] = name;
|
|
415
|
+
}
|
|
416
|
+
if (typeof options !== 'undefined') {
|
|
417
|
+
apiPayload['options'] = options;
|
|
418
|
+
}
|
|
135
419
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
136
420
|
|
|
137
421
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -142,7 +426,7 @@ export class Carts {
|
|
|
142
426
|
'post',
|
|
143
427
|
uri,
|
|
144
428
|
apiHeaders,
|
|
145
|
-
|
|
429
|
+
apiPayload
|
|
146
430
|
);
|
|
147
431
|
}
|
|
148
432
|
|
|
@@ -154,7 +438,7 @@ export class Carts {
|
|
|
154
438
|
cartsIoProfilesDefaults(): Promise<{}> {
|
|
155
439
|
|
|
156
440
|
const apiPath = '/v1/carts/io/profiles/defaults';
|
|
157
|
-
const
|
|
441
|
+
const apiPayload: Payload = {};
|
|
158
442
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
159
443
|
|
|
160
444
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -164,7 +448,7 @@ export class Carts {
|
|
|
164
448
|
'post',
|
|
165
449
|
uri,
|
|
166
450
|
apiHeaders,
|
|
167
|
-
|
|
451
|
+
apiPayload
|
|
168
452
|
);
|
|
169
453
|
}
|
|
170
454
|
|
|
@@ -203,7 +487,7 @@ export class Carts {
|
|
|
203
487
|
}
|
|
204
488
|
|
|
205
489
|
const apiPath = '/v1/carts/io/profiles/{id}'.replace('{id}', id);
|
|
206
|
-
const
|
|
490
|
+
const apiPayload: Payload = {};
|
|
207
491
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
208
492
|
|
|
209
493
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -213,7 +497,7 @@ export class Carts {
|
|
|
213
497
|
'delete',
|
|
214
498
|
uri,
|
|
215
499
|
apiHeaders,
|
|
216
|
-
|
|
500
|
+
apiPayload
|
|
217
501
|
);
|
|
218
502
|
}
|
|
219
503
|
|
|
@@ -252,7 +536,7 @@ export class Carts {
|
|
|
252
536
|
}
|
|
253
537
|
|
|
254
538
|
const apiPath = '/v1/carts/io/profiles/{id}'.replace('{id}', id);
|
|
255
|
-
const
|
|
539
|
+
const apiPayload: Payload = {};
|
|
256
540
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
257
541
|
|
|
258
542
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -262,46 +546,103 @@ export class Carts {
|
|
|
262
546
|
'get',
|
|
263
547
|
uri,
|
|
264
548
|
apiHeaders,
|
|
265
|
-
|
|
549
|
+
apiPayload
|
|
266
550
|
);
|
|
267
551
|
}
|
|
268
552
|
|
|
269
553
|
/**
|
|
270
554
|
*
|
|
271
555
|
* @param {string} params.id -
|
|
556
|
+
* @param {CartIoApplyMode} params.applyMode - Default 'insert'.
|
|
557
|
+
* @param {CartIoDirection} params.direction -
|
|
558
|
+
* @param {CartIoEntity} params.entity - Default 'carts'.
|
|
559
|
+
* @param {CartIoFormat} params.format - Default 'json'.
|
|
560
|
+
* @param {boolean} params.isTemplate -
|
|
561
|
+
* @param {object} params.mapping - Column mapping (Baseline-IO-compatible).
|
|
562
|
+
* @param {string} params.name -
|
|
563
|
+
* @param {object} params.options -
|
|
272
564
|
* @throws {RevenexxException}
|
|
273
565
|
* @returns {Promise<Models.IoProfile>}
|
|
274
566
|
*/
|
|
275
|
-
cartsIoProfilesUpdate(params: { id: string }): Promise<Models.IoProfile>;
|
|
567
|
+
cartsIoProfilesUpdate(params: { id: string, applyMode?: CartIoApplyMode, direction?: CartIoDirection, entity?: CartIoEntity, format?: CartIoFormat, isTemplate?: boolean, mapping?: object, name?: string, options?: object }): Promise<Models.IoProfile>;
|
|
276
568
|
/**
|
|
277
569
|
*
|
|
278
570
|
* @param {string} id -
|
|
571
|
+
* @param {CartIoApplyMode} applyMode - Default 'insert'.
|
|
572
|
+
* @param {CartIoDirection} direction -
|
|
573
|
+
* @param {CartIoEntity} entity - Default 'carts'.
|
|
574
|
+
* @param {CartIoFormat} format - Default 'json'.
|
|
575
|
+
* @param {boolean} isTemplate -
|
|
576
|
+
* @param {object} mapping - Column mapping (Baseline-IO-compatible).
|
|
577
|
+
* @param {string} name -
|
|
578
|
+
* @param {object} options -
|
|
279
579
|
* @throws {RevenexxException}
|
|
280
580
|
* @returns {Promise<Models.IoProfile>}
|
|
281
581
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
282
582
|
*/
|
|
283
|
-
cartsIoProfilesUpdate(id: string): Promise<Models.IoProfile>;
|
|
583
|
+
cartsIoProfilesUpdate(id: string, applyMode?: CartIoApplyMode, direction?: CartIoDirection, entity?: CartIoEntity, format?: CartIoFormat, isTemplate?: boolean, mapping?: object, name?: string, options?: object): Promise<Models.IoProfile>;
|
|
284
584
|
cartsIoProfilesUpdate(
|
|
285
|
-
paramsOrFirst: { id: string } | string
|
|
585
|
+
paramsOrFirst: { id: string, applyMode?: CartIoApplyMode, direction?: CartIoDirection, entity?: CartIoEntity, format?: CartIoFormat, isTemplate?: boolean, mapping?: object, name?: string, options?: object } | string,
|
|
586
|
+
...rest: [(CartIoApplyMode)?, (CartIoDirection)?, (CartIoEntity)?, (CartIoFormat)?, (boolean)?, (object)?, (string)?, (object)?]
|
|
286
587
|
): Promise<Models.IoProfile> {
|
|
287
|
-
let params: { id: string };
|
|
588
|
+
let params: { id: string, applyMode?: CartIoApplyMode, direction?: CartIoDirection, entity?: CartIoEntity, format?: CartIoFormat, isTemplate?: boolean, mapping?: object, name?: string, options?: object };
|
|
288
589
|
|
|
289
590
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
290
|
-
params = (paramsOrFirst || {}) as { id: string };
|
|
591
|
+
params = (paramsOrFirst || {}) as { id: string, applyMode?: CartIoApplyMode, direction?: CartIoDirection, entity?: CartIoEntity, format?: CartIoFormat, isTemplate?: boolean, mapping?: object, name?: string, options?: object };
|
|
291
592
|
} else {
|
|
292
593
|
params = {
|
|
293
|
-
id: paramsOrFirst as string
|
|
594
|
+
id: paramsOrFirst as string,
|
|
595
|
+
applyMode: rest[0] as CartIoApplyMode,
|
|
596
|
+
direction: rest[1] as CartIoDirection,
|
|
597
|
+
entity: rest[2] as CartIoEntity,
|
|
598
|
+
format: rest[3] as CartIoFormat,
|
|
599
|
+
isTemplate: rest[4] as boolean,
|
|
600
|
+
mapping: rest[5] as object,
|
|
601
|
+
name: rest[6] as string,
|
|
602
|
+
options: rest[7] as object
|
|
294
603
|
};
|
|
295
604
|
}
|
|
296
605
|
|
|
297
606
|
const id = params.id;
|
|
607
|
+
const applyMode = params.applyMode;
|
|
608
|
+
const direction = params.direction;
|
|
609
|
+
const entity = params.entity;
|
|
610
|
+
const format = params.format;
|
|
611
|
+
const isTemplate = params.isTemplate;
|
|
612
|
+
const mapping = params.mapping;
|
|
613
|
+
const name = params.name;
|
|
614
|
+
const options = params.options;
|
|
298
615
|
|
|
299
616
|
if (typeof id === 'undefined') {
|
|
300
617
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
301
618
|
}
|
|
302
619
|
|
|
303
620
|
const apiPath = '/v1/carts/io/profiles/{id}'.replace('{id}', id);
|
|
304
|
-
const
|
|
621
|
+
const apiPayload: Payload = {};
|
|
622
|
+
if (typeof applyMode !== 'undefined') {
|
|
623
|
+
apiPayload['apply_mode'] = applyMode;
|
|
624
|
+
}
|
|
625
|
+
if (typeof direction !== 'undefined') {
|
|
626
|
+
apiPayload['direction'] = direction;
|
|
627
|
+
}
|
|
628
|
+
if (typeof entity !== 'undefined') {
|
|
629
|
+
apiPayload['entity'] = entity;
|
|
630
|
+
}
|
|
631
|
+
if (typeof format !== 'undefined') {
|
|
632
|
+
apiPayload['format'] = format;
|
|
633
|
+
}
|
|
634
|
+
if (typeof isTemplate !== 'undefined') {
|
|
635
|
+
apiPayload['is_template'] = isTemplate;
|
|
636
|
+
}
|
|
637
|
+
if (typeof mapping !== 'undefined') {
|
|
638
|
+
apiPayload['mapping'] = mapping;
|
|
639
|
+
}
|
|
640
|
+
if (typeof name !== 'undefined') {
|
|
641
|
+
apiPayload['name'] = name;
|
|
642
|
+
}
|
|
643
|
+
if (typeof options !== 'undefined') {
|
|
644
|
+
apiPayload['options'] = options;
|
|
645
|
+
}
|
|
305
646
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
306
647
|
|
|
307
648
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -312,19 +653,60 @@ export class Carts {
|
|
|
312
653
|
'put',
|
|
313
654
|
uri,
|
|
314
655
|
apiHeaders,
|
|
315
|
-
|
|
656
|
+
apiPayload
|
|
316
657
|
);
|
|
317
658
|
}
|
|
318
659
|
|
|
319
660
|
/**
|
|
320
661
|
*
|
|
662
|
+
* @param {string} params.sourceCartId - Cart whose lines move into the target (becomes status merged).
|
|
663
|
+
* @param {string} params.targetCartId - Receiving cart (must be active).
|
|
321
664
|
* @throws {RevenexxException}
|
|
322
665
|
* @returns {Promise<{}>}
|
|
323
666
|
*/
|
|
324
|
-
cartsMerge(): Promise<{}
|
|
667
|
+
cartsMerge(params: { sourceCartId: string, targetCartId: string }): Promise<{}>;
|
|
668
|
+
/**
|
|
669
|
+
*
|
|
670
|
+
* @param {string} sourceCartId - Cart whose lines move into the target (becomes status merged).
|
|
671
|
+
* @param {string} targetCartId - Receiving cart (must be active).
|
|
672
|
+
* @throws {RevenexxException}
|
|
673
|
+
* @returns {Promise<{}>}
|
|
674
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
675
|
+
*/
|
|
676
|
+
cartsMerge(sourceCartId: string, targetCartId: string): Promise<{}>;
|
|
677
|
+
cartsMerge(
|
|
678
|
+
paramsOrFirst: { sourceCartId: string, targetCartId: string } | string,
|
|
679
|
+
...rest: [(string)?]
|
|
680
|
+
): Promise<{}> {
|
|
681
|
+
let params: { sourceCartId: string, targetCartId: string };
|
|
682
|
+
|
|
683
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
684
|
+
params = (paramsOrFirst || {}) as { sourceCartId: string, targetCartId: string };
|
|
685
|
+
} else {
|
|
686
|
+
params = {
|
|
687
|
+
sourceCartId: paramsOrFirst as string,
|
|
688
|
+
targetCartId: rest[0] as string
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
const sourceCartId = params.sourceCartId;
|
|
693
|
+
const targetCartId = params.targetCartId;
|
|
694
|
+
|
|
695
|
+
if (typeof sourceCartId === 'undefined') {
|
|
696
|
+
throw new RevenexxException('Missing required parameter: "sourceCartId"');
|
|
697
|
+
}
|
|
698
|
+
if (typeof targetCartId === 'undefined') {
|
|
699
|
+
throw new RevenexxException('Missing required parameter: "targetCartId"');
|
|
700
|
+
}
|
|
325
701
|
|
|
326
702
|
const apiPath = '/v1/carts/merge';
|
|
327
|
-
const
|
|
703
|
+
const apiPayload: Payload = {};
|
|
704
|
+
if (typeof sourceCartId !== 'undefined') {
|
|
705
|
+
apiPayload['source_cart_id'] = sourceCartId;
|
|
706
|
+
}
|
|
707
|
+
if (typeof targetCartId !== 'undefined') {
|
|
708
|
+
apiPayload['target_cart_id'] = targetCartId;
|
|
709
|
+
}
|
|
328
710
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
329
711
|
|
|
330
712
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -335,7 +717,7 @@ export class Carts {
|
|
|
335
717
|
'post',
|
|
336
718
|
uri,
|
|
337
719
|
apiHeaders,
|
|
338
|
-
|
|
720
|
+
apiPayload
|
|
339
721
|
);
|
|
340
722
|
}
|
|
341
723
|
|
|
@@ -373,8 +755,8 @@ export class Carts {
|
|
|
373
755
|
throw new RevenexxException('Missing required parameter: "cartId"');
|
|
374
756
|
}
|
|
375
757
|
|
|
376
|
-
const apiPath = '/v1/carts/{cart_id}/items'.replace('{
|
|
377
|
-
const
|
|
758
|
+
const apiPath = '/v1/carts/{cart_id}/items'.replace('{cart_id}', cartId);
|
|
759
|
+
const apiPayload: Payload = {};
|
|
378
760
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
379
761
|
|
|
380
762
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -384,46 +766,138 @@ export class Carts {
|
|
|
384
766
|
'get',
|
|
385
767
|
uri,
|
|
386
768
|
apiHeaders,
|
|
387
|
-
|
|
769
|
+
apiPayload
|
|
388
770
|
);
|
|
389
771
|
}
|
|
390
772
|
|
|
391
773
|
/**
|
|
392
774
|
*
|
|
393
775
|
* @param {string} params.cartId -
|
|
776
|
+
* @param {object} params.configuration - Free-form configuration — configured lines never merge.
|
|
777
|
+
* @param {string} params.currency - Defaults to the cart's currency.
|
|
778
|
+
* @param {object} params.metadata - Free-form metadata.
|
|
779
|
+
* @param {string} params.name - Falls back to 'sku' when omitted.
|
|
780
|
+
* @param {number} params.position -
|
|
781
|
+
* @param {string} params.productId -
|
|
782
|
+
* @param {number} params.quantity - Default 1.
|
|
783
|
+
* @param {string} params.sku -
|
|
784
|
+
* @param {object} params.snapshot - Loose product snapshot at add-time (price, name, image, …).
|
|
785
|
+
* @param {number} params.taxRate -
|
|
786
|
+
* @param {CartItemType} params.type - Line type (default 'product'). Plain product lines merge by product+price; configurations always stand alone.
|
|
787
|
+
* @param {string} params.unit -
|
|
788
|
+
* @param {number} params.unitPrice - Per-unit net price — line_total is always derived.
|
|
394
789
|
* @throws {RevenexxException}
|
|
395
790
|
* @returns {Promise<Models.CartItem>}
|
|
396
791
|
*/
|
|
397
|
-
cartsItemsCreate(params: { cartId: string }): Promise<Models.CartItem>;
|
|
792
|
+
cartsItemsCreate(params: { cartId: string, configuration?: object, currency?: string, metadata?: object, name?: string, position?: number, productId?: string, quantity?: number, sku?: string, snapshot?: object, taxRate?: number, type?: CartItemType, unit?: string, unitPrice?: number }): Promise<Models.CartItem>;
|
|
398
793
|
/**
|
|
399
794
|
*
|
|
400
795
|
* @param {string} cartId -
|
|
796
|
+
* @param {object} configuration - Free-form configuration — configured lines never merge.
|
|
797
|
+
* @param {string} currency - Defaults to the cart's currency.
|
|
798
|
+
* @param {object} metadata - Free-form metadata.
|
|
799
|
+
* @param {string} name - Falls back to 'sku' when omitted.
|
|
800
|
+
* @param {number} position -
|
|
801
|
+
* @param {string} productId -
|
|
802
|
+
* @param {number} quantity - Default 1.
|
|
803
|
+
* @param {string} sku -
|
|
804
|
+
* @param {object} snapshot - Loose product snapshot at add-time (price, name, image, …).
|
|
805
|
+
* @param {number} taxRate -
|
|
806
|
+
* @param {CartItemType} type - Line type (default 'product'). Plain product lines merge by product+price; configurations always stand alone.
|
|
807
|
+
* @param {string} unit -
|
|
808
|
+
* @param {number} unitPrice - Per-unit net price — line_total is always derived.
|
|
401
809
|
* @throws {RevenexxException}
|
|
402
810
|
* @returns {Promise<Models.CartItem>}
|
|
403
811
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
404
812
|
*/
|
|
405
|
-
cartsItemsCreate(cartId: string): Promise<Models.CartItem>;
|
|
813
|
+
cartsItemsCreate(cartId: string, configuration?: object, currency?: string, metadata?: object, name?: string, position?: number, productId?: string, quantity?: number, sku?: string, snapshot?: object, taxRate?: number, type?: CartItemType, unit?: string, unitPrice?: number): Promise<Models.CartItem>;
|
|
406
814
|
cartsItemsCreate(
|
|
407
|
-
paramsOrFirst: { cartId: string } | string
|
|
815
|
+
paramsOrFirst: { cartId: string, configuration?: object, currency?: string, metadata?: object, name?: string, position?: number, productId?: string, quantity?: number, sku?: string, snapshot?: object, taxRate?: number, type?: CartItemType, unit?: string, unitPrice?: number } | string,
|
|
816
|
+
...rest: [(object)?, (string)?, (object)?, (string)?, (number)?, (string)?, (number)?, (string)?, (object)?, (number)?, (CartItemType)?, (string)?, (number)?]
|
|
408
817
|
): Promise<Models.CartItem> {
|
|
409
|
-
let params: { cartId: string };
|
|
818
|
+
let params: { cartId: string, configuration?: object, currency?: string, metadata?: object, name?: string, position?: number, productId?: string, quantity?: number, sku?: string, snapshot?: object, taxRate?: number, type?: CartItemType, unit?: string, unitPrice?: number };
|
|
410
819
|
|
|
411
820
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
412
|
-
params = (paramsOrFirst || {}) as { cartId: string };
|
|
821
|
+
params = (paramsOrFirst || {}) as { cartId: string, configuration?: object, currency?: string, metadata?: object, name?: string, position?: number, productId?: string, quantity?: number, sku?: string, snapshot?: object, taxRate?: number, type?: CartItemType, unit?: string, unitPrice?: number };
|
|
413
822
|
} else {
|
|
414
823
|
params = {
|
|
415
|
-
cartId: paramsOrFirst as string
|
|
824
|
+
cartId: paramsOrFirst as string,
|
|
825
|
+
configuration: rest[0] as object,
|
|
826
|
+
currency: rest[1] as string,
|
|
827
|
+
metadata: rest[2] as object,
|
|
828
|
+
name: rest[3] as string,
|
|
829
|
+
position: rest[4] as number,
|
|
830
|
+
productId: rest[5] as string,
|
|
831
|
+
quantity: rest[6] as number,
|
|
832
|
+
sku: rest[7] as string,
|
|
833
|
+
snapshot: rest[8] as object,
|
|
834
|
+
taxRate: rest[9] as number,
|
|
835
|
+
type: rest[10] as CartItemType,
|
|
836
|
+
unit: rest[11] as string,
|
|
837
|
+
unitPrice: rest[12] as number
|
|
416
838
|
};
|
|
417
839
|
}
|
|
418
840
|
|
|
419
841
|
const cartId = params.cartId;
|
|
842
|
+
const configuration = params.configuration;
|
|
843
|
+
const currency = params.currency;
|
|
844
|
+
const metadata = params.metadata;
|
|
845
|
+
const name = params.name;
|
|
846
|
+
const position = params.position;
|
|
847
|
+
const productId = params.productId;
|
|
848
|
+
const quantity = params.quantity;
|
|
849
|
+
const sku = params.sku;
|
|
850
|
+
const snapshot = params.snapshot;
|
|
851
|
+
const taxRate = params.taxRate;
|
|
852
|
+
const type = params.type;
|
|
853
|
+
const unit = params.unit;
|
|
854
|
+
const unitPrice = params.unitPrice;
|
|
420
855
|
|
|
421
856
|
if (typeof cartId === 'undefined') {
|
|
422
857
|
throw new RevenexxException('Missing required parameter: "cartId"');
|
|
423
858
|
}
|
|
424
859
|
|
|
425
|
-
const apiPath = '/v1/carts/{cart_id}/items'.replace('{
|
|
426
|
-
const
|
|
860
|
+
const apiPath = '/v1/carts/{cart_id}/items'.replace('{cart_id}', cartId);
|
|
861
|
+
const apiPayload: Payload = {};
|
|
862
|
+
if (typeof configuration !== 'undefined') {
|
|
863
|
+
apiPayload['configuration'] = configuration;
|
|
864
|
+
}
|
|
865
|
+
if (typeof currency !== 'undefined') {
|
|
866
|
+
apiPayload['currency'] = currency;
|
|
867
|
+
}
|
|
868
|
+
if (typeof metadata !== 'undefined') {
|
|
869
|
+
apiPayload['metadata'] = metadata;
|
|
870
|
+
}
|
|
871
|
+
if (typeof name !== 'undefined') {
|
|
872
|
+
apiPayload['name'] = name;
|
|
873
|
+
}
|
|
874
|
+
if (typeof position !== 'undefined') {
|
|
875
|
+
apiPayload['position'] = position;
|
|
876
|
+
}
|
|
877
|
+
if (typeof productId !== 'undefined') {
|
|
878
|
+
apiPayload['product_id'] = productId;
|
|
879
|
+
}
|
|
880
|
+
if (typeof quantity !== 'undefined') {
|
|
881
|
+
apiPayload['quantity'] = quantity;
|
|
882
|
+
}
|
|
883
|
+
if (typeof sku !== 'undefined') {
|
|
884
|
+
apiPayload['sku'] = sku;
|
|
885
|
+
}
|
|
886
|
+
if (typeof snapshot !== 'undefined') {
|
|
887
|
+
apiPayload['snapshot'] = snapshot;
|
|
888
|
+
}
|
|
889
|
+
if (typeof taxRate !== 'undefined') {
|
|
890
|
+
apiPayload['tax_rate'] = taxRate;
|
|
891
|
+
}
|
|
892
|
+
if (typeof type !== 'undefined') {
|
|
893
|
+
apiPayload['type'] = type;
|
|
894
|
+
}
|
|
895
|
+
if (typeof unit !== 'undefined') {
|
|
896
|
+
apiPayload['unit'] = unit;
|
|
897
|
+
}
|
|
898
|
+
if (typeof unitPrice !== 'undefined') {
|
|
899
|
+
apiPayload['unit_price'] = unitPrice;
|
|
900
|
+
}
|
|
427
901
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
428
902
|
|
|
429
903
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -434,46 +908,57 @@ export class Carts {
|
|
|
434
908
|
'post',
|
|
435
909
|
uri,
|
|
436
910
|
apiHeaders,
|
|
437
|
-
|
|
911
|
+
apiPayload
|
|
438
912
|
);
|
|
439
913
|
}
|
|
440
914
|
|
|
441
915
|
/**
|
|
442
916
|
*
|
|
443
917
|
* @param {string} params.cartId -
|
|
918
|
+
* @param {Models.CartItemCreateRequest[]} params.items - The complete new item set (set semantics).
|
|
444
919
|
* @throws {RevenexxException}
|
|
445
920
|
* @returns {Promise<{}>}
|
|
446
921
|
*/
|
|
447
|
-
cartsItemsReplace(params: { cartId: string }): Promise<{}>;
|
|
922
|
+
cartsItemsReplace(params: { cartId: string, items: Models.CartItemCreateRequest[] }): Promise<{}>;
|
|
448
923
|
/**
|
|
449
924
|
*
|
|
450
925
|
* @param {string} cartId -
|
|
926
|
+
* @param {Models.CartItemCreateRequest[]} items - The complete new item set (set semantics).
|
|
451
927
|
* @throws {RevenexxException}
|
|
452
928
|
* @returns {Promise<{}>}
|
|
453
929
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
454
930
|
*/
|
|
455
|
-
cartsItemsReplace(cartId: string): Promise<{}>;
|
|
931
|
+
cartsItemsReplace(cartId: string, items: Models.CartItemCreateRequest[]): Promise<{}>;
|
|
456
932
|
cartsItemsReplace(
|
|
457
|
-
paramsOrFirst: { cartId: string } | string
|
|
933
|
+
paramsOrFirst: { cartId: string, items: Models.CartItemCreateRequest[] } | string,
|
|
934
|
+
...rest: [(Models.CartItemCreateRequest[])?]
|
|
458
935
|
): Promise<{}> {
|
|
459
|
-
let params: { cartId: string };
|
|
936
|
+
let params: { cartId: string, items: Models.CartItemCreateRequest[] };
|
|
460
937
|
|
|
461
938
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
462
|
-
params = (paramsOrFirst || {}) as { cartId: string };
|
|
939
|
+
params = (paramsOrFirst || {}) as { cartId: string, items: Models.CartItemCreateRequest[] };
|
|
463
940
|
} else {
|
|
464
941
|
params = {
|
|
465
|
-
cartId: paramsOrFirst as string
|
|
942
|
+
cartId: paramsOrFirst as string,
|
|
943
|
+
items: rest[0] as Models.CartItemCreateRequest[]
|
|
466
944
|
};
|
|
467
945
|
}
|
|
468
946
|
|
|
469
947
|
const cartId = params.cartId;
|
|
948
|
+
const items = params.items;
|
|
470
949
|
|
|
471
950
|
if (typeof cartId === 'undefined') {
|
|
472
951
|
throw new RevenexxException('Missing required parameter: "cartId"');
|
|
473
952
|
}
|
|
953
|
+
if (typeof items === 'undefined') {
|
|
954
|
+
throw new RevenexxException('Missing required parameter: "items"');
|
|
955
|
+
}
|
|
474
956
|
|
|
475
|
-
const apiPath = '/v1/carts/{cart_id}/items'.replace('{
|
|
476
|
-
const
|
|
957
|
+
const apiPath = '/v1/carts/{cart_id}/items'.replace('{cart_id}', cartId);
|
|
958
|
+
const apiPayload: Payload = {};
|
|
959
|
+
if (typeof items !== 'undefined') {
|
|
960
|
+
apiPayload['items'] = items;
|
|
961
|
+
}
|
|
477
962
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
478
963
|
|
|
479
964
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -484,7 +969,7 @@ export class Carts {
|
|
|
484
969
|
'put',
|
|
485
970
|
uri,
|
|
486
971
|
apiHeaders,
|
|
487
|
-
|
|
972
|
+
apiPayload
|
|
488
973
|
);
|
|
489
974
|
}
|
|
490
975
|
|
|
@@ -530,8 +1015,8 @@ export class Carts {
|
|
|
530
1015
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
531
1016
|
}
|
|
532
1017
|
|
|
533
|
-
const apiPath = '/v1/carts/{cart_id}/items/{id}'.replace('{
|
|
534
|
-
const
|
|
1018
|
+
const apiPath = '/v1/carts/{cart_id}/items/{id}'.replace('{cart_id}', cartId).replace('{id}', id);
|
|
1019
|
+
const apiPayload: Payload = {};
|
|
535
1020
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
536
1021
|
|
|
537
1022
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -541,7 +1026,7 @@ export class Carts {
|
|
|
541
1026
|
'delete',
|
|
542
1027
|
uri,
|
|
543
1028
|
apiHeaders,
|
|
544
|
-
|
|
1029
|
+
apiPayload
|
|
545
1030
|
);
|
|
546
1031
|
}
|
|
547
1032
|
|
|
@@ -587,8 +1072,8 @@ export class Carts {
|
|
|
587
1072
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
588
1073
|
}
|
|
589
1074
|
|
|
590
|
-
const apiPath = '/v1/carts/{cart_id}/items/{id}'.replace('{
|
|
591
|
-
const
|
|
1075
|
+
const apiPath = '/v1/carts/{cart_id}/items/{id}'.replace('{cart_id}', cartId).replace('{id}', id);
|
|
1076
|
+
const apiPayload: Payload = {};
|
|
592
1077
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
593
1078
|
|
|
594
1079
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -598,7 +1083,7 @@ export class Carts {
|
|
|
598
1083
|
'get',
|
|
599
1084
|
uri,
|
|
600
1085
|
apiHeaders,
|
|
601
|
-
|
|
1086
|
+
apiPayload
|
|
602
1087
|
);
|
|
603
1088
|
}
|
|
604
1089
|
|
|
@@ -606,36 +1091,88 @@ export class Carts {
|
|
|
606
1091
|
*
|
|
607
1092
|
* @param {string} params.cartId -
|
|
608
1093
|
* @param {string} params.id -
|
|
1094
|
+
* @param {object} params.configuration - Free-form configuration — configured lines never merge.
|
|
1095
|
+
* @param {string} params.currency - Defaults to the cart's currency.
|
|
1096
|
+
* @param {object} params.metadata - Free-form metadata.
|
|
1097
|
+
* @param {string} params.name - Falls back to 'sku' when omitted.
|
|
1098
|
+
* @param {number} params.position -
|
|
1099
|
+
* @param {string} params.productId -
|
|
1100
|
+
* @param {number} params.quantity - Default 1.
|
|
1101
|
+
* @param {string} params.sku -
|
|
1102
|
+
* @param {object} params.snapshot - Loose product snapshot at add-time (price, name, image, …).
|
|
1103
|
+
* @param {number} params.taxRate -
|
|
1104
|
+
* @param {CartItemType} params.type - Line type (default 'product'). Plain product lines merge by product+price; configurations always stand alone.
|
|
1105
|
+
* @param {string} params.unit -
|
|
1106
|
+
* @param {number} params.unitPrice - Per-unit net price — line_total is always derived.
|
|
609
1107
|
* @throws {RevenexxException}
|
|
610
1108
|
* @returns {Promise<Models.CartItem>}
|
|
611
1109
|
*/
|
|
612
|
-
cartsItemsUpdate(params: { cartId: string, id: string }): Promise<Models.CartItem>;
|
|
1110
|
+
cartsItemsUpdate(params: { cartId: string, id: string, configuration?: object, currency?: string, metadata?: object, name?: string, position?: number, productId?: string, quantity?: number, sku?: string, snapshot?: object, taxRate?: number, type?: CartItemType, unit?: string, unitPrice?: number }): Promise<Models.CartItem>;
|
|
613
1111
|
/**
|
|
614
1112
|
*
|
|
615
1113
|
* @param {string} cartId -
|
|
616
1114
|
* @param {string} id -
|
|
1115
|
+
* @param {object} configuration - Free-form configuration — configured lines never merge.
|
|
1116
|
+
* @param {string} currency - Defaults to the cart's currency.
|
|
1117
|
+
* @param {object} metadata - Free-form metadata.
|
|
1118
|
+
* @param {string} name - Falls back to 'sku' when omitted.
|
|
1119
|
+
* @param {number} position -
|
|
1120
|
+
* @param {string} productId -
|
|
1121
|
+
* @param {number} quantity - Default 1.
|
|
1122
|
+
* @param {string} sku -
|
|
1123
|
+
* @param {object} snapshot - Loose product snapshot at add-time (price, name, image, …).
|
|
1124
|
+
* @param {number} taxRate -
|
|
1125
|
+
* @param {CartItemType} type - Line type (default 'product'). Plain product lines merge by product+price; configurations always stand alone.
|
|
1126
|
+
* @param {string} unit -
|
|
1127
|
+
* @param {number} unitPrice - Per-unit net price — line_total is always derived.
|
|
617
1128
|
* @throws {RevenexxException}
|
|
618
1129
|
* @returns {Promise<Models.CartItem>}
|
|
619
1130
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
620
1131
|
*/
|
|
621
|
-
cartsItemsUpdate(cartId: string, id: string): Promise<Models.CartItem>;
|
|
1132
|
+
cartsItemsUpdate(cartId: string, id: string, configuration?: object, currency?: string, metadata?: object, name?: string, position?: number, productId?: string, quantity?: number, sku?: string, snapshot?: object, taxRate?: number, type?: CartItemType, unit?: string, unitPrice?: number): Promise<Models.CartItem>;
|
|
622
1133
|
cartsItemsUpdate(
|
|
623
|
-
paramsOrFirst: { cartId: string, id: string } | string,
|
|
624
|
-
...rest: [(string)?]
|
|
1134
|
+
paramsOrFirst: { cartId: string, id: string, configuration?: object, currency?: string, metadata?: object, name?: string, position?: number, productId?: string, quantity?: number, sku?: string, snapshot?: object, taxRate?: number, type?: CartItemType, unit?: string, unitPrice?: number } | string,
|
|
1135
|
+
...rest: [(string)?, (object)?, (string)?, (object)?, (string)?, (number)?, (string)?, (number)?, (string)?, (object)?, (number)?, (CartItemType)?, (string)?, (number)?]
|
|
625
1136
|
): Promise<Models.CartItem> {
|
|
626
|
-
let params: { cartId: string, id: string };
|
|
1137
|
+
let params: { cartId: string, id: string, configuration?: object, currency?: string, metadata?: object, name?: string, position?: number, productId?: string, quantity?: number, sku?: string, snapshot?: object, taxRate?: number, type?: CartItemType, unit?: string, unitPrice?: number };
|
|
627
1138
|
|
|
628
1139
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
629
|
-
params = (paramsOrFirst || {}) as { cartId: string, id: string };
|
|
1140
|
+
params = (paramsOrFirst || {}) as { cartId: string, id: string, configuration?: object, currency?: string, metadata?: object, name?: string, position?: number, productId?: string, quantity?: number, sku?: string, snapshot?: object, taxRate?: number, type?: CartItemType, unit?: string, unitPrice?: number };
|
|
630
1141
|
} else {
|
|
631
1142
|
params = {
|
|
632
1143
|
cartId: paramsOrFirst as string,
|
|
633
|
-
id: rest[0] as string
|
|
1144
|
+
id: rest[0] as string,
|
|
1145
|
+
configuration: rest[1] as object,
|
|
1146
|
+
currency: rest[2] as string,
|
|
1147
|
+
metadata: rest[3] as object,
|
|
1148
|
+
name: rest[4] as string,
|
|
1149
|
+
position: rest[5] as number,
|
|
1150
|
+
productId: rest[6] as string,
|
|
1151
|
+
quantity: rest[7] as number,
|
|
1152
|
+
sku: rest[8] as string,
|
|
1153
|
+
snapshot: rest[9] as object,
|
|
1154
|
+
taxRate: rest[10] as number,
|
|
1155
|
+
type: rest[11] as CartItemType,
|
|
1156
|
+
unit: rest[12] as string,
|
|
1157
|
+
unitPrice: rest[13] as number
|
|
634
1158
|
};
|
|
635
1159
|
}
|
|
636
1160
|
|
|
637
1161
|
const cartId = params.cartId;
|
|
638
1162
|
const id = params.id;
|
|
1163
|
+
const configuration = params.configuration;
|
|
1164
|
+
const currency = params.currency;
|
|
1165
|
+
const metadata = params.metadata;
|
|
1166
|
+
const name = params.name;
|
|
1167
|
+
const position = params.position;
|
|
1168
|
+
const productId = params.productId;
|
|
1169
|
+
const quantity = params.quantity;
|
|
1170
|
+
const sku = params.sku;
|
|
1171
|
+
const snapshot = params.snapshot;
|
|
1172
|
+
const taxRate = params.taxRate;
|
|
1173
|
+
const type = params.type;
|
|
1174
|
+
const unit = params.unit;
|
|
1175
|
+
const unitPrice = params.unitPrice;
|
|
639
1176
|
|
|
640
1177
|
if (typeof cartId === 'undefined') {
|
|
641
1178
|
throw new RevenexxException('Missing required parameter: "cartId"');
|
|
@@ -644,8 +1181,47 @@ export class Carts {
|
|
|
644
1181
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
645
1182
|
}
|
|
646
1183
|
|
|
647
|
-
const apiPath = '/v1/carts/{cart_id}/items/{id}'.replace('{
|
|
648
|
-
const
|
|
1184
|
+
const apiPath = '/v1/carts/{cart_id}/items/{id}'.replace('{cart_id}', cartId).replace('{id}', id);
|
|
1185
|
+
const apiPayload: Payload = {};
|
|
1186
|
+
if (typeof configuration !== 'undefined') {
|
|
1187
|
+
apiPayload['configuration'] = configuration;
|
|
1188
|
+
}
|
|
1189
|
+
if (typeof currency !== 'undefined') {
|
|
1190
|
+
apiPayload['currency'] = currency;
|
|
1191
|
+
}
|
|
1192
|
+
if (typeof metadata !== 'undefined') {
|
|
1193
|
+
apiPayload['metadata'] = metadata;
|
|
1194
|
+
}
|
|
1195
|
+
if (typeof name !== 'undefined') {
|
|
1196
|
+
apiPayload['name'] = name;
|
|
1197
|
+
}
|
|
1198
|
+
if (typeof position !== 'undefined') {
|
|
1199
|
+
apiPayload['position'] = position;
|
|
1200
|
+
}
|
|
1201
|
+
if (typeof productId !== 'undefined') {
|
|
1202
|
+
apiPayload['product_id'] = productId;
|
|
1203
|
+
}
|
|
1204
|
+
if (typeof quantity !== 'undefined') {
|
|
1205
|
+
apiPayload['quantity'] = quantity;
|
|
1206
|
+
}
|
|
1207
|
+
if (typeof sku !== 'undefined') {
|
|
1208
|
+
apiPayload['sku'] = sku;
|
|
1209
|
+
}
|
|
1210
|
+
if (typeof snapshot !== 'undefined') {
|
|
1211
|
+
apiPayload['snapshot'] = snapshot;
|
|
1212
|
+
}
|
|
1213
|
+
if (typeof taxRate !== 'undefined') {
|
|
1214
|
+
apiPayload['tax_rate'] = taxRate;
|
|
1215
|
+
}
|
|
1216
|
+
if (typeof type !== 'undefined') {
|
|
1217
|
+
apiPayload['type'] = type;
|
|
1218
|
+
}
|
|
1219
|
+
if (typeof unit !== 'undefined') {
|
|
1220
|
+
apiPayload['unit'] = unit;
|
|
1221
|
+
}
|
|
1222
|
+
if (typeof unitPrice !== 'undefined') {
|
|
1223
|
+
apiPayload['unit_price'] = unitPrice;
|
|
1224
|
+
}
|
|
649
1225
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
650
1226
|
|
|
651
1227
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -656,7 +1232,7 @@ export class Carts {
|
|
|
656
1232
|
'put',
|
|
657
1233
|
uri,
|
|
658
1234
|
apiHeaders,
|
|
659
|
-
|
|
1235
|
+
apiPayload
|
|
660
1236
|
);
|
|
661
1237
|
}
|
|
662
1238
|
|
|
@@ -695,7 +1271,7 @@ export class Carts {
|
|
|
695
1271
|
}
|
|
696
1272
|
|
|
697
1273
|
const apiPath = '/v1/carts/{id}'.replace('{id}', id);
|
|
698
|
-
const
|
|
1274
|
+
const apiPayload: Payload = {};
|
|
699
1275
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
700
1276
|
|
|
701
1277
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -705,7 +1281,7 @@ export class Carts {
|
|
|
705
1281
|
'delete',
|
|
706
1282
|
uri,
|
|
707
1283
|
apiHeaders,
|
|
708
|
-
|
|
1284
|
+
apiPayload
|
|
709
1285
|
);
|
|
710
1286
|
}
|
|
711
1287
|
|
|
@@ -744,7 +1320,7 @@ export class Carts {
|
|
|
744
1320
|
}
|
|
745
1321
|
|
|
746
1322
|
const apiPath = '/v1/carts/{id}'.replace('{id}', id);
|
|
747
|
-
const
|
|
1323
|
+
const apiPayload: Payload = {};
|
|
748
1324
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
749
1325
|
|
|
750
1326
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -754,46 +1330,82 @@ export class Carts {
|
|
|
754
1330
|
'get',
|
|
755
1331
|
uri,
|
|
756
1332
|
apiHeaders,
|
|
757
|
-
|
|
1333
|
+
apiPayload
|
|
758
1334
|
);
|
|
759
1335
|
}
|
|
760
1336
|
|
|
761
1337
|
/**
|
|
762
1338
|
*
|
|
763
1339
|
* @param {string} params.id -
|
|
1340
|
+
* @param {string} params.channelId -
|
|
1341
|
+
* @param {string} params.currency - ISO 4217 code.
|
|
1342
|
+
* @param {string} params.marketId -
|
|
1343
|
+
* @param {object} params.metadata - Free-form metadata.
|
|
1344
|
+
* @param {string} params.name -
|
|
764
1345
|
* @throws {RevenexxException}
|
|
765
1346
|
* @returns {Promise<Models.Cart>}
|
|
766
1347
|
*/
|
|
767
|
-
cartsUpdate(params: { id: string }): Promise<Models.Cart>;
|
|
1348
|
+
cartsUpdate(params: { id: string, channelId?: string, currency?: string, marketId?: string, metadata?: object, name?: string }): Promise<Models.Cart>;
|
|
768
1349
|
/**
|
|
769
1350
|
*
|
|
770
1351
|
* @param {string} id -
|
|
1352
|
+
* @param {string} channelId -
|
|
1353
|
+
* @param {string} currency - ISO 4217 code.
|
|
1354
|
+
* @param {string} marketId -
|
|
1355
|
+
* @param {object} metadata - Free-form metadata.
|
|
1356
|
+
* @param {string} name -
|
|
771
1357
|
* @throws {RevenexxException}
|
|
772
1358
|
* @returns {Promise<Models.Cart>}
|
|
773
1359
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
774
1360
|
*/
|
|
775
|
-
cartsUpdate(id: string): Promise<Models.Cart>;
|
|
1361
|
+
cartsUpdate(id: string, channelId?: string, currency?: string, marketId?: string, metadata?: object, name?: string): Promise<Models.Cart>;
|
|
776
1362
|
cartsUpdate(
|
|
777
|
-
paramsOrFirst: { id: string } | string
|
|
1363
|
+
paramsOrFirst: { id: string, channelId?: string, currency?: string, marketId?: string, metadata?: object, name?: string } | string,
|
|
1364
|
+
...rest: [(string)?, (string)?, (string)?, (object)?, (string)?]
|
|
778
1365
|
): Promise<Models.Cart> {
|
|
779
|
-
let params: { id: string };
|
|
1366
|
+
let params: { id: string, channelId?: string, currency?: string, marketId?: string, metadata?: object, name?: string };
|
|
780
1367
|
|
|
781
1368
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
782
|
-
params = (paramsOrFirst || {}) as { id: string };
|
|
1369
|
+
params = (paramsOrFirst || {}) as { id: string, channelId?: string, currency?: string, marketId?: string, metadata?: object, name?: string };
|
|
783
1370
|
} else {
|
|
784
1371
|
params = {
|
|
785
|
-
id: paramsOrFirst as string
|
|
1372
|
+
id: paramsOrFirst as string,
|
|
1373
|
+
channelId: rest[0] as string,
|
|
1374
|
+
currency: rest[1] as string,
|
|
1375
|
+
marketId: rest[2] as string,
|
|
1376
|
+
metadata: rest[3] as object,
|
|
1377
|
+
name: rest[4] as string
|
|
786
1378
|
};
|
|
787
1379
|
}
|
|
788
1380
|
|
|
789
1381
|
const id = params.id;
|
|
1382
|
+
const channelId = params.channelId;
|
|
1383
|
+
const currency = params.currency;
|
|
1384
|
+
const marketId = params.marketId;
|
|
1385
|
+
const metadata = params.metadata;
|
|
1386
|
+
const name = params.name;
|
|
790
1387
|
|
|
791
1388
|
if (typeof id === 'undefined') {
|
|
792
1389
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
793
1390
|
}
|
|
794
1391
|
|
|
795
1392
|
const apiPath = '/v1/carts/{id}'.replace('{id}', id);
|
|
796
|
-
const
|
|
1393
|
+
const apiPayload: Payload = {};
|
|
1394
|
+
if (typeof channelId !== 'undefined') {
|
|
1395
|
+
apiPayload['channel_id'] = channelId;
|
|
1396
|
+
}
|
|
1397
|
+
if (typeof currency !== 'undefined') {
|
|
1398
|
+
apiPayload['currency'] = currency;
|
|
1399
|
+
}
|
|
1400
|
+
if (typeof marketId !== 'undefined') {
|
|
1401
|
+
apiPayload['market_id'] = marketId;
|
|
1402
|
+
}
|
|
1403
|
+
if (typeof metadata !== 'undefined') {
|
|
1404
|
+
apiPayload['metadata'] = metadata;
|
|
1405
|
+
}
|
|
1406
|
+
if (typeof name !== 'undefined') {
|
|
1407
|
+
apiPayload['name'] = name;
|
|
1408
|
+
}
|
|
797
1409
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
798
1410
|
|
|
799
1411
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -804,7 +1416,7 @@ export class Carts {
|
|
|
804
1416
|
'put',
|
|
805
1417
|
uri,
|
|
806
1418
|
apiHeaders,
|
|
807
|
-
|
|
1419
|
+
apiPayload
|
|
808
1420
|
);
|
|
809
1421
|
}
|
|
810
1422
|
|
|
@@ -843,7 +1455,7 @@ export class Carts {
|
|
|
843
1455
|
}
|
|
844
1456
|
|
|
845
1457
|
const apiPath = '/v1/carts/{id}/abandon'.replace('{id}', id);
|
|
846
|
-
const
|
|
1458
|
+
const apiPayload: Payload = {};
|
|
847
1459
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
848
1460
|
|
|
849
1461
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -853,7 +1465,7 @@ export class Carts {
|
|
|
853
1465
|
'post',
|
|
854
1466
|
uri,
|
|
855
1467
|
apiHeaders,
|
|
856
|
-
|
|
1468
|
+
apiPayload
|
|
857
1469
|
);
|
|
858
1470
|
}
|
|
859
1471
|
|
|
@@ -892,7 +1504,7 @@ export class Carts {
|
|
|
892
1504
|
}
|
|
893
1505
|
|
|
894
1506
|
const apiPath = '/v1/carts/{id}/activate'.replace('{id}', id);
|
|
895
|
-
const
|
|
1507
|
+
const apiPayload: Payload = {};
|
|
896
1508
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
897
1509
|
|
|
898
1510
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -902,46 +1514,61 @@ export class Carts {
|
|
|
902
1514
|
'post',
|
|
903
1515
|
uri,
|
|
904
1516
|
apiHeaders,
|
|
905
|
-
|
|
1517
|
+
apiPayload
|
|
906
1518
|
);
|
|
907
1519
|
}
|
|
908
1520
|
|
|
909
1521
|
/**
|
|
910
1522
|
*
|
|
911
1523
|
* @param {string} params.id -
|
|
1524
|
+
* @param {CartExportFormat} params.format - Ad-hoc export format (only without profile_id).
|
|
1525
|
+
* @param {string} params.profileId - Export profile to run; ad-hoc JSON/CSV export when omitted.
|
|
912
1526
|
* @throws {RevenexxException}
|
|
913
1527
|
* @returns {Promise<{}>}
|
|
914
1528
|
*/
|
|
915
|
-
cartsExport(params: { id: string }): Promise<{}>;
|
|
1529
|
+
cartsExport(params: { id: string, format?: CartExportFormat, profileId?: string }): Promise<{}>;
|
|
916
1530
|
/**
|
|
917
1531
|
*
|
|
918
1532
|
* @param {string} id -
|
|
1533
|
+
* @param {CartExportFormat} format - Ad-hoc export format (only without profile_id).
|
|
1534
|
+
* @param {string} profileId - Export profile to run; ad-hoc JSON/CSV export when omitted.
|
|
919
1535
|
* @throws {RevenexxException}
|
|
920
1536
|
* @returns {Promise<{}>}
|
|
921
1537
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
922
1538
|
*/
|
|
923
|
-
cartsExport(id: string): Promise<{}>;
|
|
1539
|
+
cartsExport(id: string, format?: CartExportFormat, profileId?: string): Promise<{}>;
|
|
924
1540
|
cartsExport(
|
|
925
|
-
paramsOrFirst: { id: string } | string
|
|
1541
|
+
paramsOrFirst: { id: string, format?: CartExportFormat, profileId?: string } | string,
|
|
1542
|
+
...rest: [(CartExportFormat)?, (string)?]
|
|
926
1543
|
): Promise<{}> {
|
|
927
|
-
let params: { id: string };
|
|
1544
|
+
let params: { id: string, format?: CartExportFormat, profileId?: string };
|
|
928
1545
|
|
|
929
1546
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
930
|
-
params = (paramsOrFirst || {}) as { id: string };
|
|
1547
|
+
params = (paramsOrFirst || {}) as { id: string, format?: CartExportFormat, profileId?: string };
|
|
931
1548
|
} else {
|
|
932
1549
|
params = {
|
|
933
|
-
id: paramsOrFirst as string
|
|
1550
|
+
id: paramsOrFirst as string,
|
|
1551
|
+
format: rest[0] as CartExportFormat,
|
|
1552
|
+
profileId: rest[1] as string
|
|
934
1553
|
};
|
|
935
1554
|
}
|
|
936
1555
|
|
|
937
1556
|
const id = params.id;
|
|
1557
|
+
const format = params.format;
|
|
1558
|
+
const profileId = params.profileId;
|
|
938
1559
|
|
|
939
1560
|
if (typeof id === 'undefined') {
|
|
940
1561
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
941
1562
|
}
|
|
942
1563
|
|
|
943
1564
|
const apiPath = '/v1/carts/{id}/export'.replace('{id}', id);
|
|
944
|
-
const
|
|
1565
|
+
const apiPayload: Payload = {};
|
|
1566
|
+
if (typeof format !== 'undefined') {
|
|
1567
|
+
apiPayload['format'] = format;
|
|
1568
|
+
}
|
|
1569
|
+
if (typeof profileId !== 'undefined') {
|
|
1570
|
+
apiPayload['profile_id'] = profileId;
|
|
1571
|
+
}
|
|
945
1572
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
946
1573
|
|
|
947
1574
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -952,46 +1579,54 @@ export class Carts {
|
|
|
952
1579
|
'post',
|
|
953
1580
|
uri,
|
|
954
1581
|
apiHeaders,
|
|
955
|
-
|
|
1582
|
+
apiPayload
|
|
956
1583
|
);
|
|
957
1584
|
}
|
|
958
1585
|
|
|
959
1586
|
/**
|
|
960
1587
|
*
|
|
961
1588
|
* @param {string} params.id -
|
|
1589
|
+
* @param {string} params.orderRef - External order reference from order management.
|
|
962
1590
|
* @throws {RevenexxException}
|
|
963
1591
|
* @returns {Promise<Models.Cart>}
|
|
964
1592
|
*/
|
|
965
|
-
cartsOrder(params: { id: string }): Promise<Models.Cart>;
|
|
1593
|
+
cartsOrder(params: { id: string, orderRef?: string }): Promise<Models.Cart>;
|
|
966
1594
|
/**
|
|
967
1595
|
*
|
|
968
1596
|
* @param {string} id -
|
|
1597
|
+
* @param {string} orderRef - External order reference from order management.
|
|
969
1598
|
* @throws {RevenexxException}
|
|
970
1599
|
* @returns {Promise<Models.Cart>}
|
|
971
1600
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
972
1601
|
*/
|
|
973
|
-
cartsOrder(id: string): Promise<Models.Cart>;
|
|
1602
|
+
cartsOrder(id: string, orderRef?: string): Promise<Models.Cart>;
|
|
974
1603
|
cartsOrder(
|
|
975
|
-
paramsOrFirst: { id: string } | string
|
|
1604
|
+
paramsOrFirst: { id: string, orderRef?: string } | string,
|
|
1605
|
+
...rest: [(string)?]
|
|
976
1606
|
): Promise<Models.Cart> {
|
|
977
|
-
let params: { id: string };
|
|
1607
|
+
let params: { id: string, orderRef?: string };
|
|
978
1608
|
|
|
979
1609
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
980
|
-
params = (paramsOrFirst || {}) as { id: string };
|
|
1610
|
+
params = (paramsOrFirst || {}) as { id: string, orderRef?: string };
|
|
981
1611
|
} else {
|
|
982
1612
|
params = {
|
|
983
|
-
id: paramsOrFirst as string
|
|
1613
|
+
id: paramsOrFirst as string,
|
|
1614
|
+
orderRef: rest[0] as string
|
|
984
1615
|
};
|
|
985
1616
|
}
|
|
986
1617
|
|
|
987
1618
|
const id = params.id;
|
|
1619
|
+
const orderRef = params.orderRef;
|
|
988
1620
|
|
|
989
1621
|
if (typeof id === 'undefined') {
|
|
990
1622
|
throw new RevenexxException('Missing required parameter: "id"');
|
|
991
1623
|
}
|
|
992
1624
|
|
|
993
1625
|
const apiPath = '/v1/carts/{id}/order'.replace('{id}', id);
|
|
994
|
-
const
|
|
1626
|
+
const apiPayload: Payload = {};
|
|
1627
|
+
if (typeof orderRef !== 'undefined') {
|
|
1628
|
+
apiPayload['order_ref'] = orderRef;
|
|
1629
|
+
}
|
|
995
1630
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
996
1631
|
|
|
997
1632
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -1002,7 +1637,7 @@ export class Carts {
|
|
|
1002
1637
|
'post',
|
|
1003
1638
|
uri,
|
|
1004
1639
|
apiHeaders,
|
|
1005
|
-
|
|
1640
|
+
apiPayload
|
|
1006
1641
|
);
|
|
1007
1642
|
}
|
|
1008
1643
|
|
|
@@ -1041,7 +1676,7 @@ export class Carts {
|
|
|
1041
1676
|
}
|
|
1042
1677
|
|
|
1043
1678
|
const apiPath = '/v1/carts/{id}/reopen'.replace('{id}', id);
|
|
1044
|
-
const
|
|
1679
|
+
const apiPayload: Payload = {};
|
|
1045
1680
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1046
1681
|
|
|
1047
1682
|
const apiHeaders: { [header: string]: string } = {
|
|
@@ -1051,7 +1686,7 @@ export class Carts {
|
|
|
1051
1686
|
'post',
|
|
1052
1687
|
uri,
|
|
1053
1688
|
apiHeaders,
|
|
1054
|
-
|
|
1689
|
+
apiPayload
|
|
1055
1690
|
);
|
|
1056
1691
|
}
|
|
1057
1692
|
}
|