@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,9 @@ const { FDKClientValidationError } = require("../../common/FDKError");
3
3
  const constructUrl = require("../constructUrl");
4
4
  const Paginator = require("../../common/Paginator");
5
5
  const InventoryValidator = require("./InventoryPublicValidator");
6
+ const InventoryModel = require("./InventoryPublicModel");
7
+ const { Logger } = require("./../../common/Logger");
8
+
6
9
  class Inventory {
7
10
  constructor(_conf) {
8
11
  this._conf = _conf;
@@ -41,7 +44,7 @@ class Inventory {
41
44
  * @summary: Find all the JobCodes from Metrics Collection based on the field Values
42
45
  * @description: Endpoint to return all JobCodes present in Metrics Collection
43
46
  */
44
- getJobCodesMetrics({ dailyJob, jobCode } = {}) {
47
+ async getJobCodesMetrics({ dailyJob, jobCode } = {}) {
45
48
  const { error } = InventoryValidator.getJobCodesMetrics().validate(
46
49
  { dailyJob, jobCode },
47
50
  { abortEarly: false, allowUnknown: true }
@@ -58,8 +61,11 @@ class Inventory {
58
61
  { abortEarly: false, allowUnknown: false }
59
62
  );
60
63
  if (warrning) {
61
- console.log("Parameter Validation warrnings for getJobCodesMetrics");
62
- console.log(warrning);
64
+ Logger({
65
+ level: "WARN",
66
+ message: "Parameter Validation warrnings for getJobCodesMetrics",
67
+ });
68
+ Logger({ level: "WARN", message: warrning });
63
69
  }
64
70
 
65
71
  const query_params = {};
@@ -68,7 +74,7 @@ class Inventory {
68
74
 
69
75
  const xHeaders = {};
70
76
 
71
- return PublicAPIClient.execute(
77
+ const response = await PublicAPIClient.execute(
72
78
  this._conf,
73
79
  "get",
74
80
  constructUrl({
@@ -79,6 +85,23 @@ class Inventory {
79
85
  undefined,
80
86
  xHeaders
81
87
  );
88
+
89
+ const {
90
+ error: res_error,
91
+ } = InventoryModel.ResponseEnvelopeObject().validate(response, {
92
+ abortEarly: false,
93
+ allowUnknown: false,
94
+ });
95
+
96
+ if (res_error) {
97
+ Logger({
98
+ level: "WARN",
99
+ message: "Response Validation Warnnings for getJobCodesMetrics",
100
+ });
101
+ Logger({ level: "WARN", message: res_error });
102
+ }
103
+
104
+ return response;
82
105
  }
83
106
 
84
107
  /**
@@ -88,7 +111,7 @@ class Inventory {
88
111
  * @summary: Save JobCode Metrics
89
112
  * @description: Endpoint to save JobCode Metrics
90
113
  */
91
- saveJobCodesMetrics({ body } = {}) {
114
+ async saveJobCodesMetrics({ body } = {}) {
92
115
  const { error } = InventoryValidator.saveJobCodesMetrics().validate(
93
116
  { body },
94
117
  { abortEarly: false, allowUnknown: true }
@@ -105,15 +128,18 @@ class Inventory {
105
128
  { abortEarly: false, allowUnknown: false }
106
129
  );
107
130
  if (warrning) {
108
- console.log("Parameter Validation warrnings for saveJobCodesMetrics");
109
- console.log(warrning);
131
+ Logger({
132
+ level: "WARN",
133
+ message: "Parameter Validation warrnings for saveJobCodesMetrics",
134
+ });
135
+ Logger({ level: "WARN", message: warrning });
110
136
  }
111
137
 
112
138
  const query_params = {};
113
139
 
114
140
  const xHeaders = {};
115
141
 
116
- return PublicAPIClient.execute(
142
+ const response = await PublicAPIClient.execute(
117
143
  this._conf,
118
144
  "post",
119
145
  constructUrl({
@@ -124,6 +150,23 @@ class Inventory {
124
150
  body,
125
151
  xHeaders
126
152
  );
153
+
154
+ const {
155
+ error: res_error,
156
+ } = InventoryModel.ResponseEnvelopeEmailJobMetrics().validate(response, {
157
+ abortEarly: false,
158
+ allowUnknown: false,
159
+ });
160
+
161
+ if (res_error) {
162
+ Logger({
163
+ level: "WARN",
164
+ message: "Response Validation Warnnings for saveJobCodesMetrics",
165
+ });
166
+ Logger({ level: "WARN", message: res_error });
167
+ }
168
+
169
+ return response;
127
170
  }
128
171
 
129
172
  /**
@@ -133,7 +176,7 @@ class Inventory {
133
176
  * @summary: Get Slingshot Configuration Of A Company using API key
134
177
  * @description: REST Endpoint that returns all configuration detail of a company
135
178
  */
136
- getConfigByApiKey({ apikey } = {}) {
179
+ async getConfigByApiKey({ apikey } = {}) {
137
180
  const { error } = InventoryValidator.getConfigByApiKey().validate(
138
181
  { apikey },
139
182
  { abortEarly: false, allowUnknown: true }
@@ -148,8 +191,11 @@ class Inventory {
148
191
  { abortEarly: false, allowUnknown: false }
149
192
  );
150
193
  if (warrning) {
151
- console.log("Parameter Validation warrnings for getConfigByApiKey");
152
- console.log(warrning);
194
+ Logger({
195
+ level: "WARN",
196
+ message: "Parameter Validation warrnings for getConfigByApiKey",
197
+ });
198
+ Logger({ level: "WARN", message: warrning });
153
199
  }
154
200
 
155
201
  const query_params = {};
@@ -157,7 +203,7 @@ class Inventory {
157
203
 
158
204
  const xHeaders = {};
159
205
 
160
- return PublicAPIClient.execute(
206
+ const response = await PublicAPIClient.execute(
161
207
  this._conf,
162
208
  "get",
163
209
  constructUrl({
@@ -168,6 +214,23 @@ class Inventory {
168
214
  undefined,
169
215
  xHeaders
170
216
  );
217
+
218
+ const {
219
+ error: res_error,
220
+ } = InventoryModel.ResponseEnvelopeSlingshotConfigurationDetail().validate(
221
+ response,
222
+ { abortEarly: false, allowUnknown: false }
223
+ );
224
+
225
+ if (res_error) {
226
+ Logger({
227
+ level: "WARN",
228
+ message: "Response Validation Warnnings for getConfigByApiKey",
229
+ });
230
+ Logger({ level: "WARN", message: res_error });
231
+ }
232
+
233
+ return response;
171
234
  }
172
235
 
173
236
  /**
@@ -178,7 +241,7 @@ class Inventory {
178
241
  * @summary: Get apikey for Company to call other Slingshot Configuration APIs
179
242
  * @description: REST Endpoint that returns apikey by username by password
180
243
  */
181
- getApiKey({ userName, password } = {}) {
244
+ async getApiKey({ userName, password } = {}) {
182
245
  const { error } = InventoryValidator.getApiKey().validate(
183
246
  { userName, password },
184
247
  { abortEarly: false, allowUnknown: true }
@@ -193,8 +256,11 @@ class Inventory {
193
256
  { abortEarly: false, allowUnknown: false }
194
257
  );
195
258
  if (warrning) {
196
- console.log("Parameter Validation warrnings for getApiKey");
197
- console.log(warrning);
259
+ Logger({
260
+ level: "WARN",
261
+ message: "Parameter Validation warrnings for getApiKey",
262
+ });
263
+ Logger({ level: "WARN", message: warrning });
198
264
  }
199
265
 
200
266
  const query_params = {};
@@ -203,7 +269,7 @@ class Inventory {
203
269
 
204
270
  const xHeaders = {};
205
271
 
206
- return PublicAPIClient.execute(
272
+ const response = await PublicAPIClient.execute(
207
273
  this._conf,
208
274
  "get",
209
275
  constructUrl({
@@ -214,6 +280,23 @@ class Inventory {
214
280
  undefined,
215
281
  xHeaders
216
282
  );
283
+
284
+ const {
285
+ error: res_error,
286
+ } = InventoryModel.ResponseEnvelopeApikeyModel().validate(response, {
287
+ abortEarly: false,
288
+ allowUnknown: false,
289
+ });
290
+
291
+ if (res_error) {
292
+ Logger({
293
+ level: "WARN",
294
+ message: "Response Validation Warnnings for getApiKey",
295
+ });
296
+ Logger({ level: "WARN", message: res_error });
297
+ }
298
+
299
+ return response;
217
300
  }
218
301
 
219
302
  /**
@@ -223,7 +306,7 @@ class Inventory {
223
306
  * @summary: Get Job Config By Code
224
307
  * @description: REST Endpoint that returns job config by code
225
308
  */
226
- getJobByCode({ code } = {}) {
309
+ async getJobByCode({ code } = {}) {
227
310
  const { error } = InventoryValidator.getJobByCode().validate(
228
311
  { code },
229
312
  { abortEarly: false, allowUnknown: true }
@@ -238,15 +321,18 @@ class Inventory {
238
321
  { abortEarly: false, allowUnknown: false }
239
322
  );
240
323
  if (warrning) {
241
- console.log("Parameter Validation warrnings for getJobByCode");
242
- console.log(warrning);
324
+ Logger({
325
+ level: "WARN",
326
+ message: "Parameter Validation warrnings for getJobByCode",
327
+ });
328
+ Logger({ level: "WARN", message: warrning });
243
329
  }
244
330
 
245
331
  const query_params = {};
246
332
 
247
333
  const xHeaders = {};
248
334
 
249
- return PublicAPIClient.execute(
335
+ const response = await PublicAPIClient.execute(
250
336
  this._conf,
251
337
  "get",
252
338
  constructUrl({
@@ -257,6 +343,23 @@ class Inventory {
257
343
  undefined,
258
344
  xHeaders
259
345
  );
346
+
347
+ const {
348
+ error: res_error,
349
+ } = InventoryModel.ResponseEnvelopeJobConfigDTO().validate(response, {
350
+ abortEarly: false,
351
+ allowUnknown: false,
352
+ });
353
+
354
+ if (res_error) {
355
+ Logger({
356
+ level: "WARN",
357
+ message: "Response Validation Warnnings for getJobByCode",
358
+ });
359
+ Logger({ level: "WARN", message: res_error });
360
+ }
361
+
362
+ return response;
260
363
  }
261
364
 
262
365
  /**
@@ -267,7 +370,7 @@ class Inventory {
267
370
  * @summary: Get Job Configs By Integration Type
268
371
  * @description: REST Endpoint that returns all job Configs by Integration Type
269
372
  */
270
- getJobConfigByIntegrationType({ integrationType, disable } = {}) {
373
+ async getJobConfigByIntegrationType({ integrationType, disable } = {}) {
271
374
  const {
272
375
  error,
273
376
  } = InventoryValidator.getJobConfigByIntegrationType().validate(
@@ -286,10 +389,12 @@ class Inventory {
286
389
  { abortEarly: false, allowUnknown: false }
287
390
  );
288
391
  if (warrning) {
289
- console.log(
290
- "Parameter Validation warrnings for getJobConfigByIntegrationType"
291
- );
292
- console.log(warrning);
392
+ Logger({
393
+ level: "WARN",
394
+ message:
395
+ "Parameter Validation warrnings for getJobConfigByIntegrationType",
396
+ });
397
+ Logger({ level: "WARN", message: warrning });
293
398
  }
294
399
 
295
400
  const query_params = {};
@@ -298,7 +403,7 @@ class Inventory {
298
403
 
299
404
  const xHeaders = {};
300
405
 
301
- return PublicAPIClient.execute(
406
+ const response = await PublicAPIClient.execute(
302
407
  this._conf,
303
408
  "get",
304
409
  constructUrl({
@@ -309,6 +414,24 @@ class Inventory {
309
414
  undefined,
310
415
  xHeaders
311
416
  );
417
+
418
+ const {
419
+ error: res_error,
420
+ } = InventoryModel.ResponseEnvelopeListJobConfigDTO().validate(response, {
421
+ abortEarly: false,
422
+ allowUnknown: false,
423
+ });
424
+
425
+ if (res_error) {
426
+ Logger({
427
+ level: "WARN",
428
+ message:
429
+ "Response Validation Warnnings for getJobConfigByIntegrationType",
430
+ });
431
+ Logger({ level: "WARN", message: res_error });
432
+ }
433
+
434
+ return response;
312
435
  }
313
436
  }
314
437
  module.exports = Inventory;
@@ -3,6 +3,9 @@ const { FDKClientValidationError } = require("../../common/FDKError");
3
3
  const constructUrl = require("../constructUrl");
4
4
  const Paginator = require("../../common/Paginator");
5
5
  const WebhookValidator = require("./WebhookPublicValidator");
6
+ const WebhookModel = require("./WebhookPublicModel");
7
+ const { Logger } = require("./../../common/Logger");
8
+
6
9
  class Webhook {
7
10
  constructor(_conf) {
8
11
  this._conf = _conf;
@@ -33,7 +36,7 @@ class Webhook {
33
36
  * @summary: Get All Webhook Events
34
37
  * @description: Get All Webhook Events
35
38
  */
36
- fetchAllWebhookEvents({} = {}) {
39
+ async fetchAllWebhookEvents({} = {}) {
37
40
  const { error } = WebhookValidator.fetchAllWebhookEvents().validate(
38
41
  {},
39
42
  { abortEarly: false, allowUnknown: true }
@@ -50,15 +53,18 @@ class Webhook {
50
53
  { abortEarly: false, allowUnknown: false }
51
54
  );
52
55
  if (warrning) {
53
- console.log("Parameter Validation warrnings for fetchAllWebhookEvents");
54
- console.log(warrning);
56
+ Logger({
57
+ level: "WARN",
58
+ message: "Parameter Validation warrnings for fetchAllWebhookEvents",
59
+ });
60
+ Logger({ level: "WARN", message: warrning });
55
61
  }
56
62
 
57
63
  const query_params = {};
58
64
 
59
65
  const xHeaders = {};
60
66
 
61
- return PublicAPIClient.execute(
67
+ const response = await PublicAPIClient.execute(
62
68
  this._conf,
63
69
  "get",
64
70
  constructUrl({
@@ -69,6 +75,23 @@ class Webhook {
69
75
  undefined,
70
76
  xHeaders
71
77
  );
78
+
79
+ const {
80
+ error: res_error,
81
+ } = WebhookModel.EventConfigResponse().validate(response, {
82
+ abortEarly: false,
83
+ allowUnknown: false,
84
+ });
85
+
86
+ if (res_error) {
87
+ Logger({
88
+ level: "WARN",
89
+ message: "Response Validation Warnnings for fetchAllWebhookEvents",
90
+ });
91
+ Logger({ level: "WARN", message: res_error });
92
+ }
93
+
94
+ return response;
72
95
  }
73
96
 
74
97
  /**
@@ -78,7 +101,7 @@ class Webhook {
78
101
  * @summary: Send webhook event name, type, version, category in request body to get complete details of event from server
79
102
  * @description: Get Webhook Event Details for provided events
80
103
  */
81
- queryWebhookEventDetails({ body } = {}) {
104
+ async queryWebhookEventDetails({ body } = {}) {
82
105
  const { error } = WebhookValidator.queryWebhookEventDetails().validate(
83
106
  { body },
84
107
  { abortEarly: false, allowUnknown: true }
@@ -95,17 +118,18 @@ class Webhook {
95
118
  { abortEarly: false, allowUnknown: false }
96
119
  );
97
120
  if (warrning) {
98
- console.log(
99
- "Parameter Validation warrnings for queryWebhookEventDetails"
100
- );
101
- console.log(warrning);
121
+ Logger({
122
+ level: "WARN",
123
+ message: "Parameter Validation warrnings for queryWebhookEventDetails",
124
+ });
125
+ Logger({ level: "WARN", message: warrning });
102
126
  }
103
127
 
104
128
  const query_params = {};
105
129
 
106
130
  const xHeaders = {};
107
131
 
108
- return PublicAPIClient.execute(
132
+ const response = await PublicAPIClient.execute(
109
133
  this._conf,
110
134
  "post",
111
135
  constructUrl({
@@ -116,6 +140,23 @@ class Webhook {
116
140
  body,
117
141
  xHeaders
118
142
  );
143
+
144
+ const {
145
+ error: res_error,
146
+ } = WebhookModel.EventConfigResponse().validate(response, {
147
+ abortEarly: false,
148
+ allowUnknown: false,
149
+ });
150
+
151
+ if (res_error) {
152
+ Logger({
153
+ level: "WARN",
154
+ message: "Response Validation Warnnings for queryWebhookEventDetails",
155
+ });
156
+ Logger({ level: "WARN", message: res_error });
157
+ }
158
+
159
+ return response;
119
160
  }
120
161
  }
121
162
  module.exports = Webhook;