@gofynd/fdk-client-javascript 1.4.15-beta.7 → 1.4.15-beta.8

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 (60) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/sdk/application/Cart/CartApplicationClient.d.ts +5 -5
  4. package/sdk/application/Cart/CartApplicationClient.js +26 -252
  5. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +16 -16
  6. package/sdk/application/Catalog/CatalogApplicationClient.js +90 -339
  7. package/sdk/application/Common/CommonApplicationClient.js +1 -16
  8. package/sdk/application/Communication/CommunicationApplicationClient.js +1 -24
  9. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +2 -2
  10. package/sdk/application/Configuration/ConfigurationApplicationClient.js +11 -134
  11. package/sdk/application/Content/ContentApplicationClient.d.ts +8 -8
  12. package/sdk/application/Content/ContentApplicationClient.js +44 -206
  13. package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +5 -3
  14. package/sdk/application/FileStorage/FileStorageApplicationClient.js +14 -30
  15. package/sdk/application/Lead/LeadApplicationClient.d.ts +4 -4
  16. package/sdk/application/Lead/LeadApplicationClient.js +21 -52
  17. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +5 -5
  18. package/sdk/application/Logistic/LogisticApplicationClient.js +32 -128
  19. package/sdk/application/Order/OrderApplicationClient.d.ts +10 -10
  20. package/sdk/application/Order/OrderApplicationClient.js +63 -142
  21. package/sdk/application/Payment/PaymentApplicationClient.d.ts +1 -1
  22. package/sdk/application/Payment/PaymentApplicationClient.js +6 -418
  23. package/sdk/application/Rewards/RewardsApplicationClient.d.ts +1 -1
  24. package/sdk/application/Rewards/RewardsApplicationClient.js +6 -59
  25. package/sdk/application/Share/ShareApplicationClient.d.ts +4 -4
  26. package/sdk/application/Share/ShareApplicationClient.js +21 -75
  27. package/sdk/application/Theme/ThemeApplicationClient.d.ts +3 -3
  28. package/sdk/application/Theme/ThemeApplicationClient.js +19 -47
  29. package/sdk/application/User/UserApplicationClient.js +1 -407
  30. package/sdk/application/Webhook/WebhookApplicationClient.js +1 -8
  31. package/sdk/common/Utility.d.ts +1 -1
  32. package/sdk/common/Utility.js +10 -7
  33. package/sdk/common/Validator.d.ts +1 -0
  34. package/sdk/common/Validator.js +20 -0
  35. package/sdk/common/utils.d.ts +0 -1
  36. package/sdk/common/utils.js +0 -14
  37. package/sdk/partner/FileStorage/FileStoragePartnerModel.d.ts +2 -0
  38. package/sdk/partner/FileStorage/FileStoragePartnerModel.js +2 -0
  39. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +7 -0
  40. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +3 -0
  41. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +3 -1
  42. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +3 -0
  43. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +3 -1
  44. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +3 -0
  45. package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +16 -1
  46. package/sdk/platform/FileStorage/FileStoragePlatformModel.js +20 -0
  47. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +0 -10
  48. package/sdk/platform/Order/OrderPlatformApplicationClient.js +0 -92
  49. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -28
  50. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +0 -18
  51. package/sdk/platform/Order/OrderPlatformClient.d.ts +10 -0
  52. package/sdk/platform/Order/OrderPlatformClient.js +99 -0
  53. package/sdk/platform/Order/OrderPlatformValidator.d.ts +33 -1
  54. package/sdk/platform/Order/OrderPlatformValidator.js +20 -0
  55. package/sdk/public/Configuration/ConfigurationPublicClient.js +1 -16
  56. package/sdk/public/Content/ContentPublicClient.d.ts +1 -1
  57. package/sdk/public/Content/ContentPublicClient.js +6 -11
  58. package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
  59. package/sdk/public/Partner/PartnerPublicClient.js +6 -11
  60. package/sdk/public/Webhook/WebhookPublicClient.js +1 -40
package/README.md CHANGED
@@ -237,7 +237,7 @@ console.log("Active Theme: ", response.information.name);
237
237
  The above code will log the curl command in the console
238
238
 
239
239
  ```bash
240
- curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 1.4.15-beta.7' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
240
+ curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 1.4.15-beta.8' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
241
241
  Active Theme: Emerge
242
242
  ```
243
243
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gofynd/fdk-client-javascript",
3
- "version": "1.4.15-beta.7",
3
+ "version": "1.4.15-beta.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -96,7 +96,7 @@ declare class Cart {
96
96
  * @summary: Get details for a single customer address
97
97
  * @description: Get a specific customer address stored in the system by providing its unique identifier. This API provides detailed information about the address, including the recipient's name, address, city, postal code, and other relevant details. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getAddressById/).
98
98
  */
99
- getAddressById({ id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault, requestHeaders, }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<Address>;
99
+ getAddressById({ id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault, requestHeaders, }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<Address>;
100
100
  /**
101
101
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
102
102
  * @param {import("../ApplicationAPIClient").Options} - Options
@@ -150,7 +150,7 @@ declare class Cart {
150
150
  * @summary: List shared cart items
151
151
  * @description: Get cart items from the shared cart link based on unique token. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getCartSharedItems/).
152
152
  */
153
- getCartSharedItems({ token, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<SharedCartResponse>;
153
+ getCartSharedItems({ token, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<SharedCartResponse>;
154
154
  /**
155
155
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
156
156
  * @param {import("../ApplicationAPIClient").Options} - Options
@@ -213,7 +213,7 @@ declare class Cart {
213
213
  * @summary: Removes an address from a customer's address list
214
214
  * @description: Delete an existing customer address from the system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/removeAddress/).
215
215
  */
216
- removeAddress({ id, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<DeleteAddressResponse>;
216
+ removeAddress({ id, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<DeleteAddressResponse>;
217
217
  /**
218
218
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
219
219
  * @param {import("../ApplicationAPIClient").Options} - Options
@@ -249,7 +249,7 @@ declare class Cart {
249
249
  * @summary: Updates an existing customer address
250
250
  * @description: Customer can modify the details of a previously saved addresses. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/updateAddress/).
251
251
  */
252
- updateAddress({ id, body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<UpdateAddressResponse>;
252
+ updateAddress({ id, body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<UpdateAddressResponse>;
253
253
  /**
254
254
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
255
255
  * @param {import("../ApplicationAPIClient").Options} - Options
@@ -276,7 +276,7 @@ declare class Cart {
276
276
  * @summary: Update with shared items
277
277
  * @description: Merge or replace shared cart items with existing cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/updateCartWithSharedItems/).
278
278
  */
279
- updateCartWithSharedItems({ token, action, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<SharedCartResponse>;
279
+ updateCartWithSharedItems({ token, action, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<SharedCartResponse>;
280
280
  /**
281
281
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
282
282
  * @param {import("../ApplicationAPIClient").Options} - Options
@@ -6,6 +6,7 @@ const {
6
6
  const ApplicationAPIClient = require("../ApplicationAPIClient");
7
7
  const constructUrl = require("../constructUrl");
8
8
  const Paginator = require("../../common/Paginator");
9
+ const { validateRequiredParams } = require("../../common/Validator");
9
10
 
10
11
  class Cart {
11
12
  constructor(_conf) {
@@ -71,14 +72,6 @@ class Cart {
71
72
  { body, requestHeaders } = { requestHeaders: {} },
72
73
  { responseHeaders } = { responseHeaders: false }
73
74
  ) {
74
- let invalidInput = [];
75
- if (invalidInput.length) {
76
- const error = new Error();
77
- error.message = "Missing required field";
78
- error.details = invalidInput;
79
- return Promise.reject(new FDKClientValidationError(error));
80
- }
81
-
82
75
  const query_params = {};
83
76
 
84
77
  const xHeaders = {};
@@ -118,14 +111,6 @@ class Cart {
118
111
  },
119
112
  { responseHeaders } = { responseHeaders: false }
120
113
  ) {
121
- let invalidInput = [];
122
- if (invalidInput.length) {
123
- const error = new Error();
124
- error.message = "Missing required field";
125
- error.details = invalidInput;
126
- return Promise.reject(new FDKClientValidationError(error));
127
- }
128
-
129
114
  const query_params = {};
130
115
  query_params["i"] = i;
131
116
  query_params["b"] = b;
@@ -171,14 +156,6 @@ class Cart {
171
156
  },
172
157
  { responseHeaders } = { responseHeaders: false }
173
158
  ) {
174
- let invalidInput = [];
175
- if (invalidInput.length) {
176
- const error = new Error();
177
- error.message = "Missing required field";
178
- error.details = invalidInput;
179
- return Promise.reject(new FDKClientValidationError(error));
180
- }
181
-
182
159
  const query_params = {};
183
160
  query_params["i"] = i;
184
161
  query_params["b"] = b;
@@ -222,14 +199,6 @@ class Cart {
222
199
  { body, id, i, b, buyNow, requestHeaders } = { requestHeaders: {} },
223
200
  { responseHeaders } = { responseHeaders: false }
224
201
  ) {
225
- let invalidInput = [];
226
- if (invalidInput.length) {
227
- const error = new Error();
228
- error.message = "Missing required field";
229
- error.details = invalidInput;
230
- return Promise.reject(new FDKClientValidationError(error));
231
- }
232
-
233
202
  const query_params = {};
234
203
  query_params["id"] = id;
235
204
  query_params["i"] = i;
@@ -271,14 +240,6 @@ class Cart {
271
240
  { body, buyNow, cartType, requestHeaders } = { requestHeaders: {} },
272
241
  { responseHeaders } = { responseHeaders: false }
273
242
  ) {
274
- let invalidInput = [];
275
- if (invalidInput.length) {
276
- const error = new Error();
277
- error.message = "Missing required field";
278
- error.details = invalidInput;
279
- return Promise.reject(new FDKClientValidationError(error));
280
- }
281
-
282
243
  const query_params = {};
283
244
  query_params["buy_now"] = buyNow;
284
245
  query_params["cart_type"] = cartType;
@@ -318,14 +279,6 @@ class Cart {
318
279
  { id, requestHeaders } = { requestHeaders: {} },
319
280
  { responseHeaders } = { responseHeaders: false }
320
281
  ) {
321
- let invalidInput = [];
322
- if (invalidInput.length) {
323
- const error = new Error();
324
- error.message = "Missing required field";
325
- error.details = invalidInput;
326
- return Promise.reject(new FDKClientValidationError(error));
327
- }
328
-
329
282
  const query_params = {};
330
283
  query_params["id"] = id;
331
284
 
@@ -373,18 +326,12 @@ class Cart {
373
326
  } = { requestHeaders: {} },
374
327
  { responseHeaders } = { responseHeaders: false }
375
328
  ) {
376
- let invalidInput = [];
377
-
378
- if (!id) {
379
- invalidInput.push({
380
- message: `The 'id' field is required.`,
381
- path: ["id"],
329
+ const errors = validateRequiredParams(arguments[0], ["id"]);
330
+ if (errors.length > 0) {
331
+ const error = new FDKClientValidationError({
332
+ message: "Missing required field",
333
+ details: errors,
382
334
  });
383
- }
384
- if (invalidInput.length) {
385
- const error = new Error();
386
- error.message = "Missing required field";
387
- error.details = invalidInput;
388
335
  return Promise.reject(new FDKClientValidationError(error));
389
336
  }
390
337
 
@@ -439,14 +386,6 @@ class Cart {
439
386
  } = { requestHeaders: {} },
440
387
  { responseHeaders } = { responseHeaders: false }
441
388
  ) {
442
- let invalidInput = [];
443
- if (invalidInput.length) {
444
- const error = new Error();
445
- error.message = "Missing required field";
446
- error.details = invalidInput;
447
- return Promise.reject(new FDKClientValidationError(error));
448
- }
449
-
450
389
  const query_params = {};
451
390
  query_params["cart_id"] = cartId;
452
391
  query_params["buy_now"] = buyNow;
@@ -490,14 +429,6 @@ class Cart {
490
429
  { itemId, articleId, uid, slug, requestHeaders } = { requestHeaders: {} },
491
430
  { responseHeaders } = { responseHeaders: false }
492
431
  ) {
493
- let invalidInput = [];
494
- if (invalidInput.length) {
495
- const error = new Error();
496
- error.message = "Missing required field";
497
- error.details = invalidInput;
498
- return Promise.reject(new FDKClientValidationError(error));
499
- }
500
-
501
432
  const query_params = {};
502
433
  query_params["item_id"] = itemId;
503
434
  query_params["article_id"] = articleId;
@@ -549,14 +480,6 @@ class Cart {
549
480
  } = { requestHeaders: {} },
550
481
  { responseHeaders } = { responseHeaders: false }
551
482
  ) {
552
- let invalidInput = [];
553
- if (invalidInput.length) {
554
- const error = new Error();
555
- error.message = "Missing required field";
556
- error.details = invalidInput;
557
- return Promise.reject(new FDKClientValidationError(error));
558
- }
559
-
560
483
  const query_params = {};
561
484
  query_params["id"] = id;
562
485
  query_params["i"] = i;
@@ -602,14 +525,6 @@ class Cart {
602
525
  { id, requestHeaders } = { requestHeaders: {} },
603
526
  { responseHeaders } = { responseHeaders: false }
604
527
  ) {
605
- let invalidInput = [];
606
- if (invalidInput.length) {
607
- const error = new Error();
608
- error.message = "Missing required field";
609
- error.details = invalidInput;
610
- return Promise.reject(new FDKClientValidationError(error));
611
- }
612
-
613
528
  const query_params = {};
614
529
  query_params["id"] = id;
615
530
 
@@ -648,14 +563,6 @@ class Cart {
648
563
  { body, requestHeaders } = { requestHeaders: {} },
649
564
  { responseHeaders } = { responseHeaders: false }
650
565
  ) {
651
- let invalidInput = [];
652
- if (invalidInput.length) {
653
- const error = new Error();
654
- error.message = "Missing required field";
655
- error.details = invalidInput;
656
- return Promise.reject(new FDKClientValidationError(error));
657
- }
658
-
659
566
  const query_params = {};
660
567
 
661
568
  const xHeaders = {};
@@ -693,18 +600,12 @@ class Cart {
693
600
  { token, requestHeaders } = { requestHeaders: {} },
694
601
  { responseHeaders } = { responseHeaders: false }
695
602
  ) {
696
- let invalidInput = [];
697
-
698
- if (!token) {
699
- invalidInput.push({
700
- message: `The 'token' field is required.`,
701
- path: ["token"],
603
+ const errors = validateRequiredParams(arguments[0], ["token"]);
604
+ if (errors.length > 0) {
605
+ const error = new FDKClientValidationError({
606
+ message: "Missing required field",
607
+ details: errors,
702
608
  });
703
- }
704
- if (invalidInput.length) {
705
- const error = new Error();
706
- error.message = "Missing required field";
707
- error.details = invalidInput;
708
609
  return Promise.reject(new FDKClientValidationError(error));
709
610
  }
710
611
 
@@ -745,14 +646,6 @@ class Cart {
745
646
  { id, buyNow, slug, storeId, requestHeaders } = { requestHeaders: {} },
746
647
  { responseHeaders } = { responseHeaders: false }
747
648
  ) {
748
- let invalidInput = [];
749
- if (invalidInput.length) {
750
- const error = new Error();
751
- error.message = "Missing required field";
752
- error.details = invalidInput;
753
- return Promise.reject(new FDKClientValidationError(error));
754
- }
755
-
756
649
  const query_params = {};
757
650
  query_params["id"] = id;
758
651
  query_params["buy_now"] = buyNow;
@@ -794,14 +687,6 @@ class Cart {
794
687
  { id, buyNow, requestHeaders } = { requestHeaders: {} },
795
688
  { responseHeaders } = { responseHeaders: false }
796
689
  ) {
797
- let invalidInput = [];
798
- if (invalidInput.length) {
799
- const error = new Error();
800
- error.message = "Missing required field";
801
- error.details = invalidInput;
802
- return Promise.reject(new FDKClientValidationError(error));
803
- }
804
-
805
690
  const query_params = {};
806
691
  query_params["id"] = id;
807
692
  query_params["buy_now"] = buyNow;
@@ -843,21 +728,6 @@ class Cart {
843
728
  },
844
729
  { responseHeaders } = { responseHeaders: false }
845
730
  ) {
846
- let invalidInput = [];
847
-
848
- if (!slug) {
849
- invalidInput.push({
850
- message: `The 'slug' field is required.`,
851
- path: ["slug"],
852
- });
853
- }
854
- if (invalidInput.length) {
855
- const error = new Error();
856
- error.message = "Missing required field";
857
- error.details = invalidInput;
858
- return Promise.reject(new FDKClientValidationError(error));
859
- }
860
-
861
731
  const query_params = {};
862
732
  query_params["slug"] = slug;
863
733
  query_params["store_id"] = storeId;
@@ -901,14 +771,6 @@ class Cart {
901
771
  },
902
772
  { responseHeaders } = { responseHeaders: false }
903
773
  ) {
904
- let invalidInput = [];
905
- if (invalidInput.length) {
906
- const error = new Error();
907
- error.message = "Missing required field";
908
- error.details = invalidInput;
909
- return Promise.reject(new FDKClientValidationError(error));
910
- }
911
-
912
774
  const query_params = {};
913
775
  query_params["slug"] = slug;
914
776
  query_params["page_size"] = pageSize;
@@ -951,14 +813,6 @@ class Cart {
951
813
  { id, uid, requestHeaders } = { requestHeaders: {} },
952
814
  { responseHeaders } = { responseHeaders: false }
953
815
  ) {
954
- let invalidInput = [];
955
- if (invalidInput.length) {
956
- const error = new Error();
957
- error.message = "Missing required field";
958
- error.details = invalidInput;
959
- return Promise.reject(new FDKClientValidationError(error));
960
- }
961
-
962
816
  const query_params = {};
963
817
  query_params["id"] = id;
964
818
  query_params["uid"] = uid;
@@ -1000,14 +854,6 @@ class Cart {
1000
854
  },
1001
855
  { responseHeaders } = { responseHeaders: false }
1002
856
  ) {
1003
- let invalidInput = [];
1004
- if (invalidInput.length) {
1005
- const error = new Error();
1006
- error.message = "Missing required field";
1007
- error.details = invalidInput;
1008
- return Promise.reject(new FDKClientValidationError(error));
1009
- }
1010
-
1011
857
  const query_params = {};
1012
858
  query_params["p"] = p;
1013
859
  query_params["id"] = id;
@@ -1051,18 +897,12 @@ class Cart {
1051
897
  { id, requestHeaders } = { requestHeaders: {} },
1052
898
  { responseHeaders } = { responseHeaders: false }
1053
899
  ) {
1054
- let invalidInput = [];
1055
-
1056
- if (!id) {
1057
- invalidInput.push({
1058
- message: `The 'id' field is required.`,
1059
- path: ["id"],
900
+ const errors = validateRequiredParams(arguments[0], ["id"]);
901
+ if (errors.length > 0) {
902
+ const error = new FDKClientValidationError({
903
+ message: "Missing required field",
904
+ details: errors,
1060
905
  });
1061
- }
1062
- if (invalidInput.length) {
1063
- const error = new Error();
1064
- error.message = "Missing required field";
1065
- error.details = invalidInput;
1066
906
  return Promise.reject(new FDKClientValidationError(error));
1067
907
  }
1068
908
 
@@ -1103,14 +943,6 @@ class Cart {
1103
943
  { id, buyNow, requestHeaders } = { requestHeaders: {} },
1104
944
  { responseHeaders } = { responseHeaders: false }
1105
945
  ) {
1106
- let invalidInput = [];
1107
- if (invalidInput.length) {
1108
- const error = new Error();
1109
- error.message = "Missing required field";
1110
- error.details = invalidInput;
1111
- return Promise.reject(new FDKClientValidationError(error));
1112
- }
1113
-
1114
946
  const query_params = {};
1115
947
  query_params["id"] = id;
1116
948
  query_params["buy_now"] = buyNow;
@@ -1150,14 +982,6 @@ class Cart {
1150
982
  { body, cartId, buyNow, i, b, requestHeaders } = { requestHeaders: {} },
1151
983
  { responseHeaders } = { responseHeaders: false }
1152
984
  ) {
1153
- let invalidInput = [];
1154
- if (invalidInput.length) {
1155
- const error = new Error();
1156
- error.message = "Missing required field";
1157
- error.details = invalidInput;
1158
- return Promise.reject(new FDKClientValidationError(error));
1159
- }
1160
-
1161
985
  const query_params = {};
1162
986
  query_params["cart_id"] = cartId;
1163
987
  query_params["buy_now"] = buyNow;
@@ -1199,14 +1023,6 @@ class Cart {
1199
1023
  { body, id, buyNow, requestHeaders } = { requestHeaders: {} },
1200
1024
  { responseHeaders } = { responseHeaders: false }
1201
1025
  ) {
1202
- let invalidInput = [];
1203
- if (invalidInput.length) {
1204
- const error = new Error();
1205
- error.message = "Missing required field";
1206
- error.details = invalidInput;
1207
- return Promise.reject(new FDKClientValidationError(error));
1208
- }
1209
-
1210
1026
  const query_params = {};
1211
1027
  query_params["id"] = id;
1212
1028
  query_params["buy_now"] = buyNow;
@@ -1246,18 +1062,12 @@ class Cart {
1246
1062
  { id, body, requestHeaders } = { requestHeaders: {} },
1247
1063
  { responseHeaders } = { responseHeaders: false }
1248
1064
  ) {
1249
- let invalidInput = [];
1250
-
1251
- if (!id) {
1252
- invalidInput.push({
1253
- message: `The 'id' field is required.`,
1254
- path: ["id"],
1065
+ const errors = validateRequiredParams(arguments[0], ["id"]);
1066
+ if (errors.length > 0) {
1067
+ const error = new FDKClientValidationError({
1068
+ message: "Missing required field",
1069
+ details: errors,
1255
1070
  });
1256
- }
1257
- if (invalidInput.length) {
1258
- const error = new Error();
1259
- error.message = "Missing required field";
1260
- error.details = invalidInput;
1261
1071
  return Promise.reject(new FDKClientValidationError(error));
1262
1072
  }
1263
1073
 
@@ -1308,14 +1118,6 @@ class Cart {
1308
1118
  } = { requestHeaders: {} },
1309
1119
  { responseHeaders } = { responseHeaders: false }
1310
1120
  ) {
1311
- let invalidInput = [];
1312
- if (invalidInput.length) {
1313
- const error = new Error();
1314
- error.message = "Missing required field";
1315
- error.details = invalidInput;
1316
- return Promise.reject(new FDKClientValidationError(error));
1317
- }
1318
-
1319
1121
  const query_params = {};
1320
1122
  query_params["id"] = id;
1321
1123
  query_params["i"] = i;
@@ -1360,14 +1162,6 @@ class Cart {
1360
1162
  { body, id, buyNow, requestHeaders } = { requestHeaders: {} },
1361
1163
  { responseHeaders } = { responseHeaders: false }
1362
1164
  ) {
1363
- let invalidInput = [];
1364
- if (invalidInput.length) {
1365
- const error = new Error();
1366
- error.message = "Missing required field";
1367
- error.details = invalidInput;
1368
- return Promise.reject(new FDKClientValidationError(error));
1369
- }
1370
-
1371
1165
  const query_params = {};
1372
1166
  query_params["id"] = id;
1373
1167
  query_params["buy_now"] = buyNow;
@@ -1407,24 +1201,12 @@ class Cart {
1407
1201
  { token, action, requestHeaders } = { requestHeaders: {} },
1408
1202
  { responseHeaders } = { responseHeaders: false }
1409
1203
  ) {
1410
- let invalidInput = [];
1411
-
1412
- if (!token) {
1413
- invalidInput.push({
1414
- message: `The 'token' field is required.`,
1415
- path: ["token"],
1416
- });
1417
- }
1418
- if (!action) {
1419
- invalidInput.push({
1420
- message: `The 'action' field is required.`,
1421
- path: ["action"],
1204
+ const errors = validateRequiredParams(arguments[0], ["token", "action"]);
1205
+ if (errors.length > 0) {
1206
+ const error = new FDKClientValidationError({
1207
+ message: "Missing required field",
1208
+ details: errors,
1422
1209
  });
1423
- }
1424
- if (invalidInput.length) {
1425
- const error = new Error();
1426
- error.message = "Missing required field";
1427
- error.details = invalidInput;
1428
1210
  return Promise.reject(new FDKClientValidationError(error));
1429
1211
  }
1430
1212
 
@@ -1479,14 +1261,6 @@ class Cart {
1479
1261
  } = { requestHeaders: {} },
1480
1262
  { responseHeaders } = { responseHeaders: false }
1481
1263
  ) {
1482
- let invalidInput = [];
1483
- if (invalidInput.length) {
1484
- const error = new Error();
1485
- error.message = "Missing required field";
1486
- error.details = invalidInput;
1487
- return Promise.reject(new FDKClientValidationError(error));
1488
- }
1489
-
1490
1264
  const query_params = {};
1491
1265
  query_params["id"] = id;
1492
1266
  query_params["buy_now"] = buyNow;