@gofynd/fdk-client-javascript 1.6.4 → 2.0.1

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 (148) 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 +20 -20
  6. package/sdk/application/Catalog/CatalogApplicationClient.js +98 -347
  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 +24 -2
  10. package/sdk/application/Configuration/ConfigurationApplicationClient.js +58 -137
  11. package/sdk/application/Content/ContentApplicationClient.d.ts +47 -7
  12. package/sdk/application/Content/ContentApplicationClient.js +222 -191
  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 +16 -56
  19. package/sdk/application/Logistic/LogisticApplicationClient.js +57 -332
  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 +2 -12
  23. package/sdk/application/Payment/PaymentApplicationClient.js +7 -487
  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 +10 -7
  34. package/sdk/common/Validator.d.ts +1 -0
  35. package/sdk/common/Validator.js +20 -0
  36. package/sdk/common/utils.d.ts +0 -1
  37. package/sdk/common/utils.js +0 -14
  38. package/sdk/partner/FileStorage/FileStoragePartnerClient.d.ts +1 -55
  39. package/sdk/partner/FileStorage/FileStoragePartnerClient.js +1 -408
  40. package/sdk/partner/FileStorage/FileStoragePartnerValidator.d.ts +0 -5
  41. package/sdk/partner/FileStorage/FileStoragePartnerValidator.js +0 -37
  42. package/sdk/partner/Lead/LeadPartnerModel.d.ts +5 -0
  43. package/sdk/partner/Lead/LeadPartnerModel.js +2 -0
  44. package/sdk/partner/Logistics/LogisticsPartnerClient.d.ts +29 -25
  45. package/sdk/partner/Logistics/LogisticsPartnerClient.js +65 -42
  46. package/sdk/partner/Logistics/LogisticsPartnerModel.d.ts +1008 -794
  47. package/sdk/partner/Logistics/LogisticsPartnerModel.js +573 -460
  48. package/sdk/partner/Logistics/LogisticsPartnerValidator.js +10 -5
  49. package/sdk/partner/Webhook/WebhookPartnerModel.d.ts +5 -0
  50. package/sdk/partner/Webhook/WebhookPartnerModel.js +2 -0
  51. package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +5 -0
  52. package/sdk/platform/Analytics/AnalyticsPlatformModel.js +2 -0
  53. package/sdk/platform/Cart/CartPlatformModel.d.ts +67 -9
  54. package/sdk/platform/Cart/CartPlatformModel.js +38 -5
  55. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1 -1
  56. package/sdk/platform/Catalog/CatalogPlatformClient.js +4 -4
  57. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +47 -13
  58. package/sdk/platform/Catalog/CatalogPlatformModel.js +29 -7
  59. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +2 -2
  60. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +7 -4
  61. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +71 -7
  62. package/sdk/platform/Communication/CommunicationPlatformModel.js +70 -6
  63. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +0 -27
  64. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +8 -60
  65. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +31 -20
  66. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +18 -18
  67. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +1 -1
  68. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +3 -3
  69. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +13 -0
  70. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +30 -1
  71. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +68 -11
  72. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +49 -7
  73. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +169 -0
  74. package/sdk/platform/Content/ContentPlatformApplicationClient.js +1279 -132
  75. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +156 -1
  76. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +180 -0
  77. package/sdk/platform/Content/ContentPlatformClient.d.ts +162 -0
  78. package/sdk/platform/Content/ContentPlatformClient.js +1697 -497
  79. package/sdk/platform/Content/ContentPlatformModel.d.ts +1053 -35
  80. package/sdk/platform/Content/ContentPlatformModel.js +717 -34
  81. package/sdk/platform/Content/ContentPlatformValidator.d.ts +127 -1
  82. package/sdk/platform/Content/ContentPlatformValidator.js +171 -0
  83. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +34 -0
  84. package/sdk/platform/Discount/DiscountPlatformClient.js +59 -0
  85. package/sdk/platform/Discount/DiscountPlatformModel.d.ts +365 -93
  86. package/sdk/platform/Discount/DiscountPlatformModel.js +98 -93
  87. package/sdk/platform/Discount/DiscountPlatformValidator.d.ts +54 -34
  88. package/sdk/platform/Discount/DiscountPlatformValidator.js +27 -17
  89. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +0 -156
  90. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +0 -1072
  91. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +1 -137
  92. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +0 -173
  93. package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +1 -1105
  94. package/sdk/platform/FileStorage/FileStoragePlatformModel.js +0 -1125
  95. package/sdk/platform/Lead/LeadPlatformModel.d.ts +5 -0
  96. package/sdk/platform/Lead/LeadPlatformModel.js +2 -0
  97. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +0 -10
  98. package/sdk/platform/Order/OrderPlatformApplicationClient.js +0 -92
  99. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -28
  100. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +0 -18
  101. package/sdk/platform/Order/OrderPlatformClient.d.ts +212 -0
  102. package/sdk/platform/Order/OrderPlatformClient.js +397 -0
  103. package/sdk/platform/Order/OrderPlatformModel.d.ts +41 -9
  104. package/sdk/platform/Order/OrderPlatformModel.js +20 -7
  105. package/sdk/platform/Order/OrderPlatformValidator.d.ts +33 -1
  106. package/sdk/platform/Order/OrderPlatformValidator.js +20 -0
  107. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +58 -10
  108. package/sdk/platform/Partner/PartnerPlatformModel.js +19 -10
  109. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +12 -2
  110. package/sdk/platform/Payment/PaymentPlatformModel.js +8 -2
  111. package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +5 -0
  112. package/sdk/platform/Rewards/RewardsPlatformModel.js +2 -0
  113. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +240 -24
  114. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +1753 -277
  115. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +320 -22
  116. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +269 -19
  117. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +53 -104
  118. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +201 -629
  119. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +5720 -2891
  120. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +3414 -2181
  121. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +138 -216
  122. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +81 -148
  123. package/sdk/platform/Share/SharePlatformModel.d.ts +5 -0
  124. package/sdk/platform/Share/SharePlatformModel.js +2 -0
  125. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +10 -0
  126. package/sdk/platform/User/UserPlatformApplicationClient.js +79 -0
  127. package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +13 -1
  128. package/sdk/platform/User/UserPlatformApplicationValidator.js +12 -0
  129. package/sdk/platform/User/UserPlatformModel.d.ts +52 -1
  130. package/sdk/platform/User/UserPlatformModel.js +36 -0
  131. package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +5 -0
  132. package/sdk/platform/Webhook/WebhookPlatformModel.js +2 -0
  133. package/sdk/public/Catalog/CatalogPublicClient.d.ts +1 -1
  134. package/sdk/public/Catalog/CatalogPublicClient.js +6 -11
  135. package/sdk/public/Configuration/ConfigurationPublicClient.js +1 -16
  136. package/sdk/public/Content/ContentPublicClient.d.ts +36 -3
  137. package/sdk/public/Content/ContentPublicClient.js +261 -104
  138. package/sdk/public/Content/ContentPublicModel.d.ts +155 -1
  139. package/sdk/public/Content/ContentPublicModel.js +102 -0
  140. package/sdk/public/Content/ContentPublicValidator.d.ts +18 -1
  141. package/sdk/public/Content/ContentPublicValidator.js +26 -0
  142. package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
  143. package/sdk/public/Partner/PartnerPublicClient.js +6 -11
  144. package/sdk/public/Partner/PartnerPublicModel.d.ts +248 -72
  145. package/sdk/public/Partner/PartnerPublicModel.js +81 -71
  146. package/sdk/public/Partner/PartnerPublicValidator.d.ts +2 -2
  147. package/sdk/public/Partner/PartnerPublicValidator.js +1 -1
  148. 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.6.4' --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: 2.0.1' --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.6.4",
3
+ "version": "2.0.1",
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
@@ -224,7 +224,7 @@ declare class Cart {
224
224
  * @summary: Removes an address from a customer's address list
225
225
  * @description: Delete an existing customer address from the system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/removeAddress/).
226
226
  */
227
- removeAddress({ id, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<DeleteAddressResult>;
227
+ removeAddress({ id, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<DeleteAddressResult>;
228
228
  /**
229
229
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
230
230
  * @param {import("../ApplicationAPIClient").Options} - Options
@@ -260,7 +260,7 @@ declare class Cart {
260
260
  * @summary: Updates an existing customer address
261
261
  * @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/).
262
262
  */
263
- updateAddress({ id, body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<UpdateAddressResult>;
263
+ updateAddress({ id, body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options, ...args: any[]): Promise<UpdateAddressResult>;
264
264
  /**
265
265
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
266
266
  * @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;
@@ -950,14 +812,6 @@ class Cart {
950
812
  },
951
813
  { responseHeaders } = { responseHeaders: false }
952
814
  ) {
953
- let invalidInput = [];
954
- if (invalidInput.length) {
955
- const error = new Error();
956
- error.message = "Missing required field";
957
- error.details = invalidInput;
958
- return Promise.reject(new FDKClientValidationError(error));
959
- }
960
-
961
815
  const query_params = {};
962
816
  query_params["slug"] = slug;
963
817
  query_params["page_size"] = pageSize;
@@ -1000,14 +854,6 @@ class Cart {
1000
854
  { id, uid, requestHeaders } = { requestHeaders: {} },
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["id"] = id;
1013
859
  query_params["uid"] = uid;
@@ -1049,14 +895,6 @@ class Cart {
1049
895
  },
1050
896
  { responseHeaders } = { responseHeaders: false }
1051
897
  ) {
1052
- let invalidInput = [];
1053
- if (invalidInput.length) {
1054
- const error = new Error();
1055
- error.message = "Missing required field";
1056
- error.details = invalidInput;
1057
- return Promise.reject(new FDKClientValidationError(error));
1058
- }
1059
-
1060
898
  const query_params = {};
1061
899
  query_params["p"] = p;
1062
900
  query_params["id"] = id;
@@ -1100,18 +938,12 @@ class Cart {
1100
938
  { id, requestHeaders } = { requestHeaders: {} },
1101
939
  { responseHeaders } = { responseHeaders: false }
1102
940
  ) {
1103
- let invalidInput = [];
1104
-
1105
- if (!id) {
1106
- invalidInput.push({
1107
- message: `The 'id' field is required.`,
1108
- path: ["id"],
941
+ const errors = validateRequiredParams(arguments[0], ["id"]);
942
+ if (errors.length > 0) {
943
+ const error = new FDKClientValidationError({
944
+ message: "Missing required field",
945
+ details: errors,
1109
946
  });
1110
- }
1111
- if (invalidInput.length) {
1112
- const error = new Error();
1113
- error.message = "Missing required field";
1114
- error.details = invalidInput;
1115
947
  return Promise.reject(new FDKClientValidationError(error));
1116
948
  }
1117
949
 
@@ -1152,14 +984,6 @@ class Cart {
1152
984
  { id, buyNow, requestHeaders } = { requestHeaders: {} },
1153
985
  { responseHeaders } = { responseHeaders: false }
1154
986
  ) {
1155
- let invalidInput = [];
1156
- if (invalidInput.length) {
1157
- const error = new Error();
1158
- error.message = "Missing required field";
1159
- error.details = invalidInput;
1160
- return Promise.reject(new FDKClientValidationError(error));
1161
- }
1162
-
1163
987
  const query_params = {};
1164
988
  query_params["id"] = id;
1165
989
  query_params["buy_now"] = buyNow;
@@ -1199,14 +1023,6 @@ class Cart {
1199
1023
  { body, cartId, buyNow, i, b, 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["cart_id"] = cartId;
1212
1028
  query_params["buy_now"] = buyNow;
@@ -1248,14 +1064,6 @@ class Cart {
1248
1064
  { body, id, buyNow, requestHeaders } = { requestHeaders: {} },
1249
1065
  { responseHeaders } = { responseHeaders: false }
1250
1066
  ) {
1251
- let invalidInput = [];
1252
- if (invalidInput.length) {
1253
- const error = new Error();
1254
- error.message = "Missing required field";
1255
- error.details = invalidInput;
1256
- return Promise.reject(new FDKClientValidationError(error));
1257
- }
1258
-
1259
1067
  const query_params = {};
1260
1068
  query_params["id"] = id;
1261
1069
  query_params["buy_now"] = buyNow;
@@ -1295,18 +1103,12 @@ class Cart {
1295
1103
  { id, body, requestHeaders } = { requestHeaders: {} },
1296
1104
  { responseHeaders } = { responseHeaders: false }
1297
1105
  ) {
1298
- let invalidInput = [];
1299
-
1300
- if (!id) {
1301
- invalidInput.push({
1302
- message: `The 'id' field is required.`,
1303
- path: ["id"],
1106
+ const errors = validateRequiredParams(arguments[0], ["id"]);
1107
+ if (errors.length > 0) {
1108
+ const error = new FDKClientValidationError({
1109
+ message: "Missing required field",
1110
+ details: errors,
1304
1111
  });
1305
- }
1306
- if (invalidInput.length) {
1307
- const error = new Error();
1308
- error.message = "Missing required field";
1309
- error.details = invalidInput;
1310
1112
  return Promise.reject(new FDKClientValidationError(error));
1311
1113
  }
1312
1114
 
@@ -1357,14 +1159,6 @@ class Cart {
1357
1159
  } = { requestHeaders: {} },
1358
1160
  { responseHeaders } = { responseHeaders: false }
1359
1161
  ) {
1360
- let invalidInput = [];
1361
- if (invalidInput.length) {
1362
- const error = new Error();
1363
- error.message = "Missing required field";
1364
- error.details = invalidInput;
1365
- return Promise.reject(new FDKClientValidationError(error));
1366
- }
1367
-
1368
1162
  const query_params = {};
1369
1163
  query_params["id"] = id;
1370
1164
  query_params["i"] = i;
@@ -1411,14 +1205,6 @@ class Cart {
1411
1205
  },
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;
@@ -1461,14 +1247,6 @@ class Cart {
1461
1247
  { body, id, buyNow, requestHeaders } = { requestHeaders: {} },
1462
1248
  { responseHeaders } = { responseHeaders: false }
1463
1249
  ) {
1464
- let invalidInput = [];
1465
- if (invalidInput.length) {
1466
- const error = new Error();
1467
- error.message = "Missing required field";
1468
- error.details = invalidInput;
1469
- return Promise.reject(new FDKClientValidationError(error));
1470
- }
1471
-
1472
1250
  const query_params = {};
1473
1251
  query_params["id"] = id;
1474
1252
  query_params["buy_now"] = buyNow;
@@ -1508,24 +1286,12 @@ class Cart {
1508
1286
  { token, action, requestHeaders } = { requestHeaders: {} },
1509
1287
  { responseHeaders } = { responseHeaders: false }
1510
1288
  ) {
1511
- let invalidInput = [];
1512
-
1513
- if (!token) {
1514
- invalidInput.push({
1515
- message: `The 'token' field is required.`,
1516
- path: ["token"],
1289
+ const errors = validateRequiredParams(arguments[0], ["token", "action"]);
1290
+ if (errors.length > 0) {
1291
+ const error = new FDKClientValidationError({
1292
+ message: "Missing required field",
1293
+ details: errors,
1517
1294
  });
1518
- }
1519
- if (!action) {
1520
- invalidInput.push({
1521
- message: `The 'action' field is required.`,
1522
- path: ["action"],
1523
- });
1524
- }
1525
- if (invalidInput.length) {
1526
- const error = new Error();
1527
- error.message = "Missing required field";
1528
- error.details = invalidInput;
1529
1295
  return Promise.reject(new FDKClientValidationError(error));
1530
1296
  }
1531
1297
 
@@ -1580,14 +1346,6 @@ class Cart {
1580
1346
  } = { requestHeaders: {} },
1581
1347
  { responseHeaders } = { responseHeaders: false }
1582
1348
  ) {
1583
- let invalidInput = [];
1584
- if (invalidInput.length) {
1585
- const error = new Error();
1586
- error.message = "Missing required field";
1587
- error.details = invalidInput;
1588
- return Promise.reject(new FDKClientValidationError(error));
1589
- }
1590
-
1591
1349
  const query_params = {};
1592
1350
  query_params["id"] = id;
1593
1351
  query_params["buy_now"] = buyNow;