@gofynd/fdk-client-javascript 1.0.1 → 1.0.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 (134) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +414 -414
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +290 -290
  5. package/documentation/application/PAYMENT.md +255 -255
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3088 -2702
  9. package/documentation/platform/COMPANYPROFILE.md +201 -201
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1233 -1158
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +83 -83
  14. package/package.json +1 -1
  15. package/sdk/application/ApplicationConfig.js +1 -1
  16. package/sdk/application/Cart/CartApplicationClient.js +619 -108
  17. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  18. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  19. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  20. package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
  21. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
  22. package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
  23. package/sdk/application/Common/CommonApplicationClient.js +48 -8
  24. package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
  25. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  26. package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
  27. package/sdk/application/Content/ContentApplicationClient.js +444 -76
  28. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  29. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  30. package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
  31. package/sdk/application/Lead/LeadApplicationClient.js +164 -30
  32. package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
  33. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  34. package/sdk/application/Order/OrderApplicationClient.js +287 -54
  35. package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
  36. package/sdk/application/Order/OrderApplicationModel.js +357 -357
  37. package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
  38. package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
  39. package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
  40. package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
  41. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  42. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  43. package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
  44. package/sdk/application/Share/ShareApplicationClient.js +157 -32
  45. package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
  46. package/sdk/application/User/UserApplicationClient.js +806 -148
  47. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  48. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
  49. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  50. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
  51. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  52. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
  53. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  54. package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
  55. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  56. package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
  57. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  58. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  59. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
  60. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
  61. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
  62. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
  63. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
  64. package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
  65. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
  66. package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
  67. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
  68. package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
  69. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  70. package/sdk/platform/Common/CommonPlatformClient.js +51 -8
  71. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  72. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
  73. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  74. package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
  75. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  76. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
  77. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
  78. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
  79. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  80. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
  81. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  82. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
  83. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  84. package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
  85. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  86. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  87. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  88. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  89. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  90. package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
  91. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  92. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
  93. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  94. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
  95. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  96. package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
  97. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  98. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
  99. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  100. package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
  101. package/sdk/platform/OAuthClient.js +8 -8
  102. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  103. package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
  104. package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
  105. package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
  106. package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
  107. package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
  108. package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
  109. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  110. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
  111. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  112. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  113. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  114. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
  115. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  116. package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
  117. package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
  118. package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
  119. package/sdk/platform/PlatformApplicationClient.js +3420 -3212
  120. package/sdk/platform/PlatformClient.d.ts +2959 -2787
  121. package/sdk/platform/PlatformClient.js +3420 -3212
  122. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  123. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
  124. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  125. package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
  126. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  127. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
  128. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  129. package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
  130. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  131. package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
  132. package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
  133. package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
  134. package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
@@ -3,6 +3,8 @@ const constructUrl = require("../constructUrl");
3
3
  const Paginator = require("../../common/Paginator");
4
4
  const { FDKClientValidationError } = require("../../common/FDKError");
5
5
  const CatalogValidator = require("./CatalogApplicationValidator");
6
+ const CatalogModel = require("./CatalogApplicationModel");
7
+ const { Logger } = require("./../../common/Logger");
6
8
 
7
9
  class Catalog {
8
10
  constructor(_conf) {
@@ -84,7 +86,7 @@ class Catalog {
84
86
  * @summary: Get a product
85
87
  * @description: Use this API to retrieve a product by its slug value.
86
88
  */
87
- getProductDetailBySlug({ slug } = {}) {
89
+ async getProductDetailBySlug({ slug } = {}) {
88
90
  const { error } = CatalogValidator.getProductDetailBySlug().validate(
89
91
  { slug },
90
92
  { abortEarly: false, allowUnknown: true }
@@ -101,15 +103,18 @@ class Catalog {
101
103
  { abortEarly: false, allowUnknown: false }
102
104
  );
103
105
  if (warrning) {
104
- console.log("Parameter Validation warrnings for getProductDetailBySlug");
105
- console.log(warrning);
106
+ Logger({
107
+ level: "WARN",
108
+ message: "Parameter Validation warrnings for getProductDetailBySlug",
109
+ });
110
+ Logger({ level: "WARN", message: warrning });
106
111
  }
107
112
 
108
113
  const query_params = {};
109
114
 
110
115
  const xHeaders = {};
111
116
 
112
- return APIClient.execute(
117
+ const response = await APIClient.execute(
113
118
  this._conf,
114
119
  "get",
115
120
  constructUrl({
@@ -120,6 +125,21 @@ class Catalog {
120
125
  undefined,
121
126
  xHeaders
122
127
  );
128
+
129
+ const { error: res_error } = CatalogModel.ProductDetail().validate(
130
+ response,
131
+ { abortEarly: false, allowUnknown: false }
132
+ );
133
+
134
+ if (res_error) {
135
+ Logger({
136
+ level: "WARN",
137
+ message: "Response Validation Warnnings for getProductDetailBySlug",
138
+ });
139
+ Logger({ level: "WARN", message: res_error });
140
+ }
141
+
142
+ return response;
123
143
  }
124
144
 
125
145
  /**
@@ -133,7 +153,7 @@ class Catalog {
133
153
  * @summary: Get the sizes of a product
134
154
  * @description: A product can have multiple sizes. Use this API to fetch all the available sizes of a product.
135
155
  */
136
- getProductSizesBySlug({ slug, storeId } = {}) {
156
+ async getProductSizesBySlug({ slug, storeId } = {}) {
137
157
  const { error } = CatalogValidator.getProductSizesBySlug().validate(
138
158
  { slug, storeId },
139
159
  { abortEarly: false, allowUnknown: true }
@@ -150,8 +170,11 @@ class Catalog {
150
170
  { abortEarly: false, allowUnknown: false }
151
171
  );
152
172
  if (warrning) {
153
- console.log("Parameter Validation warrnings for getProductSizesBySlug");
154
- console.log(warrning);
173
+ Logger({
174
+ level: "WARN",
175
+ message: "Parameter Validation warrnings for getProductSizesBySlug",
176
+ });
177
+ Logger({ level: "WARN", message: warrning });
155
178
  }
156
179
 
157
180
  const query_params = {};
@@ -159,7 +182,7 @@ class Catalog {
159
182
 
160
183
  const xHeaders = {};
161
184
 
162
- return APIClient.execute(
185
+ const response = await APIClient.execute(
163
186
  this._conf,
164
187
  "get",
165
188
  constructUrl({
@@ -170,6 +193,21 @@ class Catalog {
170
193
  undefined,
171
194
  xHeaders
172
195
  );
196
+
197
+ const { error: res_error } = CatalogModel.ProductSizes().validate(
198
+ response,
199
+ { abortEarly: false, allowUnknown: false }
200
+ );
201
+
202
+ if (res_error) {
203
+ Logger({
204
+ level: "WARN",
205
+ message: "Response Validation Warnnings for getProductSizesBySlug",
206
+ });
207
+ Logger({ level: "WARN", message: res_error });
208
+ }
209
+
210
+ return response;
173
211
  }
174
212
 
175
213
  /**
@@ -181,7 +219,7 @@ class Catalog {
181
219
  * @summary: Compare products
182
220
  * @description: Use this API to compare the features of products belonging to the same category. Note that at least one slug is mandatory in the request query.
183
221
  */
184
- getProductComparisonBySlugs({ slug } = {}) {
222
+ async getProductComparisonBySlugs({ slug } = {}) {
185
223
  const { error } = CatalogValidator.getProductComparisonBySlugs().validate(
186
224
  { slug },
187
225
  { abortEarly: false, allowUnknown: true }
@@ -198,10 +236,12 @@ class Catalog {
198
236
  { abortEarly: false, allowUnknown: false }
199
237
  );
200
238
  if (warrning) {
201
- console.log(
202
- "Parameter Validation warrnings for getProductComparisonBySlugs"
203
- );
204
- console.log(warrning);
239
+ Logger({
240
+ level: "WARN",
241
+ message:
242
+ "Parameter Validation warrnings for getProductComparisonBySlugs",
243
+ });
244
+ Logger({ level: "WARN", message: warrning });
205
245
  }
206
246
 
207
247
  const query_params = {};
@@ -209,7 +249,7 @@ class Catalog {
209
249
 
210
250
  const xHeaders = {};
211
251
 
212
- return APIClient.execute(
252
+ const response = await APIClient.execute(
213
253
  this._conf,
214
254
  "get",
215
255
  constructUrl({
@@ -220,6 +260,24 @@ class Catalog {
220
260
  undefined,
221
261
  xHeaders
222
262
  );
263
+
264
+ const {
265
+ error: res_error,
266
+ } = CatalogModel.ProductsComparisonResponse().validate(response, {
267
+ abortEarly: false,
268
+ allowUnknown: false,
269
+ });
270
+
271
+ if (res_error) {
272
+ Logger({
273
+ level: "WARN",
274
+ message:
275
+ "Response Validation Warnnings for getProductComparisonBySlugs",
276
+ });
277
+ Logger({ level: "WARN", message: res_error });
278
+ }
279
+
280
+ return response;
223
281
  }
224
282
 
225
283
  /**
@@ -231,7 +289,7 @@ class Catalog {
231
289
  * @summary: Get comparison between similar products
232
290
  * @description: Use this API to compare a given product automatically with similar products. Only one slug is needed.
233
291
  */
234
- getSimilarComparisonProductBySlug({ slug } = {}) {
292
+ async getSimilarComparisonProductBySlug({ slug } = {}) {
235
293
  const {
236
294
  error,
237
295
  } = CatalogValidator.getSimilarComparisonProductBySlug().validate(
@@ -250,17 +308,19 @@ class Catalog {
250
308
  { abortEarly: false, allowUnknown: false }
251
309
  );
252
310
  if (warrning) {
253
- console.log(
254
- "Parameter Validation warrnings for getSimilarComparisonProductBySlug"
255
- );
256
- console.log(warrning);
311
+ Logger({
312
+ level: "WARN",
313
+ message:
314
+ "Parameter Validation warrnings for getSimilarComparisonProductBySlug",
315
+ });
316
+ Logger({ level: "WARN", message: warrning });
257
317
  }
258
318
 
259
319
  const query_params = {};
260
320
 
261
321
  const xHeaders = {};
262
322
 
263
- return APIClient.execute(
323
+ const response = await APIClient.execute(
264
324
  this._conf,
265
325
  "get",
266
326
  constructUrl({
@@ -271,6 +331,24 @@ class Catalog {
271
331
  undefined,
272
332
  xHeaders
273
333
  );
334
+
335
+ const {
336
+ error: res_error,
337
+ } = CatalogModel.ProductCompareResponse().validate(response, {
338
+ abortEarly: false,
339
+ allowUnknown: false,
340
+ });
341
+
342
+ if (res_error) {
343
+ Logger({
344
+ level: "WARN",
345
+ message:
346
+ "Response Validation Warnnings for getSimilarComparisonProductBySlug",
347
+ });
348
+ Logger({ level: "WARN", message: res_error });
349
+ }
350
+
351
+ return response;
274
352
  }
275
353
 
276
354
  /**
@@ -282,7 +360,7 @@ class Catalog {
282
360
  * @summary: Get comparison between frequently compared products with the given product
283
361
  * @description: Use this API to compare a given product automatically with products that are frequently compared with it. Only one slug is needed.
284
362
  */
285
- getComparedFrequentlyProductBySlug({ slug } = {}) {
363
+ async getComparedFrequentlyProductBySlug({ slug } = {}) {
286
364
  const {
287
365
  error,
288
366
  } = CatalogValidator.getComparedFrequentlyProductBySlug().validate(
@@ -301,17 +379,19 @@ class Catalog {
301
379
  { abortEarly: false, allowUnknown: false }
302
380
  );
303
381
  if (warrning) {
304
- console.log(
305
- "Parameter Validation warrnings for getComparedFrequentlyProductBySlug"
306
- );
307
- console.log(warrning);
382
+ Logger({
383
+ level: "WARN",
384
+ message:
385
+ "Parameter Validation warrnings for getComparedFrequentlyProductBySlug",
386
+ });
387
+ Logger({ level: "WARN", message: warrning });
308
388
  }
309
389
 
310
390
  const query_params = {};
311
391
 
312
392
  const xHeaders = {};
313
393
 
314
- return APIClient.execute(
394
+ const response = await APIClient.execute(
315
395
  this._conf,
316
396
  "get",
317
397
  constructUrl({
@@ -322,6 +402,24 @@ class Catalog {
322
402
  undefined,
323
403
  xHeaders
324
404
  );
405
+
406
+ const {
407
+ error: res_error,
408
+ } = CatalogModel.ProductFrequentlyComparedSimilarResponse().validate(
409
+ response,
410
+ { abortEarly: false, allowUnknown: false }
411
+ );
412
+
413
+ if (res_error) {
414
+ Logger({
415
+ level: "WARN",
416
+ message:
417
+ "Response Validation Warnnings for getComparedFrequentlyProductBySlug",
418
+ });
419
+ Logger({ level: "WARN", message: res_error });
420
+ }
421
+
422
+ return response;
325
423
  }
326
424
 
327
425
  /**
@@ -333,7 +431,7 @@ class Catalog {
333
431
  * @summary: Get variant of a particular product
334
432
  * @description: A product can have a different type of variants such as colour, shade, memory. Use this API to fetch all the available variants of a product using its slug.
335
433
  */
336
- getProductVariantsBySlug({ slug } = {}) {
434
+ async getProductVariantsBySlug({ slug } = {}) {
337
435
  const { error } = CatalogValidator.getProductVariantsBySlug().validate(
338
436
  { slug },
339
437
  { abortEarly: false, allowUnknown: true }
@@ -350,17 +448,18 @@ class Catalog {
350
448
  { abortEarly: false, allowUnknown: false }
351
449
  );
352
450
  if (warrning) {
353
- console.log(
354
- "Parameter Validation warrnings for getProductVariantsBySlug"
355
- );
356
- console.log(warrning);
451
+ Logger({
452
+ level: "WARN",
453
+ message: "Parameter Validation warrnings for getProductVariantsBySlug",
454
+ });
455
+ Logger({ level: "WARN", message: warrning });
357
456
  }
358
457
 
359
458
  const query_params = {};
360
459
 
361
460
  const xHeaders = {};
362
461
 
363
- return APIClient.execute(
462
+ const response = await APIClient.execute(
364
463
  this._conf,
365
464
  "get",
366
465
  constructUrl({
@@ -371,6 +470,23 @@ class Catalog {
371
470
  undefined,
372
471
  xHeaders
373
472
  );
473
+
474
+ const {
475
+ error: res_error,
476
+ } = CatalogModel.ProductVariantsResponse().validate(response, {
477
+ abortEarly: false,
478
+ allowUnknown: false,
479
+ });
480
+
481
+ if (res_error) {
482
+ Logger({
483
+ level: "WARN",
484
+ message: "Response Validation Warnnings for getProductVariantsBySlug",
485
+ });
486
+ Logger({ level: "WARN", message: res_error });
487
+ }
488
+
489
+ return response;
374
490
  }
375
491
 
376
492
  /**
@@ -388,7 +504,7 @@ class Catalog {
388
504
  * @summary: Get the stock of a product
389
505
  * @description: Retrieve the available stock of the products. Use this API to retrieve stock of multiple products (up to 50) at a time.
390
506
  */
391
- getProductStockByIds({ itemId, alu, skuCode, ean, upc } = {}) {
507
+ async getProductStockByIds({ itemId, alu, skuCode, ean, upc } = {}) {
392
508
  const { error } = CatalogValidator.getProductStockByIds().validate(
393
509
  { itemId, alu, skuCode, ean, upc },
394
510
  { abortEarly: false, allowUnknown: true }
@@ -405,8 +521,11 @@ class Catalog {
405
521
  { abortEarly: false, allowUnknown: false }
406
522
  );
407
523
  if (warrning) {
408
- console.log("Parameter Validation warrnings for getProductStockByIds");
409
- console.log(warrning);
524
+ Logger({
525
+ level: "WARN",
526
+ message: "Parameter Validation warrnings for getProductStockByIds",
527
+ });
528
+ Logger({ level: "WARN", message: warrning });
410
529
  }
411
530
 
412
531
  const query_params = {};
@@ -418,7 +537,7 @@ class Catalog {
418
537
 
419
538
  const xHeaders = {};
420
539
 
421
- return APIClient.execute(
540
+ const response = await APIClient.execute(
422
541
  this._conf,
423
542
  "get",
424
543
  constructUrl({
@@ -429,6 +548,23 @@ class Catalog {
429
548
  undefined,
430
549
  xHeaders
431
550
  );
551
+
552
+ const {
553
+ error: res_error,
554
+ } = CatalogModel.ProductStockStatusResponse().validate(response, {
555
+ abortEarly: false,
556
+ allowUnknown: false,
557
+ });
558
+
559
+ if (res_error) {
560
+ Logger({
561
+ level: "WARN",
562
+ message: "Response Validation Warnnings for getProductStockByIds",
563
+ });
564
+ Logger({ level: "WARN", message: res_error });
565
+ }
566
+
567
+ return response;
432
568
  }
433
569
 
434
570
  /**
@@ -440,7 +576,7 @@ class Catalog {
440
576
  * @summary: Get the stock of a product
441
577
  * @description: Retrieve the available stock of the products. Use this API to get the stock status of products whose inventory is updated at the specified time
442
578
  */
443
- getProductStockForTimeByIds({ timestamp, pageSize, pageId } = {}) {
579
+ async getProductStockForTimeByIds({ timestamp, pageSize, pageId } = {}) {
444
580
  const { error } = CatalogValidator.getProductStockForTimeByIds().validate(
445
581
  { timestamp, pageSize, pageId },
446
582
  { abortEarly: false, allowUnknown: true }
@@ -457,10 +593,12 @@ class Catalog {
457
593
  { abortEarly: false, allowUnknown: false }
458
594
  );
459
595
  if (warrning) {
460
- console.log(
461
- "Parameter Validation warrnings for getProductStockForTimeByIds"
462
- );
463
- console.log(warrning);
596
+ Logger({
597
+ level: "WARN",
598
+ message:
599
+ "Parameter Validation warrnings for getProductStockForTimeByIds",
600
+ });
601
+ Logger({ level: "WARN", message: warrning });
464
602
  }
465
603
 
466
604
  const query_params = {};
@@ -470,7 +608,7 @@ class Catalog {
470
608
 
471
609
  const xHeaders = {};
472
610
 
473
- return APIClient.execute(
611
+ const response = await APIClient.execute(
474
612
  this._conf,
475
613
  "get",
476
614
  constructUrl({
@@ -481,6 +619,24 @@ class Catalog {
481
619
  undefined,
482
620
  xHeaders
483
621
  );
622
+
623
+ const {
624
+ error: res_error,
625
+ } = CatalogModel.ProductStockPolling().validate(response, {
626
+ abortEarly: false,
627
+ allowUnknown: false,
628
+ });
629
+
630
+ if (res_error) {
631
+ Logger({
632
+ level: "WARN",
633
+ message:
634
+ "Response Validation Warnnings for getProductStockForTimeByIds",
635
+ });
636
+ Logger({ level: "WARN", message: res_error });
637
+ }
638
+
639
+ return response;
484
640
  }
485
641
 
486
642
  /**
@@ -533,7 +689,7 @@ class Catalog {
533
689
  * @summary: Get all the products
534
690
  * @description: Use this API to list all the products. You may choose a sort order or make arbitrary search queries by entering the product name, brand, category or collection.
535
691
  */
536
- getProducts({
692
+ async getProducts({
537
693
  q,
538
694
  f,
539
695
  filters,
@@ -557,8 +713,11 @@ class Catalog {
557
713
  { abortEarly: false, allowUnknown: false }
558
714
  );
559
715
  if (warrning) {
560
- console.log("Parameter Validation warrnings for getProducts");
561
- console.log(warrning);
716
+ Logger({
717
+ level: "WARN",
718
+ message: "Parameter Validation warrnings for getProducts",
719
+ });
720
+ Logger({ level: "WARN", message: warrning });
562
721
  }
563
722
 
564
723
  const query_params = {};
@@ -573,7 +732,7 @@ class Catalog {
573
732
 
574
733
  const xHeaders = {};
575
734
 
576
- return APIClient.execute(
735
+ const response = await APIClient.execute(
577
736
  this._conf,
578
737
  "get",
579
738
  constructUrl({
@@ -584,6 +743,23 @@ class Catalog {
584
743
  undefined,
585
744
  xHeaders
586
745
  );
746
+
747
+ const {
748
+ error: res_error,
749
+ } = CatalogModel.ProductListingResponse().validate(response, {
750
+ abortEarly: false,
751
+ allowUnknown: false,
752
+ });
753
+
754
+ if (res_error) {
755
+ Logger({
756
+ level: "WARN",
757
+ message: "Response Validation Warnnings for getProducts",
758
+ });
759
+ Logger({ level: "WARN", message: res_error });
760
+ }
761
+
762
+ return response;
587
763
  }
588
764
 
589
765
  /**
@@ -642,7 +818,7 @@ class Catalog {
642
818
  * @summary: Get all the brands
643
819
  * @description: A brand is the name under which a product is sold. Use this API to list all the brands. You can also filter the brands by department.
644
820
  */
645
- getBrands({ department, pageNo, pageSize } = {}) {
821
+ async getBrands({ department, pageNo, pageSize } = {}) {
646
822
  const { error } = CatalogValidator.getBrands().validate(
647
823
  { department, pageNo, pageSize },
648
824
  { abortEarly: false, allowUnknown: true }
@@ -657,8 +833,11 @@ class Catalog {
657
833
  { abortEarly: false, allowUnknown: false }
658
834
  );
659
835
  if (warrning) {
660
- console.log("Parameter Validation warrnings for getBrands");
661
- console.log(warrning);
836
+ Logger({
837
+ level: "WARN",
838
+ message: "Parameter Validation warrnings for getBrands",
839
+ });
840
+ Logger({ level: "WARN", message: warrning });
662
841
  }
663
842
 
664
843
  const query_params = {};
@@ -668,7 +847,7 @@ class Catalog {
668
847
 
669
848
  const xHeaders = {};
670
849
 
671
- return APIClient.execute(
850
+ const response = await APIClient.execute(
672
851
  this._conf,
673
852
  "get",
674
853
  constructUrl({
@@ -679,6 +858,23 @@ class Catalog {
679
858
  undefined,
680
859
  xHeaders
681
860
  );
861
+
862
+ const {
863
+ error: res_error,
864
+ } = CatalogModel.BrandListingResponse().validate(response, {
865
+ abortEarly: false,
866
+ allowUnknown: false,
867
+ });
868
+
869
+ if (res_error) {
870
+ Logger({
871
+ level: "WARN",
872
+ message: "Response Validation Warnnings for getBrands",
873
+ });
874
+ Logger({ level: "WARN", message: res_error });
875
+ }
876
+
877
+ return response;
682
878
  }
683
879
 
684
880
  /**
@@ -721,7 +917,7 @@ class Catalog {
721
917
  * @summary: Get metadata of a brand
722
918
  * @description: Fetch metadata of a brand such as name, information, logo, banner, etc.
723
919
  */
724
- getBrandDetailBySlug({ slug } = {}) {
920
+ async getBrandDetailBySlug({ slug } = {}) {
725
921
  const { error } = CatalogValidator.getBrandDetailBySlug().validate(
726
922
  { slug },
727
923
  { abortEarly: false, allowUnknown: true }
@@ -738,15 +934,18 @@ class Catalog {
738
934
  { abortEarly: false, allowUnknown: false }
739
935
  );
740
936
  if (warrning) {
741
- console.log("Parameter Validation warrnings for getBrandDetailBySlug");
742
- console.log(warrning);
937
+ Logger({
938
+ level: "WARN",
939
+ message: "Parameter Validation warrnings for getBrandDetailBySlug",
940
+ });
941
+ Logger({ level: "WARN", message: warrning });
743
942
  }
744
943
 
745
944
  const query_params = {};
746
945
 
747
946
  const xHeaders = {};
748
947
 
749
- return APIClient.execute(
948
+ const response = await APIClient.execute(
750
949
  this._conf,
751
950
  "get",
752
951
  constructUrl({
@@ -757,6 +956,23 @@ class Catalog {
757
956
  undefined,
758
957
  xHeaders
759
958
  );
959
+
960
+ const {
961
+ error: res_error,
962
+ } = CatalogModel.BrandDetailResponse().validate(response, {
963
+ abortEarly: false,
964
+ allowUnknown: false,
965
+ });
966
+
967
+ if (res_error) {
968
+ Logger({
969
+ level: "WARN",
970
+ message: "Response Validation Warnnings for getBrandDetailBySlug",
971
+ });
972
+ Logger({ level: "WARN", message: res_error });
973
+ }
974
+
975
+ return response;
760
976
  }
761
977
 
762
978
  /**
@@ -769,7 +985,7 @@ class Catalog {
769
985
  * @summary: List all the categories
770
986
  * @description: Use this API to list all the categories. You can also filter the categories by department.
771
987
  */
772
- getCategories({ department } = {}) {
988
+ async getCategories({ department } = {}) {
773
989
  const { error } = CatalogValidator.getCategories().validate(
774
990
  { department },
775
991
  { abortEarly: false, allowUnknown: true }
@@ -784,8 +1000,11 @@ class Catalog {
784
1000
  { abortEarly: false, allowUnknown: false }
785
1001
  );
786
1002
  if (warrning) {
787
- console.log("Parameter Validation warrnings for getCategories");
788
- console.log(warrning);
1003
+ Logger({
1004
+ level: "WARN",
1005
+ message: "Parameter Validation warrnings for getCategories",
1006
+ });
1007
+ Logger({ level: "WARN", message: warrning });
789
1008
  }
790
1009
 
791
1010
  const query_params = {};
@@ -793,7 +1012,7 @@ class Catalog {
793
1012
 
794
1013
  const xHeaders = {};
795
1014
 
796
- return APIClient.execute(
1015
+ const response = await APIClient.execute(
797
1016
  this._conf,
798
1017
  "get",
799
1018
  constructUrl({
@@ -804,6 +1023,23 @@ class Catalog {
804
1023
  undefined,
805
1024
  xHeaders
806
1025
  );
1026
+
1027
+ const {
1028
+ error: res_error,
1029
+ } = CatalogModel.CategoryListingResponse().validate(response, {
1030
+ abortEarly: false,
1031
+ allowUnknown: false,
1032
+ });
1033
+
1034
+ if (res_error) {
1035
+ Logger({
1036
+ level: "WARN",
1037
+ message: "Response Validation Warnnings for getCategories",
1038
+ });
1039
+ Logger({ level: "WARN", message: res_error });
1040
+ }
1041
+
1042
+ return response;
807
1043
  }
808
1044
 
809
1045
  /**
@@ -815,7 +1051,7 @@ class Catalog {
815
1051
  * @summary: Get metadata of a category
816
1052
  * @description: Fetch metadata of a category such as name, information, logo, banner, etc.
817
1053
  */
818
- getCategoryDetailBySlug({ slug } = {}) {
1054
+ async getCategoryDetailBySlug({ slug } = {}) {
819
1055
  const { error } = CatalogValidator.getCategoryDetailBySlug().validate(
820
1056
  { slug },
821
1057
  { abortEarly: false, allowUnknown: true }
@@ -832,15 +1068,18 @@ class Catalog {
832
1068
  { abortEarly: false, allowUnknown: false }
833
1069
  );
834
1070
  if (warrning) {
835
- console.log("Parameter Validation warrnings for getCategoryDetailBySlug");
836
- console.log(warrning);
1071
+ Logger({
1072
+ level: "WARN",
1073
+ message: "Parameter Validation warrnings for getCategoryDetailBySlug",
1074
+ });
1075
+ Logger({ level: "WARN", message: warrning });
837
1076
  }
838
1077
 
839
1078
  const query_params = {};
840
1079
 
841
1080
  const xHeaders = {};
842
1081
 
843
- return APIClient.execute(
1082
+ const response = await APIClient.execute(
844
1083
  this._conf,
845
1084
  "get",
846
1085
  constructUrl({
@@ -851,6 +1090,23 @@ class Catalog {
851
1090
  undefined,
852
1091
  xHeaders
853
1092
  );
1093
+
1094
+ const {
1095
+ error: res_error,
1096
+ } = CatalogModel.CategoryMetaResponse().validate(response, {
1097
+ abortEarly: false,
1098
+ allowUnknown: false,
1099
+ });
1100
+
1101
+ if (res_error) {
1102
+ Logger({
1103
+ level: "WARN",
1104
+ message: "Response Validation Warnnings for getCategoryDetailBySlug",
1105
+ });
1106
+ Logger({ level: "WARN", message: res_error });
1107
+ }
1108
+
1109
+ return response;
854
1110
  }
855
1111
 
856
1112
  /**
@@ -864,7 +1120,7 @@ class Catalog {
864
1120
  * @summary: List the products
865
1121
  * @description: List all the products associated with a brand, collection or category in a random order.
866
1122
  */
867
- getHomeProducts({ sortOn, pageId, pageSize } = {}) {
1123
+ async getHomeProducts({ sortOn, pageId, pageSize } = {}) {
868
1124
  const { error } = CatalogValidator.getHomeProducts().validate(
869
1125
  { sortOn, pageId, pageSize },
870
1126
  { abortEarly: false, allowUnknown: true }
@@ -879,8 +1135,11 @@ class Catalog {
879
1135
  { abortEarly: false, allowUnknown: false }
880
1136
  );
881
1137
  if (warrning) {
882
- console.log("Parameter Validation warrnings for getHomeProducts");
883
- console.log(warrning);
1138
+ Logger({
1139
+ level: "WARN",
1140
+ message: "Parameter Validation warrnings for getHomeProducts",
1141
+ });
1142
+ Logger({ level: "WARN", message: warrning });
884
1143
  }
885
1144
 
886
1145
  const query_params = {};
@@ -890,7 +1149,7 @@ class Catalog {
890
1149
 
891
1150
  const xHeaders = {};
892
1151
 
893
- return APIClient.execute(
1152
+ const response = await APIClient.execute(
894
1153
  this._conf,
895
1154
  "get",
896
1155
  constructUrl({
@@ -901,6 +1160,23 @@ class Catalog {
901
1160
  undefined,
902
1161
  xHeaders
903
1162
  );
1163
+
1164
+ const {
1165
+ error: res_error,
1166
+ } = CatalogModel.HomeListingResponse().validate(response, {
1167
+ abortEarly: false,
1168
+ allowUnknown: false,
1169
+ });
1170
+
1171
+ if (res_error) {
1172
+ Logger({
1173
+ level: "WARN",
1174
+ message: "Response Validation Warnnings for getHomeProducts",
1175
+ });
1176
+ Logger({ level: "WARN", message: res_error });
1177
+ }
1178
+
1179
+ return response;
904
1180
  }
905
1181
 
906
1182
  /**
@@ -939,7 +1215,7 @@ class Catalog {
939
1215
  * @summary: List all the departments
940
1216
  * @description: Departments are a way to categorise similar products. A product can lie in multiple departments. For example, a skirt can below to the 'Women's Fashion' Department while a handbag can lie in 'Women's Accessories' Department. Use this API to list all the departments. If successful, returns the list of departments specified in `DepartmentResponse`
941
1217
  */
942
- getDepartments({} = {}) {
1218
+ async getDepartments({} = {}) {
943
1219
  const { error } = CatalogValidator.getDepartments().validate(
944
1220
  {},
945
1221
  { abortEarly: false, allowUnknown: true }
@@ -954,15 +1230,18 @@ class Catalog {
954
1230
  { abortEarly: false, allowUnknown: false }
955
1231
  );
956
1232
  if (warrning) {
957
- console.log("Parameter Validation warrnings for getDepartments");
958
- console.log(warrning);
1233
+ Logger({
1234
+ level: "WARN",
1235
+ message: "Parameter Validation warrnings for getDepartments",
1236
+ });
1237
+ Logger({ level: "WARN", message: warrning });
959
1238
  }
960
1239
 
961
1240
  const query_params = {};
962
1241
 
963
1242
  const xHeaders = {};
964
1243
 
965
- return APIClient.execute(
1244
+ const response = await APIClient.execute(
966
1245
  this._conf,
967
1246
  "get",
968
1247
  constructUrl({
@@ -973,6 +1252,23 @@ class Catalog {
973
1252
  undefined,
974
1253
  xHeaders
975
1254
  );
1255
+
1256
+ const {
1257
+ error: res_error,
1258
+ } = CatalogModel.DepartmentResponse().validate(response, {
1259
+ abortEarly: false,
1260
+ allowUnknown: false,
1261
+ });
1262
+
1263
+ if (res_error) {
1264
+ Logger({
1265
+ level: "WARN",
1266
+ message: "Response Validation Warnnings for getDepartments",
1267
+ });
1268
+ Logger({ level: "WARN", message: res_error });
1269
+ }
1270
+
1271
+ return response;
976
1272
  }
977
1273
 
978
1274
  /**
@@ -985,7 +1281,7 @@ class Catalog {
985
1281
  * @summary: Get relevant suggestions for a search query
986
1282
  * @description: Retrieves a list of suggestions for a given search query. Each suggestion is a valid search term that's generated on the basis of query. This is particularly useful to enhance the user experience while using the search tool.
987
1283
  */
988
- getSearchResults({ q } = {}) {
1284
+ async getSearchResults({ q } = {}) {
989
1285
  const { error } = CatalogValidator.getSearchResults().validate(
990
1286
  { q },
991
1287
  { abortEarly: false, allowUnknown: true }
@@ -1000,8 +1296,11 @@ class Catalog {
1000
1296
  { abortEarly: false, allowUnknown: false }
1001
1297
  );
1002
1298
  if (warrning) {
1003
- console.log("Parameter Validation warrnings for getSearchResults");
1004
- console.log(warrning);
1299
+ Logger({
1300
+ level: "WARN",
1301
+ message: "Parameter Validation warrnings for getSearchResults",
1302
+ });
1303
+ Logger({ level: "WARN", message: warrning });
1005
1304
  }
1006
1305
 
1007
1306
  const query_params = {};
@@ -1009,7 +1308,7 @@ class Catalog {
1009
1308
 
1010
1309
  const xHeaders = {};
1011
1310
 
1012
- return APIClient.execute(
1311
+ const response = await APIClient.execute(
1013
1312
  this._conf,
1014
1313
  "get",
1015
1314
  constructUrl({
@@ -1020,6 +1319,23 @@ class Catalog {
1020
1319
  undefined,
1021
1320
  xHeaders
1022
1321
  );
1322
+
1323
+ const {
1324
+ error: res_error,
1325
+ } = CatalogModel.AutoCompleteResponse().validate(response, {
1326
+ abortEarly: false,
1327
+ allowUnknown: false,
1328
+ });
1329
+
1330
+ if (res_error) {
1331
+ Logger({
1332
+ level: "WARN",
1333
+ message: "Response Validation Warnnings for getSearchResults",
1334
+ });
1335
+ Logger({ level: "WARN", message: res_error });
1336
+ }
1337
+
1338
+ return response;
1023
1339
  }
1024
1340
 
1025
1341
  /**
@@ -1032,7 +1348,7 @@ class Catalog {
1032
1348
  * @summary: List all the collections
1033
1349
  * @description: Collections are a great way to organize your products and can improve the ability for customers to find items quickly and efficiently.
1034
1350
  */
1035
- getCollections({ pageNo, pageSize, tag } = {}) {
1351
+ async getCollections({ pageNo, pageSize, tag } = {}) {
1036
1352
  const { error } = CatalogValidator.getCollections().validate(
1037
1353
  { pageNo, pageSize, tag },
1038
1354
  { abortEarly: false, allowUnknown: true }
@@ -1047,8 +1363,11 @@ class Catalog {
1047
1363
  { abortEarly: false, allowUnknown: false }
1048
1364
  );
1049
1365
  if (warrning) {
1050
- console.log("Parameter Validation warrnings for getCollections");
1051
- console.log(warrning);
1366
+ Logger({
1367
+ level: "WARN",
1368
+ message: "Parameter Validation warrnings for getCollections",
1369
+ });
1370
+ Logger({ level: "WARN", message: warrning });
1052
1371
  }
1053
1372
 
1054
1373
  const query_params = {};
@@ -1058,7 +1377,7 @@ class Catalog {
1058
1377
 
1059
1378
  const xHeaders = {};
1060
1379
 
1061
- return APIClient.execute(
1380
+ const response = await APIClient.execute(
1062
1381
  this._conf,
1063
1382
  "get",
1064
1383
  constructUrl({
@@ -1069,6 +1388,23 @@ class Catalog {
1069
1388
  undefined,
1070
1389
  xHeaders
1071
1390
  );
1391
+
1392
+ const {
1393
+ error: res_error,
1394
+ } = CatalogModel.GetCollectionListingResponse().validate(response, {
1395
+ abortEarly: false,
1396
+ allowUnknown: false,
1397
+ });
1398
+
1399
+ if (res_error) {
1400
+ Logger({
1401
+ level: "WARN",
1402
+ message: "Response Validation Warnnings for getCollections",
1403
+ });
1404
+ Logger({ level: "WARN", message: res_error });
1405
+ }
1406
+
1407
+ return response;
1072
1408
  }
1073
1409
 
1074
1410
  /**
@@ -1119,7 +1455,7 @@ class Catalog {
1119
1455
  * @summary: Get the items in a collection
1120
1456
  * @description: Get items in a collection specified by its `slug`.
1121
1457
  */
1122
- getCollectionItemsBySlug({
1458
+ async getCollectionItemsBySlug({
1123
1459
  slug,
1124
1460
  f,
1125
1461
  filters,
@@ -1143,10 +1479,11 @@ class Catalog {
1143
1479
  { abortEarly: false, allowUnknown: false }
1144
1480
  );
1145
1481
  if (warrning) {
1146
- console.log(
1147
- "Parameter Validation warrnings for getCollectionItemsBySlug"
1148
- );
1149
- console.log(warrning);
1482
+ Logger({
1483
+ level: "WARN",
1484
+ message: "Parameter Validation warrnings for getCollectionItemsBySlug",
1485
+ });
1486
+ Logger({ level: "WARN", message: warrning });
1150
1487
  }
1151
1488
 
1152
1489
  const query_params = {};
@@ -1158,7 +1495,7 @@ class Catalog {
1158
1495
 
1159
1496
  const xHeaders = {};
1160
1497
 
1161
- return APIClient.execute(
1498
+ const response = await APIClient.execute(
1162
1499
  this._conf,
1163
1500
  "get",
1164
1501
  constructUrl({
@@ -1169,6 +1506,23 @@ class Catalog {
1169
1506
  undefined,
1170
1507
  xHeaders
1171
1508
  );
1509
+
1510
+ const {
1511
+ error: res_error,
1512
+ } = CatalogModel.ProductListingResponse().validate(response, {
1513
+ abortEarly: false,
1514
+ allowUnknown: false,
1515
+ });
1516
+
1517
+ if (res_error) {
1518
+ Logger({
1519
+ level: "WARN",
1520
+ message: "Response Validation Warnnings for getCollectionItemsBySlug",
1521
+ });
1522
+ Logger({ level: "WARN", message: res_error });
1523
+ }
1524
+
1525
+ return response;
1172
1526
  }
1173
1527
 
1174
1528
  /**
@@ -1228,7 +1582,7 @@ class Catalog {
1228
1582
  * @summary: Get a particular collection
1229
1583
  * @description: Get the details of a collection by its `slug`.
1230
1584
  */
1231
- getCollectionDetailBySlug({ slug } = {}) {
1585
+ async getCollectionDetailBySlug({ slug } = {}) {
1232
1586
  const { error } = CatalogValidator.getCollectionDetailBySlug().validate(
1233
1587
  { slug },
1234
1588
  { abortEarly: false, allowUnknown: true }
@@ -1245,17 +1599,18 @@ class Catalog {
1245
1599
  { abortEarly: false, allowUnknown: false }
1246
1600
  );
1247
1601
  if (warrning) {
1248
- console.log(
1249
- "Parameter Validation warrnings for getCollectionDetailBySlug"
1250
- );
1251
- console.log(warrning);
1602
+ Logger({
1603
+ level: "WARN",
1604
+ message: "Parameter Validation warrnings for getCollectionDetailBySlug",
1605
+ });
1606
+ Logger({ level: "WARN", message: warrning });
1252
1607
  }
1253
1608
 
1254
1609
  const query_params = {};
1255
1610
 
1256
1611
  const xHeaders = {};
1257
1612
 
1258
- return APIClient.execute(
1613
+ const response = await APIClient.execute(
1259
1614
  this._conf,
1260
1615
  "get",
1261
1616
  constructUrl({
@@ -1266,6 +1621,23 @@ class Catalog {
1266
1621
  undefined,
1267
1622
  xHeaders
1268
1623
  );
1624
+
1625
+ const {
1626
+ error: res_error,
1627
+ } = CatalogModel.CollectionDetailResponse().validate(response, {
1628
+ abortEarly: false,
1629
+ allowUnknown: false,
1630
+ });
1631
+
1632
+ if (res_error) {
1633
+ Logger({
1634
+ level: "WARN",
1635
+ message: "Response Validation Warnnings for getCollectionDetailBySlug",
1636
+ });
1637
+ Logger({ level: "WARN", message: res_error });
1638
+ }
1639
+
1640
+ return response;
1269
1641
  }
1270
1642
 
1271
1643
  /**
@@ -1278,7 +1650,7 @@ class Catalog {
1278
1650
  * @summary: Get a list of followed Products, Brands, Collections
1279
1651
  * @description: Users can follow a product they like. This API retrieves the products the user have followed.
1280
1652
  */
1281
- getFollowedListing({ collectionType, pageId, pageSize } = {}) {
1653
+ async getFollowedListing({ collectionType, pageId, pageSize } = {}) {
1282
1654
  const { error } = CatalogValidator.getFollowedListing().validate(
1283
1655
  { collectionType, pageId, pageSize },
1284
1656
  { abortEarly: false, allowUnknown: true }
@@ -1293,8 +1665,11 @@ class Catalog {
1293
1665
  { abortEarly: false, allowUnknown: false }
1294
1666
  );
1295
1667
  if (warrning) {
1296
- console.log("Parameter Validation warrnings for getFollowedListing");
1297
- console.log(warrning);
1668
+ Logger({
1669
+ level: "WARN",
1670
+ message: "Parameter Validation warrnings for getFollowedListing",
1671
+ });
1672
+ Logger({ level: "WARN", message: warrning });
1298
1673
  }
1299
1674
 
1300
1675
  const query_params = {};
@@ -1303,7 +1678,7 @@ class Catalog {
1303
1678
 
1304
1679
  const xHeaders = {};
1305
1680
 
1306
- return APIClient.execute(
1681
+ const response = await APIClient.execute(
1307
1682
  this._conf,
1308
1683
  "get",
1309
1684
  constructUrl({
@@ -1314,6 +1689,23 @@ class Catalog {
1314
1689
  undefined,
1315
1690
  xHeaders
1316
1691
  );
1692
+
1693
+ const {
1694
+ error: res_error,
1695
+ } = CatalogModel.GetFollowListingResponse().validate(response, {
1696
+ abortEarly: false,
1697
+ allowUnknown: false,
1698
+ });
1699
+
1700
+ if (res_error) {
1701
+ Logger({
1702
+ level: "WARN",
1703
+ message: "Response Validation Warnnings for getFollowedListing",
1704
+ });
1705
+ Logger({ level: "WARN", message: res_error });
1706
+ }
1707
+
1708
+ return response;
1317
1709
  }
1318
1710
 
1319
1711
  /**
@@ -1354,7 +1746,7 @@ class Catalog {
1354
1746
  * @summary: Follow an entity (product/brand/collection)
1355
1747
  * @description: Follow a particular entity such as product, brand, collection specified by its ID.
1356
1748
  */
1357
- followById({ collectionType, collectionId } = {}) {
1749
+ async followById({ collectionType, collectionId } = {}) {
1358
1750
  const { error } = CatalogValidator.followById().validate(
1359
1751
  { collectionType, collectionId },
1360
1752
  { abortEarly: false, allowUnknown: true }
@@ -1369,15 +1761,18 @@ class Catalog {
1369
1761
  { abortEarly: false, allowUnknown: false }
1370
1762
  );
1371
1763
  if (warrning) {
1372
- console.log("Parameter Validation warrnings for followById");
1373
- console.log(warrning);
1764
+ Logger({
1765
+ level: "WARN",
1766
+ message: "Parameter Validation warrnings for followById",
1767
+ });
1768
+ Logger({ level: "WARN", message: warrning });
1374
1769
  }
1375
1770
 
1376
1771
  const query_params = {};
1377
1772
 
1378
1773
  const xHeaders = {};
1379
1774
 
1380
- return APIClient.execute(
1775
+ const response = await APIClient.execute(
1381
1776
  this._conf,
1382
1777
  "post",
1383
1778
  constructUrl({
@@ -1388,6 +1783,23 @@ class Catalog {
1388
1783
  undefined,
1389
1784
  xHeaders
1390
1785
  );
1786
+
1787
+ const {
1788
+ error: res_error,
1789
+ } = CatalogModel.FollowPostResponse().validate(response, {
1790
+ abortEarly: false,
1791
+ allowUnknown: false,
1792
+ });
1793
+
1794
+ if (res_error) {
1795
+ Logger({
1796
+ level: "WARN",
1797
+ message: "Response Validation Warnnings for followById",
1798
+ });
1799
+ Logger({ level: "WARN", message: res_error });
1800
+ }
1801
+
1802
+ return response;
1391
1803
  }
1392
1804
 
1393
1805
  /**
@@ -1399,7 +1811,7 @@ class Catalog {
1399
1811
  * @summary: Unfollow an entity (product/brand/collection)
1400
1812
  * @description: You can undo a followed product, brand or collection by its ID. This action is referred as _unfollow_.
1401
1813
  */
1402
- unfollowById({ collectionType, collectionId } = {}) {
1814
+ async unfollowById({ collectionType, collectionId } = {}) {
1403
1815
  const { error } = CatalogValidator.unfollowById().validate(
1404
1816
  { collectionType, collectionId },
1405
1817
  { abortEarly: false, allowUnknown: true }
@@ -1414,15 +1826,18 @@ class Catalog {
1414
1826
  { abortEarly: false, allowUnknown: false }
1415
1827
  );
1416
1828
  if (warrning) {
1417
- console.log("Parameter Validation warrnings for unfollowById");
1418
- console.log(warrning);
1829
+ Logger({
1830
+ level: "WARN",
1831
+ message: "Parameter Validation warrnings for unfollowById",
1832
+ });
1833
+ Logger({ level: "WARN", message: warrning });
1419
1834
  }
1420
1835
 
1421
1836
  const query_params = {};
1422
1837
 
1423
1838
  const xHeaders = {};
1424
1839
 
1425
- return APIClient.execute(
1840
+ const response = await APIClient.execute(
1426
1841
  this._conf,
1427
1842
  "delete",
1428
1843
  constructUrl({
@@ -1433,6 +1848,23 @@ class Catalog {
1433
1848
  undefined,
1434
1849
  xHeaders
1435
1850
  );
1851
+
1852
+ const {
1853
+ error: res_error,
1854
+ } = CatalogModel.FollowPostResponse().validate(response, {
1855
+ abortEarly: false,
1856
+ allowUnknown: false,
1857
+ });
1858
+
1859
+ if (res_error) {
1860
+ Logger({
1861
+ level: "WARN",
1862
+ message: "Response Validation Warnnings for unfollowById",
1863
+ });
1864
+ Logger({ level: "WARN", message: res_error });
1865
+ }
1866
+
1867
+ return response;
1436
1868
  }
1437
1869
 
1438
1870
  /**
@@ -1444,7 +1876,7 @@ class Catalog {
1444
1876
  * @summary: Get Follow Count
1445
1877
  * @description: Get the total count of followers for a given collection type and collection ID.
1446
1878
  */
1447
- getFollowerCountById({ collectionType, collectionId } = {}) {
1879
+ async getFollowerCountById({ collectionType, collectionId } = {}) {
1448
1880
  const { error } = CatalogValidator.getFollowerCountById().validate(
1449
1881
  { collectionType, collectionId },
1450
1882
  { abortEarly: false, allowUnknown: true }
@@ -1461,15 +1893,18 @@ class Catalog {
1461
1893
  { abortEarly: false, allowUnknown: false }
1462
1894
  );
1463
1895
  if (warrning) {
1464
- console.log("Parameter Validation warrnings for getFollowerCountById");
1465
- console.log(warrning);
1896
+ Logger({
1897
+ level: "WARN",
1898
+ message: "Parameter Validation warrnings for getFollowerCountById",
1899
+ });
1900
+ Logger({ level: "WARN", message: warrning });
1466
1901
  }
1467
1902
 
1468
1903
  const query_params = {};
1469
1904
 
1470
1905
  const xHeaders = {};
1471
1906
 
1472
- return APIClient.execute(
1907
+ const response = await APIClient.execute(
1473
1908
  this._conf,
1474
1909
  "get",
1475
1910
  constructUrl({
@@ -1480,6 +1915,23 @@ class Catalog {
1480
1915
  undefined,
1481
1916
  xHeaders
1482
1917
  );
1918
+
1919
+ const {
1920
+ error: res_error,
1921
+ } = CatalogModel.FollowerCountResponse().validate(response, {
1922
+ abortEarly: false,
1923
+ allowUnknown: false,
1924
+ });
1925
+
1926
+ if (res_error) {
1927
+ Logger({
1928
+ level: "WARN",
1929
+ message: "Response Validation Warnnings for getFollowerCountById",
1930
+ });
1931
+ Logger({ level: "WARN", message: res_error });
1932
+ }
1933
+
1934
+ return response;
1483
1935
  }
1484
1936
 
1485
1937
  /**
@@ -1490,7 +1942,7 @@ class Catalog {
1490
1942
  * @summary: Get the IDs of followed products, brands and collections.
1491
1943
  * @description: You can get the IDs of all the followed Products, Brands and Collections. Pass collection_type as query parameter to fetch specific Ids
1492
1944
  */
1493
- getFollowIds({ collectionType } = {}) {
1945
+ async getFollowIds({ collectionType } = {}) {
1494
1946
  const { error } = CatalogValidator.getFollowIds().validate(
1495
1947
  { collectionType },
1496
1948
  { abortEarly: false, allowUnknown: true }
@@ -1505,8 +1957,11 @@ class Catalog {
1505
1957
  { abortEarly: false, allowUnknown: false }
1506
1958
  );
1507
1959
  if (warrning) {
1508
- console.log("Parameter Validation warrnings for getFollowIds");
1509
- console.log(warrning);
1960
+ Logger({
1961
+ level: "WARN",
1962
+ message: "Parameter Validation warrnings for getFollowIds",
1963
+ });
1964
+ Logger({ level: "WARN", message: warrning });
1510
1965
  }
1511
1966
 
1512
1967
  const query_params = {};
@@ -1514,7 +1969,7 @@ class Catalog {
1514
1969
 
1515
1970
  const xHeaders = {};
1516
1971
 
1517
- return APIClient.execute(
1972
+ const response = await APIClient.execute(
1518
1973
  this._conf,
1519
1974
  "get",
1520
1975
  constructUrl({
@@ -1525,6 +1980,23 @@ class Catalog {
1525
1980
  undefined,
1526
1981
  xHeaders
1527
1982
  );
1983
+
1984
+ const {
1985
+ error: res_error,
1986
+ } = CatalogModel.FollowIdsResponse().validate(response, {
1987
+ abortEarly: false,
1988
+ allowUnknown: false,
1989
+ });
1990
+
1991
+ if (res_error) {
1992
+ Logger({
1993
+ level: "WARN",
1994
+ message: "Response Validation Warnnings for getFollowIds",
1995
+ });
1996
+ Logger({ level: "WARN", message: res_error });
1997
+ }
1998
+
1999
+ return response;
1528
2000
  }
1529
2001
 
1530
2002
  /**
@@ -1544,7 +2016,15 @@ class Catalog {
1544
2016
  * @summary: Get store meta information.
1545
2017
  * @description: Use this API to get a list of stores in a specific application.
1546
2018
  */
1547
- getStores({ pageNo, pageSize, q, city, range, latitude, longitude } = {}) {
2019
+ async getStores({
2020
+ pageNo,
2021
+ pageSize,
2022
+ q,
2023
+ city,
2024
+ range,
2025
+ latitude,
2026
+ longitude,
2027
+ } = {}) {
1548
2028
  const { error } = CatalogValidator.getStores().validate(
1549
2029
  { pageNo, pageSize, q, city, range, latitude, longitude },
1550
2030
  { abortEarly: false, allowUnknown: true }
@@ -1559,8 +2039,11 @@ class Catalog {
1559
2039
  { abortEarly: false, allowUnknown: false }
1560
2040
  );
1561
2041
  if (warrning) {
1562
- console.log("Parameter Validation warrnings for getStores");
1563
- console.log(warrning);
2042
+ Logger({
2043
+ level: "WARN",
2044
+ message: "Parameter Validation warrnings for getStores",
2045
+ });
2046
+ Logger({ level: "WARN", message: warrning });
1564
2047
  }
1565
2048
 
1566
2049
  const query_params = {};
@@ -1574,7 +2057,7 @@ class Catalog {
1574
2057
 
1575
2058
  const xHeaders = {};
1576
2059
 
1577
- return APIClient.execute(
2060
+ const response = await APIClient.execute(
1578
2061
  this._conf,
1579
2062
  "get",
1580
2063
  constructUrl({
@@ -1585,6 +2068,23 @@ class Catalog {
1585
2068
  undefined,
1586
2069
  xHeaders
1587
2070
  );
2071
+
2072
+ const {
2073
+ error: res_error,
2074
+ } = CatalogModel.StoreListingResponse().validate(response, {
2075
+ abortEarly: false,
2076
+ allowUnknown: false,
2077
+ });
2078
+
2079
+ if (res_error) {
2080
+ Logger({
2081
+ level: "WARN",
2082
+ message: "Response Validation Warnnings for getStores",
2083
+ });
2084
+ Logger({ level: "WARN", message: res_error });
2085
+ }
2086
+
2087
+ return response;
1588
2088
  }
1589
2089
 
1590
2090
  /**
@@ -1643,7 +2143,7 @@ class Catalog {
1643
2143
  * @summary: Get store meta information.
1644
2144
  * @description: Use this API to get a list of stores in a specific application.
1645
2145
  */
1646
- getInStockLocations({
2146
+ async getInStockLocations({
1647
2147
  pageNo,
1648
2148
  pageSize,
1649
2149
  q,
@@ -1666,8 +2166,11 @@ class Catalog {
1666
2166
  { abortEarly: false, allowUnknown: false }
1667
2167
  );
1668
2168
  if (warrning) {
1669
- console.log("Parameter Validation warrnings for getInStockLocations");
1670
- console.log(warrning);
2169
+ Logger({
2170
+ level: "WARN",
2171
+ message: "Parameter Validation warrnings for getInStockLocations",
2172
+ });
2173
+ Logger({ level: "WARN", message: warrning });
1671
2174
  }
1672
2175
 
1673
2176
  const query_params = {};
@@ -1681,7 +2184,7 @@ class Catalog {
1681
2184
 
1682
2185
  const xHeaders = {};
1683
2186
 
1684
- return APIClient.execute(
2187
+ const response = await APIClient.execute(
1685
2188
  this._conf,
1686
2189
  "get",
1687
2190
  constructUrl({
@@ -1692,6 +2195,23 @@ class Catalog {
1692
2195
  undefined,
1693
2196
  xHeaders
1694
2197
  );
2198
+
2199
+ const {
2200
+ error: res_error,
2201
+ } = CatalogModel.ApplicationStoreListing().validate(response, {
2202
+ abortEarly: false,
2203
+ allowUnknown: false,
2204
+ });
2205
+
2206
+ if (res_error) {
2207
+ Logger({
2208
+ level: "WARN",
2209
+ message: "Response Validation Warnnings for getInStockLocations",
2210
+ });
2211
+ Logger({ level: "WARN", message: res_error });
2212
+ }
2213
+
2214
+ return response;
1695
2215
  }
1696
2216
 
1697
2217
  /**
@@ -1747,7 +2267,7 @@ class Catalog {
1747
2267
  * @summary: Get store meta information.
1748
2268
  * @description: Use this API to get meta details for a store.
1749
2269
  */
1750
- getLocationDetailsById({ locationId } = {}) {
2270
+ async getLocationDetailsById({ locationId } = {}) {
1751
2271
  const { error } = CatalogValidator.getLocationDetailsById().validate(
1752
2272
  { locationId },
1753
2273
  { abortEarly: false, allowUnknown: true }
@@ -1764,15 +2284,18 @@ class Catalog {
1764
2284
  { abortEarly: false, allowUnknown: false }
1765
2285
  );
1766
2286
  if (warrning) {
1767
- console.log("Parameter Validation warrnings for getLocationDetailsById");
1768
- console.log(warrning);
2287
+ Logger({
2288
+ level: "WARN",
2289
+ message: "Parameter Validation warrnings for getLocationDetailsById",
2290
+ });
2291
+ Logger({ level: "WARN", message: warrning });
1769
2292
  }
1770
2293
 
1771
2294
  const query_params = {};
1772
2295
 
1773
2296
  const xHeaders = {};
1774
2297
 
1775
- return APIClient.execute(
2298
+ const response = await APIClient.execute(
1776
2299
  this._conf,
1777
2300
  "get",
1778
2301
  constructUrl({
@@ -1783,6 +2306,21 @@ class Catalog {
1783
2306
  undefined,
1784
2307
  xHeaders
1785
2308
  );
2309
+
2310
+ const { error: res_error } = CatalogModel.StoreDetails().validate(
2311
+ response,
2312
+ { abortEarly: false, allowUnknown: false }
2313
+ );
2314
+
2315
+ if (res_error) {
2316
+ Logger({
2317
+ level: "WARN",
2318
+ message: "Response Validation Warnnings for getLocationDetailsById",
2319
+ });
2320
+ Logger({ level: "WARN", message: res_error });
2321
+ }
2322
+
2323
+ return response;
1786
2324
  }
1787
2325
 
1788
2326
  /**
@@ -1793,7 +2331,7 @@ class Catalog {
1793
2331
  * @summary: Get product bundles
1794
2332
  * @description: Use this API to retrieve products bundles to the one specified by its slug.
1795
2333
  */
1796
- getProductBundlesBySlug({ slug, id } = {}) {
2334
+ async getProductBundlesBySlug({ slug, id } = {}) {
1797
2335
  const { error } = CatalogValidator.getProductBundlesBySlug().validate(
1798
2336
  { slug, id },
1799
2337
  { abortEarly: false, allowUnknown: true }
@@ -1810,8 +2348,11 @@ class Catalog {
1810
2348
  { abortEarly: false, allowUnknown: false }
1811
2349
  );
1812
2350
  if (warrning) {
1813
- console.log("Parameter Validation warrnings for getProductBundlesBySlug");
1814
- console.log(warrning);
2351
+ Logger({
2352
+ level: "WARN",
2353
+ message: "Parameter Validation warrnings for getProductBundlesBySlug",
2354
+ });
2355
+ Logger({ level: "WARN", message: warrning });
1815
2356
  }
1816
2357
 
1817
2358
  const query_params = {};
@@ -1820,7 +2361,7 @@ class Catalog {
1820
2361
 
1821
2362
  const xHeaders = {};
1822
2363
 
1823
- return APIClient.execute(
2364
+ const response = await APIClient.execute(
1824
2365
  this._conf,
1825
2366
  "get",
1826
2367
  constructUrl({
@@ -1831,6 +2372,21 @@ class Catalog {
1831
2372
  undefined,
1832
2373
  xHeaders
1833
2374
  );
2375
+
2376
+ const { error: res_error } = CatalogModel.ProductBundle().validate(
2377
+ response,
2378
+ { abortEarly: false, allowUnknown: false }
2379
+ );
2380
+
2381
+ if (res_error) {
2382
+ Logger({
2383
+ level: "WARN",
2384
+ message: "Response Validation Warnnings for getProductBundlesBySlug",
2385
+ });
2386
+ Logger({ level: "WARN", message: res_error });
2387
+ }
2388
+
2389
+ return response;
1834
2390
  }
1835
2391
 
1836
2392
  /**
@@ -1851,7 +2407,7 @@ class Catalog {
1851
2407
  * @summary: Get the price of a product size at a PIN Code
1852
2408
  * @description: Prices may vary for different sizes of a product. Use this API to retrieve the price of a product size at all the selling locations near to a PIN Code.
1853
2409
  */
1854
- getProductPriceBySlug({ slug, size, storeId, pincode, moq } = {}) {
2410
+ async getProductPriceBySlug({ slug, size, storeId, pincode, moq } = {}) {
1855
2411
  const { error } = CatalogValidator.getProductPriceBySlug().validate(
1856
2412
  { slug, size, storeId, pincode, moq },
1857
2413
  { abortEarly: false, allowUnknown: true }
@@ -1868,8 +2424,11 @@ class Catalog {
1868
2424
  { abortEarly: false, allowUnknown: false }
1869
2425
  );
1870
2426
  if (warrning) {
1871
- console.log("Parameter Validation warrnings for getProductPriceBySlug");
1872
- console.log(warrning);
2427
+ Logger({
2428
+ level: "WARN",
2429
+ message: "Parameter Validation warrnings for getProductPriceBySlug",
2430
+ });
2431
+ Logger({ level: "WARN", message: warrning });
1873
2432
  }
1874
2433
 
1875
2434
  const query_params = {};
@@ -1879,7 +2438,7 @@ class Catalog {
1879
2438
 
1880
2439
  const xHeaders = {};
1881
2440
 
1882
- return APIClient.execute(
2441
+ const response = await APIClient.execute(
1883
2442
  this._conf,
1884
2443
  "get",
1885
2444
  constructUrl({
@@ -1890,6 +2449,23 @@ class Catalog {
1890
2449
  undefined,
1891
2450
  xHeaders
1892
2451
  );
2452
+
2453
+ const {
2454
+ error: res_error,
2455
+ } = CatalogModel.ProductSizePriceResponseV3().validate(response, {
2456
+ abortEarly: false,
2457
+ allowUnknown: false,
2458
+ });
2459
+
2460
+ if (res_error) {
2461
+ Logger({
2462
+ level: "WARN",
2463
+ message: "Response Validation Warnnings for getProductPriceBySlug",
2464
+ });
2465
+ Logger({ level: "WARN", message: res_error });
2466
+ }
2467
+
2468
+ return response;
1893
2469
  }
1894
2470
 
1895
2471
  /**
@@ -1911,7 +2487,7 @@ class Catalog {
1911
2487
  * @summary: Get the sellers of a product size at a PIN Code
1912
2488
  * @description: A product of a particular size may be sold by multiple sellers. Use this API to fetch the sellers having the stock of a particular size at a given PIN Code.
1913
2489
  */
1914
- getProductSellersBySlug({
2490
+ async getProductSellersBySlug({
1915
2491
  slug,
1916
2492
  size,
1917
2493
  pincode,
@@ -1935,8 +2511,11 @@ class Catalog {
1935
2511
  { abortEarly: false, allowUnknown: false }
1936
2512
  );
1937
2513
  if (warrning) {
1938
- console.log("Parameter Validation warrnings for getProductSellersBySlug");
1939
- console.log(warrning);
2514
+ Logger({
2515
+ level: "WARN",
2516
+ message: "Parameter Validation warrnings for getProductSellersBySlug",
2517
+ });
2518
+ Logger({ level: "WARN", message: warrning });
1940
2519
  }
1941
2520
 
1942
2521
  const query_params = {};
@@ -1947,7 +2526,7 @@ class Catalog {
1947
2526
 
1948
2527
  const xHeaders = {};
1949
2528
 
1950
- return APIClient.execute(
2529
+ const response = await APIClient.execute(
1951
2530
  this._conf,
1952
2531
  "get",
1953
2532
  constructUrl({
@@ -1958,6 +2537,23 @@ class Catalog {
1958
2537
  undefined,
1959
2538
  xHeaders
1960
2539
  );
2540
+
2541
+ const {
2542
+ error: res_error,
2543
+ } = CatalogModel.ProductSizeSellersResponseV3().validate(response, {
2544
+ abortEarly: false,
2545
+ allowUnknown: false,
2546
+ });
2547
+
2548
+ if (res_error) {
2549
+ Logger({
2550
+ level: "WARN",
2551
+ message: "Response Validation Warnnings for getProductSellersBySlug",
2552
+ });
2553
+ Logger({ level: "WARN", message: res_error });
2554
+ }
2555
+
2556
+ return response;
1961
2557
  }
1962
2558
 
1963
2559
  /**