@revenexx/sdk 0.0.2 → 0.0.5

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.
Files changed (90) hide show
  1. package/dist/cjs/sdk.js +13496 -3442
  2. package/dist/cjs/sdk.js.map +1 -1
  3. package/dist/esm/sdk.js +13467 -3443
  4. package/dist/esm/sdk.js.map +1 -1
  5. package/dist/iife/sdk.js +13496 -3442
  6. package/package.json +1 -1
  7. package/src/client.ts +1 -1
  8. package/src/enums/address-type.ts +4 -0
  9. package/src/enums/cart-export-format.ts +4 -0
  10. package/src/enums/cart-io-apply-mode.ts +5 -0
  11. package/src/enums/cart-io-direction.ts +4 -0
  12. package/src/enums/cart-io-entity.ts +4 -0
  13. package/src/enums/cart-io-format.ts +4 -0
  14. package/src/enums/cart-item-type.ts +5 -0
  15. package/src/enums/channel-status.ts +4 -0
  16. package/src/enums/channel-type.ts +7 -0
  17. package/src/enums/contact-role.ts +6 -0
  18. package/src/enums/contact-status.ts +5 -0
  19. package/src/enums/location-type.ts +6 -0
  20. package/src/enums/market-status.ts +4 -0
  21. package/src/enums/order-comment-visibility.ts +4 -0
  22. package/src/enums/order-item-type.ts +5 -0
  23. package/src/enums/order-payment-status.ts +9 -0
  24. package/src/enums/organization-status.ts +4 -0
  25. package/src/enums/page-status.ts +5 -0
  26. package/src/enums/payment-fee-type.ts +5 -0
  27. package/src/enums/payment-method-kind.ts +4 -0
  28. package/src/enums/price-entry-type.ts +4 -0
  29. package/src/enums/price-list-status.ts +4 -0
  30. package/src/enums/shipping-method-matrix-basis.ts +6 -0
  31. package/src/enums/shipping-method-pricing-type.ts +5 -0
  32. package/src/index.ts +30 -0
  33. package/src/models.ts +5628 -410
  34. package/src/services/apps.ts +154 -154
  35. package/src/services/avatars.ts +57 -57
  36. package/src/services/carts.ts +739 -104
  37. package/src/services/channels.ts +147 -19
  38. package/src/services/customers.ts +801 -69
  39. package/src/services/greetings.ts +18 -18
  40. package/src/services/inventories.ts +1278 -0
  41. package/src/services/locale.ts +16 -16
  42. package/src/services/markets.ts +373 -75
  43. package/src/services/messaging.ts +273 -273
  44. package/src/services/orders.ts +1648 -0
  45. package/src/services/pages.ts +2317 -0
  46. package/src/services/payments.ts +1334 -0
  47. package/src/services/prices.ts +1036 -0
  48. package/src/services/products.ts +1836 -272
  49. package/src/services/search.ts +24 -24
  50. package/src/services/shipping.ts +956 -0
  51. package/src/services/sites.ts +116 -116
  52. package/src/services/storage.ts +72 -72
  53. package/src/services/tokens.ts +14 -14
  54. package/types/enums/address-type.d.ts +4 -0
  55. package/types/enums/cart-export-format.d.ts +4 -0
  56. package/types/enums/cart-io-apply-mode.d.ts +5 -0
  57. package/types/enums/cart-io-direction.d.ts +4 -0
  58. package/types/enums/cart-io-entity.d.ts +4 -0
  59. package/types/enums/cart-io-format.d.ts +4 -0
  60. package/types/enums/cart-item-type.d.ts +5 -0
  61. package/types/enums/channel-status.d.ts +4 -0
  62. package/types/enums/channel-type.d.ts +7 -0
  63. package/types/enums/contact-role.d.ts +6 -0
  64. package/types/enums/contact-status.d.ts +5 -0
  65. package/types/enums/location-type.d.ts +6 -0
  66. package/types/enums/market-status.d.ts +4 -0
  67. package/types/enums/order-comment-visibility.d.ts +4 -0
  68. package/types/enums/order-item-type.d.ts +5 -0
  69. package/types/enums/order-payment-status.d.ts +9 -0
  70. package/types/enums/organization-status.d.ts +4 -0
  71. package/types/enums/page-status.d.ts +5 -0
  72. package/types/enums/payment-fee-type.d.ts +5 -0
  73. package/types/enums/payment-method-kind.d.ts +4 -0
  74. package/types/enums/price-entry-type.d.ts +4 -0
  75. package/types/enums/price-list-status.d.ts +4 -0
  76. package/types/enums/shipping-method-matrix-basis.d.ts +6 -0
  77. package/types/enums/shipping-method-pricing-type.d.ts +5 -0
  78. package/types/index.d.ts +30 -0
  79. package/types/models.d.ts +5470 -404
  80. package/types/services/carts.d.ts +271 -12
  81. package/types/services/channels.d.ts +54 -2
  82. package/types/services/customers.d.ts +295 -12
  83. package/types/services/inventories.d.ts +440 -0
  84. package/types/services/markets.d.ts +123 -6
  85. package/types/services/orders.d.ts +590 -0
  86. package/types/services/pages.d.ts +792 -0
  87. package/types/services/payments.d.ts +480 -0
  88. package/types/services/prices.d.ts +384 -0
  89. package/types/services/products.d.ts +646 -32
  90. package/types/services/shipping.d.ts +351 -0
@@ -0,0 +1,1278 @@
1
+ import { Service } from '../service';
2
+ import { RevenexxException, Client, type Payload, UploadProgress } from '../client';
3
+ import type { Models } from '../models';
4
+
5
+ import { LocationType } from '../enums/location-type';
6
+
7
+ export class Inventories {
8
+ client: Client;
9
+
10
+ constructor(client: Client) {
11
+ this.client = client;
12
+ }
13
+
14
+ /**
15
+ *
16
+ * @param {Models.InventoryAdjustItem[]} params.items - The corrections — quantities are SIGNED deltas (at most 200).
17
+ * @param {string} params.reason - Mandatory audit reason — every adjustment is a ledger row.
18
+ * @param {string} params.locationCode - Adjusted location (default 'main').
19
+ * @throws {RevenexxException}
20
+ * @returns {Promise<{}>}
21
+ */
22
+ inventoriesAdjust(params: { items: Models.InventoryAdjustItem[], reason: string, locationCode?: string }): Promise<{}>;
23
+ /**
24
+ *
25
+ * @param {Models.InventoryAdjustItem[]} items - The corrections — quantities are SIGNED deltas (at most 200).
26
+ * @param {string} reason - Mandatory audit reason — every adjustment is a ledger row.
27
+ * @param {string} locationCode - Adjusted location (default 'main').
28
+ * @throws {RevenexxException}
29
+ * @returns {Promise<{}>}
30
+ * @deprecated Use the object parameter style method for a better developer experience.
31
+ */
32
+ inventoriesAdjust(items: Models.InventoryAdjustItem[], reason: string, locationCode?: string): Promise<{}>;
33
+ inventoriesAdjust(
34
+ paramsOrFirst: { items: Models.InventoryAdjustItem[], reason: string, locationCode?: string } | Models.InventoryAdjustItem[],
35
+ ...rest: [(string)?, (string)?]
36
+ ): Promise<{}> {
37
+ let params: { items: Models.InventoryAdjustItem[], reason: string, locationCode?: string };
38
+
39
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('items' in paramsOrFirst || 'reason' in paramsOrFirst || 'locationCode' in paramsOrFirst))) {
40
+ params = (paramsOrFirst || {}) as { items: Models.InventoryAdjustItem[], reason: string, locationCode?: string };
41
+ } else {
42
+ params = {
43
+ items: paramsOrFirst as Models.InventoryAdjustItem[],
44
+ reason: rest[0] as string,
45
+ locationCode: rest[1] as string
46
+ };
47
+ }
48
+
49
+ const items = params.items;
50
+ const reason = params.reason;
51
+ const locationCode = params.locationCode;
52
+
53
+ if (typeof items === 'undefined') {
54
+ throw new RevenexxException('Missing required parameter: "items"');
55
+ }
56
+ if (typeof reason === 'undefined') {
57
+ throw new RevenexxException('Missing required parameter: "reason"');
58
+ }
59
+
60
+ const apiPath = '/v1/inventories/adjust';
61
+ const apiPayload: Payload = {};
62
+ if (typeof items !== 'undefined') {
63
+ apiPayload['items'] = items;
64
+ }
65
+ if (typeof locationCode !== 'undefined') {
66
+ apiPayload['location_code'] = locationCode;
67
+ }
68
+ if (typeof reason !== 'undefined') {
69
+ apiPayload['reason'] = reason;
70
+ }
71
+ const uri = new URL(this.client.config.endpoint + apiPath);
72
+
73
+ const apiHeaders: { [header: string]: string } = {
74
+ 'content-type': 'application/json',
75
+ }
76
+
77
+ return this.client.call(
78
+ 'post',
79
+ uri,
80
+ apiHeaders,
81
+ apiPayload
82
+ );
83
+ }
84
+
85
+ /**
86
+ *
87
+ * @param {Models.InventoryAvailabilityItem[]} params.items - The items to check (batch, at most 200).
88
+ * @param {string} params.locationCode - Restrict the check to one location (default: all enabled locations).
89
+ * @throws {RevenexxException}
90
+ * @returns {Promise<{}>}
91
+ */
92
+ inventoriesAvailability(params: { items: Models.InventoryAvailabilityItem[], locationCode?: string }): Promise<{}>;
93
+ /**
94
+ *
95
+ * @param {Models.InventoryAvailabilityItem[]} items - The items to check (batch, at most 200).
96
+ * @param {string} locationCode - Restrict the check to one location (default: all enabled locations).
97
+ * @throws {RevenexxException}
98
+ * @returns {Promise<{}>}
99
+ * @deprecated Use the object parameter style method for a better developer experience.
100
+ */
101
+ inventoriesAvailability(items: Models.InventoryAvailabilityItem[], locationCode?: string): Promise<{}>;
102
+ inventoriesAvailability(
103
+ paramsOrFirst: { items: Models.InventoryAvailabilityItem[], locationCode?: string } | Models.InventoryAvailabilityItem[],
104
+ ...rest: [(string)?]
105
+ ): Promise<{}> {
106
+ let params: { items: Models.InventoryAvailabilityItem[], locationCode?: string };
107
+
108
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('items' in paramsOrFirst || 'locationCode' in paramsOrFirst))) {
109
+ params = (paramsOrFirst || {}) as { items: Models.InventoryAvailabilityItem[], locationCode?: string };
110
+ } else {
111
+ params = {
112
+ items: paramsOrFirst as Models.InventoryAvailabilityItem[],
113
+ locationCode: rest[0] as string
114
+ };
115
+ }
116
+
117
+ const items = params.items;
118
+ const locationCode = params.locationCode;
119
+
120
+ if (typeof items === 'undefined') {
121
+ throw new RevenexxException('Missing required parameter: "items"');
122
+ }
123
+
124
+ const apiPath = '/v1/inventories/availability';
125
+ const apiPayload: Payload = {};
126
+ if (typeof items !== 'undefined') {
127
+ apiPayload['items'] = items;
128
+ }
129
+ if (typeof locationCode !== 'undefined') {
130
+ apiPayload['location_code'] = locationCode;
131
+ }
132
+ const uri = new URL(this.client.config.endpoint + apiPath);
133
+
134
+ const apiHeaders: { [header: string]: string } = {
135
+ 'content-type': 'application/json',
136
+ }
137
+
138
+ return this.client.call(
139
+ 'post',
140
+ uri,
141
+ apiHeaders,
142
+ apiPayload
143
+ );
144
+ }
145
+
146
+ /**
147
+ *
148
+ * @param {string} params.orderRef - The order whose active reservations are committed (shipment).
149
+ * @throws {RevenexxException}
150
+ * @returns {Promise<{}>}
151
+ */
152
+ inventoriesCommit(params: { orderRef: string }): Promise<{}>;
153
+ /**
154
+ *
155
+ * @param {string} orderRef - The order whose active reservations are committed (shipment).
156
+ * @throws {RevenexxException}
157
+ * @returns {Promise<{}>}
158
+ * @deprecated Use the object parameter style method for a better developer experience.
159
+ */
160
+ inventoriesCommit(orderRef: string): Promise<{}>;
161
+ inventoriesCommit(
162
+ paramsOrFirst: { orderRef: string } | string
163
+ ): Promise<{}> {
164
+ let params: { orderRef: string };
165
+
166
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
167
+ params = (paramsOrFirst || {}) as { orderRef: string };
168
+ } else {
169
+ params = {
170
+ orderRef: paramsOrFirst as string
171
+ };
172
+ }
173
+
174
+ const orderRef = params.orderRef;
175
+
176
+ if (typeof orderRef === 'undefined') {
177
+ throw new RevenexxException('Missing required parameter: "orderRef"');
178
+ }
179
+
180
+ const apiPath = '/v1/inventories/commit';
181
+ const apiPayload: Payload = {};
182
+ if (typeof orderRef !== 'undefined') {
183
+ apiPayload['order_ref'] = orderRef;
184
+ }
185
+ const uri = new URL(this.client.config.endpoint + apiPath);
186
+
187
+ const apiHeaders: { [header: string]: string } = {
188
+ 'content-type': 'application/json',
189
+ }
190
+
191
+ return this.client.call(
192
+ 'post',
193
+ uri,
194
+ apiHeaders,
195
+ apiPayload
196
+ );
197
+ }
198
+
199
+ /**
200
+ *
201
+ * @throws {RevenexxException}
202
+ * @returns {Promise<{}>}
203
+ */
204
+ inventoriesLocationsList(): Promise<{}> {
205
+
206
+ const apiPath = '/v1/inventories/locations';
207
+ const apiPayload: Payload = {};
208
+ const uri = new URL(this.client.config.endpoint + apiPath);
209
+
210
+ const apiHeaders: { [header: string]: string } = {
211
+ }
212
+
213
+ return this.client.call(
214
+ 'get',
215
+ uri,
216
+ apiHeaders,
217
+ apiPayload
218
+ );
219
+ }
220
+
221
+ /**
222
+ *
223
+ * @param {string} params.code - Unique location code (per tenant).
224
+ * @param {string} params.name -
225
+ * @param {object} params.address -
226
+ * @param {boolean} params.enabled - Disabled locations are skipped by availability and reserve (default true).
227
+ * @param {object} params.labels - Localised display names ({de, en, …}).
228
+ * @param {object} params.metadata - Free-form metadata.
229
+ * @param {number} params.priority - Sourcing order — lower wins (default 0).
230
+ * @param {LocationType} params.type - Default 'warehouse'.
231
+ * @throws {RevenexxException}
232
+ * @returns {Promise<Models.Location>}
233
+ */
234
+ inventoriesLocationsCreate(params: { code: string, name: string, address?: object, enabled?: boolean, labels?: object, metadata?: object, priority?: number, type?: LocationType }): Promise<Models.Location>;
235
+ /**
236
+ *
237
+ * @param {string} code - Unique location code (per tenant).
238
+ * @param {string} name -
239
+ * @param {object} address -
240
+ * @param {boolean} enabled - Disabled locations are skipped by availability and reserve (default true).
241
+ * @param {object} labels - Localised display names ({de, en, …}).
242
+ * @param {object} metadata - Free-form metadata.
243
+ * @param {number} priority - Sourcing order — lower wins (default 0).
244
+ * @param {LocationType} type - Default 'warehouse'.
245
+ * @throws {RevenexxException}
246
+ * @returns {Promise<Models.Location>}
247
+ * @deprecated Use the object parameter style method for a better developer experience.
248
+ */
249
+ inventoriesLocationsCreate(code: string, name: string, address?: object, enabled?: boolean, labels?: object, metadata?: object, priority?: number, type?: LocationType): Promise<Models.Location>;
250
+ inventoriesLocationsCreate(
251
+ paramsOrFirst: { code: string, name: string, address?: object, enabled?: boolean, labels?: object, metadata?: object, priority?: number, type?: LocationType } | string,
252
+ ...rest: [(string)?, (object)?, (boolean)?, (object)?, (object)?, (number)?, (LocationType)?]
253
+ ): Promise<Models.Location> {
254
+ let params: { code: string, name: string, address?: object, enabled?: boolean, labels?: object, metadata?: object, priority?: number, type?: LocationType };
255
+
256
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
257
+ params = (paramsOrFirst || {}) as { code: string, name: string, address?: object, enabled?: boolean, labels?: object, metadata?: object, priority?: number, type?: LocationType };
258
+ } else {
259
+ params = {
260
+ code: paramsOrFirst as string,
261
+ name: rest[0] as string,
262
+ address: rest[1] as object,
263
+ enabled: rest[2] as boolean,
264
+ labels: rest[3] as object,
265
+ metadata: rest[4] as object,
266
+ priority: rest[5] as number,
267
+ type: rest[6] as LocationType
268
+ };
269
+ }
270
+
271
+ const code = params.code;
272
+ const name = params.name;
273
+ const address = params.address;
274
+ const enabled = params.enabled;
275
+ const labels = params.labels;
276
+ const metadata = params.metadata;
277
+ const priority = params.priority;
278
+ const type = params.type;
279
+
280
+ if (typeof code === 'undefined') {
281
+ throw new RevenexxException('Missing required parameter: "code"');
282
+ }
283
+ if (typeof name === 'undefined') {
284
+ throw new RevenexxException('Missing required parameter: "name"');
285
+ }
286
+
287
+ const apiPath = '/v1/inventories/locations';
288
+ const apiPayload: Payload = {};
289
+ if (typeof address !== 'undefined') {
290
+ apiPayload['address'] = address;
291
+ }
292
+ if (typeof code !== 'undefined') {
293
+ apiPayload['code'] = code;
294
+ }
295
+ if (typeof enabled !== 'undefined') {
296
+ apiPayload['enabled'] = enabled;
297
+ }
298
+ if (typeof labels !== 'undefined') {
299
+ apiPayload['labels'] = labels;
300
+ }
301
+ if (typeof metadata !== 'undefined') {
302
+ apiPayload['metadata'] = metadata;
303
+ }
304
+ if (typeof name !== 'undefined') {
305
+ apiPayload['name'] = name;
306
+ }
307
+ if (typeof priority !== 'undefined') {
308
+ apiPayload['priority'] = priority;
309
+ }
310
+ if (typeof type !== 'undefined') {
311
+ apiPayload['type'] = type;
312
+ }
313
+ const uri = new URL(this.client.config.endpoint + apiPath);
314
+
315
+ const apiHeaders: { [header: string]: string } = {
316
+ 'content-type': 'application/json',
317
+ }
318
+
319
+ return this.client.call(
320
+ 'post',
321
+ uri,
322
+ apiHeaders,
323
+ apiPayload
324
+ );
325
+ }
326
+
327
+ /**
328
+ *
329
+ * @throws {RevenexxException}
330
+ * @returns {Promise<{}>}
331
+ */
332
+ inventoriesLocationsDefaults(): Promise<{}> {
333
+
334
+ const apiPath = '/v1/inventories/locations/defaults';
335
+ const apiPayload: Payload = {};
336
+ const uri = new URL(this.client.config.endpoint + apiPath);
337
+
338
+ const apiHeaders: { [header: string]: string } = {
339
+ }
340
+
341
+ return this.client.call(
342
+ 'post',
343
+ uri,
344
+ apiHeaders,
345
+ apiPayload
346
+ );
347
+ }
348
+
349
+ /**
350
+ *
351
+ * @param {string} params.id -
352
+ * @throws {RevenexxException}
353
+ * @returns {Promise<{}>}
354
+ */
355
+ inventoriesLocationsDelete(params: { id: string }): Promise<{}>;
356
+ /**
357
+ *
358
+ * @param {string} id -
359
+ * @throws {RevenexxException}
360
+ * @returns {Promise<{}>}
361
+ * @deprecated Use the object parameter style method for a better developer experience.
362
+ */
363
+ inventoriesLocationsDelete(id: string): Promise<{}>;
364
+ inventoriesLocationsDelete(
365
+ paramsOrFirst: { id: string } | string
366
+ ): Promise<{}> {
367
+ let params: { id: string };
368
+
369
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
370
+ params = (paramsOrFirst || {}) as { id: string };
371
+ } else {
372
+ params = {
373
+ id: paramsOrFirst as string
374
+ };
375
+ }
376
+
377
+ const id = params.id;
378
+
379
+ if (typeof id === 'undefined') {
380
+ throw new RevenexxException('Missing required parameter: "id"');
381
+ }
382
+
383
+ const apiPath = '/v1/inventories/locations/{id}'.replace('{id}', id);
384
+ const apiPayload: Payload = {};
385
+ const uri = new URL(this.client.config.endpoint + apiPath);
386
+
387
+ const apiHeaders: { [header: string]: string } = {
388
+ }
389
+
390
+ return this.client.call(
391
+ 'delete',
392
+ uri,
393
+ apiHeaders,
394
+ apiPayload
395
+ );
396
+ }
397
+
398
+ /**
399
+ *
400
+ * @param {string} params.id -
401
+ * @throws {RevenexxException}
402
+ * @returns {Promise<Models.Location>}
403
+ */
404
+ inventoriesLocationsGet(params: { id: string }): Promise<Models.Location>;
405
+ /**
406
+ *
407
+ * @param {string} id -
408
+ * @throws {RevenexxException}
409
+ * @returns {Promise<Models.Location>}
410
+ * @deprecated Use the object parameter style method for a better developer experience.
411
+ */
412
+ inventoriesLocationsGet(id: string): Promise<Models.Location>;
413
+ inventoriesLocationsGet(
414
+ paramsOrFirst: { id: string } | string
415
+ ): Promise<Models.Location> {
416
+ let params: { id: string };
417
+
418
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
419
+ params = (paramsOrFirst || {}) as { id: string };
420
+ } else {
421
+ params = {
422
+ id: paramsOrFirst as string
423
+ };
424
+ }
425
+
426
+ const id = params.id;
427
+
428
+ if (typeof id === 'undefined') {
429
+ throw new RevenexxException('Missing required parameter: "id"');
430
+ }
431
+
432
+ const apiPath = '/v1/inventories/locations/{id}'.replace('{id}', id);
433
+ const apiPayload: Payload = {};
434
+ const uri = new URL(this.client.config.endpoint + apiPath);
435
+
436
+ const apiHeaders: { [header: string]: string } = {
437
+ }
438
+
439
+ return this.client.call(
440
+ 'get',
441
+ uri,
442
+ apiHeaders,
443
+ apiPayload
444
+ );
445
+ }
446
+
447
+ /**
448
+ *
449
+ * @param {string} params.id -
450
+ * @param {object} params.address -
451
+ * @param {string} params.code - Unique location code (per tenant).
452
+ * @param {boolean} params.enabled - Disabled locations are skipped by availability and reserve (default true).
453
+ * @param {object} params.labels - Localised display names ({de, en, …}).
454
+ * @param {object} params.metadata - Free-form metadata.
455
+ * @param {string} params.name -
456
+ * @param {number} params.priority - Sourcing order — lower wins (default 0).
457
+ * @param {LocationType} params.type - Default 'warehouse'.
458
+ * @throws {RevenexxException}
459
+ * @returns {Promise<Models.Location>}
460
+ */
461
+ inventoriesLocationsUpdate(params: { id: string, address?: object, code?: string, enabled?: boolean, labels?: object, metadata?: object, name?: string, priority?: number, type?: LocationType }): Promise<Models.Location>;
462
+ /**
463
+ *
464
+ * @param {string} id -
465
+ * @param {object} address -
466
+ * @param {string} code - Unique location code (per tenant).
467
+ * @param {boolean} enabled - Disabled locations are skipped by availability and reserve (default true).
468
+ * @param {object} labels - Localised display names ({de, en, …}).
469
+ * @param {object} metadata - Free-form metadata.
470
+ * @param {string} name -
471
+ * @param {number} priority - Sourcing order — lower wins (default 0).
472
+ * @param {LocationType} type - Default 'warehouse'.
473
+ * @throws {RevenexxException}
474
+ * @returns {Promise<Models.Location>}
475
+ * @deprecated Use the object parameter style method for a better developer experience.
476
+ */
477
+ inventoriesLocationsUpdate(id: string, address?: object, code?: string, enabled?: boolean, labels?: object, metadata?: object, name?: string, priority?: number, type?: LocationType): Promise<Models.Location>;
478
+ inventoriesLocationsUpdate(
479
+ paramsOrFirst: { id: string, address?: object, code?: string, enabled?: boolean, labels?: object, metadata?: object, name?: string, priority?: number, type?: LocationType } | string,
480
+ ...rest: [(object)?, (string)?, (boolean)?, (object)?, (object)?, (string)?, (number)?, (LocationType)?]
481
+ ): Promise<Models.Location> {
482
+ let params: { id: string, address?: object, code?: string, enabled?: boolean, labels?: object, metadata?: object, name?: string, priority?: number, type?: LocationType };
483
+
484
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
485
+ params = (paramsOrFirst || {}) as { id: string, address?: object, code?: string, enabled?: boolean, labels?: object, metadata?: object, name?: string, priority?: number, type?: LocationType };
486
+ } else {
487
+ params = {
488
+ id: paramsOrFirst as string,
489
+ address: rest[0] as object,
490
+ code: rest[1] as string,
491
+ enabled: rest[2] as boolean,
492
+ labels: rest[3] as object,
493
+ metadata: rest[4] as object,
494
+ name: rest[5] as string,
495
+ priority: rest[6] as number,
496
+ type: rest[7] as LocationType
497
+ };
498
+ }
499
+
500
+ const id = params.id;
501
+ const address = params.address;
502
+ const code = params.code;
503
+ const enabled = params.enabled;
504
+ const labels = params.labels;
505
+ const metadata = params.metadata;
506
+ const name = params.name;
507
+ const priority = params.priority;
508
+ const type = params.type;
509
+
510
+ if (typeof id === 'undefined') {
511
+ throw new RevenexxException('Missing required parameter: "id"');
512
+ }
513
+
514
+ const apiPath = '/v1/inventories/locations/{id}'.replace('{id}', id);
515
+ const apiPayload: Payload = {};
516
+ if (typeof address !== 'undefined') {
517
+ apiPayload['address'] = address;
518
+ }
519
+ if (typeof code !== 'undefined') {
520
+ apiPayload['code'] = code;
521
+ }
522
+ if (typeof enabled !== 'undefined') {
523
+ apiPayload['enabled'] = enabled;
524
+ }
525
+ if (typeof labels !== 'undefined') {
526
+ apiPayload['labels'] = labels;
527
+ }
528
+ if (typeof metadata !== 'undefined') {
529
+ apiPayload['metadata'] = metadata;
530
+ }
531
+ if (typeof name !== 'undefined') {
532
+ apiPayload['name'] = name;
533
+ }
534
+ if (typeof priority !== 'undefined') {
535
+ apiPayload['priority'] = priority;
536
+ }
537
+ if (typeof type !== 'undefined') {
538
+ apiPayload['type'] = type;
539
+ }
540
+ const uri = new URL(this.client.config.endpoint + apiPath);
541
+
542
+ const apiHeaders: { [header: string]: string } = {
543
+ 'content-type': 'application/json',
544
+ }
545
+
546
+ return this.client.call(
547
+ 'put',
548
+ uri,
549
+ apiHeaders,
550
+ apiPayload
551
+ );
552
+ }
553
+
554
+ /**
555
+ *
556
+ * @throws {RevenexxException}
557
+ * @returns {Promise<{}>}
558
+ */
559
+ inventoriesMovementsList(): Promise<{}> {
560
+
561
+ const apiPath = '/v1/inventories/movements';
562
+ const apiPayload: Payload = {};
563
+ const uri = new URL(this.client.config.endpoint + apiPath);
564
+
565
+ const apiHeaders: { [header: string]: string } = {
566
+ }
567
+
568
+ return this.client.call(
569
+ 'get',
570
+ uri,
571
+ apiHeaders,
572
+ apiPayload
573
+ );
574
+ }
575
+
576
+ /**
577
+ *
578
+ * @param {string} params.id -
579
+ * @throws {RevenexxException}
580
+ * @returns {Promise<Models.StockMovement>}
581
+ */
582
+ inventoriesMovementsGet(params: { id: string }): Promise<Models.StockMovement>;
583
+ /**
584
+ *
585
+ * @param {string} id -
586
+ * @throws {RevenexxException}
587
+ * @returns {Promise<Models.StockMovement>}
588
+ * @deprecated Use the object parameter style method for a better developer experience.
589
+ */
590
+ inventoriesMovementsGet(id: string): Promise<Models.StockMovement>;
591
+ inventoriesMovementsGet(
592
+ paramsOrFirst: { id: string } | string
593
+ ): Promise<Models.StockMovement> {
594
+ let params: { id: string };
595
+
596
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
597
+ params = (paramsOrFirst || {}) as { id: string };
598
+ } else {
599
+ params = {
600
+ id: paramsOrFirst as string
601
+ };
602
+ }
603
+
604
+ const id = params.id;
605
+
606
+ if (typeof id === 'undefined') {
607
+ throw new RevenexxException('Missing required parameter: "id"');
608
+ }
609
+
610
+ const apiPath = '/v1/inventories/movements/{id}'.replace('{id}', id);
611
+ const apiPayload: Payload = {};
612
+ const uri = new URL(this.client.config.endpoint + apiPath);
613
+
614
+ const apiHeaders: { [header: string]: string } = {
615
+ }
616
+
617
+ return this.client.call(
618
+ 'get',
619
+ uri,
620
+ apiHeaders,
621
+ apiPayload
622
+ );
623
+ }
624
+
625
+ /**
626
+ *
627
+ * @param {Models.InventoryStockItem[]} params.items - The inbound items (at most 200).
628
+ * @param {string} params.locationCode - Receiving location (default 'main').
629
+ * @param {string} params.reason - Ledger note (e.g. delivery note number).
630
+ * @throws {RevenexxException}
631
+ * @returns {Promise<{}>}
632
+ */
633
+ inventoriesReceive(params: { items: Models.InventoryStockItem[], locationCode?: string, reason?: string }): Promise<{}>;
634
+ /**
635
+ *
636
+ * @param {Models.InventoryStockItem[]} items - The inbound items (at most 200).
637
+ * @param {string} locationCode - Receiving location (default 'main').
638
+ * @param {string} reason - Ledger note (e.g. delivery note number).
639
+ * @throws {RevenexxException}
640
+ * @returns {Promise<{}>}
641
+ * @deprecated Use the object parameter style method for a better developer experience.
642
+ */
643
+ inventoriesReceive(items: Models.InventoryStockItem[], locationCode?: string, reason?: string): Promise<{}>;
644
+ inventoriesReceive(
645
+ paramsOrFirst: { items: Models.InventoryStockItem[], locationCode?: string, reason?: string } | Models.InventoryStockItem[],
646
+ ...rest: [(string)?, (string)?]
647
+ ): Promise<{}> {
648
+ let params: { items: Models.InventoryStockItem[], locationCode?: string, reason?: string };
649
+
650
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('items' in paramsOrFirst || 'locationCode' in paramsOrFirst || 'reason' in paramsOrFirst))) {
651
+ params = (paramsOrFirst || {}) as { items: Models.InventoryStockItem[], locationCode?: string, reason?: string };
652
+ } else {
653
+ params = {
654
+ items: paramsOrFirst as Models.InventoryStockItem[],
655
+ locationCode: rest[0] as string,
656
+ reason: rest[1] as string
657
+ };
658
+ }
659
+
660
+ const items = params.items;
661
+ const locationCode = params.locationCode;
662
+ const reason = params.reason;
663
+
664
+ if (typeof items === 'undefined') {
665
+ throw new RevenexxException('Missing required parameter: "items"');
666
+ }
667
+
668
+ const apiPath = '/v1/inventories/receive';
669
+ const apiPayload: Payload = {};
670
+ if (typeof items !== 'undefined') {
671
+ apiPayload['items'] = items;
672
+ }
673
+ if (typeof locationCode !== 'undefined') {
674
+ apiPayload['location_code'] = locationCode;
675
+ }
676
+ if (typeof reason !== 'undefined') {
677
+ apiPayload['reason'] = reason;
678
+ }
679
+ const uri = new URL(this.client.config.endpoint + apiPath);
680
+
681
+ const apiHeaders: { [header: string]: string } = {
682
+ 'content-type': 'application/json',
683
+ }
684
+
685
+ return this.client.call(
686
+ 'post',
687
+ uri,
688
+ apiHeaders,
689
+ apiPayload
690
+ );
691
+ }
692
+
693
+ /**
694
+ *
695
+ * @param {string} params.orderRef - The order whose active reservations are released.
696
+ * @throws {RevenexxException}
697
+ * @returns {Promise<{}>}
698
+ */
699
+ inventoriesRelease(params: { orderRef: string }): Promise<{}>;
700
+ /**
701
+ *
702
+ * @param {string} orderRef - The order whose active reservations are released.
703
+ * @throws {RevenexxException}
704
+ * @returns {Promise<{}>}
705
+ * @deprecated Use the object parameter style method for a better developer experience.
706
+ */
707
+ inventoriesRelease(orderRef: string): Promise<{}>;
708
+ inventoriesRelease(
709
+ paramsOrFirst: { orderRef: string } | string
710
+ ): Promise<{}> {
711
+ let params: { orderRef: string };
712
+
713
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
714
+ params = (paramsOrFirst || {}) as { orderRef: string };
715
+ } else {
716
+ params = {
717
+ orderRef: paramsOrFirst as string
718
+ };
719
+ }
720
+
721
+ const orderRef = params.orderRef;
722
+
723
+ if (typeof orderRef === 'undefined') {
724
+ throw new RevenexxException('Missing required parameter: "orderRef"');
725
+ }
726
+
727
+ const apiPath = '/v1/inventories/release';
728
+ const apiPayload: Payload = {};
729
+ if (typeof orderRef !== 'undefined') {
730
+ apiPayload['order_ref'] = orderRef;
731
+ }
732
+ const uri = new URL(this.client.config.endpoint + apiPath);
733
+
734
+ const apiHeaders: { [header: string]: string } = {
735
+ 'content-type': 'application/json',
736
+ }
737
+
738
+ return this.client.call(
739
+ 'post',
740
+ uri,
741
+ apiHeaders,
742
+ apiPayload
743
+ );
744
+ }
745
+
746
+ /**
747
+ *
748
+ * @throws {RevenexxException}
749
+ * @returns {Promise<{}>}
750
+ */
751
+ inventoriesReservationsList(): Promise<{}> {
752
+
753
+ const apiPath = '/v1/inventories/reservations';
754
+ const apiPayload: Payload = {};
755
+ const uri = new URL(this.client.config.endpoint + apiPath);
756
+
757
+ const apiHeaders: { [header: string]: string } = {
758
+ }
759
+
760
+ return this.client.call(
761
+ 'get',
762
+ uri,
763
+ apiHeaders,
764
+ apiPayload
765
+ );
766
+ }
767
+
768
+ /**
769
+ *
770
+ * @param {string} params.id -
771
+ * @throws {RevenexxException}
772
+ * @returns {Promise<Models.Reservation>}
773
+ */
774
+ inventoriesReservationsGet(params: { id: string }): Promise<Models.Reservation>;
775
+ /**
776
+ *
777
+ * @param {string} id -
778
+ * @throws {RevenexxException}
779
+ * @returns {Promise<Models.Reservation>}
780
+ * @deprecated Use the object parameter style method for a better developer experience.
781
+ */
782
+ inventoriesReservationsGet(id: string): Promise<Models.Reservation>;
783
+ inventoriesReservationsGet(
784
+ paramsOrFirst: { id: string } | string
785
+ ): Promise<Models.Reservation> {
786
+ let params: { id: string };
787
+
788
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
789
+ params = (paramsOrFirst || {}) as { id: string };
790
+ } else {
791
+ params = {
792
+ id: paramsOrFirst as string
793
+ };
794
+ }
795
+
796
+ const id = params.id;
797
+
798
+ if (typeof id === 'undefined') {
799
+ throw new RevenexxException('Missing required parameter: "id"');
800
+ }
801
+
802
+ const apiPath = '/v1/inventories/reservations/{id}'.replace('{id}', id);
803
+ const apiPayload: Payload = {};
804
+ const uri = new URL(this.client.config.endpoint + apiPath);
805
+
806
+ const apiHeaders: { [header: string]: string } = {
807
+ }
808
+
809
+ return this.client.call(
810
+ 'get',
811
+ uri,
812
+ apiHeaders,
813
+ apiPayload
814
+ );
815
+ }
816
+
817
+ /**
818
+ *
819
+ * @param {Models.InventoryStockItem[]} params.items - The items to reserve — all-or-nothing (at most 200).
820
+ * @param {string} params.orderRef - The order this reservation belongs to.
821
+ * @param {string} params.expiresAt - Optional reservation expiry.
822
+ * @throws {RevenexxException}
823
+ * @returns {Promise<{}>}
824
+ */
825
+ inventoriesReserve(params: { items: Models.InventoryStockItem[], orderRef: string, expiresAt?: string }): Promise<{}>;
826
+ /**
827
+ *
828
+ * @param {Models.InventoryStockItem[]} items - The items to reserve — all-or-nothing (at most 200).
829
+ * @param {string} orderRef - The order this reservation belongs to.
830
+ * @param {string} expiresAt - Optional reservation expiry.
831
+ * @throws {RevenexxException}
832
+ * @returns {Promise<{}>}
833
+ * @deprecated Use the object parameter style method for a better developer experience.
834
+ */
835
+ inventoriesReserve(items: Models.InventoryStockItem[], orderRef: string, expiresAt?: string): Promise<{}>;
836
+ inventoriesReserve(
837
+ paramsOrFirst: { items: Models.InventoryStockItem[], orderRef: string, expiresAt?: string } | Models.InventoryStockItem[],
838
+ ...rest: [(string)?, (string)?]
839
+ ): Promise<{}> {
840
+ let params: { items: Models.InventoryStockItem[], orderRef: string, expiresAt?: string };
841
+
842
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('items' in paramsOrFirst || 'orderRef' in paramsOrFirst || 'expiresAt' in paramsOrFirst))) {
843
+ params = (paramsOrFirst || {}) as { items: Models.InventoryStockItem[], orderRef: string, expiresAt?: string };
844
+ } else {
845
+ params = {
846
+ items: paramsOrFirst as Models.InventoryStockItem[],
847
+ orderRef: rest[0] as string,
848
+ expiresAt: rest[1] as string
849
+ };
850
+ }
851
+
852
+ const items = params.items;
853
+ const orderRef = params.orderRef;
854
+ const expiresAt = params.expiresAt;
855
+
856
+ if (typeof items === 'undefined') {
857
+ throw new RevenexxException('Missing required parameter: "items"');
858
+ }
859
+ if (typeof orderRef === 'undefined') {
860
+ throw new RevenexxException('Missing required parameter: "orderRef"');
861
+ }
862
+
863
+ const apiPath = '/v1/inventories/reserve';
864
+ const apiPayload: Payload = {};
865
+ if (typeof expiresAt !== 'undefined') {
866
+ apiPayload['expires_at'] = expiresAt;
867
+ }
868
+ if (typeof items !== 'undefined') {
869
+ apiPayload['items'] = items;
870
+ }
871
+ if (typeof orderRef !== 'undefined') {
872
+ apiPayload['order_ref'] = orderRef;
873
+ }
874
+ const uri = new URL(this.client.config.endpoint + apiPath);
875
+
876
+ const apiHeaders: { [header: string]: string } = {
877
+ 'content-type': 'application/json',
878
+ }
879
+
880
+ return this.client.call(
881
+ 'post',
882
+ uri,
883
+ apiHeaders,
884
+ apiPayload
885
+ );
886
+ }
887
+
888
+ /**
889
+ *
890
+ * @param {Models.InventoryStockItem[]} params.items - The returned items (at most 200).
891
+ * @param {string} params.locationCode - Restocking location (default 'main').
892
+ * @param {string} params.orderRef - Originating order (ledger reference).
893
+ * @param {string} params.reason - Ledger note (e.g. return reason).
894
+ * @throws {RevenexxException}
895
+ * @returns {Promise<{}>}
896
+ */
897
+ inventoriesRestock(params: { items: Models.InventoryStockItem[], locationCode?: string, orderRef?: string, reason?: string }): Promise<{}>;
898
+ /**
899
+ *
900
+ * @param {Models.InventoryStockItem[]} items - The returned items (at most 200).
901
+ * @param {string} locationCode - Restocking location (default 'main').
902
+ * @param {string} orderRef - Originating order (ledger reference).
903
+ * @param {string} reason - Ledger note (e.g. return reason).
904
+ * @throws {RevenexxException}
905
+ * @returns {Promise<{}>}
906
+ * @deprecated Use the object parameter style method for a better developer experience.
907
+ */
908
+ inventoriesRestock(items: Models.InventoryStockItem[], locationCode?: string, orderRef?: string, reason?: string): Promise<{}>;
909
+ inventoriesRestock(
910
+ paramsOrFirst: { items: Models.InventoryStockItem[], locationCode?: string, orderRef?: string, reason?: string } | Models.InventoryStockItem[],
911
+ ...rest: [(string)?, (string)?, (string)?]
912
+ ): Promise<{}> {
913
+ let params: { items: Models.InventoryStockItem[], locationCode?: string, orderRef?: string, reason?: string };
914
+
915
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('items' in paramsOrFirst || 'locationCode' in paramsOrFirst || 'orderRef' in paramsOrFirst || 'reason' in paramsOrFirst))) {
916
+ params = (paramsOrFirst || {}) as { items: Models.InventoryStockItem[], locationCode?: string, orderRef?: string, reason?: string };
917
+ } else {
918
+ params = {
919
+ items: paramsOrFirst as Models.InventoryStockItem[],
920
+ locationCode: rest[0] as string,
921
+ orderRef: rest[1] as string,
922
+ reason: rest[2] as string
923
+ };
924
+ }
925
+
926
+ const items = params.items;
927
+ const locationCode = params.locationCode;
928
+ const orderRef = params.orderRef;
929
+ const reason = params.reason;
930
+
931
+ if (typeof items === 'undefined') {
932
+ throw new RevenexxException('Missing required parameter: "items"');
933
+ }
934
+
935
+ const apiPath = '/v1/inventories/restock';
936
+ const apiPayload: Payload = {};
937
+ if (typeof items !== 'undefined') {
938
+ apiPayload['items'] = items;
939
+ }
940
+ if (typeof locationCode !== 'undefined') {
941
+ apiPayload['location_code'] = locationCode;
942
+ }
943
+ if (typeof orderRef !== 'undefined') {
944
+ apiPayload['order_ref'] = orderRef;
945
+ }
946
+ if (typeof reason !== 'undefined') {
947
+ apiPayload['reason'] = reason;
948
+ }
949
+ const uri = new URL(this.client.config.endpoint + apiPath);
950
+
951
+ const apiHeaders: { [header: string]: string } = {
952
+ 'content-type': 'application/json',
953
+ }
954
+
955
+ return this.client.call(
956
+ 'post',
957
+ uri,
958
+ apiHeaders,
959
+ apiPayload
960
+ );
961
+ }
962
+
963
+ /**
964
+ *
965
+ * @throws {RevenexxException}
966
+ * @returns {Promise<{}>}
967
+ */
968
+ inventoriesStockList(): Promise<{}> {
969
+
970
+ const apiPath = '/v1/inventories/stock';
971
+ const apiPayload: Payload = {};
972
+ const uri = new URL(this.client.config.endpoint + apiPath);
973
+
974
+ const apiHeaders: { [header: string]: string } = {
975
+ }
976
+
977
+ return this.client.call(
978
+ 'get',
979
+ uri,
980
+ apiHeaders,
981
+ apiPayload
982
+ );
983
+ }
984
+
985
+ /**
986
+ *
987
+ * @param {string} params.locationId - Owning location.
988
+ * @param {object} params.metadata - Free-form metadata.
989
+ * @param {number} params.onHand - Physical stock (default 0).
990
+ * @param {string} params.productId - Tracked product.
991
+ * @param {number} params.reorderPoint -
992
+ * @param {number} params.reserved - Reserved stock (default 0) — normally managed by reserve/release/commit.
993
+ * @param {string} params.sku - Tracked SKU (alternative to product_id).
994
+ * @throws {RevenexxException}
995
+ * @returns {Promise<Models.StockLevel>}
996
+ */
997
+ inventoriesStockCreate(params: { locationId: string, metadata?: object, onHand?: number, productId?: string, reorderPoint?: number, reserved?: number, sku?: string }): Promise<Models.StockLevel>;
998
+ /**
999
+ *
1000
+ * @param {string} locationId - Owning location.
1001
+ * @param {object} metadata - Free-form metadata.
1002
+ * @param {number} onHand - Physical stock (default 0).
1003
+ * @param {string} productId - Tracked product.
1004
+ * @param {number} reorderPoint -
1005
+ * @param {number} reserved - Reserved stock (default 0) — normally managed by reserve/release/commit.
1006
+ * @param {string} sku - Tracked SKU (alternative to product_id).
1007
+ * @throws {RevenexxException}
1008
+ * @returns {Promise<Models.StockLevel>}
1009
+ * @deprecated Use the object parameter style method for a better developer experience.
1010
+ */
1011
+ inventoriesStockCreate(locationId: string, metadata?: object, onHand?: number, productId?: string, reorderPoint?: number, reserved?: number, sku?: string): Promise<Models.StockLevel>;
1012
+ inventoriesStockCreate(
1013
+ paramsOrFirst: { locationId: string, metadata?: object, onHand?: number, productId?: string, reorderPoint?: number, reserved?: number, sku?: string } | string,
1014
+ ...rest: [(object)?, (number)?, (string)?, (number)?, (number)?, (string)?]
1015
+ ): Promise<Models.StockLevel> {
1016
+ let params: { locationId: string, metadata?: object, onHand?: number, productId?: string, reorderPoint?: number, reserved?: number, sku?: string };
1017
+
1018
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1019
+ params = (paramsOrFirst || {}) as { locationId: string, metadata?: object, onHand?: number, productId?: string, reorderPoint?: number, reserved?: number, sku?: string };
1020
+ } else {
1021
+ params = {
1022
+ locationId: paramsOrFirst as string,
1023
+ metadata: rest[0] as object,
1024
+ onHand: rest[1] as number,
1025
+ productId: rest[2] as string,
1026
+ reorderPoint: rest[3] as number,
1027
+ reserved: rest[4] as number,
1028
+ sku: rest[5] as string
1029
+ };
1030
+ }
1031
+
1032
+ const locationId = params.locationId;
1033
+ const metadata = params.metadata;
1034
+ const onHand = params.onHand;
1035
+ const productId = params.productId;
1036
+ const reorderPoint = params.reorderPoint;
1037
+ const reserved = params.reserved;
1038
+ const sku = params.sku;
1039
+
1040
+ if (typeof locationId === 'undefined') {
1041
+ throw new RevenexxException('Missing required parameter: "locationId"');
1042
+ }
1043
+
1044
+ const apiPath = '/v1/inventories/stock';
1045
+ const apiPayload: Payload = {};
1046
+ if (typeof locationId !== 'undefined') {
1047
+ apiPayload['location_id'] = locationId;
1048
+ }
1049
+ if (typeof metadata !== 'undefined') {
1050
+ apiPayload['metadata'] = metadata;
1051
+ }
1052
+ if (typeof onHand !== 'undefined') {
1053
+ apiPayload['on_hand'] = onHand;
1054
+ }
1055
+ if (typeof productId !== 'undefined') {
1056
+ apiPayload['product_id'] = productId;
1057
+ }
1058
+ if (typeof reorderPoint !== 'undefined') {
1059
+ apiPayload['reorder_point'] = reorderPoint;
1060
+ }
1061
+ if (typeof reserved !== 'undefined') {
1062
+ apiPayload['reserved'] = reserved;
1063
+ }
1064
+ if (typeof sku !== 'undefined') {
1065
+ apiPayload['sku'] = sku;
1066
+ }
1067
+ const uri = new URL(this.client.config.endpoint + apiPath);
1068
+
1069
+ const apiHeaders: { [header: string]: string } = {
1070
+ 'content-type': 'application/json',
1071
+ }
1072
+
1073
+ return this.client.call(
1074
+ 'post',
1075
+ uri,
1076
+ apiHeaders,
1077
+ apiPayload
1078
+ );
1079
+ }
1080
+
1081
+ /**
1082
+ *
1083
+ * @param {string} params.id -
1084
+ * @throws {RevenexxException}
1085
+ * @returns {Promise<{}>}
1086
+ */
1087
+ inventoriesStockDelete(params: { id: string }): Promise<{}>;
1088
+ /**
1089
+ *
1090
+ * @param {string} id -
1091
+ * @throws {RevenexxException}
1092
+ * @returns {Promise<{}>}
1093
+ * @deprecated Use the object parameter style method for a better developer experience.
1094
+ */
1095
+ inventoriesStockDelete(id: string): Promise<{}>;
1096
+ inventoriesStockDelete(
1097
+ paramsOrFirst: { id: string } | string
1098
+ ): Promise<{}> {
1099
+ let params: { id: string };
1100
+
1101
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1102
+ params = (paramsOrFirst || {}) as { id: string };
1103
+ } else {
1104
+ params = {
1105
+ id: paramsOrFirst as string
1106
+ };
1107
+ }
1108
+
1109
+ const id = params.id;
1110
+
1111
+ if (typeof id === 'undefined') {
1112
+ throw new RevenexxException('Missing required parameter: "id"');
1113
+ }
1114
+
1115
+ const apiPath = '/v1/inventories/stock/{id}'.replace('{id}', id);
1116
+ const apiPayload: Payload = {};
1117
+ const uri = new URL(this.client.config.endpoint + apiPath);
1118
+
1119
+ const apiHeaders: { [header: string]: string } = {
1120
+ }
1121
+
1122
+ return this.client.call(
1123
+ 'delete',
1124
+ uri,
1125
+ apiHeaders,
1126
+ apiPayload
1127
+ );
1128
+ }
1129
+
1130
+ /**
1131
+ *
1132
+ * @param {string} params.id -
1133
+ * @throws {RevenexxException}
1134
+ * @returns {Promise<Models.StockLevel>}
1135
+ */
1136
+ inventoriesStockGet(params: { id: string }): Promise<Models.StockLevel>;
1137
+ /**
1138
+ *
1139
+ * @param {string} id -
1140
+ * @throws {RevenexxException}
1141
+ * @returns {Promise<Models.StockLevel>}
1142
+ * @deprecated Use the object parameter style method for a better developer experience.
1143
+ */
1144
+ inventoriesStockGet(id: string): Promise<Models.StockLevel>;
1145
+ inventoriesStockGet(
1146
+ paramsOrFirst: { id: string } | string
1147
+ ): Promise<Models.StockLevel> {
1148
+ let params: { id: string };
1149
+
1150
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1151
+ params = (paramsOrFirst || {}) as { id: string };
1152
+ } else {
1153
+ params = {
1154
+ id: paramsOrFirst as string
1155
+ };
1156
+ }
1157
+
1158
+ const id = params.id;
1159
+
1160
+ if (typeof id === 'undefined') {
1161
+ throw new RevenexxException('Missing required parameter: "id"');
1162
+ }
1163
+
1164
+ const apiPath = '/v1/inventories/stock/{id}'.replace('{id}', id);
1165
+ const apiPayload: Payload = {};
1166
+ const uri = new URL(this.client.config.endpoint + apiPath);
1167
+
1168
+ const apiHeaders: { [header: string]: string } = {
1169
+ }
1170
+
1171
+ return this.client.call(
1172
+ 'get',
1173
+ uri,
1174
+ apiHeaders,
1175
+ apiPayload
1176
+ );
1177
+ }
1178
+
1179
+ /**
1180
+ *
1181
+ * @param {string} params.id -
1182
+ * @param {string} params.locationId - Owning location.
1183
+ * @param {object} params.metadata - Free-form metadata.
1184
+ * @param {number} params.onHand - Physical stock (default 0).
1185
+ * @param {string} params.productId - Tracked product.
1186
+ * @param {number} params.reorderPoint -
1187
+ * @param {number} params.reserved - Reserved stock (default 0) — normally managed by reserve/release/commit.
1188
+ * @param {string} params.sku - Tracked SKU (alternative to product_id).
1189
+ * @throws {RevenexxException}
1190
+ * @returns {Promise<Models.StockLevel>}
1191
+ */
1192
+ inventoriesStockUpdate(params: { id: string, locationId?: string, metadata?: object, onHand?: number, productId?: string, reorderPoint?: number, reserved?: number, sku?: string }): Promise<Models.StockLevel>;
1193
+ /**
1194
+ *
1195
+ * @param {string} id -
1196
+ * @param {string} locationId - Owning location.
1197
+ * @param {object} metadata - Free-form metadata.
1198
+ * @param {number} onHand - Physical stock (default 0).
1199
+ * @param {string} productId - Tracked product.
1200
+ * @param {number} reorderPoint -
1201
+ * @param {number} reserved - Reserved stock (default 0) — normally managed by reserve/release/commit.
1202
+ * @param {string} sku - Tracked SKU (alternative to product_id).
1203
+ * @throws {RevenexxException}
1204
+ * @returns {Promise<Models.StockLevel>}
1205
+ * @deprecated Use the object parameter style method for a better developer experience.
1206
+ */
1207
+ inventoriesStockUpdate(id: string, locationId?: string, metadata?: object, onHand?: number, productId?: string, reorderPoint?: number, reserved?: number, sku?: string): Promise<Models.StockLevel>;
1208
+ inventoriesStockUpdate(
1209
+ paramsOrFirst: { id: string, locationId?: string, metadata?: object, onHand?: number, productId?: string, reorderPoint?: number, reserved?: number, sku?: string } | string,
1210
+ ...rest: [(string)?, (object)?, (number)?, (string)?, (number)?, (number)?, (string)?]
1211
+ ): Promise<Models.StockLevel> {
1212
+ let params: { id: string, locationId?: string, metadata?: object, onHand?: number, productId?: string, reorderPoint?: number, reserved?: number, sku?: string };
1213
+
1214
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1215
+ params = (paramsOrFirst || {}) as { id: string, locationId?: string, metadata?: object, onHand?: number, productId?: string, reorderPoint?: number, reserved?: number, sku?: string };
1216
+ } else {
1217
+ params = {
1218
+ id: paramsOrFirst as string,
1219
+ locationId: rest[0] as string,
1220
+ metadata: rest[1] as object,
1221
+ onHand: rest[2] as number,
1222
+ productId: rest[3] as string,
1223
+ reorderPoint: rest[4] as number,
1224
+ reserved: rest[5] as number,
1225
+ sku: rest[6] as string
1226
+ };
1227
+ }
1228
+
1229
+ const id = params.id;
1230
+ const locationId = params.locationId;
1231
+ const metadata = params.metadata;
1232
+ const onHand = params.onHand;
1233
+ const productId = params.productId;
1234
+ const reorderPoint = params.reorderPoint;
1235
+ const reserved = params.reserved;
1236
+ const sku = params.sku;
1237
+
1238
+ if (typeof id === 'undefined') {
1239
+ throw new RevenexxException('Missing required parameter: "id"');
1240
+ }
1241
+
1242
+ const apiPath = '/v1/inventories/stock/{id}'.replace('{id}', id);
1243
+ const apiPayload: Payload = {};
1244
+ if (typeof locationId !== 'undefined') {
1245
+ apiPayload['location_id'] = locationId;
1246
+ }
1247
+ if (typeof metadata !== 'undefined') {
1248
+ apiPayload['metadata'] = metadata;
1249
+ }
1250
+ if (typeof onHand !== 'undefined') {
1251
+ apiPayload['on_hand'] = onHand;
1252
+ }
1253
+ if (typeof productId !== 'undefined') {
1254
+ apiPayload['product_id'] = productId;
1255
+ }
1256
+ if (typeof reorderPoint !== 'undefined') {
1257
+ apiPayload['reorder_point'] = reorderPoint;
1258
+ }
1259
+ if (typeof reserved !== 'undefined') {
1260
+ apiPayload['reserved'] = reserved;
1261
+ }
1262
+ if (typeof sku !== 'undefined') {
1263
+ apiPayload['sku'] = sku;
1264
+ }
1265
+ const uri = new URL(this.client.config.endpoint + apiPath);
1266
+
1267
+ const apiHeaders: { [header: string]: string } = {
1268
+ 'content-type': 'application/json',
1269
+ }
1270
+
1271
+ return this.client.call(
1272
+ 'put',
1273
+ uri,
1274
+ apiHeaders,
1275
+ apiPayload
1276
+ );
1277
+ }
1278
+ }