@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,956 @@
1
+ import { Service } from '../service';
2
+ import { RevenexxException, Client, type Payload, UploadProgress } from '../client';
3
+ import type { Models } from '../models';
4
+
5
+ import { ShippingMethodMatrixBasis } from '../enums/shipping-method-matrix-basis';
6
+ import { ShippingMethodPricingType } from '../enums/shipping-method-pricing-type';
7
+
8
+ export class Shipping {
9
+ client: Client;
10
+
11
+ constructor(client: Client) {
12
+ this.client = client;
13
+ }
14
+
15
+ /**
16
+ *
17
+ * @throws {RevenexxException}
18
+ * @returns {Promise<{}>}
19
+ */
20
+ shippingMethodsList(): Promise<{}> {
21
+
22
+ const apiPath = '/v1/shipping/methods';
23
+ const apiPayload: Payload = {};
24
+ const uri = new URL(this.client.config.endpoint + apiPath);
25
+
26
+ const apiHeaders: { [header: string]: string } = {
27
+ }
28
+
29
+ return this.client.call(
30
+ 'get',
31
+ uri,
32
+ apiHeaders,
33
+ apiPayload
34
+ );
35
+ }
36
+
37
+ /**
38
+ *
39
+ * @param {string} params.code - Stable method code, unique per tenant (e.g. standard, express).
40
+ * @param {string} params.name - Display name.
41
+ * @param {string} params.carrier - Carrier anchor for the upcoming carrier connect (dynamic rates, tracking links).
42
+ * @param {string[]} params.countries - Allowed ISO 3166-1 alpha-2 codes; null or empty = worldwide.
43
+ * @param {string} params.currency - ISO 4217 code (default EUR).
44
+ * @param {string} params.description -
45
+ * @param {boolean} params.enabled - Only enabled methods appear in rate responses (default false).
46
+ * @param {number} params.etaDaysMax - Delivery-time estimate for the checkout (days, upper bound).
47
+ * @param {number} params.etaDaysMin - Delivery-time estimate for the checkout (days, lower bound).
48
+ * @param {number} params.freeAbove - Free shipping at or above this order value — wins over every pricing model.
49
+ * @param {object} params.labels - Localized display names keyed by locale (e.g. {de, en}).
50
+ * @param {string} params.matrixAttribute - Attribute name for matrix_basis 'attribute'.
51
+ * @param {ShippingMethodMatrixBasis} params.matrixBasis - The measure a matrix method prices over; 'attribute' reads matrix_attribute from the rate request.
52
+ * @param {object} params.metadata - Free-form metadata.
53
+ * @param {number} params.position - Sort order in the checkout (default 0).
54
+ * @param {number} params.price - The fixed price (default 0) — ignored for 'free' and 'matrix'.
55
+ * @param {ShippingMethodPricingType} params.pricingType - Pricing model (default 'fixed'): one price, no price, or tiered over a measure.
56
+ * @throws {RevenexxException}
57
+ * @returns {Promise<Models.ShippingMethod>}
58
+ */
59
+ shippingMethodsCreate(params: { code: string, name: string, carrier?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, position?: number, price?: number, pricingType?: ShippingMethodPricingType }): Promise<Models.ShippingMethod>;
60
+ /**
61
+ *
62
+ * @param {string} code - Stable method code, unique per tenant (e.g. standard, express).
63
+ * @param {string} name - Display name.
64
+ * @param {string} carrier - Carrier anchor for the upcoming carrier connect (dynamic rates, tracking links).
65
+ * @param {string[]} countries - Allowed ISO 3166-1 alpha-2 codes; null or empty = worldwide.
66
+ * @param {string} currency - ISO 4217 code (default EUR).
67
+ * @param {string} description -
68
+ * @param {boolean} enabled - Only enabled methods appear in rate responses (default false).
69
+ * @param {number} etaDaysMax - Delivery-time estimate for the checkout (days, upper bound).
70
+ * @param {number} etaDaysMin - Delivery-time estimate for the checkout (days, lower bound).
71
+ * @param {number} freeAbove - Free shipping at or above this order value — wins over every pricing model.
72
+ * @param {object} labels - Localized display names keyed by locale (e.g. {de, en}).
73
+ * @param {string} matrixAttribute - Attribute name for matrix_basis 'attribute'.
74
+ * @param {ShippingMethodMatrixBasis} matrixBasis - The measure a matrix method prices over; 'attribute' reads matrix_attribute from the rate request.
75
+ * @param {object} metadata - Free-form metadata.
76
+ * @param {number} position - Sort order in the checkout (default 0).
77
+ * @param {number} price - The fixed price (default 0) — ignored for 'free' and 'matrix'.
78
+ * @param {ShippingMethodPricingType} pricingType - Pricing model (default 'fixed'): one price, no price, or tiered over a measure.
79
+ * @throws {RevenexxException}
80
+ * @returns {Promise<Models.ShippingMethod>}
81
+ * @deprecated Use the object parameter style method for a better developer experience.
82
+ */
83
+ shippingMethodsCreate(code: string, name: string, carrier?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, position?: number, price?: number, pricingType?: ShippingMethodPricingType): Promise<Models.ShippingMethod>;
84
+ shippingMethodsCreate(
85
+ paramsOrFirst: { code: string, name: string, carrier?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, position?: number, price?: number, pricingType?: ShippingMethodPricingType } | string,
86
+ ...rest: [(string)?, (string)?, (string[])?, (string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (object)?, (string)?, (ShippingMethodMatrixBasis)?, (object)?, (number)?, (number)?, (ShippingMethodPricingType)?]
87
+ ): Promise<Models.ShippingMethod> {
88
+ let params: { code: string, name: string, carrier?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, position?: number, price?: number, pricingType?: ShippingMethodPricingType };
89
+
90
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
91
+ params = (paramsOrFirst || {}) as { code: string, name: string, carrier?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, position?: number, price?: number, pricingType?: ShippingMethodPricingType };
92
+ } else {
93
+ params = {
94
+ code: paramsOrFirst as string,
95
+ name: rest[0] as string,
96
+ carrier: rest[1] as string,
97
+ countries: rest[2] as string[],
98
+ currency: rest[3] as string,
99
+ description: rest[4] as string,
100
+ enabled: rest[5] as boolean,
101
+ etaDaysMax: rest[6] as number,
102
+ etaDaysMin: rest[7] as number,
103
+ freeAbove: rest[8] as number,
104
+ labels: rest[9] as object,
105
+ matrixAttribute: rest[10] as string,
106
+ matrixBasis: rest[11] as ShippingMethodMatrixBasis,
107
+ metadata: rest[12] as object,
108
+ position: rest[13] as number,
109
+ price: rest[14] as number,
110
+ pricingType: rest[15] as ShippingMethodPricingType
111
+ };
112
+ }
113
+
114
+ const code = params.code;
115
+ const name = params.name;
116
+ const carrier = params.carrier;
117
+ const countries = params.countries;
118
+ const currency = params.currency;
119
+ const description = params.description;
120
+ const enabled = params.enabled;
121
+ const etaDaysMax = params.etaDaysMax;
122
+ const etaDaysMin = params.etaDaysMin;
123
+ const freeAbove = params.freeAbove;
124
+ const labels = params.labels;
125
+ const matrixAttribute = params.matrixAttribute;
126
+ const matrixBasis = params.matrixBasis;
127
+ const metadata = params.metadata;
128
+ const position = params.position;
129
+ const price = params.price;
130
+ const pricingType = params.pricingType;
131
+
132
+ if (typeof code === 'undefined') {
133
+ throw new RevenexxException('Missing required parameter: "code"');
134
+ }
135
+ if (typeof name === 'undefined') {
136
+ throw new RevenexxException('Missing required parameter: "name"');
137
+ }
138
+
139
+ const apiPath = '/v1/shipping/methods';
140
+ const apiPayload: Payload = {};
141
+ if (typeof carrier !== 'undefined') {
142
+ apiPayload['carrier'] = carrier;
143
+ }
144
+ if (typeof code !== 'undefined') {
145
+ apiPayload['code'] = code;
146
+ }
147
+ if (typeof countries !== 'undefined') {
148
+ apiPayload['countries'] = countries;
149
+ }
150
+ if (typeof currency !== 'undefined') {
151
+ apiPayload['currency'] = currency;
152
+ }
153
+ if (typeof description !== 'undefined') {
154
+ apiPayload['description'] = description;
155
+ }
156
+ if (typeof enabled !== 'undefined') {
157
+ apiPayload['enabled'] = enabled;
158
+ }
159
+ if (typeof etaDaysMax !== 'undefined') {
160
+ apiPayload['eta_days_max'] = etaDaysMax;
161
+ }
162
+ if (typeof etaDaysMin !== 'undefined') {
163
+ apiPayload['eta_days_min'] = etaDaysMin;
164
+ }
165
+ if (typeof freeAbove !== 'undefined') {
166
+ apiPayload['free_above'] = freeAbove;
167
+ }
168
+ if (typeof labels !== 'undefined') {
169
+ apiPayload['labels'] = labels;
170
+ }
171
+ if (typeof matrixAttribute !== 'undefined') {
172
+ apiPayload['matrix_attribute'] = matrixAttribute;
173
+ }
174
+ if (typeof matrixBasis !== 'undefined') {
175
+ apiPayload['matrix_basis'] = matrixBasis;
176
+ }
177
+ if (typeof metadata !== 'undefined') {
178
+ apiPayload['metadata'] = metadata;
179
+ }
180
+ if (typeof name !== 'undefined') {
181
+ apiPayload['name'] = name;
182
+ }
183
+ if (typeof position !== 'undefined') {
184
+ apiPayload['position'] = position;
185
+ }
186
+ if (typeof price !== 'undefined') {
187
+ apiPayload['price'] = price;
188
+ }
189
+ if (typeof pricingType !== 'undefined') {
190
+ apiPayload['pricing_type'] = pricingType;
191
+ }
192
+ const uri = new URL(this.client.config.endpoint + apiPath);
193
+
194
+ const apiHeaders: { [header: string]: string } = {
195
+ 'content-type': 'application/json',
196
+ }
197
+
198
+ return this.client.call(
199
+ 'post',
200
+ uri,
201
+ apiHeaders,
202
+ apiPayload
203
+ );
204
+ }
205
+
206
+ /**
207
+ *
208
+ * @throws {RevenexxException}
209
+ * @returns {Promise<{}>}
210
+ */
211
+ shippingMethodsDefaults(): Promise<{}> {
212
+
213
+ const apiPath = '/v1/shipping/methods/defaults';
214
+ const apiPayload: Payload = {};
215
+ const uri = new URL(this.client.config.endpoint + apiPath);
216
+
217
+ const apiHeaders: { [header: string]: string } = {
218
+ }
219
+
220
+ return this.client.call(
221
+ 'post',
222
+ uri,
223
+ apiHeaders,
224
+ apiPayload
225
+ );
226
+ }
227
+
228
+ /**
229
+ *
230
+ * @param {string} params.id -
231
+ * @throws {RevenexxException}
232
+ * @returns {Promise<{}>}
233
+ */
234
+ shippingMethodsDelete(params: { id: string }): Promise<{}>;
235
+ /**
236
+ *
237
+ * @param {string} id -
238
+ * @throws {RevenexxException}
239
+ * @returns {Promise<{}>}
240
+ * @deprecated Use the object parameter style method for a better developer experience.
241
+ */
242
+ shippingMethodsDelete(id: string): Promise<{}>;
243
+ shippingMethodsDelete(
244
+ paramsOrFirst: { id: string } | string
245
+ ): Promise<{}> {
246
+ let params: { id: string };
247
+
248
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
249
+ params = (paramsOrFirst || {}) as { id: string };
250
+ } else {
251
+ params = {
252
+ id: paramsOrFirst as string
253
+ };
254
+ }
255
+
256
+ const id = params.id;
257
+
258
+ if (typeof id === 'undefined') {
259
+ throw new RevenexxException('Missing required parameter: "id"');
260
+ }
261
+
262
+ const apiPath = '/v1/shipping/methods/{id}'.replace('{id}', id);
263
+ const apiPayload: Payload = {};
264
+ const uri = new URL(this.client.config.endpoint + apiPath);
265
+
266
+ const apiHeaders: { [header: string]: string } = {
267
+ }
268
+
269
+ return this.client.call(
270
+ 'delete',
271
+ uri,
272
+ apiHeaders,
273
+ apiPayload
274
+ );
275
+ }
276
+
277
+ /**
278
+ *
279
+ * @param {string} params.id -
280
+ * @throws {RevenexxException}
281
+ * @returns {Promise<Models.ShippingMethod>}
282
+ */
283
+ shippingMethodsGet(params: { id: string }): Promise<Models.ShippingMethod>;
284
+ /**
285
+ *
286
+ * @param {string} id -
287
+ * @throws {RevenexxException}
288
+ * @returns {Promise<Models.ShippingMethod>}
289
+ * @deprecated Use the object parameter style method for a better developer experience.
290
+ */
291
+ shippingMethodsGet(id: string): Promise<Models.ShippingMethod>;
292
+ shippingMethodsGet(
293
+ paramsOrFirst: { id: string } | string
294
+ ): Promise<Models.ShippingMethod> {
295
+ let params: { id: string };
296
+
297
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
298
+ params = (paramsOrFirst || {}) as { id: string };
299
+ } else {
300
+ params = {
301
+ id: paramsOrFirst as string
302
+ };
303
+ }
304
+
305
+ const id = params.id;
306
+
307
+ if (typeof id === 'undefined') {
308
+ throw new RevenexxException('Missing required parameter: "id"');
309
+ }
310
+
311
+ const apiPath = '/v1/shipping/methods/{id}'.replace('{id}', id);
312
+ const apiPayload: Payload = {};
313
+ const uri = new URL(this.client.config.endpoint + apiPath);
314
+
315
+ const apiHeaders: { [header: string]: string } = {
316
+ }
317
+
318
+ return this.client.call(
319
+ 'get',
320
+ uri,
321
+ apiHeaders,
322
+ apiPayload
323
+ );
324
+ }
325
+
326
+ /**
327
+ *
328
+ * @param {string} params.id -
329
+ * @param {string} params.carrier - Carrier anchor for the upcoming carrier connect (dynamic rates, tracking links).
330
+ * @param {string} params.code - Stable method code, unique per tenant (e.g. standard, express).
331
+ * @param {string[]} params.countries - Allowed ISO 3166-1 alpha-2 codes; null or empty = worldwide.
332
+ * @param {string} params.currency - ISO 4217 code (default EUR).
333
+ * @param {string} params.description -
334
+ * @param {boolean} params.enabled - Only enabled methods appear in rate responses (default false).
335
+ * @param {number} params.etaDaysMax - Delivery-time estimate for the checkout (days, upper bound).
336
+ * @param {number} params.etaDaysMin - Delivery-time estimate for the checkout (days, lower bound).
337
+ * @param {number} params.freeAbove - Free shipping at or above this order value — wins over every pricing model.
338
+ * @param {object} params.labels - Localized display names keyed by locale (e.g. {de, en}).
339
+ * @param {string} params.matrixAttribute - Attribute name for matrix_basis 'attribute'.
340
+ * @param {ShippingMethodMatrixBasis} params.matrixBasis - The measure a matrix method prices over; 'attribute' reads matrix_attribute from the rate request.
341
+ * @param {object} params.metadata - Free-form metadata.
342
+ * @param {string} params.name - Display name.
343
+ * @param {number} params.position - Sort order in the checkout (default 0).
344
+ * @param {number} params.price - The fixed price (default 0) — ignored for 'free' and 'matrix'.
345
+ * @param {ShippingMethodPricingType} params.pricingType - Pricing model (default 'fixed'): one price, no price, or tiered over a measure.
346
+ * @throws {RevenexxException}
347
+ * @returns {Promise<Models.ShippingMethod>}
348
+ */
349
+ shippingMethodsUpdate(params: { id: string, carrier?: string, code?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, name?: string, position?: number, price?: number, pricingType?: ShippingMethodPricingType }): Promise<Models.ShippingMethod>;
350
+ /**
351
+ *
352
+ * @param {string} id -
353
+ * @param {string} carrier - Carrier anchor for the upcoming carrier connect (dynamic rates, tracking links).
354
+ * @param {string} code - Stable method code, unique per tenant (e.g. standard, express).
355
+ * @param {string[]} countries - Allowed ISO 3166-1 alpha-2 codes; null or empty = worldwide.
356
+ * @param {string} currency - ISO 4217 code (default EUR).
357
+ * @param {string} description -
358
+ * @param {boolean} enabled - Only enabled methods appear in rate responses (default false).
359
+ * @param {number} etaDaysMax - Delivery-time estimate for the checkout (days, upper bound).
360
+ * @param {number} etaDaysMin - Delivery-time estimate for the checkout (days, lower bound).
361
+ * @param {number} freeAbove - Free shipping at or above this order value — wins over every pricing model.
362
+ * @param {object} labels - Localized display names keyed by locale (e.g. {de, en}).
363
+ * @param {string} matrixAttribute - Attribute name for matrix_basis 'attribute'.
364
+ * @param {ShippingMethodMatrixBasis} matrixBasis - The measure a matrix method prices over; 'attribute' reads matrix_attribute from the rate request.
365
+ * @param {object} metadata - Free-form metadata.
366
+ * @param {string} name - Display name.
367
+ * @param {number} position - Sort order in the checkout (default 0).
368
+ * @param {number} price - The fixed price (default 0) — ignored for 'free' and 'matrix'.
369
+ * @param {ShippingMethodPricingType} pricingType - Pricing model (default 'fixed'): one price, no price, or tiered over a measure.
370
+ * @throws {RevenexxException}
371
+ * @returns {Promise<Models.ShippingMethod>}
372
+ * @deprecated Use the object parameter style method for a better developer experience.
373
+ */
374
+ shippingMethodsUpdate(id: string, carrier?: string, code?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, name?: string, position?: number, price?: number, pricingType?: ShippingMethodPricingType): Promise<Models.ShippingMethod>;
375
+ shippingMethodsUpdate(
376
+ paramsOrFirst: { id: string, carrier?: string, code?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, name?: string, position?: number, price?: number, pricingType?: ShippingMethodPricingType } | string,
377
+ ...rest: [(string)?, (string)?, (string[])?, (string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (object)?, (string)?, (ShippingMethodMatrixBasis)?, (object)?, (string)?, (number)?, (number)?, (ShippingMethodPricingType)?]
378
+ ): Promise<Models.ShippingMethod> {
379
+ let params: { id: string, carrier?: string, code?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, name?: string, position?: number, price?: number, pricingType?: ShippingMethodPricingType };
380
+
381
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
382
+ params = (paramsOrFirst || {}) as { id: string, carrier?: string, code?: string, countries?: string[], currency?: string, description?: string, enabled?: boolean, etaDaysMax?: number, etaDaysMin?: number, freeAbove?: number, labels?: object, matrixAttribute?: string, matrixBasis?: ShippingMethodMatrixBasis, metadata?: object, name?: string, position?: number, price?: number, pricingType?: ShippingMethodPricingType };
383
+ } else {
384
+ params = {
385
+ id: paramsOrFirst as string,
386
+ carrier: rest[0] as string,
387
+ code: rest[1] as string,
388
+ countries: rest[2] as string[],
389
+ currency: rest[3] as string,
390
+ description: rest[4] as string,
391
+ enabled: rest[5] as boolean,
392
+ etaDaysMax: rest[6] as number,
393
+ etaDaysMin: rest[7] as number,
394
+ freeAbove: rest[8] as number,
395
+ labels: rest[9] as object,
396
+ matrixAttribute: rest[10] as string,
397
+ matrixBasis: rest[11] as ShippingMethodMatrixBasis,
398
+ metadata: rest[12] as object,
399
+ name: rest[13] as string,
400
+ position: rest[14] as number,
401
+ price: rest[15] as number,
402
+ pricingType: rest[16] as ShippingMethodPricingType
403
+ };
404
+ }
405
+
406
+ const id = params.id;
407
+ const carrier = params.carrier;
408
+ const code = params.code;
409
+ const countries = params.countries;
410
+ const currency = params.currency;
411
+ const description = params.description;
412
+ const enabled = params.enabled;
413
+ const etaDaysMax = params.etaDaysMax;
414
+ const etaDaysMin = params.etaDaysMin;
415
+ const freeAbove = params.freeAbove;
416
+ const labels = params.labels;
417
+ const matrixAttribute = params.matrixAttribute;
418
+ const matrixBasis = params.matrixBasis;
419
+ const metadata = params.metadata;
420
+ const name = params.name;
421
+ const position = params.position;
422
+ const price = params.price;
423
+ const pricingType = params.pricingType;
424
+
425
+ if (typeof id === 'undefined') {
426
+ throw new RevenexxException('Missing required parameter: "id"');
427
+ }
428
+
429
+ const apiPath = '/v1/shipping/methods/{id}'.replace('{id}', id);
430
+ const apiPayload: Payload = {};
431
+ if (typeof carrier !== 'undefined') {
432
+ apiPayload['carrier'] = carrier;
433
+ }
434
+ if (typeof code !== 'undefined') {
435
+ apiPayload['code'] = code;
436
+ }
437
+ if (typeof countries !== 'undefined') {
438
+ apiPayload['countries'] = countries;
439
+ }
440
+ if (typeof currency !== 'undefined') {
441
+ apiPayload['currency'] = currency;
442
+ }
443
+ if (typeof description !== 'undefined') {
444
+ apiPayload['description'] = description;
445
+ }
446
+ if (typeof enabled !== 'undefined') {
447
+ apiPayload['enabled'] = enabled;
448
+ }
449
+ if (typeof etaDaysMax !== 'undefined') {
450
+ apiPayload['eta_days_max'] = etaDaysMax;
451
+ }
452
+ if (typeof etaDaysMin !== 'undefined') {
453
+ apiPayload['eta_days_min'] = etaDaysMin;
454
+ }
455
+ if (typeof freeAbove !== 'undefined') {
456
+ apiPayload['free_above'] = freeAbove;
457
+ }
458
+ if (typeof labels !== 'undefined') {
459
+ apiPayload['labels'] = labels;
460
+ }
461
+ if (typeof matrixAttribute !== 'undefined') {
462
+ apiPayload['matrix_attribute'] = matrixAttribute;
463
+ }
464
+ if (typeof matrixBasis !== 'undefined') {
465
+ apiPayload['matrix_basis'] = matrixBasis;
466
+ }
467
+ if (typeof metadata !== 'undefined') {
468
+ apiPayload['metadata'] = metadata;
469
+ }
470
+ if (typeof name !== 'undefined') {
471
+ apiPayload['name'] = name;
472
+ }
473
+ if (typeof position !== 'undefined') {
474
+ apiPayload['position'] = position;
475
+ }
476
+ if (typeof price !== 'undefined') {
477
+ apiPayload['price'] = price;
478
+ }
479
+ if (typeof pricingType !== 'undefined') {
480
+ apiPayload['pricing_type'] = pricingType;
481
+ }
482
+ const uri = new URL(this.client.config.endpoint + apiPath);
483
+
484
+ const apiHeaders: { [header: string]: string } = {
485
+ 'content-type': 'application/json',
486
+ }
487
+
488
+ return this.client.call(
489
+ 'put',
490
+ uri,
491
+ apiHeaders,
492
+ apiPayload
493
+ );
494
+ }
495
+
496
+ /**
497
+ *
498
+ * @param {string} params.methodId -
499
+ * @throws {RevenexxException}
500
+ * @returns {Promise<{}>}
501
+ */
502
+ shippingTiersList(params: { methodId: string }): Promise<{}>;
503
+ /**
504
+ *
505
+ * @param {string} methodId -
506
+ * @throws {RevenexxException}
507
+ * @returns {Promise<{}>}
508
+ * @deprecated Use the object parameter style method for a better developer experience.
509
+ */
510
+ shippingTiersList(methodId: string): Promise<{}>;
511
+ shippingTiersList(
512
+ paramsOrFirst: { methodId: string } | string
513
+ ): Promise<{}> {
514
+ let params: { methodId: string };
515
+
516
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
517
+ params = (paramsOrFirst || {}) as { methodId: string };
518
+ } else {
519
+ params = {
520
+ methodId: paramsOrFirst as string
521
+ };
522
+ }
523
+
524
+ const methodId = params.methodId;
525
+
526
+ if (typeof methodId === 'undefined') {
527
+ throw new RevenexxException('Missing required parameter: "methodId"');
528
+ }
529
+
530
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{method_id}', methodId);
531
+ const apiPayload: Payload = {};
532
+ const uri = new URL(this.client.config.endpoint + apiPath);
533
+
534
+ const apiHeaders: { [header: string]: string } = {
535
+ }
536
+
537
+ return this.client.call(
538
+ 'get',
539
+ uri,
540
+ apiHeaders,
541
+ apiPayload
542
+ );
543
+ }
544
+
545
+ /**
546
+ *
547
+ * @param {string} params.methodId -
548
+ * @param {number} params.fromValue - Tier threshold (default 0) — the tier with the highest from_value at or below the measured value wins.
549
+ * @param {number} params.position - Sort order (default 0; bulk replace derives it from the array index).
550
+ * @param {number} params.price - Price of this tier (default 0).
551
+ * @throws {RevenexxException}
552
+ * @returns {Promise<Models.ShippingRateTier>}
553
+ */
554
+ shippingTiersCreate(params: { methodId: string, fromValue?: number, position?: number, price?: number }): Promise<Models.ShippingRateTier>;
555
+ /**
556
+ *
557
+ * @param {string} methodId -
558
+ * @param {number} fromValue - Tier threshold (default 0) — the tier with the highest from_value at or below the measured value wins.
559
+ * @param {number} position - Sort order (default 0; bulk replace derives it from the array index).
560
+ * @param {number} price - Price of this tier (default 0).
561
+ * @throws {RevenexxException}
562
+ * @returns {Promise<Models.ShippingRateTier>}
563
+ * @deprecated Use the object parameter style method for a better developer experience.
564
+ */
565
+ shippingTiersCreate(methodId: string, fromValue?: number, position?: number, price?: number): Promise<Models.ShippingRateTier>;
566
+ shippingTiersCreate(
567
+ paramsOrFirst: { methodId: string, fromValue?: number, position?: number, price?: number } | string,
568
+ ...rest: [(number)?, (number)?, (number)?]
569
+ ): Promise<Models.ShippingRateTier> {
570
+ let params: { methodId: string, fromValue?: number, position?: number, price?: number };
571
+
572
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
573
+ params = (paramsOrFirst || {}) as { methodId: string, fromValue?: number, position?: number, price?: number };
574
+ } else {
575
+ params = {
576
+ methodId: paramsOrFirst as string,
577
+ fromValue: rest[0] as number,
578
+ position: rest[1] as number,
579
+ price: rest[2] as number
580
+ };
581
+ }
582
+
583
+ const methodId = params.methodId;
584
+ const fromValue = params.fromValue;
585
+ const position = params.position;
586
+ const price = params.price;
587
+
588
+ if (typeof methodId === 'undefined') {
589
+ throw new RevenexxException('Missing required parameter: "methodId"');
590
+ }
591
+
592
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{method_id}', methodId);
593
+ const apiPayload: Payload = {};
594
+ if (typeof fromValue !== 'undefined') {
595
+ apiPayload['from_value'] = fromValue;
596
+ }
597
+ if (typeof position !== 'undefined') {
598
+ apiPayload['position'] = position;
599
+ }
600
+ if (typeof price !== 'undefined') {
601
+ apiPayload['price'] = price;
602
+ }
603
+ const uri = new URL(this.client.config.endpoint + apiPath);
604
+
605
+ const apiHeaders: { [header: string]: string } = {
606
+ 'content-type': 'application/json',
607
+ }
608
+
609
+ return this.client.call(
610
+ 'post',
611
+ uri,
612
+ apiHeaders,
613
+ apiPayload
614
+ );
615
+ }
616
+
617
+ /**
618
+ *
619
+ * @param {string} params.methodId -
620
+ * @param {Models.ShippingRateTierCreateRequest[]} params.tiers - The complete new tier set (set semantics) — positions are derived from the array order.
621
+ * @throws {RevenexxException}
622
+ * @returns {Promise<{}>}
623
+ */
624
+ shippingTiersReplace(params: { methodId: string, tiers: Models.ShippingRateTierCreateRequest[] }): Promise<{}>;
625
+ /**
626
+ *
627
+ * @param {string} methodId -
628
+ * @param {Models.ShippingRateTierCreateRequest[]} tiers - The complete new tier set (set semantics) — positions are derived from the array order.
629
+ * @throws {RevenexxException}
630
+ * @returns {Promise<{}>}
631
+ * @deprecated Use the object parameter style method for a better developer experience.
632
+ */
633
+ shippingTiersReplace(methodId: string, tiers: Models.ShippingRateTierCreateRequest[]): Promise<{}>;
634
+ shippingTiersReplace(
635
+ paramsOrFirst: { methodId: string, tiers: Models.ShippingRateTierCreateRequest[] } | string,
636
+ ...rest: [(Models.ShippingRateTierCreateRequest[])?]
637
+ ): Promise<{}> {
638
+ let params: { methodId: string, tiers: Models.ShippingRateTierCreateRequest[] };
639
+
640
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
641
+ params = (paramsOrFirst || {}) as { methodId: string, tiers: Models.ShippingRateTierCreateRequest[] };
642
+ } else {
643
+ params = {
644
+ methodId: paramsOrFirst as string,
645
+ tiers: rest[0] as Models.ShippingRateTierCreateRequest[]
646
+ };
647
+ }
648
+
649
+ const methodId = params.methodId;
650
+ const tiers = params.tiers;
651
+
652
+ if (typeof methodId === 'undefined') {
653
+ throw new RevenexxException('Missing required parameter: "methodId"');
654
+ }
655
+ if (typeof tiers === 'undefined') {
656
+ throw new RevenexxException('Missing required parameter: "tiers"');
657
+ }
658
+
659
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{method_id}', methodId);
660
+ const apiPayload: Payload = {};
661
+ if (typeof tiers !== 'undefined') {
662
+ apiPayload['tiers'] = tiers;
663
+ }
664
+ const uri = new URL(this.client.config.endpoint + apiPath);
665
+
666
+ const apiHeaders: { [header: string]: string } = {
667
+ 'content-type': 'application/json',
668
+ }
669
+
670
+ return this.client.call(
671
+ 'put',
672
+ uri,
673
+ apiHeaders,
674
+ apiPayload
675
+ );
676
+ }
677
+
678
+ /**
679
+ *
680
+ * @param {string} params.methodId -
681
+ * @param {string} params.id -
682
+ * @throws {RevenexxException}
683
+ * @returns {Promise<{}>}
684
+ */
685
+ shippingTiersDelete(params: { methodId: string, id: string }): Promise<{}>;
686
+ /**
687
+ *
688
+ * @param {string} methodId -
689
+ * @param {string} id -
690
+ * @throws {RevenexxException}
691
+ * @returns {Promise<{}>}
692
+ * @deprecated Use the object parameter style method for a better developer experience.
693
+ */
694
+ shippingTiersDelete(methodId: string, id: string): Promise<{}>;
695
+ shippingTiersDelete(
696
+ paramsOrFirst: { methodId: string, id: string } | string,
697
+ ...rest: [(string)?]
698
+ ): Promise<{}> {
699
+ let params: { methodId: string, id: string };
700
+
701
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
702
+ params = (paramsOrFirst || {}) as { methodId: string, id: string };
703
+ } else {
704
+ params = {
705
+ methodId: paramsOrFirst as string,
706
+ id: rest[0] as string
707
+ };
708
+ }
709
+
710
+ const methodId = params.methodId;
711
+ const id = params.id;
712
+
713
+ if (typeof methodId === 'undefined') {
714
+ throw new RevenexxException('Missing required parameter: "methodId"');
715
+ }
716
+ if (typeof id === 'undefined') {
717
+ throw new RevenexxException('Missing required parameter: "id"');
718
+ }
719
+
720
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{method_id}', methodId).replace('{id}', id);
721
+ const apiPayload: Payload = {};
722
+ const uri = new URL(this.client.config.endpoint + apiPath);
723
+
724
+ const apiHeaders: { [header: string]: string } = {
725
+ }
726
+
727
+ return this.client.call(
728
+ 'delete',
729
+ uri,
730
+ apiHeaders,
731
+ apiPayload
732
+ );
733
+ }
734
+
735
+ /**
736
+ *
737
+ * @param {string} params.methodId -
738
+ * @param {string} params.id -
739
+ * @throws {RevenexxException}
740
+ * @returns {Promise<Models.ShippingRateTier>}
741
+ */
742
+ shippingTiersGet(params: { methodId: string, id: string }): Promise<Models.ShippingRateTier>;
743
+ /**
744
+ *
745
+ * @param {string} methodId -
746
+ * @param {string} id -
747
+ * @throws {RevenexxException}
748
+ * @returns {Promise<Models.ShippingRateTier>}
749
+ * @deprecated Use the object parameter style method for a better developer experience.
750
+ */
751
+ shippingTiersGet(methodId: string, id: string): Promise<Models.ShippingRateTier>;
752
+ shippingTiersGet(
753
+ paramsOrFirst: { methodId: string, id: string } | string,
754
+ ...rest: [(string)?]
755
+ ): Promise<Models.ShippingRateTier> {
756
+ let params: { methodId: string, id: string };
757
+
758
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
759
+ params = (paramsOrFirst || {}) as { methodId: string, id: string };
760
+ } else {
761
+ params = {
762
+ methodId: paramsOrFirst as string,
763
+ id: rest[0] as string
764
+ };
765
+ }
766
+
767
+ const methodId = params.methodId;
768
+ const id = params.id;
769
+
770
+ if (typeof methodId === 'undefined') {
771
+ throw new RevenexxException('Missing required parameter: "methodId"');
772
+ }
773
+ if (typeof id === 'undefined') {
774
+ throw new RevenexxException('Missing required parameter: "id"');
775
+ }
776
+
777
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{method_id}', methodId).replace('{id}', id);
778
+ const apiPayload: Payload = {};
779
+ const uri = new URL(this.client.config.endpoint + apiPath);
780
+
781
+ const apiHeaders: { [header: string]: string } = {
782
+ }
783
+
784
+ return this.client.call(
785
+ 'get',
786
+ uri,
787
+ apiHeaders,
788
+ apiPayload
789
+ );
790
+ }
791
+
792
+ /**
793
+ *
794
+ * @param {string} params.methodId -
795
+ * @param {string} params.id -
796
+ * @param {number} params.fromValue - Tier threshold (default 0) — the tier with the highest from_value at or below the measured value wins.
797
+ * @param {number} params.position - Sort order (default 0; bulk replace derives it from the array index).
798
+ * @param {number} params.price - Price of this tier (default 0).
799
+ * @throws {RevenexxException}
800
+ * @returns {Promise<Models.ShippingRateTier>}
801
+ */
802
+ shippingTiersUpdate(params: { methodId: string, id: string, fromValue?: number, position?: number, price?: number }): Promise<Models.ShippingRateTier>;
803
+ /**
804
+ *
805
+ * @param {string} methodId -
806
+ * @param {string} id -
807
+ * @param {number} fromValue - Tier threshold (default 0) — the tier with the highest from_value at or below the measured value wins.
808
+ * @param {number} position - Sort order (default 0; bulk replace derives it from the array index).
809
+ * @param {number} price - Price of this tier (default 0).
810
+ * @throws {RevenexxException}
811
+ * @returns {Promise<Models.ShippingRateTier>}
812
+ * @deprecated Use the object parameter style method for a better developer experience.
813
+ */
814
+ shippingTiersUpdate(methodId: string, id: string, fromValue?: number, position?: number, price?: number): Promise<Models.ShippingRateTier>;
815
+ shippingTiersUpdate(
816
+ paramsOrFirst: { methodId: string, id: string, fromValue?: number, position?: number, price?: number } | string,
817
+ ...rest: [(string)?, (number)?, (number)?, (number)?]
818
+ ): Promise<Models.ShippingRateTier> {
819
+ let params: { methodId: string, id: string, fromValue?: number, position?: number, price?: number };
820
+
821
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
822
+ params = (paramsOrFirst || {}) as { methodId: string, id: string, fromValue?: number, position?: number, price?: number };
823
+ } else {
824
+ params = {
825
+ methodId: paramsOrFirst as string,
826
+ id: rest[0] as string,
827
+ fromValue: rest[1] as number,
828
+ position: rest[2] as number,
829
+ price: rest[3] as number
830
+ };
831
+ }
832
+
833
+ const methodId = params.methodId;
834
+ const id = params.id;
835
+ const fromValue = params.fromValue;
836
+ const position = params.position;
837
+ const price = params.price;
838
+
839
+ if (typeof methodId === 'undefined') {
840
+ throw new RevenexxException('Missing required parameter: "methodId"');
841
+ }
842
+ if (typeof id === 'undefined') {
843
+ throw new RevenexxException('Missing required parameter: "id"');
844
+ }
845
+
846
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{method_id}', methodId).replace('{id}', id);
847
+ const apiPayload: Payload = {};
848
+ if (typeof fromValue !== 'undefined') {
849
+ apiPayload['from_value'] = fromValue;
850
+ }
851
+ if (typeof position !== 'undefined') {
852
+ apiPayload['position'] = position;
853
+ }
854
+ if (typeof price !== 'undefined') {
855
+ apiPayload['price'] = price;
856
+ }
857
+ const uri = new URL(this.client.config.endpoint + apiPath);
858
+
859
+ const apiHeaders: { [header: string]: string } = {
860
+ 'content-type': 'application/json',
861
+ }
862
+
863
+ return this.client.call(
864
+ 'put',
865
+ uri,
866
+ apiHeaders,
867
+ apiPayload
868
+ );
869
+ }
870
+
871
+ /**
872
+ *
873
+ * @param {object} params.attributes - Measure values for attribute matrices, keyed by attribute name.
874
+ * @param {string} params.country - Destination ISO 3166-1 alpha-2 code — checked against method country restrictions.
875
+ * @param {string} params.currency - Echoed into the rates (default 'EUR').
876
+ * @param {number} params.orderValue - Order value (default 0) — drives free-above thresholds and order_value matrices.
877
+ * @param {number} params.quantity - Total quantity — measure for quantity matrices.
878
+ * @param {number} params.weight - Total weight — measure for weight matrices.
879
+ * @throws {RevenexxException}
880
+ * @returns {Promise<{}>}
881
+ */
882
+ shippingRates(params?: { attributes?: object, country?: string, currency?: string, orderValue?: number, quantity?: number, weight?: number }): Promise<{}>;
883
+ /**
884
+ *
885
+ * @param {object} attributes - Measure values for attribute matrices, keyed by attribute name.
886
+ * @param {string} country - Destination ISO 3166-1 alpha-2 code — checked against method country restrictions.
887
+ * @param {string} currency - Echoed into the rates (default 'EUR').
888
+ * @param {number} orderValue - Order value (default 0) — drives free-above thresholds and order_value matrices.
889
+ * @param {number} quantity - Total quantity — measure for quantity matrices.
890
+ * @param {number} weight - Total weight — measure for weight matrices.
891
+ * @throws {RevenexxException}
892
+ * @returns {Promise<{}>}
893
+ * @deprecated Use the object parameter style method for a better developer experience.
894
+ */
895
+ shippingRates(attributes?: object, country?: string, currency?: string, orderValue?: number, quantity?: number, weight?: number): Promise<{}>;
896
+ shippingRates(
897
+ paramsOrFirst?: { attributes?: object, country?: string, currency?: string, orderValue?: number, quantity?: number, weight?: number } | object,
898
+ ...rest: [(string)?, (string)?, (number)?, (number)?, (number)?]
899
+ ): Promise<{}> {
900
+ let params: { attributes?: object, country?: string, currency?: string, orderValue?: number, quantity?: number, weight?: number };
901
+
902
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('attributes' in paramsOrFirst || 'country' in paramsOrFirst || 'currency' in paramsOrFirst || 'orderValue' in paramsOrFirst || 'quantity' in paramsOrFirst || 'weight' in paramsOrFirst))) {
903
+ params = (paramsOrFirst || {}) as { attributes?: object, country?: string, currency?: string, orderValue?: number, quantity?: number, weight?: number };
904
+ } else {
905
+ params = {
906
+ attributes: paramsOrFirst as object,
907
+ country: rest[0] as string,
908
+ currency: rest[1] as string,
909
+ orderValue: rest[2] as number,
910
+ quantity: rest[3] as number,
911
+ weight: rest[4] as number
912
+ };
913
+ }
914
+
915
+ const attributes = params.attributes;
916
+ const country = params.country;
917
+ const currency = params.currency;
918
+ const orderValue = params.orderValue;
919
+ const quantity = params.quantity;
920
+ const weight = params.weight;
921
+
922
+
923
+ const apiPath = '/v1/shipping/rates';
924
+ const apiPayload: Payload = {};
925
+ if (typeof attributes !== 'undefined') {
926
+ apiPayload['attributes'] = attributes;
927
+ }
928
+ if (typeof country !== 'undefined') {
929
+ apiPayload['country'] = country;
930
+ }
931
+ if (typeof currency !== 'undefined') {
932
+ apiPayload['currency'] = currency;
933
+ }
934
+ if (typeof orderValue !== 'undefined') {
935
+ apiPayload['order_value'] = orderValue;
936
+ }
937
+ if (typeof quantity !== 'undefined') {
938
+ apiPayload['quantity'] = quantity;
939
+ }
940
+ if (typeof weight !== 'undefined') {
941
+ apiPayload['weight'] = weight;
942
+ }
943
+ const uri = new URL(this.client.config.endpoint + apiPath);
944
+
945
+ const apiHeaders: { [header: string]: string } = {
946
+ 'content-type': 'application/json',
947
+ }
948
+
949
+ return this.client.call(
950
+ 'post',
951
+ uri,
952
+ apiHeaders,
953
+ apiPayload
954
+ );
955
+ }
956
+ }