@gofynd/fdk-client-javascript 1.3.6-beta.1 → 1.3.6

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 (76) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -2
  3. package/sdk/application/ApplicationConfig.d.ts +11 -3
  4. package/sdk/application/ApplicationConfig.js +21 -3
  5. package/sdk/application/Cart/CartApplicationClient.js +228 -113
  6. package/sdk/application/Catalog/CatalogApplicationClient.js +244 -121
  7. package/sdk/application/Common/CommonApplicationClient.js +20 -9
  8. package/sdk/application/Communication/CommunicationApplicationClient.js +28 -13
  9. package/sdk/application/Configuration/ConfigurationApplicationClient.js +132 -65
  10. package/sdk/application/Content/ContentApplicationClient.js +156 -77
  11. package/sdk/application/FileStorage/FileStorageApplicationClient.js +28 -13
  12. package/sdk/application/Lead/LeadApplicationClient.js +60 -29
  13. package/sdk/application/Logistic/LogisticApplicationClient.js +44 -21
  14. package/sdk/application/Order/OrderApplicationClient.js +100 -49
  15. package/sdk/application/Payment/PaymentApplicationClient.js +340 -169
  16. package/sdk/application/PosCart/PosCartApplicationClient.js +220 -109
  17. package/sdk/application/Rewards/RewardsApplicationClient.js +60 -29
  18. package/sdk/application/Share/ShareApplicationClient.js +60 -29
  19. package/sdk/application/Theme/ThemeApplicationClient.js +36 -17
  20. package/sdk/application/User/UserApplicationClient.js +324 -161
  21. package/sdk/common/AxiosHelper.js +3 -3
  22. package/sdk/common/FDKError.d.ts +4 -0
  23. package/sdk/common/FDKError.js +9 -0
  24. package/sdk/partner/FileStorage/FileStoragePartnerClient.d.ts +16 -40
  25. package/sdk/partner/FileStorage/FileStoragePartnerClient.js +160 -38
  26. package/sdk/partner/PartnerConfig.d.ts +10 -0
  27. package/sdk/partner/PartnerConfig.js +10 -1
  28. package/sdk/partner/Theme/ThemePartnerClient.d.ts +96 -199
  29. package/sdk/partner/Theme/ThemePartnerClient.js +935 -170
  30. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +36 -17
  31. package/sdk/platform/Billing/BillingPlatformClient.js +140 -69
  32. package/sdk/platform/Cart/CartPlatformApplicationClient.js +456 -228
  33. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +512 -256
  34. package/sdk/platform/Catalog/CatalogPlatformClient.js +620 -309
  35. package/sdk/platform/Common/CommonPlatformClient.js +20 -9
  36. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +472 -236
  37. package/sdk/platform/Communication/CommunicationPlatformClient.js +12 -5
  38. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +14 -1
  39. package/sdk/platform/Communication/CommunicationPlatformModel.js +16 -0
  40. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +116 -57
  41. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +256 -128
  42. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +148 -73
  43. package/sdk/platform/Content/ContentPlatformApplicationClient.js +552 -276
  44. package/sdk/platform/Discount/DiscountPlatformClient.js +92 -45
  45. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +88 -44
  46. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +52 -25
  47. package/sdk/platform/Finance/FinancePlatformClient.js +196 -97
  48. package/sdk/platform/Inventory/InventoryPlatformClient.js +100 -49
  49. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +104 -52
  50. package/sdk/platform/Lead/LeadPlatformClient.js +92 -45
  51. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +26 -0
  52. package/sdk/platform/Order/OrderPlatformApplicationClient.js +239 -5
  53. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +57 -1
  54. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +55 -0
  55. package/sdk/platform/Order/OrderPlatformClient.js +356 -177
  56. package/sdk/platform/Order/OrderPlatformModel.d.ts +44 -5
  57. package/sdk/platform/Order/OrderPlatformModel.js +52 -4
  58. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +16 -8
  59. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +336 -168
  60. package/sdk/platform/Payment/PaymentPlatformClient.js +84 -41
  61. package/sdk/platform/PlatformConfig.d.ts +10 -0
  62. package/sdk/platform/PlatformConfig.js +10 -1
  63. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +96 -48
  64. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +112 -56
  65. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +148 -73
  66. package/sdk/platform/Share/SharePlatformApplicationClient.js +40 -20
  67. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +224 -112
  68. package/sdk/platform/Theme/ThemePlatformClient.js +28 -13
  69. package/sdk/platform/User/UserPlatformApplicationClient.js +144 -72
  70. package/sdk/platform/Webhook/WebhookPlatformClient.js +132 -65
  71. package/sdk/public/Configuration/ConfigurationPublicClient.js +20 -9
  72. package/sdk/public/Inventory/InventoryPublicClient.js +52 -25
  73. package/sdk/public/Partner/PartnerPublicClient.js +12 -5
  74. package/sdk/public/PublicConfig.d.ts +11 -1
  75. package/sdk/public/PublicConfig.js +10 -1
  76. package/sdk/public/Webhook/WebhookPublicClient.js +20 -9
@@ -1,5 +1,8 @@
1
1
  const PublicAPIClient = require("../PublicAPIClient");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
2
+ const {
3
+ FDKClientValidationError,
4
+ FDKResponseValidationError,
5
+ } = require("../../common/FDKError");
3
6
  const constructUrl = require("../constructUrl");
4
7
  const Paginator = require("../../common/Paginator");
5
8
  const ConfigurationPublicValidator = require("./ConfigurationPublicValidator");
@@ -98,10 +101,14 @@ class Configuration {
98
101
  });
99
102
 
100
103
  if (res_error) {
101
- Logger({
102
- level: "WARN",
103
- message: `Response Validation Warnnings for public > Configuration > getLocations \n ${res_error}`,
104
- });
104
+ if (this._conf.options.strictResponseCheck === true) {
105
+ return Promise.reject(new FDKResponseValidationError(res_error));
106
+ } else {
107
+ Logger({
108
+ level: "WARN",
109
+ message: `Response Validation Warnings for public > Configuration > getLocations \n ${res_error}`,
110
+ });
111
+ }
105
112
  }
106
113
 
107
114
  return response;
@@ -174,10 +181,14 @@ class Configuration {
174
181
  });
175
182
 
176
183
  if (res_error) {
177
- Logger({
178
- level: "WARN",
179
- message: `Response Validation Warnnings for public > Configuration > searchApplication \n ${res_error}`,
180
- });
184
+ if (this._conf.options.strictResponseCheck === true) {
185
+ return Promise.reject(new FDKResponseValidationError(res_error));
186
+ } else {
187
+ Logger({
188
+ level: "WARN",
189
+ message: `Response Validation Warnings for public > Configuration > searchApplication \n ${res_error}`,
190
+ });
191
+ }
181
192
  }
182
193
 
183
194
  return response;
@@ -1,5 +1,8 @@
1
1
  const PublicAPIClient = require("../PublicAPIClient");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
2
+ const {
3
+ FDKClientValidationError,
4
+ FDKResponseValidationError,
5
+ } = require("../../common/FDKError");
3
6
  const constructUrl = require("../constructUrl");
4
7
  const Paginator = require("../../common/Paginator");
5
8
  const InventoryPublicValidator = require("./InventoryPublicValidator");
@@ -103,10 +106,14 @@ class Inventory {
103
106
  );
104
107
 
105
108
  if (res_error) {
106
- Logger({
107
- level: "WARN",
108
- message: `Response Validation Warnnings for public > Inventory > getApiKey \n ${res_error}`,
109
- });
109
+ if (this._conf.options.strictResponseCheck === true) {
110
+ return Promise.reject(new FDKResponseValidationError(res_error));
111
+ } else {
112
+ Logger({
113
+ level: "WARN",
114
+ message: `Response Validation Warnings for public > Inventory > getApiKey \n ${res_error}`,
115
+ });
116
+ }
110
117
  }
111
118
 
112
119
  return response;
@@ -180,10 +187,14 @@ class Inventory {
180
187
  );
181
188
 
182
189
  if (res_error) {
183
- Logger({
184
- level: "WARN",
185
- message: `Response Validation Warnnings for public > Inventory > getConfigByApiKey \n ${res_error}`,
186
- });
190
+ if (this._conf.options.strictResponseCheck === true) {
191
+ return Promise.reject(new FDKResponseValidationError(res_error));
192
+ } else {
193
+ Logger({
194
+ level: "WARN",
195
+ message: `Response Validation Warnings for public > Inventory > getConfigByApiKey \n ${res_error}`,
196
+ });
197
+ }
187
198
  }
188
199
 
189
200
  return response;
@@ -255,10 +266,14 @@ class Inventory {
255
266
  );
256
267
 
257
268
  if (res_error) {
258
- Logger({
259
- level: "WARN",
260
- message: `Response Validation Warnnings for public > Inventory > getJobByCode \n ${res_error}`,
261
- });
269
+ if (this._conf.options.strictResponseCheck === true) {
270
+ return Promise.reject(new FDKResponseValidationError(res_error));
271
+ } else {
272
+ Logger({
273
+ level: "WARN",
274
+ message: `Response Validation Warnings for public > Inventory > getJobByCode \n ${res_error}`,
275
+ });
276
+ }
262
277
  }
263
278
 
264
279
  return response;
@@ -331,10 +346,14 @@ class Inventory {
331
346
  });
332
347
 
333
348
  if (res_error) {
334
- Logger({
335
- level: "WARN",
336
- message: `Response Validation Warnnings for public > Inventory > getJobCodesMetrics \n ${res_error}`,
337
- });
349
+ if (this._conf.options.strictResponseCheck === true) {
350
+ return Promise.reject(new FDKResponseValidationError(res_error));
351
+ } else {
352
+ Logger({
353
+ level: "WARN",
354
+ message: `Response Validation Warnings for public > Inventory > getJobCodesMetrics \n ${res_error}`,
355
+ });
356
+ }
338
357
  }
339
358
 
340
359
  return response;
@@ -413,10 +432,14 @@ class Inventory {
413
432
  );
414
433
 
415
434
  if (res_error) {
416
- Logger({
417
- level: "WARN",
418
- message: `Response Validation Warnnings for public > Inventory > getJobConfigByIntegrationType \n ${res_error}`,
419
- });
435
+ if (this._conf.options.strictResponseCheck === true) {
436
+ return Promise.reject(new FDKResponseValidationError(res_error));
437
+ } else {
438
+ Logger({
439
+ level: "WARN",
440
+ message: `Response Validation Warnings for public > Inventory > getJobConfigByIntegrationType \n ${res_error}`,
441
+ });
442
+ }
420
443
  }
421
444
 
422
445
  return response;
@@ -489,10 +512,14 @@ class Inventory {
489
512
  );
490
513
 
491
514
  if (res_error) {
492
- Logger({
493
- level: "WARN",
494
- message: `Response Validation Warnnings for public > Inventory > saveJobCodesMetrics \n ${res_error}`,
495
- });
515
+ if (this._conf.options.strictResponseCheck === true) {
516
+ return Promise.reject(new FDKResponseValidationError(res_error));
517
+ } else {
518
+ Logger({
519
+ level: "WARN",
520
+ message: `Response Validation Warnings for public > Inventory > saveJobCodesMetrics \n ${res_error}`,
521
+ });
522
+ }
496
523
  }
497
524
 
498
525
  return response;
@@ -1,5 +1,8 @@
1
1
  const PublicAPIClient = require("../PublicAPIClient");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
2
+ const {
3
+ FDKClientValidationError,
4
+ FDKResponseValidationError,
5
+ } = require("../../common/FDKError");
3
6
  const constructUrl = require("../constructUrl");
4
7
  const Paginator = require("../../common/Paginator");
5
8
  const PartnerPublicValidator = require("./PartnerPublicValidator");
@@ -97,10 +100,14 @@ class Partner {
97
100
  });
98
101
 
99
102
  if (res_error) {
100
- Logger({
101
- level: "WARN",
102
- message: `Response Validation Warnnings for public > Partner > getPanelExtensionDetails \n ${res_error}`,
103
- });
103
+ if (this._conf.options.strictResponseCheck === true) {
104
+ return Promise.reject(new FDKResponseValidationError(res_error));
105
+ } else {
106
+ Logger({
107
+ level: "WARN",
108
+ message: `Response Validation Warnings for public > Partner > getPanelExtensionDetails \n ${res_error}`,
109
+ });
110
+ }
104
111
  }
105
112
 
106
113
  return response;
@@ -16,16 +16,26 @@ declare class PublicConfig {
16
16
  * @param {string} [_conf.language] - The language for localization.
17
17
  * @param {string} [_conf.currency] - The currency for pricing and financial
18
18
  * calculations.
19
+ * @param {object} [options] - Additional options.
20
+ * @param {boolean} [options.strictResponseCheck=false] - Strict check for
21
+ * response schema validation. Passing this `true` will check response
22
+ * against response schema and throw FDKResponseValidationError if it
23
+ * doesn't match. Default is `false`
19
24
  */
20
25
  constructor(_conf: {
21
26
  domain?: string;
22
27
  userAgent?: string;
23
28
  language?: string;
24
29
  currency?: string;
25
- }, _opts: any);
30
+ }, options?: {
31
+ strictResponseCheck?: boolean;
32
+ });
26
33
  domain: string;
27
34
  userAgent: string;
28
35
  language: string;
29
36
  currency: string;
30
37
  extraHeaders: any[];
38
+ options: {
39
+ strictResponseCheck: boolean;
40
+ };
31
41
  }
@@ -15,13 +15,22 @@ class PublicConfig {
15
15
  * @param {string} [_conf.language] - The language for localization.
16
16
  * @param {string} [_conf.currency] - The currency for pricing and financial
17
17
  * calculations.
18
+ * @param {object} [options] - Additional options.
19
+ * @param {boolean} [options.strictResponseCheck=false] - Strict check for
20
+ * response schema validation. Passing this `true` will check response
21
+ * against response schema and throw FDKResponseValidationError if it
22
+ * doesn't match. Default is `false`
18
23
  */
19
- constructor(_conf, _opts) {
24
+ constructor(_conf, options) {
20
25
  this.domain = _conf.domain || "https://api.fynd.com";
21
26
  this.userAgent = _conf.userAgent || "";
22
27
  this.language = _conf.language;
23
28
  this.currency = _conf.currency;
24
29
  this.extraHeaders = [];
30
+ this.options = {
31
+ ...{ strictResponseCheck: false },
32
+ ...options,
33
+ };
25
34
  }
26
35
  }
27
36
 
@@ -1,5 +1,8 @@
1
1
  const PublicAPIClient = require("../PublicAPIClient");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
2
+ const {
3
+ FDKClientValidationError,
4
+ FDKResponseValidationError,
5
+ } = require("../../common/FDKError");
3
6
  const constructUrl = require("../constructUrl");
4
7
  const Paginator = require("../../common/Paginator");
5
8
  const WebhookPublicValidator = require("./WebhookPublicValidator");
@@ -96,10 +99,14 @@ class Webhook {
96
99
  });
97
100
 
98
101
  if (res_error) {
99
- Logger({
100
- level: "WARN",
101
- message: `Response Validation Warnnings for public > Webhook > fetchAllWebhookEvents \n ${res_error}`,
102
- });
102
+ if (this._conf.options.strictResponseCheck === true) {
103
+ return Promise.reject(new FDKResponseValidationError(res_error));
104
+ } else {
105
+ Logger({
106
+ level: "WARN",
107
+ message: `Response Validation Warnings for public > Webhook > fetchAllWebhookEvents \n ${res_error}`,
108
+ });
109
+ }
103
110
  }
104
111
 
105
112
  return response;
@@ -172,10 +179,14 @@ class Webhook {
172
179
  });
173
180
 
174
181
  if (res_error) {
175
- Logger({
176
- level: "WARN",
177
- message: `Response Validation Warnnings for public > Webhook > queryWebhookEventDetails \n ${res_error}`,
178
- });
182
+ if (this._conf.options.strictResponseCheck === true) {
183
+ return Promise.reject(new FDKResponseValidationError(res_error));
184
+ } else {
185
+ Logger({
186
+ level: "WARN",
187
+ message: `Response Validation Warnings for public > Webhook > queryWebhookEventDetails \n ${res_error}`,
188
+ });
189
+ }
179
190
  }
180
191
 
181
192
  return response;