@revenexx/sdk 0.0.2 → 0.0.4

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.
@@ -0,0 +1,571 @@
1
+ import { Service } from '../service';
2
+ import { RevenexxException, Client, type Payload, UploadProgress } from '../client';
3
+ import type { Models } from '../models';
4
+
5
+
6
+ export class Shipping {
7
+ client: Client;
8
+
9
+ constructor(client: Client) {
10
+ this.client = client;
11
+ }
12
+
13
+ /**
14
+ *
15
+ * @throws {RevenexxException}
16
+ * @returns {Promise<{}>}
17
+ */
18
+ shippingMethodsList(): Promise<{}> {
19
+
20
+ const apiPath = '/v1/shipping/methods';
21
+ const payload: Payload = {};
22
+ const uri = new URL(this.client.config.endpoint + apiPath);
23
+
24
+ const apiHeaders: { [header: string]: string } = {
25
+ }
26
+
27
+ return this.client.call(
28
+ 'get',
29
+ uri,
30
+ apiHeaders,
31
+ payload
32
+ );
33
+ }
34
+
35
+ /**
36
+ *
37
+ * @throws {RevenexxException}
38
+ * @returns {Promise<Models.ShippingMethod>}
39
+ */
40
+ shippingMethodsCreate(): Promise<Models.ShippingMethod> {
41
+
42
+ const apiPath = '/v1/shipping/methods';
43
+ const payload: Payload = {};
44
+ const uri = new URL(this.client.config.endpoint + apiPath);
45
+
46
+ const apiHeaders: { [header: string]: string } = {
47
+ 'content-type': 'application/json',
48
+ }
49
+
50
+ return this.client.call(
51
+ 'post',
52
+ uri,
53
+ apiHeaders,
54
+ payload
55
+ );
56
+ }
57
+
58
+ /**
59
+ *
60
+ * @throws {RevenexxException}
61
+ * @returns {Promise<{}>}
62
+ */
63
+ shippingMethodsDefaults(): Promise<{}> {
64
+
65
+ const apiPath = '/v1/shipping/methods/defaults';
66
+ const payload: Payload = {};
67
+ const uri = new URL(this.client.config.endpoint + apiPath);
68
+
69
+ const apiHeaders: { [header: string]: string } = {
70
+ }
71
+
72
+ return this.client.call(
73
+ 'post',
74
+ uri,
75
+ apiHeaders,
76
+ payload
77
+ );
78
+ }
79
+
80
+ /**
81
+ *
82
+ * @param {string} params.id -
83
+ * @throws {RevenexxException}
84
+ * @returns {Promise<{}>}
85
+ */
86
+ shippingMethodsDelete(params: { id: string }): Promise<{}>;
87
+ /**
88
+ *
89
+ * @param {string} id -
90
+ * @throws {RevenexxException}
91
+ * @returns {Promise<{}>}
92
+ * @deprecated Use the object parameter style method for a better developer experience.
93
+ */
94
+ shippingMethodsDelete(id: string): Promise<{}>;
95
+ shippingMethodsDelete(
96
+ paramsOrFirst: { id: string } | string
97
+ ): Promise<{}> {
98
+ let params: { id: string };
99
+
100
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
101
+ params = (paramsOrFirst || {}) as { id: string };
102
+ } else {
103
+ params = {
104
+ id: paramsOrFirst as string
105
+ };
106
+ }
107
+
108
+ const id = params.id;
109
+
110
+ if (typeof id === 'undefined') {
111
+ throw new RevenexxException('Missing required parameter: "id"');
112
+ }
113
+
114
+ const apiPath = '/v1/shipping/methods/{id}'.replace('{id}', id);
115
+ const payload: Payload = {};
116
+ const uri = new URL(this.client.config.endpoint + apiPath);
117
+
118
+ const apiHeaders: { [header: string]: string } = {
119
+ }
120
+
121
+ return this.client.call(
122
+ 'delete',
123
+ uri,
124
+ apiHeaders,
125
+ payload
126
+ );
127
+ }
128
+
129
+ /**
130
+ *
131
+ * @param {string} params.id -
132
+ * @throws {RevenexxException}
133
+ * @returns {Promise<Models.ShippingMethod>}
134
+ */
135
+ shippingMethodsGet(params: { id: string }): Promise<Models.ShippingMethod>;
136
+ /**
137
+ *
138
+ * @param {string} id -
139
+ * @throws {RevenexxException}
140
+ * @returns {Promise<Models.ShippingMethod>}
141
+ * @deprecated Use the object parameter style method for a better developer experience.
142
+ */
143
+ shippingMethodsGet(id: string): Promise<Models.ShippingMethod>;
144
+ shippingMethodsGet(
145
+ paramsOrFirst: { id: string } | string
146
+ ): Promise<Models.ShippingMethod> {
147
+ let params: { id: string };
148
+
149
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
150
+ params = (paramsOrFirst || {}) as { id: string };
151
+ } else {
152
+ params = {
153
+ id: paramsOrFirst as string
154
+ };
155
+ }
156
+
157
+ const id = params.id;
158
+
159
+ if (typeof id === 'undefined') {
160
+ throw new RevenexxException('Missing required parameter: "id"');
161
+ }
162
+
163
+ const apiPath = '/v1/shipping/methods/{id}'.replace('{id}', id);
164
+ const payload: Payload = {};
165
+ const uri = new URL(this.client.config.endpoint + apiPath);
166
+
167
+ const apiHeaders: { [header: string]: string } = {
168
+ }
169
+
170
+ return this.client.call(
171
+ 'get',
172
+ uri,
173
+ apiHeaders,
174
+ payload
175
+ );
176
+ }
177
+
178
+ /**
179
+ *
180
+ * @param {string} params.id -
181
+ * @throws {RevenexxException}
182
+ * @returns {Promise<Models.ShippingMethod>}
183
+ */
184
+ shippingMethodsUpdate(params: { id: string }): Promise<Models.ShippingMethod>;
185
+ /**
186
+ *
187
+ * @param {string} id -
188
+ * @throws {RevenexxException}
189
+ * @returns {Promise<Models.ShippingMethod>}
190
+ * @deprecated Use the object parameter style method for a better developer experience.
191
+ */
192
+ shippingMethodsUpdate(id: string): Promise<Models.ShippingMethod>;
193
+ shippingMethodsUpdate(
194
+ paramsOrFirst: { id: string } | string
195
+ ): Promise<Models.ShippingMethod> {
196
+ let params: { id: string };
197
+
198
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
199
+ params = (paramsOrFirst || {}) as { id: string };
200
+ } else {
201
+ params = {
202
+ id: paramsOrFirst as string
203
+ };
204
+ }
205
+
206
+ const id = params.id;
207
+
208
+ if (typeof id === 'undefined') {
209
+ throw new RevenexxException('Missing required parameter: "id"');
210
+ }
211
+
212
+ const apiPath = '/v1/shipping/methods/{id}'.replace('{id}', id);
213
+ const payload: Payload = {};
214
+ const uri = new URL(this.client.config.endpoint + apiPath);
215
+
216
+ const apiHeaders: { [header: string]: string } = {
217
+ 'content-type': 'application/json',
218
+ }
219
+
220
+ return this.client.call(
221
+ 'put',
222
+ uri,
223
+ apiHeaders,
224
+ payload
225
+ );
226
+ }
227
+
228
+ /**
229
+ *
230
+ * @param {string} params.methodId -
231
+ * @throws {RevenexxException}
232
+ * @returns {Promise<{}>}
233
+ */
234
+ shippingTiersList(params: { methodId: string }): Promise<{}>;
235
+ /**
236
+ *
237
+ * @param {string} methodId -
238
+ * @throws {RevenexxException}
239
+ * @returns {Promise<{}>}
240
+ * @deprecated Use the object parameter style method for a better developer experience.
241
+ */
242
+ shippingTiersList(methodId: string): Promise<{}>;
243
+ shippingTiersList(
244
+ paramsOrFirst: { methodId: string } | string
245
+ ): Promise<{}> {
246
+ let params: { methodId: string };
247
+
248
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
249
+ params = (paramsOrFirst || {}) as { methodId: string };
250
+ } else {
251
+ params = {
252
+ methodId: paramsOrFirst as string
253
+ };
254
+ }
255
+
256
+ const methodId = params.methodId;
257
+
258
+ if (typeof methodId === 'undefined') {
259
+ throw new RevenexxException('Missing required parameter: "methodId"');
260
+ }
261
+
262
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{methodId}', methodId);
263
+ const payload: 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
+ 'get',
271
+ uri,
272
+ apiHeaders,
273
+ payload
274
+ );
275
+ }
276
+
277
+ /**
278
+ *
279
+ * @param {string} params.methodId -
280
+ * @throws {RevenexxException}
281
+ * @returns {Promise<Models.ShippingRateTier>}
282
+ */
283
+ shippingTiersCreate(params: { methodId: string }): Promise<Models.ShippingRateTier>;
284
+ /**
285
+ *
286
+ * @param {string} methodId -
287
+ * @throws {RevenexxException}
288
+ * @returns {Promise<Models.ShippingRateTier>}
289
+ * @deprecated Use the object parameter style method for a better developer experience.
290
+ */
291
+ shippingTiersCreate(methodId: string): Promise<Models.ShippingRateTier>;
292
+ shippingTiersCreate(
293
+ paramsOrFirst: { methodId: string } | string
294
+ ): Promise<Models.ShippingRateTier> {
295
+ let params: { methodId: string };
296
+
297
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
298
+ params = (paramsOrFirst || {}) as { methodId: string };
299
+ } else {
300
+ params = {
301
+ methodId: paramsOrFirst as string
302
+ };
303
+ }
304
+
305
+ const methodId = params.methodId;
306
+
307
+ if (typeof methodId === 'undefined') {
308
+ throw new RevenexxException('Missing required parameter: "methodId"');
309
+ }
310
+
311
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{methodId}', methodId);
312
+ const payload: Payload = {};
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
+ payload
324
+ );
325
+ }
326
+
327
+ /**
328
+ *
329
+ * @param {string} params.methodId -
330
+ * @throws {RevenexxException}
331
+ * @returns {Promise<{}>}
332
+ */
333
+ shippingTiersReplace(params: { methodId: string }): Promise<{}>;
334
+ /**
335
+ *
336
+ * @param {string} methodId -
337
+ * @throws {RevenexxException}
338
+ * @returns {Promise<{}>}
339
+ * @deprecated Use the object parameter style method for a better developer experience.
340
+ */
341
+ shippingTiersReplace(methodId: string): Promise<{}>;
342
+ shippingTiersReplace(
343
+ paramsOrFirst: { methodId: string } | string
344
+ ): Promise<{}> {
345
+ let params: { methodId: string };
346
+
347
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
348
+ params = (paramsOrFirst || {}) as { methodId: string };
349
+ } else {
350
+ params = {
351
+ methodId: paramsOrFirst as string
352
+ };
353
+ }
354
+
355
+ const methodId = params.methodId;
356
+
357
+ if (typeof methodId === 'undefined') {
358
+ throw new RevenexxException('Missing required parameter: "methodId"');
359
+ }
360
+
361
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers'.replace('{methodId}', methodId);
362
+ const payload: Payload = {};
363
+ const uri = new URL(this.client.config.endpoint + apiPath);
364
+
365
+ const apiHeaders: { [header: string]: string } = {
366
+ 'content-type': 'application/json',
367
+ }
368
+
369
+ return this.client.call(
370
+ 'put',
371
+ uri,
372
+ apiHeaders,
373
+ payload
374
+ );
375
+ }
376
+
377
+ /**
378
+ *
379
+ * @param {string} params.methodId -
380
+ * @param {string} params.id -
381
+ * @throws {RevenexxException}
382
+ * @returns {Promise<{}>}
383
+ */
384
+ shippingTiersDelete(params: { methodId: string, id: string }): Promise<{}>;
385
+ /**
386
+ *
387
+ * @param {string} methodId -
388
+ * @param {string} id -
389
+ * @throws {RevenexxException}
390
+ * @returns {Promise<{}>}
391
+ * @deprecated Use the object parameter style method for a better developer experience.
392
+ */
393
+ shippingTiersDelete(methodId: string, id: string): Promise<{}>;
394
+ shippingTiersDelete(
395
+ paramsOrFirst: { methodId: string, id: string } | string,
396
+ ...rest: [(string)?]
397
+ ): Promise<{}> {
398
+ let params: { methodId: string, id: string };
399
+
400
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
401
+ params = (paramsOrFirst || {}) as { methodId: string, id: string };
402
+ } else {
403
+ params = {
404
+ methodId: paramsOrFirst as string,
405
+ id: rest[0] as string
406
+ };
407
+ }
408
+
409
+ const methodId = params.methodId;
410
+ const id = params.id;
411
+
412
+ if (typeof methodId === 'undefined') {
413
+ throw new RevenexxException('Missing required parameter: "methodId"');
414
+ }
415
+ if (typeof id === 'undefined') {
416
+ throw new RevenexxException('Missing required parameter: "id"');
417
+ }
418
+
419
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{methodId}', methodId).replace('{id}', id);
420
+ const payload: Payload = {};
421
+ const uri = new URL(this.client.config.endpoint + apiPath);
422
+
423
+ const apiHeaders: { [header: string]: string } = {
424
+ }
425
+
426
+ return this.client.call(
427
+ 'delete',
428
+ uri,
429
+ apiHeaders,
430
+ payload
431
+ );
432
+ }
433
+
434
+ /**
435
+ *
436
+ * @param {string} params.methodId -
437
+ * @param {string} params.id -
438
+ * @throws {RevenexxException}
439
+ * @returns {Promise<Models.ShippingRateTier>}
440
+ */
441
+ shippingTiersGet(params: { methodId: string, id: string }): Promise<Models.ShippingRateTier>;
442
+ /**
443
+ *
444
+ * @param {string} methodId -
445
+ * @param {string} id -
446
+ * @throws {RevenexxException}
447
+ * @returns {Promise<Models.ShippingRateTier>}
448
+ * @deprecated Use the object parameter style method for a better developer experience.
449
+ */
450
+ shippingTiersGet(methodId: string, id: string): Promise<Models.ShippingRateTier>;
451
+ shippingTiersGet(
452
+ paramsOrFirst: { methodId: string, id: string } | string,
453
+ ...rest: [(string)?]
454
+ ): Promise<Models.ShippingRateTier> {
455
+ let params: { methodId: string, id: string };
456
+
457
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
458
+ params = (paramsOrFirst || {}) as { methodId: string, id: string };
459
+ } else {
460
+ params = {
461
+ methodId: paramsOrFirst as string,
462
+ id: rest[0] as string
463
+ };
464
+ }
465
+
466
+ const methodId = params.methodId;
467
+ const id = params.id;
468
+
469
+ if (typeof methodId === 'undefined') {
470
+ throw new RevenexxException('Missing required parameter: "methodId"');
471
+ }
472
+ if (typeof id === 'undefined') {
473
+ throw new RevenexxException('Missing required parameter: "id"');
474
+ }
475
+
476
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{methodId}', methodId).replace('{id}', id);
477
+ const payload: Payload = {};
478
+ const uri = new URL(this.client.config.endpoint + apiPath);
479
+
480
+ const apiHeaders: { [header: string]: string } = {
481
+ }
482
+
483
+ return this.client.call(
484
+ 'get',
485
+ uri,
486
+ apiHeaders,
487
+ payload
488
+ );
489
+ }
490
+
491
+ /**
492
+ *
493
+ * @param {string} params.methodId -
494
+ * @param {string} params.id -
495
+ * @throws {RevenexxException}
496
+ * @returns {Promise<Models.ShippingRateTier>}
497
+ */
498
+ shippingTiersUpdate(params: { methodId: string, id: string }): Promise<Models.ShippingRateTier>;
499
+ /**
500
+ *
501
+ * @param {string} methodId -
502
+ * @param {string} id -
503
+ * @throws {RevenexxException}
504
+ * @returns {Promise<Models.ShippingRateTier>}
505
+ * @deprecated Use the object parameter style method for a better developer experience.
506
+ */
507
+ shippingTiersUpdate(methodId: string, id: string): Promise<Models.ShippingRateTier>;
508
+ shippingTiersUpdate(
509
+ paramsOrFirst: { methodId: string, id: string } | string,
510
+ ...rest: [(string)?]
511
+ ): Promise<Models.ShippingRateTier> {
512
+ let params: { methodId: string, id: string };
513
+
514
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
515
+ params = (paramsOrFirst || {}) as { methodId: string, id: string };
516
+ } else {
517
+ params = {
518
+ methodId: paramsOrFirst as string,
519
+ id: rest[0] as string
520
+ };
521
+ }
522
+
523
+ const methodId = params.methodId;
524
+ const id = params.id;
525
+
526
+ if (typeof methodId === 'undefined') {
527
+ throw new RevenexxException('Missing required parameter: "methodId"');
528
+ }
529
+ if (typeof id === 'undefined') {
530
+ throw new RevenexxException('Missing required parameter: "id"');
531
+ }
532
+
533
+ const apiPath = '/v1/shipping/methods/{method_id}/tiers/{id}'.replace('{methodId}', methodId).replace('{id}', id);
534
+ const payload: Payload = {};
535
+ const uri = new URL(this.client.config.endpoint + apiPath);
536
+
537
+ const apiHeaders: { [header: string]: string } = {
538
+ 'content-type': 'application/json',
539
+ }
540
+
541
+ return this.client.call(
542
+ 'put',
543
+ uri,
544
+ apiHeaders,
545
+ payload
546
+ );
547
+ }
548
+
549
+ /**
550
+ *
551
+ * @throws {RevenexxException}
552
+ * @returns {Promise<{}>}
553
+ */
554
+ shippingRates(): Promise<{}> {
555
+
556
+ const apiPath = '/v1/shipping/rates';
557
+ const payload: Payload = {};
558
+ const uri = new URL(this.client.config.endpoint + apiPath);
559
+
560
+ const apiHeaders: { [header: string]: string } = {
561
+ 'content-type': 'application/json',
562
+ }
563
+
564
+ return this.client.call(
565
+ 'post',
566
+ uri,
567
+ apiHeaders,
568
+ payload
569
+ );
570
+ }
571
+ }
package/types/index.d.ts CHANGED
@@ -12,11 +12,17 @@ export { Carts } from './services/carts';
12
12
  export { Channels } from './services/channels';
13
13
  export { Customers } from './services/customers';
14
14
  export { Greetings } from './services/greetings';
15
+ export { Inventories } from './services/inventories';
15
16
  export { Locale } from './services/locale';
16
17
  export { Markets } from './services/markets';
17
18
  export { Messaging } from './services/messaging';
19
+ export { Orders } from './services/orders';
20
+ export { Pages } from './services/pages';
21
+ export { Payments } from './services/payments';
22
+ export { Prices } from './services/prices';
18
23
  export { Products } from './services/products';
19
24
  export { Search } from './services/search';
25
+ export { Shipping } from './services/shipping';
20
26
  export { Sites } from './services/sites';
21
27
  export { Storage } from './services/storage';
22
28
  export { Tokens } from './services/tokens';