@gofynd/fdk-client-javascript 1.4.16-beta.1 → 1.4.16-beta.2

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 (73) 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 -268
  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 +40 -8
  12. package/sdk/application/Content/ContentApplicationClient.js +174 -211
  13. package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +2 -2
  14. package/sdk/application/FileStorage/FileStorageApplicationClient.js +11 -30
  15. package/sdk/application/Finance/FinanceApplicationClient.js +1 -16
  16. package/sdk/application/Lead/LeadApplicationClient.d.ts +4 -4
  17. package/sdk/application/Lead/LeadApplicationClient.js +21 -52
  18. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +6 -6
  19. package/sdk/application/Logistic/LogisticApplicationClient.js +40 -153
  20. package/sdk/application/Order/OrderApplicationClient.d.ts +11 -11
  21. package/sdk/application/Order/OrderApplicationClient.js +68 -153
  22. package/sdk/application/Payment/PaymentApplicationClient.d.ts +1 -1
  23. package/sdk/application/Payment/PaymentApplicationClient.js +6 -437
  24. package/sdk/application/Rewards/RewardsApplicationClient.d.ts +1 -1
  25. package/sdk/application/Rewards/RewardsApplicationClient.js +6 -59
  26. package/sdk/application/Share/ShareApplicationClient.d.ts +4 -4
  27. package/sdk/application/Share/ShareApplicationClient.js +21 -75
  28. package/sdk/application/Theme/ThemeApplicationClient.d.ts +3 -3
  29. package/sdk/application/Theme/ThemeApplicationClient.js +19 -47
  30. package/sdk/application/User/UserApplicationClient.js +1 -407
  31. package/sdk/application/Webhook/WebhookApplicationClient.js +1 -8
  32. package/sdk/common/Utility.d.ts +1 -1
  33. package/sdk/common/Utility.js +4 -4
  34. package/sdk/common/Validator.d.ts +1 -0
  35. package/sdk/common/Validator.js +20 -0
  36. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -0
  37. package/sdk/platform/Cart/CartPlatformModel.js +16 -0
  38. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +4 -0
  39. package/sdk/platform/Catalog/CatalogPlatformModel.js +4 -0
  40. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +80 -0
  41. package/sdk/platform/Content/ContentPlatformApplicationClient.js +571 -0
  42. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +75 -1
  43. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +88 -0
  44. package/sdk/platform/Content/ContentPlatformModel.d.ts +131 -5
  45. package/sdk/platform/Content/ContentPlatformModel.js +110 -4
  46. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +0 -10
  47. package/sdk/platform/Order/OrderPlatformApplicationClient.js +0 -92
  48. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -28
  49. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +0 -18
  50. package/sdk/platform/Order/OrderPlatformClient.d.ts +10 -0
  51. package/sdk/platform/Order/OrderPlatformClient.js +99 -0
  52. package/sdk/platform/Order/OrderPlatformValidator.d.ts +33 -1
  53. package/sdk/platform/Order/OrderPlatformValidator.js +20 -0
  54. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +0 -10
  55. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +0 -118
  56. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +1 -53
  57. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +0 -29
  58. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +10 -0
  59. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +119 -0
  60. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +58 -1
  61. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +30 -0
  62. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +3 -3
  63. package/sdk/platform/Share/SharePlatformApplicationClient.js +7 -7
  64. package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +3 -6
  65. package/sdk/platform/Share/SharePlatformApplicationValidator.js +2 -2
  66. package/sdk/platform/Share/SharePlatformModel.d.ts +10 -2
  67. package/sdk/platform/Share/SharePlatformModel.js +4 -2
  68. package/sdk/public/Configuration/ConfigurationPublicClient.js +1 -16
  69. package/sdk/public/Content/ContentPublicClient.d.ts +3 -3
  70. package/sdk/public/Content/ContentPublicClient.js +16 -104
  71. package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
  72. package/sdk/public/Partner/PartnerPublicClient.js +6 -11
  73. 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.16-beta.1' --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.16-beta.2' --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.16-beta.1",
3
+ "version": "1.4.16-beta.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -107,7 +107,7 @@ declare class Cart {
107
107
  * @summary: Get details for a single customer address
108
108
  * @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/).
109
109
  */
110
- getAddressById({ id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault, requestHeaders, }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<Address>;
110
+ getAddressById({ id, cartId, buyNow, mobileNo, checkoutMode, tags, isDefault, requestHeaders, }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<Address>;
111
111
  /**
112
112
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
113
113
  * @param {import("../ApplicationAPIClient").Options} - Options
@@ -161,7 +161,7 @@ declare class Cart {
161
161
  * @summary: List shared cart items
162
162
  * @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/).
163
163
  */
164
- getCartSharedItems({ token, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<SharedCartResult>;
164
+ getCartSharedItems({ token, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<SharedCartResult>;
165
165
  /**
166
166
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
167
167
  * @param {import("../ApplicationAPIClient").Options} - Options
@@ -233,7 +233,7 @@ declare class Cart {
233
233
  * @summary: Removes an address from a customer's address list
234
234
  * @description: Delete an existing customer address from the system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/removeAddress/).
235
235
  */
236
- removeAddress({ id, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<DeleteAddressResult>;
236
+ removeAddress({ id, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<DeleteAddressResult>;
237
237
  /**
238
238
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
239
239
  * @param {import("../ApplicationAPIClient").Options} - Options
@@ -269,7 +269,7 @@ declare class Cart {
269
269
  * @summary: Updates an existing customer address
270
270
  * @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/).
271
271
  */
272
- updateAddress({ id, body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<UpdateAddressResult>;
272
+ updateAddress({ id, body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<UpdateAddressResult>;
273
273
  /**
274
274
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
275
275
  * @param {import("../ApplicationAPIClient").Options} - Options
@@ -296,7 +296,7 @@ declare class Cart {
296
296
  * @summary: Update with shared items
297
297
  * @description: Merge or replace shared cart items with existing cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/updateCartWithSharedItems/).
298
298
  */
299
- updateCartWithSharedItems({ token, action, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<SharedCartResult>;
299
+ updateCartWithSharedItems({ token, action, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<SharedCartResult>;
300
300
  /**
301
301
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
302
302
  * @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) {
@@ -73,14 +74,6 @@ class Cart {
73
74
  { body, requestHeaders } = { requestHeaders: {} },
74
75
  { responseHeaders } = { responseHeaders: false }
75
76
  ) {
76
- let invalidInput = [];
77
- if (invalidInput.length) {
78
- const error = new Error();
79
- error.message = "Missing required field";
80
- error.details = invalidInput;
81
- return Promise.reject(new FDKClientValidationError(error));
82
- }
83
-
84
77
  const query_params = {};
85
78
 
86
79
  const xHeaders = {};
@@ -120,14 +113,6 @@ class Cart {
120
113
  },
121
114
  { responseHeaders } = { responseHeaders: false }
122
115
  ) {
123
- let invalidInput = [];
124
- if (invalidInput.length) {
125
- const error = new Error();
126
- error.message = "Missing required field";
127
- error.details = invalidInput;
128
- return Promise.reject(new FDKClientValidationError(error));
129
- }
130
-
131
116
  const query_params = {};
132
117
  query_params["i"] = i;
133
118
  query_params["b"] = b;
@@ -173,14 +158,6 @@ class Cart {
173
158
  },
174
159
  { responseHeaders } = { responseHeaders: false }
175
160
  ) {
176
- let invalidInput = [];
177
- if (invalidInput.length) {
178
- const error = new Error();
179
- error.message = "Missing required field";
180
- error.details = invalidInput;
181
- return Promise.reject(new FDKClientValidationError(error));
182
- }
183
-
184
161
  const query_params = {};
185
162
  query_params["i"] = i;
186
163
  query_params["b"] = b;
@@ -224,14 +201,6 @@ class Cart {
224
201
  { body, id, i, b, buyNow, requestHeaders } = { requestHeaders: {} },
225
202
  { responseHeaders } = { responseHeaders: false }
226
203
  ) {
227
- let invalidInput = [];
228
- if (invalidInput.length) {
229
- const error = new Error();
230
- error.message = "Missing required field";
231
- error.details = invalidInput;
232
- return Promise.reject(new FDKClientValidationError(error));
233
- }
234
-
235
204
  const query_params = {};
236
205
  query_params["id"] = id;
237
206
  query_params["i"] = i;
@@ -273,14 +242,6 @@ class Cart {
273
242
  { body, buyNow, cartType, requestHeaders } = { requestHeaders: {} },
274
243
  { responseHeaders } = { responseHeaders: false }
275
244
  ) {
276
- let invalidInput = [];
277
- if (invalidInput.length) {
278
- const error = new Error();
279
- error.message = "Missing required field";
280
- error.details = invalidInput;
281
- return Promise.reject(new FDKClientValidationError(error));
282
- }
283
-
284
245
  const query_params = {};
285
246
  query_params["buy_now"] = buyNow;
286
247
  query_params["cart_type"] = cartType;
@@ -320,14 +281,6 @@ class Cart {
320
281
  { body, buyNow, cartType, requestHeaders } = { requestHeaders: {} },
321
282
  { responseHeaders } = { responseHeaders: false }
322
283
  ) {
323
- let invalidInput = [];
324
- if (invalidInput.length) {
325
- const error = new Error();
326
- error.message = "Missing required field";
327
- error.details = invalidInput;
328
- return Promise.reject(new FDKClientValidationError(error));
329
- }
330
-
331
284
  const query_params = {};
332
285
  query_params["buy_now"] = buyNow;
333
286
  query_params["cart_type"] = cartType;
@@ -367,14 +320,6 @@ class Cart {
367
320
  { id, requestHeaders } = { requestHeaders: {} },
368
321
  { responseHeaders } = { responseHeaders: false }
369
322
  ) {
370
- let invalidInput = [];
371
- if (invalidInput.length) {
372
- const error = new Error();
373
- error.message = "Missing required field";
374
- error.details = invalidInput;
375
- return Promise.reject(new FDKClientValidationError(error));
376
- }
377
-
378
323
  const query_params = {};
379
324
  query_params["id"] = id;
380
325
 
@@ -422,18 +367,12 @@ class Cart {
422
367
  } = { requestHeaders: {} },
423
368
  { responseHeaders } = { responseHeaders: false }
424
369
  ) {
425
- let invalidInput = [];
426
-
427
- if (!id) {
428
- invalidInput.push({
429
- message: `The 'id' field is required.`,
430
- path: ["id"],
370
+ const errors = validateRequiredParams(arguments[0], ["id"]);
371
+ if (errors.length > 0) {
372
+ const error = new FDKClientValidationError({
373
+ message: "Missing required field",
374
+ details: errors,
431
375
  });
432
- }
433
- if (invalidInput.length) {
434
- const error = new Error();
435
- error.message = "Missing required field";
436
- error.details = invalidInput;
437
376
  return Promise.reject(new FDKClientValidationError(error));
438
377
  }
439
378
 
@@ -488,14 +427,6 @@ class Cart {
488
427
  } = { requestHeaders: {} },
489
428
  { responseHeaders } = { responseHeaders: false }
490
429
  ) {
491
- let invalidInput = [];
492
- if (invalidInput.length) {
493
- const error = new Error();
494
- error.message = "Missing required field";
495
- error.details = invalidInput;
496
- return Promise.reject(new FDKClientValidationError(error));
497
- }
498
-
499
430
  const query_params = {};
500
431
  query_params["cart_id"] = cartId;
501
432
  query_params["buy_now"] = buyNow;
@@ -539,14 +470,6 @@ class Cart {
539
470
  { itemId, articleId, uid, slug, requestHeaders } = { requestHeaders: {} },
540
471
  { responseHeaders } = { responseHeaders: false }
541
472
  ) {
542
- let invalidInput = [];
543
- if (invalidInput.length) {
544
- const error = new Error();
545
- error.message = "Missing required field";
546
- error.details = invalidInput;
547
- return Promise.reject(new FDKClientValidationError(error));
548
- }
549
-
550
473
  const query_params = {};
551
474
  query_params["item_id"] = itemId;
552
475
  query_params["article_id"] = articleId;
@@ -598,14 +521,6 @@ class Cart {
598
521
  } = { requestHeaders: {} },
599
522
  { responseHeaders } = { responseHeaders: false }
600
523
  ) {
601
- let invalidInput = [];
602
- if (invalidInput.length) {
603
- const error = new Error();
604
- error.message = "Missing required field";
605
- error.details = invalidInput;
606
- return Promise.reject(new FDKClientValidationError(error));
607
- }
608
-
609
524
  const query_params = {};
610
525
  query_params["id"] = id;
611
526
  query_params["i"] = i;
@@ -651,14 +566,6 @@ class Cart {
651
566
  { id, requestHeaders } = { requestHeaders: {} },
652
567
  { responseHeaders } = { responseHeaders: false }
653
568
  ) {
654
- let invalidInput = [];
655
- if (invalidInput.length) {
656
- const error = new Error();
657
- error.message = "Missing required field";
658
- error.details = invalidInput;
659
- return Promise.reject(new FDKClientValidationError(error));
660
- }
661
-
662
569
  const query_params = {};
663
570
  query_params["id"] = id;
664
571
 
@@ -697,14 +604,6 @@ class Cart {
697
604
  { body, requestHeaders } = { requestHeaders: {} },
698
605
  { responseHeaders } = { responseHeaders: false }
699
606
  ) {
700
- let invalidInput = [];
701
- if (invalidInput.length) {
702
- const error = new Error();
703
- error.message = "Missing required field";
704
- error.details = invalidInput;
705
- return Promise.reject(new FDKClientValidationError(error));
706
- }
707
-
708
607
  const query_params = {};
709
608
 
710
609
  const xHeaders = {};
@@ -742,18 +641,12 @@ class Cart {
742
641
  { token, requestHeaders } = { requestHeaders: {} },
743
642
  { responseHeaders } = { responseHeaders: false }
744
643
  ) {
745
- let invalidInput = [];
746
-
747
- if (!token) {
748
- invalidInput.push({
749
- message: `The 'token' field is required.`,
750
- path: ["token"],
644
+ const errors = validateRequiredParams(arguments[0], ["token"]);
645
+ if (errors.length > 0) {
646
+ const error = new FDKClientValidationError({
647
+ message: "Missing required field",
648
+ details: errors,
751
649
  });
752
- }
753
- if (invalidInput.length) {
754
- const error = new Error();
755
- error.message = "Missing required field";
756
- error.details = invalidInput;
757
650
  return Promise.reject(new FDKClientValidationError(error));
758
651
  }
759
652
 
@@ -794,14 +687,6 @@ class Cart {
794
687
  { id, buyNow, slug, storeId, 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,14 +728,6 @@ class Cart {
843
728
  { id, buyNow, requestHeaders } = { requestHeaders: {} },
844
729
  { responseHeaders } = { responseHeaders: false }
845
730
  ) {
846
- let invalidInput = [];
847
- if (invalidInput.length) {
848
- const error = new Error();
849
- error.message = "Missing required field";
850
- error.details = invalidInput;
851
- return Promise.reject(new FDKClientValidationError(error));
852
- }
853
-
854
731
  const query_params = {};
855
732
  query_params["id"] = id;
856
733
  query_params["buy_now"] = buyNow;
@@ -892,21 +769,6 @@ class Cart {
892
769
  },
893
770
  { responseHeaders } = { responseHeaders: false }
894
771
  ) {
895
- let invalidInput = [];
896
-
897
- if (!slug) {
898
- invalidInput.push({
899
- message: `The 'slug' field is required.`,
900
- path: ["slug"],
901
- });
902
- }
903
- if (invalidInput.length) {
904
- const error = new Error();
905
- error.message = "Missing required field";
906
- error.details = invalidInput;
907
- return Promise.reject(new FDKClientValidationError(error));
908
- }
909
-
910
772
  const query_params = {};
911
773
  query_params["slug"] = slug;
912
774
  query_params["store_id"] = storeId;
@@ -956,14 +818,6 @@ class Cart {
956
818
  } = { requestHeaders: {} },
957
819
  { responseHeaders } = { responseHeaders: false }
958
820
  ) {
959
- let invalidInput = [];
960
- if (invalidInput.length) {
961
- const error = new Error();
962
- error.message = "Missing required field";
963
- error.details = invalidInput;
964
- return Promise.reject(new FDKClientValidationError(error));
965
- }
966
-
967
821
  const query_params = {};
968
822
  query_params["slug"] = slug;
969
823
  query_params["page_size"] = pageSize;
@@ -1007,14 +861,6 @@ class Cart {
1007
861
  { id, uid, requestHeaders } = { requestHeaders: {} },
1008
862
  { responseHeaders } = { responseHeaders: false }
1009
863
  ) {
1010
- let invalidInput = [];
1011
- if (invalidInput.length) {
1012
- const error = new Error();
1013
- error.message = "Missing required field";
1014
- error.details = invalidInput;
1015
- return Promise.reject(new FDKClientValidationError(error));
1016
- }
1017
-
1018
864
  const query_params = {};
1019
865
  query_params["id"] = id;
1020
866
  query_params["uid"] = uid;
@@ -1054,14 +900,6 @@ class Cart {
1054
900
  { pageSize, pageNo, requestHeaders } = { requestHeaders: {} },
1055
901
  { responseHeaders } = { responseHeaders: false }
1056
902
  ) {
1057
- let invalidInput = [];
1058
- if (invalidInput.length) {
1059
- const error = new Error();
1060
- error.message = "Missing required field";
1061
- error.details = invalidInput;
1062
- return Promise.reject(new FDKClientValidationError(error));
1063
- }
1064
-
1065
903
  const query_params = {};
1066
904
  query_params["page_size"] = pageSize;
1067
905
  query_params["page_no"] = pageNo;
@@ -1103,14 +941,6 @@ class Cart {
1103
941
  },
1104
942
  { responseHeaders } = { responseHeaders: false }
1105
943
  ) {
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
944
  const query_params = {};
1115
945
  query_params["p"] = p;
1116
946
  query_params["id"] = id;
@@ -1154,18 +984,12 @@ class Cart {
1154
984
  { id, requestHeaders } = { requestHeaders: {} },
1155
985
  { responseHeaders } = { responseHeaders: false }
1156
986
  ) {
1157
- let invalidInput = [];
1158
-
1159
- if (!id) {
1160
- invalidInput.push({
1161
- message: `The 'id' field is required.`,
1162
- path: ["id"],
987
+ const errors = validateRequiredParams(arguments[0], ["id"]);
988
+ if (errors.length > 0) {
989
+ const error = new FDKClientValidationError({
990
+ message: "Missing required field",
991
+ details: errors,
1163
992
  });
1164
- }
1165
- if (invalidInput.length) {
1166
- const error = new Error();
1167
- error.message = "Missing required field";
1168
- error.details = invalidInput;
1169
993
  return Promise.reject(new FDKClientValidationError(error));
1170
994
  }
1171
995
 
@@ -1206,14 +1030,6 @@ class Cart {
1206
1030
  { id, buyNow, requestHeaders } = { requestHeaders: {} },
1207
1031
  { responseHeaders } = { responseHeaders: false }
1208
1032
  ) {
1209
- let invalidInput = [];
1210
- if (invalidInput.length) {
1211
- const error = new Error();
1212
- error.message = "Missing required field";
1213
- error.details = invalidInput;
1214
- return Promise.reject(new FDKClientValidationError(error));
1215
- }
1216
-
1217
1033
  const query_params = {};
1218
1034
  query_params["id"] = id;
1219
1035
  query_params["buy_now"] = buyNow;
@@ -1253,14 +1069,6 @@ class Cart {
1253
1069
  { body, cartId, buyNow, i, b, requestHeaders } = { requestHeaders: {} },
1254
1070
  { responseHeaders } = { responseHeaders: false }
1255
1071
  ) {
1256
- let invalidInput = [];
1257
- if (invalidInput.length) {
1258
- const error = new Error();
1259
- error.message = "Missing required field";
1260
- error.details = invalidInput;
1261
- return Promise.reject(new FDKClientValidationError(error));
1262
- }
1263
-
1264
1072
  const query_params = {};
1265
1073
  query_params["cart_id"] = cartId;
1266
1074
  query_params["buy_now"] = buyNow;
@@ -1302,14 +1110,6 @@ class Cart {
1302
1110
  { body, id, buyNow, requestHeaders } = { requestHeaders: {} },
1303
1111
  { responseHeaders } = { responseHeaders: false }
1304
1112
  ) {
1305
- let invalidInput = [];
1306
- if (invalidInput.length) {
1307
- const error = new Error();
1308
- error.message = "Missing required field";
1309
- error.details = invalidInput;
1310
- return Promise.reject(new FDKClientValidationError(error));
1311
- }
1312
-
1313
1113
  const query_params = {};
1314
1114
  query_params["id"] = id;
1315
1115
  query_params["buy_now"] = buyNow;
@@ -1349,18 +1149,12 @@ class Cart {
1349
1149
  { id, body, requestHeaders } = { requestHeaders: {} },
1350
1150
  { responseHeaders } = { responseHeaders: false }
1351
1151
  ) {
1352
- let invalidInput = [];
1353
-
1354
- if (!id) {
1355
- invalidInput.push({
1356
- message: `The 'id' field is required.`,
1357
- path: ["id"],
1152
+ const errors = validateRequiredParams(arguments[0], ["id"]);
1153
+ if (errors.length > 0) {
1154
+ const error = new FDKClientValidationError({
1155
+ message: "Missing required field",
1156
+ details: errors,
1358
1157
  });
1359
- }
1360
- if (invalidInput.length) {
1361
- const error = new Error();
1362
- error.message = "Missing required field";
1363
- error.details = invalidInput;
1364
1158
  return Promise.reject(new FDKClientValidationError(error));
1365
1159
  }
1366
1160
 
@@ -1411,14 +1205,6 @@ class Cart {
1411
1205
  } = { requestHeaders: {} },
1412
1206
  { responseHeaders } = { responseHeaders: false }
1413
1207
  ) {
1414
- let invalidInput = [];
1415
- if (invalidInput.length) {
1416
- const error = new Error();
1417
- error.message = "Missing required field";
1418
- error.details = invalidInput;
1419
- return Promise.reject(new FDKClientValidationError(error));
1420
- }
1421
-
1422
1208
  const query_params = {};
1423
1209
  query_params["id"] = id;
1424
1210
  query_params["i"] = i;
@@ -1463,14 +1249,6 @@ class Cart {
1463
1249
  { body, id, buyNow, requestHeaders } = { requestHeaders: {} },
1464
1250
  { responseHeaders } = { responseHeaders: false }
1465
1251
  ) {
1466
- let invalidInput = [];
1467
- if (invalidInput.length) {
1468
- const error = new Error();
1469
- error.message = "Missing required field";
1470
- error.details = invalidInput;
1471
- return Promise.reject(new FDKClientValidationError(error));
1472
- }
1473
-
1474
1252
  const query_params = {};
1475
1253
  query_params["id"] = id;
1476
1254
  query_params["buy_now"] = buyNow;
@@ -1510,24 +1288,12 @@ class Cart {
1510
1288
  { token, action, requestHeaders } = { requestHeaders: {} },
1511
1289
  { responseHeaders } = { responseHeaders: false }
1512
1290
  ) {
1513
- let invalidInput = [];
1514
-
1515
- if (!token) {
1516
- invalidInput.push({
1517
- message: `The 'token' field is required.`,
1518
- path: ["token"],
1291
+ const errors = validateRequiredParams(arguments[0], ["token", "action"]);
1292
+ if (errors.length > 0) {
1293
+ const error = new FDKClientValidationError({
1294
+ message: "Missing required field",
1295
+ details: errors,
1519
1296
  });
1520
- }
1521
- if (!action) {
1522
- invalidInput.push({
1523
- message: `The 'action' field is required.`,
1524
- path: ["action"],
1525
- });
1526
- }
1527
- if (invalidInput.length) {
1528
- const error = new Error();
1529
- error.message = "Missing required field";
1530
- error.details = invalidInput;
1531
1297
  return Promise.reject(new FDKClientValidationError(error));
1532
1298
  }
1533
1299
 
@@ -1582,14 +1348,6 @@ class Cart {
1582
1348
  } = { requestHeaders: {} },
1583
1349
  { responseHeaders } = { responseHeaders: false }
1584
1350
  ) {
1585
- let invalidInput = [];
1586
- if (invalidInput.length) {
1587
- const error = new Error();
1588
- error.message = "Missing required field";
1589
- error.details = invalidInput;
1590
- return Promise.reject(new FDKClientValidationError(error));
1591
- }
1592
-
1593
1351
  const query_params = {};
1594
1352
  query_params["id"] = id;
1595
1353
  query_params["buy_now"] = buyNow;