@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 ShareValidator = require("./ShareApplicationValidator");
6
+ const ShareModel = require("./ShareApplicationModel");
7
+ const { Logger } = require("./../../common/Logger");
6
8
 
7
9
  class Share {
8
10
  constructor(_conf) {
@@ -42,7 +44,7 @@ class Share {
42
44
  * @summary: Create QR Code of an app
43
45
  * @description: Use this API to create a QR code of an app for sharing it with users who want to use the app.
44
46
  */
45
- getApplicationQRCode({} = {}) {
47
+ async getApplicationQRCode({} = {}) {
46
48
  const { error } = ShareValidator.getApplicationQRCode().validate(
47
49
  {},
48
50
  { abortEarly: false, allowUnknown: true }
@@ -57,15 +59,18 @@ class Share {
57
59
  { abortEarly: false, allowUnknown: false }
58
60
  );
59
61
  if (warrning) {
60
- console.log("Parameter Validation warrnings for getApplicationQRCode");
61
- console.log(warrning);
62
+ Logger({
63
+ level: "WARN",
64
+ message: "Parameter Validation warrnings for getApplicationQRCode",
65
+ });
66
+ Logger({ level: "WARN", message: warrning });
62
67
  }
63
68
 
64
69
  const query_params = {};
65
70
 
66
71
  const xHeaders = {};
67
72
 
68
- return APIClient.execute(
73
+ const response = await APIClient.execute(
69
74
  this._conf,
70
75
  "post",
71
76
  constructUrl({
@@ -76,6 +81,21 @@ class Share {
76
81
  undefined,
77
82
  xHeaders
78
83
  );
84
+
85
+ const { error: res_error } = ShareModel.QRCodeResp().validate(response, {
86
+ abortEarly: false,
87
+ allowUnknown: false,
88
+ });
89
+
90
+ if (res_error) {
91
+ Logger({
92
+ level: "WARN",
93
+ message: "Response Validation Warnnings for getApplicationQRCode",
94
+ });
95
+ Logger({ level: "WARN", message: res_error });
96
+ }
97
+
98
+ return response;
79
99
  }
80
100
 
81
101
  /**
@@ -86,7 +106,7 @@ class Share {
86
106
  * @summary: Create QR Code of a product
87
107
  * @description: Use this API to create a QR code of a product for sharing it with users who want to view/purchase the product.
88
108
  */
89
- getProductQRCodeBySlug({ slug } = {}) {
109
+ async getProductQRCodeBySlug({ slug } = {}) {
90
110
  const { error } = ShareValidator.getProductQRCodeBySlug().validate(
91
111
  { slug },
92
112
  { abortEarly: false, allowUnknown: true }
@@ -103,15 +123,18 @@ class Share {
103
123
  { abortEarly: false, allowUnknown: false }
104
124
  );
105
125
  if (warrning) {
106
- console.log("Parameter Validation warrnings for getProductQRCodeBySlug");
107
- console.log(warrning);
126
+ Logger({
127
+ level: "WARN",
128
+ message: "Parameter Validation warrnings for getProductQRCodeBySlug",
129
+ });
130
+ Logger({ level: "WARN", message: warrning });
108
131
  }
109
132
 
110
133
  const query_params = {};
111
134
 
112
135
  const xHeaders = {};
113
136
 
114
- return APIClient.execute(
137
+ const response = await APIClient.execute(
115
138
  this._conf,
116
139
  "post",
117
140
  constructUrl({
@@ -122,6 +145,21 @@ class Share {
122
145
  undefined,
123
146
  xHeaders
124
147
  );
148
+
149
+ const { error: res_error } = ShareModel.QRCodeResp().validate(response, {
150
+ abortEarly: false,
151
+ allowUnknown: false,
152
+ });
153
+
154
+ if (res_error) {
155
+ Logger({
156
+ level: "WARN",
157
+ message: "Response Validation Warnnings for getProductQRCodeBySlug",
158
+ });
159
+ Logger({ level: "WARN", message: res_error });
160
+ }
161
+
162
+ return response;
125
163
  }
126
164
 
127
165
  /**
@@ -132,7 +170,7 @@ class Share {
132
170
  * @summary: Create QR Code of a collection
133
171
  * @description: Use this API to create a QR code of a collection of products for sharing it with users who want to view/purchase the collection.
134
172
  */
135
- getCollectionQRCodeBySlug({ slug } = {}) {
173
+ async getCollectionQRCodeBySlug({ slug } = {}) {
136
174
  const { error } = ShareValidator.getCollectionQRCodeBySlug().validate(
137
175
  { slug },
138
176
  { abortEarly: false, allowUnknown: true }
@@ -149,17 +187,18 @@ class Share {
149
187
  { abortEarly: false, allowUnknown: false }
150
188
  );
151
189
  if (warrning) {
152
- console.log(
153
- "Parameter Validation warrnings for getCollectionQRCodeBySlug"
154
- );
155
- console.log(warrning);
190
+ Logger({
191
+ level: "WARN",
192
+ message: "Parameter Validation warrnings for getCollectionQRCodeBySlug",
193
+ });
194
+ Logger({ level: "WARN", message: warrning });
156
195
  }
157
196
 
158
197
  const query_params = {};
159
198
 
160
199
  const xHeaders = {};
161
200
 
162
- return APIClient.execute(
201
+ const response = await APIClient.execute(
163
202
  this._conf,
164
203
  "post",
165
204
  constructUrl({
@@ -170,6 +209,21 @@ class Share {
170
209
  undefined,
171
210
  xHeaders
172
211
  );
212
+
213
+ const { error: res_error } = ShareModel.QRCodeResp().validate(response, {
214
+ abortEarly: false,
215
+ allowUnknown: false,
216
+ });
217
+
218
+ if (res_error) {
219
+ Logger({
220
+ level: "WARN",
221
+ message: "Response Validation Warnnings for getCollectionQRCodeBySlug",
222
+ });
223
+ Logger({ level: "WARN", message: res_error });
224
+ }
225
+
226
+ return response;
173
227
  }
174
228
 
175
229
  /**
@@ -179,7 +233,7 @@ class Share {
179
233
  * @summary: Create QR Code of a URL
180
234
  * @description: Use this API to create a QR code of a URL for sharing it with users who want to visit the link.
181
235
  */
182
- getUrlQRCode({ url } = {}) {
236
+ async getUrlQRCode({ url } = {}) {
183
237
  const { error } = ShareValidator.getUrlQRCode().validate(
184
238
  { url },
185
239
  { abortEarly: false, allowUnknown: true }
@@ -194,8 +248,11 @@ class Share {
194
248
  { abortEarly: false, allowUnknown: false }
195
249
  );
196
250
  if (warrning) {
197
- console.log("Parameter Validation warrnings for getUrlQRCode");
198
- console.log(warrning);
251
+ Logger({
252
+ level: "WARN",
253
+ message: "Parameter Validation warrnings for getUrlQRCode",
254
+ });
255
+ Logger({ level: "WARN", message: warrning });
199
256
  }
200
257
 
201
258
  const query_params = {};
@@ -203,7 +260,7 @@ class Share {
203
260
 
204
261
  const xHeaders = {};
205
262
 
206
- return APIClient.execute(
263
+ const response = await APIClient.execute(
207
264
  this._conf,
208
265
  "post",
209
266
  constructUrl({
@@ -214,6 +271,21 @@ class Share {
214
271
  undefined,
215
272
  xHeaders
216
273
  );
274
+
275
+ const { error: res_error } = ShareModel.QRCodeResp().validate(response, {
276
+ abortEarly: false,
277
+ allowUnknown: false,
278
+ });
279
+
280
+ if (res_error) {
281
+ Logger({
282
+ level: "WARN",
283
+ message: "Response Validation Warnnings for getUrlQRCode",
284
+ });
285
+ Logger({ level: "WARN", message: res_error });
286
+ }
287
+
288
+ return response;
217
289
  }
218
290
 
219
291
  /**
@@ -223,7 +295,7 @@ class Share {
223
295
  * @summary: Create a short link
224
296
  * @description: Use this API to create a short link that is easy to write/share/read as compared to long URLs.
225
297
  */
226
- createShortLink({ body } = {}) {
298
+ async createShortLink({ body } = {}) {
227
299
  const { error } = ShareValidator.createShortLink().validate(
228
300
  { body },
229
301
  { abortEarly: false, allowUnknown: true }
@@ -238,15 +310,18 @@ class Share {
238
310
  { abortEarly: false, allowUnknown: false }
239
311
  );
240
312
  if (warrning) {
241
- console.log("Parameter Validation warrnings for createShortLink");
242
- console.log(warrning);
313
+ Logger({
314
+ level: "WARN",
315
+ message: "Parameter Validation warrnings for createShortLink",
316
+ });
317
+ Logger({ level: "WARN", message: warrning });
243
318
  }
244
319
 
245
320
  const query_params = {};
246
321
 
247
322
  const xHeaders = {};
248
323
 
249
- return APIClient.execute(
324
+ const response = await APIClient.execute(
250
325
  this._conf,
251
326
  "post",
252
327
  constructUrl({
@@ -257,6 +332,21 @@ class Share {
257
332
  body,
258
333
  xHeaders
259
334
  );
335
+
336
+ const { error: res_error } = ShareModel.ShortLinkRes().validate(response, {
337
+ abortEarly: false,
338
+ allowUnknown: false,
339
+ });
340
+
341
+ if (res_error) {
342
+ Logger({
343
+ level: "WARN",
344
+ message: "Response Validation Warnnings for createShortLink",
345
+ });
346
+ Logger({ level: "WARN", message: res_error });
347
+ }
348
+
349
+ return response;
260
350
  }
261
351
 
262
352
  /**
@@ -267,7 +357,7 @@ class Share {
267
357
  * @summary: Get short link by hash
268
358
  * @description: Use this API to get a short link by using a hash value.
269
359
  */
270
- getShortLinkByHash({ hash } = {}) {
360
+ async getShortLinkByHash({ hash } = {}) {
271
361
  const { error } = ShareValidator.getShortLinkByHash().validate(
272
362
  { hash },
273
363
  { abortEarly: false, allowUnknown: true }
@@ -282,15 +372,18 @@ class Share {
282
372
  { abortEarly: false, allowUnknown: false }
283
373
  );
284
374
  if (warrning) {
285
- console.log("Parameter Validation warrnings for getShortLinkByHash");
286
- console.log(warrning);
375
+ Logger({
376
+ level: "WARN",
377
+ message: "Parameter Validation warrnings for getShortLinkByHash",
378
+ });
379
+ Logger({ level: "WARN", message: warrning });
287
380
  }
288
381
 
289
382
  const query_params = {};
290
383
 
291
384
  const xHeaders = {};
292
385
 
293
- return APIClient.execute(
386
+ const response = await APIClient.execute(
294
387
  this._conf,
295
388
  "get",
296
389
  constructUrl({
@@ -301,6 +394,21 @@ class Share {
301
394
  undefined,
302
395
  xHeaders
303
396
  );
397
+
398
+ const { error: res_error } = ShareModel.ShortLinkRes().validate(response, {
399
+ abortEarly: false,
400
+ allowUnknown: false,
401
+ });
402
+
403
+ if (res_error) {
404
+ Logger({
405
+ level: "WARN",
406
+ message: "Response Validation Warnnings for getShortLinkByHash",
407
+ });
408
+ Logger({ level: "WARN", message: res_error });
409
+ }
410
+
411
+ return response;
304
412
  }
305
413
 
306
414
  /**
@@ -311,7 +419,7 @@ class Share {
311
419
  * @summary: Get original link by hash
312
420
  * @description: Use this API to retrieve the original link from a short-link by using a hash value.
313
421
  */
314
- getOriginalShortLinkByHash({ hash } = {}) {
422
+ async getOriginalShortLinkByHash({ hash } = {}) {
315
423
  const { error } = ShareValidator.getOriginalShortLinkByHash().validate(
316
424
  { hash },
317
425
  { abortEarly: false, allowUnknown: true }
@@ -328,17 +436,19 @@ class Share {
328
436
  { abortEarly: false, allowUnknown: false }
329
437
  );
330
438
  if (warrning) {
331
- console.log(
332
- "Parameter Validation warrnings for getOriginalShortLinkByHash"
333
- );
334
- console.log(warrning);
439
+ Logger({
440
+ level: "WARN",
441
+ message:
442
+ "Parameter Validation warrnings for getOriginalShortLinkByHash",
443
+ });
444
+ Logger({ level: "WARN", message: warrning });
335
445
  }
336
446
 
337
447
  const query_params = {};
338
448
 
339
449
  const xHeaders = {};
340
450
 
341
- return APIClient.execute(
451
+ const response = await APIClient.execute(
342
452
  this._conf,
343
453
  "get",
344
454
  constructUrl({
@@ -349,6 +459,21 @@ class Share {
349
459
  undefined,
350
460
  xHeaders
351
461
  );
462
+
463
+ const { error: res_error } = ShareModel.ShortLinkRes().validate(response, {
464
+ abortEarly: false,
465
+ allowUnknown: false,
466
+ });
467
+
468
+ if (res_error) {
469
+ Logger({
470
+ level: "WARN",
471
+ message: "Response Validation Warnnings for getOriginalShortLinkByHash",
472
+ });
473
+ Logger({ level: "WARN", message: res_error });
474
+ }
475
+
476
+ return response;
352
477
  }
353
478
  }
354
479
 
@@ -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 ThemeValidator = require("./ThemeApplicationValidator");
6
+ const ThemeModel = require("./ThemeApplicationModel");
7
+ const { Logger } = require("./../../common/Logger");
6
8
 
7
9
  class Theme {
8
10
  constructor(_conf) {
@@ -36,7 +38,7 @@ class Theme {
36
38
  * @summary: Get all pages of a theme
37
39
  * @description: Use this API to retrieve all the available pages of a theme by its ID.
38
40
  */
39
- getAllPages({ themeId } = {}) {
41
+ async getAllPages({ themeId } = {}) {
40
42
  const { error } = ThemeValidator.getAllPages().validate(
41
43
  { themeId },
42
44
  { abortEarly: false, allowUnknown: true }
@@ -51,15 +53,18 @@ class Theme {
51
53
  { abortEarly: false, allowUnknown: false }
52
54
  );
53
55
  if (warrning) {
54
- console.log("Parameter Validation warrnings for getAllPages");
55
- console.log(warrning);
56
+ Logger({
57
+ level: "WARN",
58
+ message: "Parameter Validation warrnings for getAllPages",
59
+ });
60
+ Logger({ level: "WARN", message: warrning });
56
61
  }
57
62
 
58
63
  const query_params = {};
59
64
 
60
65
  const xHeaders = {};
61
66
 
62
- return APIClient.execute(
67
+ const response = await APIClient.execute(
63
68
  this._conf,
64
69
  "get",
65
70
  constructUrl({
@@ -70,6 +75,23 @@ class Theme {
70
75
  undefined,
71
76
  xHeaders
72
77
  );
78
+
79
+ const {
80
+ error: res_error,
81
+ } = ThemeModel.AllAvailablePageSchema().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 getAllPages",
90
+ });
91
+ Logger({ level: "WARN", message: res_error });
92
+ }
93
+
94
+ return response;
73
95
  }
74
96
 
75
97
  /**
@@ -80,7 +102,7 @@ class Theme {
80
102
  * @summary: Get page of a theme
81
103
  * @description: Use this API to retrieve a page of a theme.
82
104
  */
83
- getPage({ themeId, pageValue } = {}) {
105
+ async getPage({ themeId, pageValue } = {}) {
84
106
  const { error } = ThemeValidator.getPage().validate(
85
107
  { themeId, pageValue },
86
108
  { abortEarly: false, allowUnknown: true }
@@ -95,15 +117,18 @@ class Theme {
95
117
  { abortEarly: false, allowUnknown: false }
96
118
  );
97
119
  if (warrning) {
98
- console.log("Parameter Validation warrnings for getPage");
99
- console.log(warrning);
120
+ Logger({
121
+ level: "WARN",
122
+ message: "Parameter Validation warrnings for getPage",
123
+ });
124
+ Logger({ level: "WARN", message: warrning });
100
125
  }
101
126
 
102
127
  const query_params = {};
103
128
 
104
129
  const xHeaders = {};
105
130
 
106
- return APIClient.execute(
131
+ const response = await APIClient.execute(
107
132
  this._conf,
108
133
  "get",
109
134
  constructUrl({
@@ -114,6 +139,23 @@ class Theme {
114
139
  undefined,
115
140
  xHeaders
116
141
  );
142
+
143
+ const {
144
+ error: res_error,
145
+ } = ThemeModel.AvailablePageSchema().validate(response, {
146
+ abortEarly: false,
147
+ allowUnknown: false,
148
+ });
149
+
150
+ if (res_error) {
151
+ Logger({
152
+ level: "WARN",
153
+ message: "Response Validation Warnnings for getPage",
154
+ });
155
+ Logger({ level: "WARN", message: res_error });
156
+ }
157
+
158
+ return response;
117
159
  }
118
160
 
119
161
  /**
@@ -122,7 +164,7 @@ class Theme {
122
164
  * @summary: Get the theme currently applied to an application
123
165
  * @description: An application has multiple themes, but only one theme can be applied at a time. Use this API to retrieve the theme currently applied to the application.
124
166
  */
125
- getAppliedTheme({} = {}) {
167
+ async getAppliedTheme({} = {}) {
126
168
  const { error } = ThemeValidator.getAppliedTheme().validate(
127
169
  {},
128
170
  { abortEarly: false, allowUnknown: true }
@@ -137,15 +179,18 @@ class Theme {
137
179
  { abortEarly: false, allowUnknown: false }
138
180
  );
139
181
  if (warrning) {
140
- console.log("Parameter Validation warrnings for getAppliedTheme");
141
- console.log(warrning);
182
+ Logger({
183
+ level: "WARN",
184
+ message: "Parameter Validation warrnings for getAppliedTheme",
185
+ });
186
+ Logger({ level: "WARN", message: warrning });
142
187
  }
143
188
 
144
189
  const query_params = {};
145
190
 
146
191
  const xHeaders = {};
147
192
 
148
- return APIClient.execute(
193
+ const response = await APIClient.execute(
149
194
  this._conf,
150
195
  "get",
151
196
  constructUrl({
@@ -156,6 +201,21 @@ class Theme {
156
201
  undefined,
157
202
  xHeaders
158
203
  );
204
+
205
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
206
+ abortEarly: false,
207
+ allowUnknown: false,
208
+ });
209
+
210
+ if (res_error) {
211
+ Logger({
212
+ level: "WARN",
213
+ message: "Response Validation Warnnings for getAppliedTheme",
214
+ });
215
+ Logger({ level: "WARN", message: res_error });
216
+ }
217
+
218
+ return response;
159
219
  }
160
220
 
161
221
  /**
@@ -165,7 +225,7 @@ class Theme {
165
225
  * @summary: Get a theme for a preview
166
226
  * @description: A theme can be previewed before applying it. Use this API to retrieve the preview of a theme by its ID.
167
227
  */
168
- getThemeForPreview({ themeId } = {}) {
228
+ async getThemeForPreview({ themeId } = {}) {
169
229
  const { error } = ThemeValidator.getThemeForPreview().validate(
170
230
  { themeId },
171
231
  { abortEarly: false, allowUnknown: true }
@@ -180,15 +240,18 @@ class Theme {
180
240
  { abortEarly: false, allowUnknown: false }
181
241
  );
182
242
  if (warrning) {
183
- console.log("Parameter Validation warrnings for getThemeForPreview");
184
- console.log(warrning);
243
+ Logger({
244
+ level: "WARN",
245
+ message: "Parameter Validation warrnings for getThemeForPreview",
246
+ });
247
+ Logger({ level: "WARN", message: warrning });
185
248
  }
186
249
 
187
250
  const query_params = {};
188
251
 
189
252
  const xHeaders = {};
190
253
 
191
- return APIClient.execute(
254
+ const response = await APIClient.execute(
192
255
  this._conf,
193
256
  "get",
194
257
  constructUrl({
@@ -199,6 +262,21 @@ class Theme {
199
262
  undefined,
200
263
  xHeaders
201
264
  );
265
+
266
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
267
+ abortEarly: false,
268
+ allowUnknown: false,
269
+ });
270
+
271
+ if (res_error) {
272
+ Logger({
273
+ level: "WARN",
274
+ message: "Response Validation Warnnings for getThemeForPreview",
275
+ });
276
+ Logger({ level: "WARN", message: res_error });
277
+ }
278
+
279
+ return response;
202
280
  }
203
281
  }
204
282