@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
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
2
2
  const PlatformAPIClient = require("../PlatformAPIClient");
3
3
  const { FDKClientValidationError } = require("../../common/FDKError");
4
4
  const ContentValidator = require("./ContentPlatformApplicationValidator");
5
+ const ContentModel = require("./ContentPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
5
7
 
6
8
  class Content {
7
9
  constructor(config, applicationId) {
@@ -15,10 +17,11 @@ class Content {
15
17
  * given set of results. Default value is 1.
16
18
  * @param {number} [arg.pageSize] - The number of items to retrieve in each
17
19
  * page. Default value is 10.
20
+ * @returns {Promise<GetAnnouncementListSchema>} - Success response
18
21
  * @summary: Get a list of announcements
19
22
  * @description: Announcements are useful to highlight a message or information on top of a webpage. Use this API to retrieve a list of announcements.
20
23
  */
21
- getAnnouncementsList({ pageNo, pageSize } = {}) {
24
+ async getAnnouncementsList({ pageNo, pageSize } = {}) {
22
25
  const { error } = ContentValidator.getAnnouncementsList().validate(
23
26
  {
24
27
  pageNo,
@@ -41,21 +44,41 @@ class Content {
41
44
  { abortEarly: false, allowUnknown: false }
42
45
  );
43
46
  if (warrning) {
44
- console.log("Parameter Validation warrnings for getAnnouncementsList");
45
- console.log(warrning);
47
+ Logger({
48
+ level: "WARN",
49
+ message: "Parameter Validation warrnings for getAnnouncementsList",
50
+ });
51
+ Logger({ level: "WARN", message: warrning });
46
52
  }
47
53
 
48
54
  const query_params = {};
49
55
  query_params["page_no"] = pageNo;
50
56
  query_params["page_size"] = pageSize;
51
57
 
52
- return PlatformAPIClient.execute(
58
+ const response = await PlatformAPIClient.execute(
53
59
  this.config,
54
60
  "get",
55
61
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements`,
56
62
  query_params,
57
63
  undefined
58
64
  );
65
+
66
+ const {
67
+ error: res_error,
68
+ } = ContentModel.GetAnnouncementListSchema().validate(response, {
69
+ abortEarly: false,
70
+ allowUnknown: false,
71
+ });
72
+
73
+ if (res_error) {
74
+ Logger({
75
+ level: "WARN",
76
+ message: "Response Validation Warnnings for getAnnouncementsList",
77
+ });
78
+ Logger({ level: "WARN", message: res_error });
79
+ }
80
+
81
+ return response;
59
82
  }
60
83
 
61
84
  /**
@@ -94,10 +117,11 @@ class Content {
94
117
  /**
95
118
  * @param {Object} arg - Arg object.
96
119
  * @param {AdminAnnouncementSchema} arg.body
120
+ * @returns {Promise<CreateAnnouncementSchema>} - Success response
97
121
  * @summary: Create an announcement
98
122
  * @description: Announcements are useful to highlight a message or information on top of a webpage. Use this API to create an announcement.
99
123
  */
100
- createAnnouncement({ body } = {}) {
124
+ async createAnnouncement({ body } = {}) {
101
125
  const { error } = ContentValidator.createAnnouncement().validate(
102
126
  {
103
127
  body,
@@ -116,28 +140,49 @@ class Content {
116
140
  { abortEarly: false, allowUnknown: false }
117
141
  );
118
142
  if (warrning) {
119
- console.log("Parameter Validation warrnings for createAnnouncement");
120
- console.log(warrning);
143
+ Logger({
144
+ level: "WARN",
145
+ message: "Parameter Validation warrnings for createAnnouncement",
146
+ });
147
+ Logger({ level: "WARN", message: warrning });
121
148
  }
122
149
 
123
150
  const query_params = {};
124
151
 
125
- return PlatformAPIClient.execute(
152
+ const response = await PlatformAPIClient.execute(
126
153
  this.config,
127
154
  "post",
128
155
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements`,
129
156
  query_params,
130
157
  body
131
158
  );
159
+
160
+ const {
161
+ error: res_error,
162
+ } = ContentModel.CreateAnnouncementSchema().validate(response, {
163
+ abortEarly: false,
164
+ allowUnknown: false,
165
+ });
166
+
167
+ if (res_error) {
168
+ Logger({
169
+ level: "WARN",
170
+ message: "Response Validation Warnnings for createAnnouncement",
171
+ });
172
+ Logger({ level: "WARN", message: res_error });
173
+ }
174
+
175
+ return response;
132
176
  }
133
177
 
134
178
  /**
135
179
  * @param {Object} arg - Arg object.
136
180
  * @param {string} arg.announcementId - ID allotted to the announcement.
181
+ * @returns {Promise<AdminAnnouncementSchema>} - Success response
137
182
  * @summary: Get announcement by ID
138
183
  * @description: Use this API to retrieve an announcement and its details such as the target platform and pages on which it's applicable
139
184
  */
140
- getAnnouncementById({ announcementId } = {}) {
185
+ async getAnnouncementById({ announcementId } = {}) {
141
186
  const { error } = ContentValidator.getAnnouncementById().validate(
142
187
  {
143
188
  announcementId,
@@ -156,29 +201,50 @@ class Content {
156
201
  { abortEarly: false, allowUnknown: false }
157
202
  );
158
203
  if (warrning) {
159
- console.log("Parameter Validation warrnings for getAnnouncementById");
160
- console.log(warrning);
204
+ Logger({
205
+ level: "WARN",
206
+ message: "Parameter Validation warrnings for getAnnouncementById",
207
+ });
208
+ Logger({ level: "WARN", message: warrning });
161
209
  }
162
210
 
163
211
  const query_params = {};
164
212
 
165
- return PlatformAPIClient.execute(
213
+ const response = await PlatformAPIClient.execute(
166
214
  this.config,
167
215
  "get",
168
216
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements/${announcementId}`,
169
217
  query_params,
170
218
  undefined
171
219
  );
220
+
221
+ const {
222
+ error: res_error,
223
+ } = ContentModel.AdminAnnouncementSchema().validate(response, {
224
+ abortEarly: false,
225
+ allowUnknown: false,
226
+ });
227
+
228
+ if (res_error) {
229
+ Logger({
230
+ level: "WARN",
231
+ message: "Response Validation Warnnings for getAnnouncementById",
232
+ });
233
+ Logger({ level: "WARN", message: res_error });
234
+ }
235
+
236
+ return response;
172
237
  }
173
238
 
174
239
  /**
175
240
  * @param {Object} arg - Arg object.
176
241
  * @param {string} arg.announcementId - ID allotted to the announcement.
177
242
  * @param {AdminAnnouncementSchema} arg.body
243
+ * @returns {Promise<CreateAnnouncementSchema>} - Success response
178
244
  * @summary: Update an announcement
179
245
  * @description: Use this API to edit an existing announcement and its details such as the target platform and pages on which it's applicable
180
246
  */
181
- updateAnnouncement({ announcementId, body } = {}) {
247
+ async updateAnnouncement({ announcementId, body } = {}) {
182
248
  const { error } = ContentValidator.updateAnnouncement().validate(
183
249
  {
184
250
  announcementId,
@@ -199,29 +265,50 @@ class Content {
199
265
  { abortEarly: false, allowUnknown: false }
200
266
  );
201
267
  if (warrning) {
202
- console.log("Parameter Validation warrnings for updateAnnouncement");
203
- console.log(warrning);
268
+ Logger({
269
+ level: "WARN",
270
+ message: "Parameter Validation warrnings for updateAnnouncement",
271
+ });
272
+ Logger({ level: "WARN", message: warrning });
204
273
  }
205
274
 
206
275
  const query_params = {};
207
276
 
208
- return PlatformAPIClient.execute(
277
+ const response = await PlatformAPIClient.execute(
209
278
  this.config,
210
279
  "put",
211
280
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements/${announcementId}`,
212
281
  query_params,
213
282
  body
214
283
  );
284
+
285
+ const {
286
+ error: res_error,
287
+ } = ContentModel.CreateAnnouncementSchema().validate(response, {
288
+ abortEarly: false,
289
+ allowUnknown: false,
290
+ });
291
+
292
+ if (res_error) {
293
+ Logger({
294
+ level: "WARN",
295
+ message: "Response Validation Warnnings for updateAnnouncement",
296
+ });
297
+ Logger({ level: "WARN", message: res_error });
298
+ }
299
+
300
+ return response;
215
301
  }
216
302
 
217
303
  /**
218
304
  * @param {Object} arg - Arg object.
219
305
  * @param {string} arg.announcementId - ID allotted to the announcement.
220
306
  * @param {ScheduleSchema} arg.body
307
+ * @returns {Promise<CreateAnnouncementSchema>} - Success response
221
308
  * @summary: Update the schedule and the publish status of an announcement
222
309
  * @description: Use this API to edit the duration, i.e. start date-time and end date-time of an announcement. Moreover, you can enable/disable an announcement using this API.
223
310
  */
224
- updateAnnouncementSchedule({ announcementId, body } = {}) {
311
+ async updateAnnouncementSchedule({ announcementId, body } = {}) {
225
312
  const { error } = ContentValidator.updateAnnouncementSchedule().validate(
226
313
  {
227
314
  announcementId,
@@ -244,30 +331,50 @@ class Content {
244
331
  { abortEarly: false, allowUnknown: false }
245
332
  );
246
333
  if (warrning) {
247
- console.log(
248
- "Parameter Validation warrnings for updateAnnouncementSchedule"
249
- );
250
- console.log(warrning);
334
+ Logger({
335
+ level: "WARN",
336
+ message:
337
+ "Parameter Validation warrnings for updateAnnouncementSchedule",
338
+ });
339
+ Logger({ level: "WARN", message: warrning });
251
340
  }
252
341
 
253
342
  const query_params = {};
254
343
 
255
- return PlatformAPIClient.execute(
344
+ const response = await PlatformAPIClient.execute(
256
345
  this.config,
257
346
  "patch",
258
347
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements/${announcementId}`,
259
348
  query_params,
260
349
  body
261
350
  );
351
+
352
+ const {
353
+ error: res_error,
354
+ } = ContentModel.CreateAnnouncementSchema().validate(response, {
355
+ abortEarly: false,
356
+ allowUnknown: false,
357
+ });
358
+
359
+ if (res_error) {
360
+ Logger({
361
+ level: "WARN",
362
+ message: "Response Validation Warnnings for updateAnnouncementSchedule",
363
+ });
364
+ Logger({ level: "WARN", message: res_error });
365
+ }
366
+
367
+ return response;
262
368
  }
263
369
 
264
370
  /**
265
371
  * @param {Object} arg - Arg object.
266
372
  * @param {string} arg.announcementId - ID allotted to the announcement.
373
+ * @returns {Promise<CreateAnnouncementSchema>} - Success response
267
374
  * @summary: Delete announcement by id
268
375
  * @description: Use this API to delete an existing announcement.
269
376
  */
270
- deleteAnnouncement({ announcementId } = {}) {
377
+ async deleteAnnouncement({ announcementId } = {}) {
271
378
  const { error } = ContentValidator.deleteAnnouncement().validate(
272
379
  {
273
380
  announcementId,
@@ -286,28 +393,49 @@ class Content {
286
393
  { abortEarly: false, allowUnknown: false }
287
394
  );
288
395
  if (warrning) {
289
- console.log("Parameter Validation warrnings for deleteAnnouncement");
290
- console.log(warrning);
396
+ Logger({
397
+ level: "WARN",
398
+ message: "Parameter Validation warrnings for deleteAnnouncement",
399
+ });
400
+ Logger({ level: "WARN", message: warrning });
291
401
  }
292
402
 
293
403
  const query_params = {};
294
404
 
295
- return PlatformAPIClient.execute(
405
+ const response = await PlatformAPIClient.execute(
296
406
  this.config,
297
407
  "delete",
298
408
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements/${announcementId}`,
299
409
  query_params,
300
410
  undefined
301
411
  );
412
+
413
+ const {
414
+ error: res_error,
415
+ } = ContentModel.CreateAnnouncementSchema().validate(response, {
416
+ abortEarly: false,
417
+ allowUnknown: false,
418
+ });
419
+
420
+ if (res_error) {
421
+ Logger({
422
+ level: "WARN",
423
+ message: "Response Validation Warnnings for deleteAnnouncement",
424
+ });
425
+ Logger({ level: "WARN", message: res_error });
426
+ }
427
+
428
+ return response;
302
429
  }
303
430
 
304
431
  /**
305
432
  * @param {Object} arg - Arg object.
306
433
  * @param {BlogRequest} arg.body
434
+ * @returns {Promise<BlogSchema>} - Success response
307
435
  * @summary: Create a blog
308
436
  * @description: Use this API to create a blog.
309
437
  */
310
- createBlog({ body } = {}) {
438
+ async createBlog({ body } = {}) {
311
439
  const { error } = ContentValidator.createBlog().validate(
312
440
  {
313
441
  body,
@@ -326,19 +454,37 @@ class Content {
326
454
  { abortEarly: false, allowUnknown: false }
327
455
  );
328
456
  if (warrning) {
329
- console.log("Parameter Validation warrnings for createBlog");
330
- console.log(warrning);
457
+ Logger({
458
+ level: "WARN",
459
+ message: "Parameter Validation warrnings for createBlog",
460
+ });
461
+ Logger({ level: "WARN", message: warrning });
331
462
  }
332
463
 
333
464
  const query_params = {};
334
465
 
335
- return PlatformAPIClient.execute(
466
+ const response = await PlatformAPIClient.execute(
336
467
  this.config,
337
468
  "post",
338
469
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/blogs/`,
339
470
  query_params,
340
471
  body
341
472
  );
473
+
474
+ const { error: res_error } = ContentModel.BlogSchema().validate(response, {
475
+ abortEarly: false,
476
+ allowUnknown: false,
477
+ });
478
+
479
+ if (res_error) {
480
+ Logger({
481
+ level: "WARN",
482
+ message: "Response Validation Warnnings for createBlog",
483
+ });
484
+ Logger({ level: "WARN", message: res_error });
485
+ }
486
+
487
+ return response;
342
488
  }
343
489
 
344
490
  /**
@@ -347,10 +493,11 @@ class Content {
347
493
  * given set of results. Default value is 1.
348
494
  * @param {number} [arg.pageSize] - The number of items to retrieve in each
349
495
  * page. Default value is 10.
496
+ * @returns {Promise<BlogGetResponse>} - Success response
350
497
  * @summary: Get blogs
351
498
  * @description: Use this API to get a list of blogs along with their details, such as the title, reading time, publish status, feature image, tags, author, etc.
352
499
  */
353
- getBlogs({ pageNo, pageSize } = {}) {
500
+ async getBlogs({ pageNo, pageSize } = {}) {
354
501
  const { error } = ContentValidator.getBlogs().validate(
355
502
  {
356
503
  pageNo,
@@ -371,21 +518,41 @@ class Content {
371
518
  { abortEarly: false, allowUnknown: false }
372
519
  );
373
520
  if (warrning) {
374
- console.log("Parameter Validation warrnings for getBlogs");
375
- console.log(warrning);
521
+ Logger({
522
+ level: "WARN",
523
+ message: "Parameter Validation warrnings for getBlogs",
524
+ });
525
+ Logger({ level: "WARN", message: warrning });
376
526
  }
377
527
 
378
528
  const query_params = {};
379
529
  query_params["page_no"] = pageNo;
380
530
  query_params["page_size"] = pageSize;
381
531
 
382
- return PlatformAPIClient.execute(
532
+ const response = await PlatformAPIClient.execute(
383
533
  this.config,
384
534
  "get",
385
535
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/blogs/`,
386
536
  query_params,
387
537
  undefined
388
538
  );
539
+
540
+ const {
541
+ error: res_error,
542
+ } = ContentModel.BlogGetResponse().validate(response, {
543
+ abortEarly: false,
544
+ allowUnknown: false,
545
+ });
546
+
547
+ if (res_error) {
548
+ Logger({
549
+ level: "WARN",
550
+ message: "Response Validation Warnnings for getBlogs",
551
+ });
552
+ Logger({ level: "WARN", message: res_error });
553
+ }
554
+
555
+ return response;
389
556
  }
390
557
 
391
558
  /**
@@ -425,10 +592,11 @@ class Content {
425
592
  * @param {Object} arg - Arg object.
426
593
  * @param {string} arg.id - ID allotted to the blog.
427
594
  * @param {BlogRequest} arg.body
595
+ * @returns {Promise<BlogSchema>} - Success response
428
596
  * @summary: Update a blog
429
597
  * @description: Use this API to update the details of an existing blog which includes title, feature image, content, SEO details, expiry, etc.
430
598
  */
431
- updateBlog({ id, body } = {}) {
599
+ async updateBlog({ id, body } = {}) {
432
600
  const { error } = ContentValidator.updateBlog().validate(
433
601
  {
434
602
  id,
@@ -449,28 +617,47 @@ class Content {
449
617
  { abortEarly: false, allowUnknown: false }
450
618
  );
451
619
  if (warrning) {
452
- console.log("Parameter Validation warrnings for updateBlog");
453
- console.log(warrning);
620
+ Logger({
621
+ level: "WARN",
622
+ message: "Parameter Validation warrnings for updateBlog",
623
+ });
624
+ Logger({ level: "WARN", message: warrning });
454
625
  }
455
626
 
456
627
  const query_params = {};
457
628
 
458
- return PlatformAPIClient.execute(
629
+ const response = await PlatformAPIClient.execute(
459
630
  this.config,
460
631
  "put",
461
632
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/blogs/${id}`,
462
633
  query_params,
463
634
  body
464
635
  );
636
+
637
+ const { error: res_error } = ContentModel.BlogSchema().validate(response, {
638
+ abortEarly: false,
639
+ allowUnknown: false,
640
+ });
641
+
642
+ if (res_error) {
643
+ Logger({
644
+ level: "WARN",
645
+ message: "Response Validation Warnnings for updateBlog",
646
+ });
647
+ Logger({ level: "WARN", message: res_error });
648
+ }
649
+
650
+ return response;
465
651
  }
466
652
 
467
653
  /**
468
654
  * @param {Object} arg - Arg object.
469
655
  * @param {string} arg.id - ID allotted to the blog.
656
+ * @returns {Promise<BlogSchema>} - Success response
470
657
  * @summary: Delete blogs
471
658
  * @description: Use this API to delete a blog.
472
659
  */
473
- deleteBlog({ id } = {}) {
660
+ async deleteBlog({ id } = {}) {
474
661
  const { error } = ContentValidator.deleteBlog().validate(
475
662
  {
476
663
  id,
@@ -489,29 +676,48 @@ class Content {
489
676
  { abortEarly: false, allowUnknown: false }
490
677
  );
491
678
  if (warrning) {
492
- console.log("Parameter Validation warrnings for deleteBlog");
493
- console.log(warrning);
679
+ Logger({
680
+ level: "WARN",
681
+ message: "Parameter Validation warrnings for deleteBlog",
682
+ });
683
+ Logger({ level: "WARN", message: warrning });
494
684
  }
495
685
 
496
686
  const query_params = {};
497
687
 
498
- return PlatformAPIClient.execute(
688
+ const response = await PlatformAPIClient.execute(
499
689
  this.config,
500
690
  "delete",
501
691
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/blogs/${id}`,
502
692
  query_params,
503
693
  undefined
504
694
  );
695
+
696
+ const { error: res_error } = ContentModel.BlogSchema().validate(response, {
697
+ abortEarly: false,
698
+ allowUnknown: false,
699
+ });
700
+
701
+ if (res_error) {
702
+ Logger({
703
+ level: "WARN",
704
+ message: "Response Validation Warnnings for deleteBlog",
705
+ });
706
+ Logger({ level: "WARN", message: res_error });
707
+ }
708
+
709
+ return response;
505
710
  }
506
711
 
507
712
  /**
508
713
  * @param {Object} arg - Arg object.
509
714
  * @param {string} arg.slug - A short, human-readable, URL-friendly
510
715
  * identifier of a blog page. You can get slug value of a blog from `getBlogs` API.
716
+ * @returns {Promise<BlogSchema>} - Success response
511
717
  * @summary: Get components of a blog
512
718
  * @description: Use this API to retrieve the components of a blog, such as title, slug, feature image, content, schedule, publish status, author, etc.
513
719
  */
514
- getComponentById({ slug } = {}) {
720
+ async getComponentById({ slug } = {}) {
515
721
  const { error } = ContentValidator.getComponentById().validate(
516
722
  {
517
723
  slug,
@@ -530,28 +736,47 @@ class Content {
530
736
  { abortEarly: false, allowUnknown: false }
531
737
  );
532
738
  if (warrning) {
533
- console.log("Parameter Validation warrnings for getComponentById");
534
- console.log(warrning);
739
+ Logger({
740
+ level: "WARN",
741
+ message: "Parameter Validation warrnings for getComponentById",
742
+ });
743
+ Logger({ level: "WARN", message: warrning });
535
744
  }
536
745
 
537
746
  const query_params = {};
538
747
 
539
- return PlatformAPIClient.execute(
748
+ const response = await PlatformAPIClient.execute(
540
749
  this.config,
541
750
  "get",
542
751
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/blogs/${slug}`,
543
752
  query_params,
544
753
  undefined
545
754
  );
755
+
756
+ const { error: res_error } = ContentModel.BlogSchema().validate(response, {
757
+ abortEarly: false,
758
+ allowUnknown: false,
759
+ });
760
+
761
+ if (res_error) {
762
+ Logger({
763
+ level: "WARN",
764
+ message: "Response Validation Warnnings for getComponentById",
765
+ });
766
+ Logger({ level: "WARN", message: res_error });
767
+ }
768
+
769
+ return response;
546
770
  }
547
771
 
548
772
  /**
549
773
  * @param {Object} arg - Arg object.
550
774
  * @param {DataLoaderSchema} arg.body
775
+ * @returns {Promise<DataLoaderResponseSchema>} - Success response
551
776
  * @summary: Adds a data loader
552
777
  * @description: Use this API to add data loader. This includes the data loader name, operationId, service name and its type (url/function) with corresponding value.
553
778
  */
554
- addDataLoader({ body } = {}) {
779
+ async addDataLoader({ body } = {}) {
555
780
  const { error } = ContentValidator.addDataLoader().validate(
556
781
  {
557
782
  body,
@@ -570,27 +795,48 @@ class Content {
570
795
  { abortEarly: false, allowUnknown: false }
571
796
  );
572
797
  if (warrning) {
573
- console.log("Parameter Validation warrnings for addDataLoader");
574
- console.log(warrning);
798
+ Logger({
799
+ level: "WARN",
800
+ message: "Parameter Validation warrnings for addDataLoader",
801
+ });
802
+ Logger({ level: "WARN", message: warrning });
575
803
  }
576
804
 
577
805
  const query_params = {};
578
806
 
579
- return PlatformAPIClient.execute(
807
+ const response = await PlatformAPIClient.execute(
580
808
  this.config,
581
809
  "post",
582
810
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader`,
583
811
  query_params,
584
812
  body
585
813
  );
814
+
815
+ const {
816
+ error: res_error,
817
+ } = ContentModel.DataLoaderResponseSchema().validate(response, {
818
+ abortEarly: false,
819
+ allowUnknown: false,
820
+ });
821
+
822
+ if (res_error) {
823
+ Logger({
824
+ level: "WARN",
825
+ message: "Response Validation Warnnings for addDataLoader",
826
+ });
827
+ Logger({ level: "WARN", message: res_error });
828
+ }
829
+
830
+ return response;
586
831
  }
587
832
 
588
833
  /**
589
834
  * @param {Object} arg - Arg object.
835
+ * @returns {Promise<DataLoadersSchema>} - Success response
590
836
  * @summary: Get all the data loaders in an application
591
837
  * @description: Use this to get all data loaders of an application
592
838
  */
593
- getDataLoaders({} = {}) {
839
+ async getDataLoaders({} = {}) {
594
840
  const { error } = ContentValidator.getDataLoaders().validate(
595
841
  {},
596
842
  { abortEarly: false, allowUnknown: true }
@@ -605,28 +851,49 @@ class Content {
605
851
  { abortEarly: false, allowUnknown: false }
606
852
  );
607
853
  if (warrning) {
608
- console.log("Parameter Validation warrnings for getDataLoaders");
609
- console.log(warrning);
854
+ Logger({
855
+ level: "WARN",
856
+ message: "Parameter Validation warrnings for getDataLoaders",
857
+ });
858
+ Logger({ level: "WARN", message: warrning });
610
859
  }
611
860
 
612
861
  const query_params = {};
613
862
 
614
- return PlatformAPIClient.execute(
863
+ const response = await PlatformAPIClient.execute(
615
864
  this.config,
616
865
  "get",
617
866
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader`,
618
867
  query_params,
619
868
  undefined
620
869
  );
870
+
871
+ const {
872
+ error: res_error,
873
+ } = ContentModel.DataLoadersSchema().validate(response, {
874
+ abortEarly: false,
875
+ allowUnknown: false,
876
+ });
877
+
878
+ if (res_error) {
879
+ Logger({
880
+ level: "WARN",
881
+ message: "Response Validation Warnnings for getDataLoaders",
882
+ });
883
+ Logger({ level: "WARN", message: res_error });
884
+ }
885
+
886
+ return response;
621
887
  }
622
888
 
623
889
  /**
624
890
  * @param {Object} arg - Arg object.
625
891
  * @param {string} arg.dataLoaderId - ID allotted to the data loader.
892
+ * @returns {Promise<DataLoaderResponseSchema>} - Success response
626
893
  * @summary: Delete data loader in application
627
894
  * @description: Use this API to delete data loader.
628
895
  */
629
- deleteDataLoader({ dataLoaderId } = {}) {
896
+ async deleteDataLoader({ dataLoaderId } = {}) {
630
897
  const { error } = ContentValidator.deleteDataLoader().validate(
631
898
  {
632
899
  dataLoaderId,
@@ -645,29 +912,50 @@ class Content {
645
912
  { abortEarly: false, allowUnknown: false }
646
913
  );
647
914
  if (warrning) {
648
- console.log("Parameter Validation warrnings for deleteDataLoader");
649
- console.log(warrning);
915
+ Logger({
916
+ level: "WARN",
917
+ message: "Parameter Validation warrnings for deleteDataLoader",
918
+ });
919
+ Logger({ level: "WARN", message: warrning });
650
920
  }
651
921
 
652
922
  const query_params = {};
653
923
 
654
- return PlatformAPIClient.execute(
924
+ const response = await PlatformAPIClient.execute(
655
925
  this.config,
656
926
  "delete",
657
927
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader/${dataLoaderId}`,
658
928
  query_params,
659
929
  undefined
660
930
  );
931
+
932
+ const {
933
+ error: res_error,
934
+ } = ContentModel.DataLoaderResponseSchema().validate(response, {
935
+ abortEarly: false,
936
+ allowUnknown: false,
937
+ });
938
+
939
+ if (res_error) {
940
+ Logger({
941
+ level: "WARN",
942
+ message: "Response Validation Warnnings for deleteDataLoader",
943
+ });
944
+ Logger({ level: "WARN", message: res_error });
945
+ }
946
+
947
+ return response;
661
948
  }
662
949
 
663
950
  /**
664
951
  * @param {Object} arg - Arg object.
665
952
  * @param {string} arg.dataLoaderId - ID allotted to the data loader.
666
953
  * @param {DataLoaderSchema} arg.body
954
+ * @returns {Promise<DataLoaderResponseSchema>} - Success response
667
955
  * @summary: Edit a data loader by id
668
956
  * @description: Use this API to edit the details of an existing data loader by its ID.
669
957
  */
670
- editDataLoader({ dataLoaderId, body } = {}) {
958
+ async editDataLoader({ dataLoaderId, body } = {}) {
671
959
  const { error } = ContentValidator.editDataLoader().validate(
672
960
  {
673
961
  dataLoaderId,
@@ -688,28 +976,49 @@ class Content {
688
976
  { abortEarly: false, allowUnknown: false }
689
977
  );
690
978
  if (warrning) {
691
- console.log("Parameter Validation warrnings for editDataLoader");
692
- console.log(warrning);
979
+ Logger({
980
+ level: "WARN",
981
+ message: "Parameter Validation warrnings for editDataLoader",
982
+ });
983
+ Logger({ level: "WARN", message: warrning });
693
984
  }
694
985
 
695
986
  const query_params = {};
696
987
 
697
- return PlatformAPIClient.execute(
988
+ const response = await PlatformAPIClient.execute(
698
989
  this.config,
699
990
  "put",
700
991
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader/${dataLoaderId}`,
701
992
  query_params,
702
993
  body
703
994
  );
995
+
996
+ const {
997
+ error: res_error,
998
+ } = ContentModel.DataLoaderResponseSchema().validate(response, {
999
+ abortEarly: false,
1000
+ allowUnknown: false,
1001
+ });
1002
+
1003
+ if (res_error) {
1004
+ Logger({
1005
+ level: "WARN",
1006
+ message: "Response Validation Warnnings for editDataLoader",
1007
+ });
1008
+ Logger({ level: "WARN", message: res_error });
1009
+ }
1010
+
1011
+ return response;
704
1012
  }
705
1013
 
706
1014
  /**
707
1015
  * @param {Object} arg - Arg object.
708
1016
  * @param {string} arg.dataLoaderId - ID allotted to the data loader.
1017
+ * @returns {Promise<DataLoaderResponseSchema>} - Success response
709
1018
  * @summary: Select a data loader by id
710
1019
  * @description: Use this API to select a data loader to be used in applications.
711
1020
  */
712
- selectDataLoader({ dataLoaderId } = {}) {
1021
+ async selectDataLoader({ dataLoaderId } = {}) {
713
1022
  const { error } = ContentValidator.selectDataLoader().validate(
714
1023
  {
715
1024
  dataLoaderId,
@@ -728,29 +1037,50 @@ class Content {
728
1037
  { abortEarly: false, allowUnknown: false }
729
1038
  );
730
1039
  if (warrning) {
731
- console.log("Parameter Validation warrnings for selectDataLoader");
732
- console.log(warrning);
1040
+ Logger({
1041
+ level: "WARN",
1042
+ message: "Parameter Validation warrnings for selectDataLoader",
1043
+ });
1044
+ Logger({ level: "WARN", message: warrning });
733
1045
  }
734
1046
 
735
1047
  const query_params = {};
736
1048
 
737
- return PlatformAPIClient.execute(
1049
+ const response = await PlatformAPIClient.execute(
738
1050
  this.config,
739
1051
  "put",
740
1052
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader/${dataLoaderId}/select`,
741
1053
  query_params,
742
1054
  undefined
743
1055
  );
1056
+
1057
+ const {
1058
+ error: res_error,
1059
+ } = ContentModel.DataLoaderResponseSchema().validate(response, {
1060
+ abortEarly: false,
1061
+ allowUnknown: false,
1062
+ });
1063
+
1064
+ if (res_error) {
1065
+ Logger({
1066
+ level: "WARN",
1067
+ message: "Response Validation Warnnings for selectDataLoader",
1068
+ });
1069
+ Logger({ level: "WARN", message: res_error });
1070
+ }
1071
+
1072
+ return response;
744
1073
  }
745
1074
 
746
1075
  /**
747
1076
  * @param {Object} arg - Arg object.
748
1077
  * @param {string} arg.service - Name of service.
749
1078
  * @param {string} arg.operationId - Name of operation id of the service.
1079
+ * @returns {Promise<DataLoaderResetResponseSchema>} - Success response
750
1080
  * @summary: Reset a data loader by serive name and operation Id
751
1081
  * @description: Use this API to reselect a data loader.
752
1082
  */
753
- resetDataLoader({ service, operationId } = {}) {
1083
+ async resetDataLoader({ service, operationId } = {}) {
754
1084
  const { error } = ContentValidator.resetDataLoader().validate(
755
1085
  {
756
1086
  service,
@@ -771,27 +1101,48 @@ class Content {
771
1101
  { abortEarly: false, allowUnknown: false }
772
1102
  );
773
1103
  if (warrning) {
774
- console.log("Parameter Validation warrnings for resetDataLoader");
775
- console.log(warrning);
1104
+ Logger({
1105
+ level: "WARN",
1106
+ message: "Parameter Validation warrnings for resetDataLoader",
1107
+ });
1108
+ Logger({ level: "WARN", message: warrning });
776
1109
  }
777
1110
 
778
1111
  const query_params = {};
779
1112
 
780
- return PlatformAPIClient.execute(
1113
+ const response = await PlatformAPIClient.execute(
781
1114
  this.config,
782
1115
  "put",
783
1116
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader/${service}/${operationId}/reset`,
784
1117
  query_params,
785
1118
  undefined
786
1119
  );
1120
+
1121
+ const {
1122
+ error: res_error,
1123
+ } = ContentModel.DataLoaderResetResponseSchema().validate(response, {
1124
+ abortEarly: false,
1125
+ allowUnknown: false,
1126
+ });
1127
+
1128
+ if (res_error) {
1129
+ Logger({
1130
+ level: "WARN",
1131
+ message: "Response Validation Warnnings for resetDataLoader",
1132
+ });
1133
+ Logger({ level: "WARN", message: res_error });
1134
+ }
1135
+
1136
+ return response;
787
1137
  }
788
1138
 
789
1139
  /**
790
1140
  * @param {Object} arg - Arg object.
1141
+ * @returns {Promise<GetFaqCategoriesSchema>} - Success response
791
1142
  * @summary: Get a list of FAQ categories
792
1143
  * @description: FAQs can be divided into categories. Use this API to get a list of FAQ categories.
793
1144
  */
794
- getFaqCategories({} = {}) {
1145
+ async getFaqCategories({} = {}) {
795
1146
  const { error } = ContentValidator.getFaqCategories().validate(
796
1147
  {},
797
1148
  { abortEarly: false, allowUnknown: true }
@@ -806,19 +1157,39 @@ class Content {
806
1157
  { abortEarly: false, allowUnknown: false }
807
1158
  );
808
1159
  if (warrning) {
809
- console.log("Parameter Validation warrnings for getFaqCategories");
810
- console.log(warrning);
1160
+ Logger({
1161
+ level: "WARN",
1162
+ message: "Parameter Validation warrnings for getFaqCategories",
1163
+ });
1164
+ Logger({ level: "WARN", message: warrning });
811
1165
  }
812
1166
 
813
1167
  const query_params = {};
814
1168
 
815
- return PlatformAPIClient.execute(
1169
+ const response = await PlatformAPIClient.execute(
816
1170
  this.config,
817
1171
  "get",
818
1172
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/categories`,
819
1173
  query_params,
820
1174
  undefined
821
1175
  );
1176
+
1177
+ const {
1178
+ error: res_error,
1179
+ } = ContentModel.GetFaqCategoriesSchema().validate(response, {
1180
+ abortEarly: false,
1181
+ allowUnknown: false,
1182
+ });
1183
+
1184
+ if (res_error) {
1185
+ Logger({
1186
+ level: "WARN",
1187
+ message: "Response Validation Warnnings for getFaqCategories",
1188
+ });
1189
+ Logger({ level: "WARN", message: res_error });
1190
+ }
1191
+
1192
+ return response;
822
1193
  }
823
1194
 
824
1195
  /**
@@ -827,10 +1198,11 @@ class Content {
827
1198
  * category. Slug is a short, human-readable, URL-friendly identifier of
828
1199
  * an object. You can get slug value of an FAQ category from
829
1200
  * `getFaqCategories` API.
1201
+ * @returns {Promise<GetFaqCategoryBySlugSchema>} - Success response
830
1202
  * @summary: Get an FAQ category by slug or id
831
1203
  * @description: FAQs can be divided into categories. Use this API to get an FAQ categories using its slug or ID.
832
1204
  */
833
- getFaqCategoryBySlugOrId({ idOrSlug } = {}) {
1205
+ async getFaqCategoryBySlugOrId({ idOrSlug } = {}) {
834
1206
  const { error } = ContentValidator.getFaqCategoryBySlugOrId().validate(
835
1207
  {
836
1208
  idOrSlug,
@@ -851,30 +1223,49 @@ class Content {
851
1223
  { abortEarly: false, allowUnknown: false }
852
1224
  );
853
1225
  if (warrning) {
854
- console.log(
855
- "Parameter Validation warrnings for getFaqCategoryBySlugOrId"
856
- );
857
- console.log(warrning);
1226
+ Logger({
1227
+ level: "WARN",
1228
+ message: "Parameter Validation warrnings for getFaqCategoryBySlugOrId",
1229
+ });
1230
+ Logger({ level: "WARN", message: warrning });
858
1231
  }
859
1232
 
860
1233
  const query_params = {};
861
1234
 
862
- return PlatformAPIClient.execute(
1235
+ const response = await PlatformAPIClient.execute(
863
1236
  this.config,
864
1237
  "get",
865
1238
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${idOrSlug}`,
866
1239
  query_params,
867
1240
  undefined
868
1241
  );
1242
+
1243
+ const {
1244
+ error: res_error,
1245
+ } = ContentModel.GetFaqCategoryBySlugSchema().validate(response, {
1246
+ abortEarly: false,
1247
+ allowUnknown: false,
1248
+ });
1249
+
1250
+ if (res_error) {
1251
+ Logger({
1252
+ level: "WARN",
1253
+ message: "Response Validation Warnnings for getFaqCategoryBySlugOrId",
1254
+ });
1255
+ Logger({ level: "WARN", message: res_error });
1256
+ }
1257
+
1258
+ return response;
869
1259
  }
870
1260
 
871
1261
  /**
872
1262
  * @param {Object} arg - Arg object.
873
1263
  * @param {CreateFaqCategoryRequestSchema} arg.body
1264
+ * @returns {Promise<CreateFaqCategorySchema>} - Success response
874
1265
  * @summary: Create an FAQ category
875
1266
  * @description: FAQs help users to solve an issue or know more about a process. FAQs can be categorized separately, for e.g. some questions can be related to payment, some could be related to purchase, shipping, navigating, etc. Use this API to create an FAQ category.
876
1267
  */
877
- createFaqCategory({ body } = {}) {
1268
+ async createFaqCategory({ body } = {}) {
878
1269
  const { error } = ContentValidator.createFaqCategory().validate(
879
1270
  {
880
1271
  body,
@@ -893,29 +1284,50 @@ class Content {
893
1284
  { abortEarly: false, allowUnknown: false }
894
1285
  );
895
1286
  if (warrning) {
896
- console.log("Parameter Validation warrnings for createFaqCategory");
897
- console.log(warrning);
1287
+ Logger({
1288
+ level: "WARN",
1289
+ message: "Parameter Validation warrnings for createFaqCategory",
1290
+ });
1291
+ Logger({ level: "WARN", message: warrning });
898
1292
  }
899
1293
 
900
1294
  const query_params = {};
901
1295
 
902
- return PlatformAPIClient.execute(
1296
+ const response = await PlatformAPIClient.execute(
903
1297
  this.config,
904
1298
  "post",
905
1299
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category`,
906
1300
  query_params,
907
1301
  body
908
1302
  );
1303
+
1304
+ const {
1305
+ error: res_error,
1306
+ } = ContentModel.CreateFaqCategorySchema().validate(response, {
1307
+ abortEarly: false,
1308
+ allowUnknown: false,
1309
+ });
1310
+
1311
+ if (res_error) {
1312
+ Logger({
1313
+ level: "WARN",
1314
+ message: "Response Validation Warnnings for createFaqCategory",
1315
+ });
1316
+ Logger({ level: "WARN", message: res_error });
1317
+ }
1318
+
1319
+ return response;
909
1320
  }
910
1321
 
911
1322
  /**
912
1323
  * @param {Object} arg - Arg object.
913
1324
  * @param {string} arg.id - ID allotted to an FAQ category.
914
1325
  * @param {UpdateFaqCategoryRequestSchema} arg.body
1326
+ * @returns {Promise<CreateFaqCategorySchema>} - Success response
915
1327
  * @summary: Update an FAQ category
916
1328
  * @description: Use this API to edit an existing FAQ category.
917
1329
  */
918
- updateFaqCategory({ id, body } = {}) {
1330
+ async updateFaqCategory({ id, body } = {}) {
919
1331
  const { error } = ContentValidator.updateFaqCategory().validate(
920
1332
  {
921
1333
  id,
@@ -936,28 +1348,49 @@ class Content {
936
1348
  { abortEarly: false, allowUnknown: false }
937
1349
  );
938
1350
  if (warrning) {
939
- console.log("Parameter Validation warrnings for updateFaqCategory");
940
- console.log(warrning);
1351
+ Logger({
1352
+ level: "WARN",
1353
+ message: "Parameter Validation warrnings for updateFaqCategory",
1354
+ });
1355
+ Logger({ level: "WARN", message: warrning });
941
1356
  }
942
1357
 
943
1358
  const query_params = {};
944
1359
 
945
- return PlatformAPIClient.execute(
1360
+ const response = await PlatformAPIClient.execute(
946
1361
  this.config,
947
1362
  "put",
948
1363
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${id}`,
949
1364
  query_params,
950
1365
  body
951
1366
  );
1367
+
1368
+ const {
1369
+ error: res_error,
1370
+ } = ContentModel.CreateFaqCategorySchema().validate(response, {
1371
+ abortEarly: false,
1372
+ allowUnknown: false,
1373
+ });
1374
+
1375
+ if (res_error) {
1376
+ Logger({
1377
+ level: "WARN",
1378
+ message: "Response Validation Warnnings for updateFaqCategory",
1379
+ });
1380
+ Logger({ level: "WARN", message: res_error });
1381
+ }
1382
+
1383
+ return response;
952
1384
  }
953
1385
 
954
1386
  /**
955
1387
  * @param {Object} arg - Arg object.
956
1388
  * @param {string} arg.id - ID allotted to an FAQ category.
1389
+ * @returns {Promise<FaqSchema>} - Success response
957
1390
  * @summary: Delete an FAQ category
958
1391
  * @description: Use this API to delete an FAQ category.
959
1392
  */
960
- deleteFaqCategory({ id } = {}) {
1393
+ async deleteFaqCategory({ id } = {}) {
961
1394
  const { error } = ContentValidator.deleteFaqCategory().validate(
962
1395
  {
963
1396
  id,
@@ -976,19 +1409,37 @@ class Content {
976
1409
  { abortEarly: false, allowUnknown: false }
977
1410
  );
978
1411
  if (warrning) {
979
- console.log("Parameter Validation warrnings for deleteFaqCategory");
980
- console.log(warrning);
1412
+ Logger({
1413
+ level: "WARN",
1414
+ message: "Parameter Validation warrnings for deleteFaqCategory",
1415
+ });
1416
+ Logger({ level: "WARN", message: warrning });
981
1417
  }
982
1418
 
983
1419
  const query_params = {};
984
1420
 
985
- return PlatformAPIClient.execute(
1421
+ const response = await PlatformAPIClient.execute(
986
1422
  this.config,
987
1423
  "delete",
988
1424
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${id}`,
989
1425
  query_params,
990
1426
  undefined
991
1427
  );
1428
+
1429
+ const { error: res_error } = ContentModel.FaqSchema().validate(response, {
1430
+ abortEarly: false,
1431
+ allowUnknown: false,
1432
+ });
1433
+
1434
+ if (res_error) {
1435
+ Logger({
1436
+ level: "WARN",
1437
+ message: "Response Validation Warnnings for deleteFaqCategory",
1438
+ });
1439
+ Logger({ level: "WARN", message: res_error });
1440
+ }
1441
+
1442
+ return response;
992
1443
  }
993
1444
 
994
1445
  /**
@@ -997,10 +1448,11 @@ class Content {
997
1448
  * category. Slug is a short, human-readable, URL-friendly identifier of
998
1449
  * an object. You can get slug value of an FAQ category from
999
1450
  * `getFaqCategories` API.
1451
+ * @returns {Promise<GetFaqSchema>} - Success response
1000
1452
  * @summary: Get question and answers within an FAQ category
1001
1453
  * @description: Use this API to retrieve all the commonly asked question and answers belonging to an FAQ category.
1002
1454
  */
1003
- getFaqsByCategoryIdOrSlug({ idOrSlug } = {}) {
1455
+ async getFaqsByCategoryIdOrSlug({ idOrSlug } = {}) {
1004
1456
  const { error } = ContentValidator.getFaqsByCategoryIdOrSlug().validate(
1005
1457
  {
1006
1458
  idOrSlug,
@@ -1021,31 +1473,48 @@ class Content {
1021
1473
  { abortEarly: false, allowUnknown: false }
1022
1474
  );
1023
1475
  if (warrning) {
1024
- console.log(
1025
- "Parameter Validation warrnings for getFaqsByCategoryIdOrSlug"
1026
- );
1027
- console.log(warrning);
1476
+ Logger({
1477
+ level: "WARN",
1478
+ message: "Parameter Validation warrnings for getFaqsByCategoryIdOrSlug",
1479
+ });
1480
+ Logger({ level: "WARN", message: warrning });
1028
1481
  }
1029
1482
 
1030
1483
  const query_params = {};
1031
1484
 
1032
- return PlatformAPIClient.execute(
1485
+ const response = await PlatformAPIClient.execute(
1033
1486
  this.config,
1034
1487
  "get",
1035
1488
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${idOrSlug}/faqs`,
1036
1489
  query_params,
1037
1490
  undefined
1038
1491
  );
1492
+
1493
+ const { error: res_error } = ContentModel.GetFaqSchema().validate(
1494
+ response,
1495
+ { abortEarly: false, allowUnknown: false }
1496
+ );
1497
+
1498
+ if (res_error) {
1499
+ Logger({
1500
+ level: "WARN",
1501
+ message: "Response Validation Warnnings for getFaqsByCategoryIdOrSlug",
1502
+ });
1503
+ Logger({ level: "WARN", message: res_error });
1504
+ }
1505
+
1506
+ return response;
1039
1507
  }
1040
1508
 
1041
1509
  /**
1042
1510
  * @param {Object} arg - Arg object.
1043
1511
  * @param {string} arg.categoryId - ID allotted to an FAQ category.
1044
1512
  * @param {CreateFaqSchema} arg.body
1513
+ * @returns {Promise<CreateFaqResponseSchema>} - Success response
1045
1514
  * @summary: Create an FAQ
1046
1515
  * @description: FAQs help users to solve an issue or know more about a process. Use this API to create an FAQ for a given FAQ category.
1047
1516
  */
1048
- addFaq({ categoryId, body } = {}) {
1517
+ async addFaq({ categoryId, body } = {}) {
1049
1518
  const { error } = ContentValidator.addFaq().validate(
1050
1519
  {
1051
1520
  categoryId,
@@ -1066,19 +1535,39 @@ class Content {
1066
1535
  { abortEarly: false, allowUnknown: false }
1067
1536
  );
1068
1537
  if (warrning) {
1069
- console.log("Parameter Validation warrnings for addFaq");
1070
- console.log(warrning);
1538
+ Logger({
1539
+ level: "WARN",
1540
+ message: "Parameter Validation warrnings for addFaq",
1541
+ });
1542
+ Logger({ level: "WARN", message: warrning });
1071
1543
  }
1072
1544
 
1073
1545
  const query_params = {};
1074
1546
 
1075
- return PlatformAPIClient.execute(
1547
+ const response = await PlatformAPIClient.execute(
1076
1548
  this.config,
1077
1549
  "post",
1078
1550
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${categoryId}/faqs`,
1079
1551
  query_params,
1080
1552
  body
1081
1553
  );
1554
+
1555
+ const {
1556
+ error: res_error,
1557
+ } = ContentModel.CreateFaqResponseSchema().validate(response, {
1558
+ abortEarly: false,
1559
+ allowUnknown: false,
1560
+ });
1561
+
1562
+ if (res_error) {
1563
+ Logger({
1564
+ level: "WARN",
1565
+ message: "Response Validation Warnnings for addFaq",
1566
+ });
1567
+ Logger({ level: "WARN", message: res_error });
1568
+ }
1569
+
1570
+ return response;
1082
1571
  }
1083
1572
 
1084
1573
  /**
@@ -1086,10 +1575,11 @@ class Content {
1086
1575
  * @param {string} arg.categoryId - ID allotted to an FAQ category.
1087
1576
  * @param {string} arg.faqId - ID allotted to an FAQ.
1088
1577
  * @param {CreateFaqSchema} arg.body
1578
+ * @returns {Promise<CreateFaqResponseSchema>} - Success response
1089
1579
  * @summary: Update an FAQ
1090
1580
  * @description: Use this API to edit an existing FAQ.
1091
1581
  */
1092
- updateFaq({ categoryId, faqId, body } = {}) {
1582
+ async updateFaq({ categoryId, faqId, body } = {}) {
1093
1583
  const { error } = ContentValidator.updateFaq().validate(
1094
1584
  {
1095
1585
  categoryId,
@@ -1112,29 +1602,50 @@ class Content {
1112
1602
  { abortEarly: false, allowUnknown: false }
1113
1603
  );
1114
1604
  if (warrning) {
1115
- console.log("Parameter Validation warrnings for updateFaq");
1116
- console.log(warrning);
1605
+ Logger({
1606
+ level: "WARN",
1607
+ message: "Parameter Validation warrnings for updateFaq",
1608
+ });
1609
+ Logger({ level: "WARN", message: warrning });
1117
1610
  }
1118
1611
 
1119
1612
  const query_params = {};
1120
1613
 
1121
- return PlatformAPIClient.execute(
1614
+ const response = await PlatformAPIClient.execute(
1122
1615
  this.config,
1123
1616
  "put",
1124
1617
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${categoryId}/faq/${faqId}`,
1125
1618
  query_params,
1126
1619
  body
1127
1620
  );
1621
+
1622
+ const {
1623
+ error: res_error,
1624
+ } = ContentModel.CreateFaqResponseSchema().validate(response, {
1625
+ abortEarly: false,
1626
+ allowUnknown: false,
1627
+ });
1628
+
1629
+ if (res_error) {
1630
+ Logger({
1631
+ level: "WARN",
1632
+ message: "Response Validation Warnnings for updateFaq",
1633
+ });
1634
+ Logger({ level: "WARN", message: res_error });
1635
+ }
1636
+
1637
+ return response;
1128
1638
  }
1129
1639
 
1130
1640
  /**
1131
1641
  * @param {Object} arg - Arg object.
1132
1642
  * @param {string} arg.categoryId - ID allotted to an FAQ category.
1133
1643
  * @param {string} arg.faqId - ID allotted to an FAQ.
1644
+ * @returns {Promise<CreateFaqResponseSchema>} - Success response
1134
1645
  * @summary: Delete an FAQ
1135
1646
  * @description: Use this API to delete an existing FAQ.
1136
1647
  */
1137
- deleteFaq({ categoryId, faqId } = {}) {
1648
+ async deleteFaq({ categoryId, faqId } = {}) {
1138
1649
  const { error } = ContentValidator.deleteFaq().validate(
1139
1650
  {
1140
1651
  categoryId,
@@ -1155,19 +1666,39 @@ class Content {
1155
1666
  { abortEarly: false, allowUnknown: false }
1156
1667
  );
1157
1668
  if (warrning) {
1158
- console.log("Parameter Validation warrnings for deleteFaq");
1159
- console.log(warrning);
1669
+ Logger({
1670
+ level: "WARN",
1671
+ message: "Parameter Validation warrnings for deleteFaq",
1672
+ });
1673
+ Logger({ level: "WARN", message: warrning });
1160
1674
  }
1161
1675
 
1162
1676
  const query_params = {};
1163
1677
 
1164
- return PlatformAPIClient.execute(
1678
+ const response = await PlatformAPIClient.execute(
1165
1679
  this.config,
1166
1680
  "delete",
1167
1681
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${categoryId}/faq/${faqId}`,
1168
1682
  query_params,
1169
1683
  undefined
1170
1684
  );
1685
+
1686
+ const {
1687
+ error: res_error,
1688
+ } = ContentModel.CreateFaqResponseSchema().validate(response, {
1689
+ abortEarly: false,
1690
+ allowUnknown: false,
1691
+ });
1692
+
1693
+ if (res_error) {
1694
+ Logger({
1695
+ level: "WARN",
1696
+ message: "Response Validation Warnnings for deleteFaq",
1697
+ });
1698
+ Logger({ level: "WARN", message: res_error });
1699
+ }
1700
+
1701
+ return response;
1171
1702
  }
1172
1703
 
1173
1704
  /**
@@ -1176,10 +1707,11 @@ class Content {
1176
1707
  * category. Slug is a short, human-readable, URL-friendly identifier of
1177
1708
  * an object. You can get slug value of an FAQ category from
1178
1709
  * `getFaqCategories` API.
1710
+ * @returns {Promise<CreateFaqResponseSchema>} - Success response
1179
1711
  * @summary: Get an FAQ
1180
1712
  * @description: Use this API to retrieve a specific FAQ. You will get the question and answer of that FAQ.
1181
1713
  */
1182
- getFaqByIdOrSlug({ idOrSlug } = {}) {
1714
+ async getFaqByIdOrSlug({ idOrSlug } = {}) {
1183
1715
  const { error } = ContentValidator.getFaqByIdOrSlug().validate(
1184
1716
  {
1185
1717
  idOrSlug,
@@ -1198,19 +1730,104 @@ class Content {
1198
1730
  { abortEarly: false, allowUnknown: false }
1199
1731
  );
1200
1732
  if (warrning) {
1201
- console.log("Parameter Validation warrnings for getFaqByIdOrSlug");
1202
- console.log(warrning);
1733
+ Logger({
1734
+ level: "WARN",
1735
+ message: "Parameter Validation warrnings for getFaqByIdOrSlug",
1736
+ });
1737
+ Logger({ level: "WARN", message: warrning });
1203
1738
  }
1204
1739
 
1205
1740
  const query_params = {};
1206
1741
 
1207
- return PlatformAPIClient.execute(
1742
+ const response = await PlatformAPIClient.execute(
1208
1743
  this.config,
1209
1744
  "get",
1210
1745
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/${idOrSlug}`,
1211
1746
  query_params,
1212
1747
  undefined
1213
1748
  );
1749
+
1750
+ const {
1751
+ error: res_error,
1752
+ } = ContentModel.CreateFaqResponseSchema().validate(response, {
1753
+ abortEarly: false,
1754
+ allowUnknown: false,
1755
+ });
1756
+
1757
+ if (res_error) {
1758
+ Logger({
1759
+ level: "WARN",
1760
+ message: "Response Validation Warnnings for getFaqByIdOrSlug",
1761
+ });
1762
+ Logger({ level: "WARN", message: res_error });
1763
+ }
1764
+
1765
+ return response;
1766
+ }
1767
+
1768
+ /**
1769
+ * @param {Object} arg - Arg object.
1770
+ * @param {GenerationEntityType} arg.type - String representing the type of
1771
+ * SEO content to be generated. Possible values are: title, description
1772
+ * @param {GenerateSEOContent} arg.body
1773
+ * @returns {Promise<GeneratedSEOContent>} - Success response
1774
+ * @summary: Get SEO meta tag title for content
1775
+ * @description: Use this API to get GPT3 generated SEO meta tag title for content
1776
+ */
1777
+ async generateSEOTitle({ type, body } = {}) {
1778
+ const { error } = ContentValidator.generateSEOTitle().validate(
1779
+ {
1780
+ type,
1781
+ body,
1782
+ },
1783
+ { abortEarly: false, allowUnknown: true }
1784
+ );
1785
+ if (error) {
1786
+ return Promise.reject(new FDKClientValidationError(error));
1787
+ }
1788
+
1789
+ // Showing warrnings if extra unknown parameters are found
1790
+ const { error: warrning } = ContentValidator.generateSEOTitle().validate(
1791
+ {
1792
+ type,
1793
+ body,
1794
+ },
1795
+ { abortEarly: false, allowUnknown: false }
1796
+ );
1797
+ if (warrning) {
1798
+ Logger({
1799
+ level: "WARN",
1800
+ message: "Parameter Validation warrnings for generateSEOTitle",
1801
+ });
1802
+ Logger({ level: "WARN", message: warrning });
1803
+ }
1804
+
1805
+ const query_params = {};
1806
+
1807
+ const response = await PlatformAPIClient.execute(
1808
+ this.config,
1809
+ "post",
1810
+ `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/generate-seo/${type}`,
1811
+ query_params,
1812
+ body
1813
+ );
1814
+
1815
+ const {
1816
+ error: res_error,
1817
+ } = ContentModel.GeneratedSEOContent().validate(response, {
1818
+ abortEarly: false,
1819
+ allowUnknown: false,
1820
+ });
1821
+
1822
+ if (res_error) {
1823
+ Logger({
1824
+ level: "WARN",
1825
+ message: "Response Validation Warnnings for generateSEOTitle",
1826
+ });
1827
+ Logger({ level: "WARN", message: res_error });
1828
+ }
1829
+
1830
+ return response;
1214
1831
  }
1215
1832
 
1216
1833
  /**
@@ -1219,10 +1836,11 @@ class Content {
1219
1836
  * given set of results. Default value is 1.
1220
1837
  * @param {number} [arg.pageSize] - The number of items to retrieve in each
1221
1838
  * page. Default value is 10.
1839
+ * @returns {Promise<LandingPageGetResponse>} - Success response
1222
1840
  * @summary: Get landing pages
1223
1841
  * @description: Landing page is the first page that a prospect lands upon while visiting a website. Use this API to fetch a list of landing pages.
1224
1842
  */
1225
- getLandingPages({ pageNo, pageSize } = {}) {
1843
+ async getLandingPages({ pageNo, pageSize } = {}) {
1226
1844
  const { error } = ContentValidator.getLandingPages().validate(
1227
1845
  {
1228
1846
  pageNo,
@@ -1243,21 +1861,41 @@ class Content {
1243
1861
  { abortEarly: false, allowUnknown: false }
1244
1862
  );
1245
1863
  if (warrning) {
1246
- console.log("Parameter Validation warrnings for getLandingPages");
1247
- console.log(warrning);
1864
+ Logger({
1865
+ level: "WARN",
1866
+ message: "Parameter Validation warrnings for getLandingPages",
1867
+ });
1868
+ Logger({ level: "WARN", message: warrning });
1248
1869
  }
1249
1870
 
1250
1871
  const query_params = {};
1251
1872
  query_params["page_no"] = pageNo;
1252
1873
  query_params["page_size"] = pageSize;
1253
1874
 
1254
- return PlatformAPIClient.execute(
1875
+ const response = await PlatformAPIClient.execute(
1255
1876
  this.config,
1256
1877
  "get",
1257
1878
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/landing-page/`,
1258
1879
  query_params,
1259
1880
  undefined
1260
1881
  );
1882
+
1883
+ const {
1884
+ error: res_error,
1885
+ } = ContentModel.LandingPageGetResponse().validate(response, {
1886
+ abortEarly: false,
1887
+ allowUnknown: false,
1888
+ });
1889
+
1890
+ if (res_error) {
1891
+ Logger({
1892
+ level: "WARN",
1893
+ message: "Response Validation Warnnings for getLandingPages",
1894
+ });
1895
+ Logger({ level: "WARN", message: res_error });
1896
+ }
1897
+
1898
+ return response;
1261
1899
  }
1262
1900
 
1263
1901
  /**
@@ -1296,10 +1934,11 @@ class Content {
1296
1934
  /**
1297
1935
  * @param {Object} arg - Arg object.
1298
1936
  * @param {LandingPageSchema} arg.body
1937
+ * @returns {Promise<LandingPageSchema>} - Success response
1299
1938
  * @summary: Create a landing page
1300
1939
  * @description: Landing page is the first page that a prospect lands upon while visiting a website. Use this API to create a landing page.
1301
1940
  */
1302
- createLandingPage({ body } = {}) {
1941
+ async createLandingPage({ body } = {}) {
1303
1942
  const { error } = ContentValidator.createLandingPage().validate(
1304
1943
  {
1305
1944
  body,
@@ -1318,29 +1957,50 @@ class Content {
1318
1957
  { abortEarly: false, allowUnknown: false }
1319
1958
  );
1320
1959
  if (warrning) {
1321
- console.log("Parameter Validation warrnings for createLandingPage");
1322
- console.log(warrning);
1960
+ Logger({
1961
+ level: "WARN",
1962
+ message: "Parameter Validation warrnings for createLandingPage",
1963
+ });
1964
+ Logger({ level: "WARN", message: warrning });
1323
1965
  }
1324
1966
 
1325
1967
  const query_params = {};
1326
1968
 
1327
- return PlatformAPIClient.execute(
1969
+ const response = await PlatformAPIClient.execute(
1328
1970
  this.config,
1329
1971
  "post",
1330
1972
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/landing-page/`,
1331
1973
  query_params,
1332
1974
  body
1333
1975
  );
1976
+
1977
+ const {
1978
+ error: res_error,
1979
+ } = ContentModel.LandingPageSchema().validate(response, {
1980
+ abortEarly: false,
1981
+ allowUnknown: false,
1982
+ });
1983
+
1984
+ if (res_error) {
1985
+ Logger({
1986
+ level: "WARN",
1987
+ message: "Response Validation Warnnings for createLandingPage",
1988
+ });
1989
+ Logger({ level: "WARN", message: res_error });
1990
+ }
1991
+
1992
+ return response;
1334
1993
  }
1335
1994
 
1336
1995
  /**
1337
1996
  * @param {Object} arg - Arg object.
1338
1997
  * @param {string} arg.id - ID allotted to a landing page.
1339
1998
  * @param {LandingPageSchema} arg.body
1999
+ * @returns {Promise<LandingPageSchema>} - Success response
1340
2000
  * @summary: Update a landing page
1341
2001
  * @description: Use this API to edit the details of an existing landing page.
1342
2002
  */
1343
- updateLandingPage({ id, body } = {}) {
2003
+ async updateLandingPage({ id, body } = {}) {
1344
2004
  const { error } = ContentValidator.updateLandingPage().validate(
1345
2005
  {
1346
2006
  id,
@@ -1361,28 +2021,49 @@ class Content {
1361
2021
  { abortEarly: false, allowUnknown: false }
1362
2022
  );
1363
2023
  if (warrning) {
1364
- console.log("Parameter Validation warrnings for updateLandingPage");
1365
- console.log(warrning);
2024
+ Logger({
2025
+ level: "WARN",
2026
+ message: "Parameter Validation warrnings for updateLandingPage",
2027
+ });
2028
+ Logger({ level: "WARN", message: warrning });
1366
2029
  }
1367
2030
 
1368
2031
  const query_params = {};
1369
2032
 
1370
- return PlatformAPIClient.execute(
2033
+ const response = await PlatformAPIClient.execute(
1371
2034
  this.config,
1372
2035
  "put",
1373
2036
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/landing-page/${id}`,
1374
2037
  query_params,
1375
2038
  body
1376
2039
  );
2040
+
2041
+ const {
2042
+ error: res_error,
2043
+ } = ContentModel.LandingPageSchema().validate(response, {
2044
+ abortEarly: false,
2045
+ allowUnknown: false,
2046
+ });
2047
+
2048
+ if (res_error) {
2049
+ Logger({
2050
+ level: "WARN",
2051
+ message: "Response Validation Warnnings for updateLandingPage",
2052
+ });
2053
+ Logger({ level: "WARN", message: res_error });
2054
+ }
2055
+
2056
+ return response;
1377
2057
  }
1378
2058
 
1379
2059
  /**
1380
2060
  * @param {Object} arg - Arg object.
1381
2061
  * @param {string} arg.id - ID allotted to a landing page.
2062
+ * @returns {Promise<LandingPageSchema>} - Success response
1382
2063
  * @summary: Delete a landing page
1383
2064
  * @description: Use this API to delete an existing landing page.
1384
2065
  */
1385
- deleteLandingPage({ id } = {}) {
2066
+ async deleteLandingPage({ id } = {}) {
1386
2067
  const { error } = ContentValidator.deleteLandingPage().validate(
1387
2068
  {
1388
2069
  id,
@@ -1401,27 +2082,48 @@ class Content {
1401
2082
  { abortEarly: false, allowUnknown: false }
1402
2083
  );
1403
2084
  if (warrning) {
1404
- console.log("Parameter Validation warrnings for deleteLandingPage");
1405
- console.log(warrning);
2085
+ Logger({
2086
+ level: "WARN",
2087
+ message: "Parameter Validation warrnings for deleteLandingPage",
2088
+ });
2089
+ Logger({ level: "WARN", message: warrning });
1406
2090
  }
1407
2091
 
1408
2092
  const query_params = {};
1409
2093
 
1410
- return PlatformAPIClient.execute(
2094
+ const response = await PlatformAPIClient.execute(
1411
2095
  this.config,
1412
2096
  "delete",
1413
2097
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/landing-page/${id}`,
1414
2098
  query_params,
1415
2099
  undefined
1416
2100
  );
2101
+
2102
+ const {
2103
+ error: res_error,
2104
+ } = ContentModel.LandingPageSchema().validate(response, {
2105
+ abortEarly: false,
2106
+ allowUnknown: false,
2107
+ });
2108
+
2109
+ if (res_error) {
2110
+ Logger({
2111
+ level: "WARN",
2112
+ message: "Response Validation Warnnings for deleteLandingPage",
2113
+ });
2114
+ Logger({ level: "WARN", message: res_error });
2115
+ }
2116
+
2117
+ return response;
1417
2118
  }
1418
2119
 
1419
2120
  /**
1420
2121
  * @param {Object} arg - Arg object.
2122
+ * @returns {Promise<ApplicationLegal>} - Success response
1421
2123
  * @summary: Get legal information
1422
2124
  * @description: Use this API to get the legal information of an application, which includes Policy, Terms and Conditions, Shipping Policy and FAQ regarding the application.
1423
2125
  */
1424
- getLegalInformation({} = {}) {
2126
+ async getLegalInformation({} = {}) {
1425
2127
  const { error } = ContentValidator.getLegalInformation().validate(
1426
2128
  {},
1427
2129
  { abortEarly: false, allowUnknown: true }
@@ -1436,28 +2138,49 @@ class Content {
1436
2138
  { abortEarly: false, allowUnknown: false }
1437
2139
  );
1438
2140
  if (warrning) {
1439
- console.log("Parameter Validation warrnings for getLegalInformation");
1440
- console.log(warrning);
2141
+ Logger({
2142
+ level: "WARN",
2143
+ message: "Parameter Validation warrnings for getLegalInformation",
2144
+ });
2145
+ Logger({ level: "WARN", message: warrning });
1441
2146
  }
1442
2147
 
1443
2148
  const query_params = {};
1444
2149
 
1445
- return PlatformAPIClient.execute(
2150
+ const response = await PlatformAPIClient.execute(
1446
2151
  this.config,
1447
2152
  "get",
1448
2153
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/legal`,
1449
2154
  query_params,
1450
2155
  undefined
1451
2156
  );
2157
+
2158
+ const {
2159
+ error: res_error,
2160
+ } = ContentModel.ApplicationLegal().validate(response, {
2161
+ abortEarly: false,
2162
+ allowUnknown: false,
2163
+ });
2164
+
2165
+ if (res_error) {
2166
+ Logger({
2167
+ level: "WARN",
2168
+ message: "Response Validation Warnnings for getLegalInformation",
2169
+ });
2170
+ Logger({ level: "WARN", message: res_error });
2171
+ }
2172
+
2173
+ return response;
1452
2174
  }
1453
2175
 
1454
2176
  /**
1455
2177
  * @param {Object} arg - Arg object.
1456
2178
  * @param {ApplicationLegal} arg.body
2179
+ * @returns {Promise<ApplicationLegal>} - Success response
1457
2180
  * @summary: Save legal information
1458
2181
  * @description: Use this API to edit, update and save the legal information of an application, which includes Policy, Terms and Conditions, Shipping Policy and FAQ regarding the application.
1459
2182
  */
1460
- updateLegalInformation({ body } = {}) {
2183
+ async updateLegalInformation({ body } = {}) {
1461
2184
  const { error } = ContentValidator.updateLegalInformation().validate(
1462
2185
  {
1463
2186
  body,
@@ -1478,19 +2201,39 @@ class Content {
1478
2201
  { abortEarly: false, allowUnknown: false }
1479
2202
  );
1480
2203
  if (warrning) {
1481
- console.log("Parameter Validation warrnings for updateLegalInformation");
1482
- console.log(warrning);
2204
+ Logger({
2205
+ level: "WARN",
2206
+ message: "Parameter Validation warrnings for updateLegalInformation",
2207
+ });
2208
+ Logger({ level: "WARN", message: warrning });
1483
2209
  }
1484
2210
 
1485
2211
  const query_params = {};
1486
2212
 
1487
- return PlatformAPIClient.execute(
2213
+ const response = await PlatformAPIClient.execute(
1488
2214
  this.config,
1489
2215
  "post",
1490
2216
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/legal`,
1491
2217
  query_params,
1492
2218
  body
1493
2219
  );
2220
+
2221
+ const {
2222
+ error: res_error,
2223
+ } = ContentModel.ApplicationLegal().validate(response, {
2224
+ abortEarly: false,
2225
+ allowUnknown: false,
2226
+ });
2227
+
2228
+ if (res_error) {
2229
+ Logger({
2230
+ level: "WARN",
2231
+ message: "Response Validation Warnnings for updateLegalInformation",
2232
+ });
2233
+ Logger({ level: "WARN", message: res_error });
2234
+ }
2235
+
2236
+ return response;
1494
2237
  }
1495
2238
 
1496
2239
  /**
@@ -1501,10 +2244,11 @@ class Content {
1501
2244
  * given set of results. Default value is 1.
1502
2245
  * @param {number} [arg.pageSize] - The number of items to retrieve in each
1503
2246
  * page. Default value is 10.
2247
+ * @returns {Promise<NavigationGetResponse>} - Success response
1504
2248
  * @summary: Get navigations
1505
2249
  * @description: Use this API to fetch the navigations details which includes the items of the navigation pane. It also shows the orientation, links, sub-navigations, etc.
1506
2250
  */
1507
- getNavigations({ devicePlatform, pageNo, pageSize } = {}) {
2251
+ async getNavigations({ devicePlatform, pageNo, pageSize } = {}) {
1508
2252
  const { error } = ContentValidator.getNavigations().validate(
1509
2253
  {
1510
2254
  devicePlatform,
@@ -1527,8 +2271,11 @@ class Content {
1527
2271
  { abortEarly: false, allowUnknown: false }
1528
2272
  );
1529
2273
  if (warrning) {
1530
- console.log("Parameter Validation warrnings for getNavigations");
1531
- console.log(warrning);
2274
+ Logger({
2275
+ level: "WARN",
2276
+ message: "Parameter Validation warrnings for getNavigations",
2277
+ });
2278
+ Logger({ level: "WARN", message: warrning });
1532
2279
  }
1533
2280
 
1534
2281
  const query_params = {};
@@ -1536,13 +2283,30 @@ class Content {
1536
2283
  query_params["page_no"] = pageNo;
1537
2284
  query_params["page_size"] = pageSize;
1538
2285
 
1539
- return PlatformAPIClient.execute(
2286
+ const response = await PlatformAPIClient.execute(
1540
2287
  this.config,
1541
2288
  "get",
1542
2289
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/`,
1543
2290
  query_params,
1544
2291
  undefined
1545
2292
  );
2293
+
2294
+ const {
2295
+ error: res_error,
2296
+ } = ContentModel.NavigationGetResponse().validate(response, {
2297
+ abortEarly: false,
2298
+ allowUnknown: false,
2299
+ });
2300
+
2301
+ if (res_error) {
2302
+ Logger({
2303
+ level: "WARN",
2304
+ message: "Response Validation Warnnings for getNavigations",
2305
+ });
2306
+ Logger({ level: "WARN", message: res_error });
2307
+ }
2308
+
2309
+ return response;
1546
2310
  }
1547
2311
 
1548
2312
  /**
@@ -1589,10 +2353,11 @@ class Content {
1589
2353
  /**
1590
2354
  * @param {Object} arg - Arg object.
1591
2355
  * @param {NavigationRequest} arg.body
2356
+ * @returns {Promise<NavigationSchema>} - Success response
1592
2357
  * @summary: Create a navigation
1593
2358
  * @description: Navigation is the arrangement of navigational items to ease the accessibility of resources for users on a website. Use this API to create a navigation.
1594
2359
  */
1595
- createNavigation({ body } = {}) {
2360
+ async createNavigation({ body } = {}) {
1596
2361
  const { error } = ContentValidator.createNavigation().validate(
1597
2362
  {
1598
2363
  body,
@@ -1611,27 +2376,48 @@ class Content {
1611
2376
  { abortEarly: false, allowUnknown: false }
1612
2377
  );
1613
2378
  if (warrning) {
1614
- console.log("Parameter Validation warrnings for createNavigation");
1615
- console.log(warrning);
2379
+ Logger({
2380
+ level: "WARN",
2381
+ message: "Parameter Validation warrnings for createNavigation",
2382
+ });
2383
+ Logger({ level: "WARN", message: warrning });
1616
2384
  }
1617
2385
 
1618
2386
  const query_params = {};
1619
2387
 
1620
- return PlatformAPIClient.execute(
2388
+ const response = await PlatformAPIClient.execute(
1621
2389
  this.config,
1622
2390
  "post",
1623
2391
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/`,
1624
2392
  query_params,
1625
2393
  body
1626
2394
  );
2395
+
2396
+ const {
2397
+ error: res_error,
2398
+ } = ContentModel.NavigationSchema().validate(response, {
2399
+ abortEarly: false,
2400
+ allowUnknown: false,
2401
+ });
2402
+
2403
+ if (res_error) {
2404
+ Logger({
2405
+ level: "WARN",
2406
+ message: "Response Validation Warnnings for createNavigation",
2407
+ });
2408
+ Logger({ level: "WARN", message: res_error });
2409
+ }
2410
+
2411
+ return response;
1627
2412
  }
1628
2413
 
1629
2414
  /**
1630
2415
  * @param {Object} arg - Arg object.
2416
+ * @returns {Promise<DefaultNavigationResponse>} - Success response
1631
2417
  * @summary: Get default navigations
1632
2418
  * @description: On any website (application), there are navigations that are present by default. Use this API to retrieve those default navigations.
1633
2419
  */
1634
- getDefaultNavigations({} = {}) {
2420
+ async getDefaultNavigations({} = {}) {
1635
2421
  const { error } = ContentValidator.getDefaultNavigations().validate(
1636
2422
  {},
1637
2423
  { abortEarly: false, allowUnknown: true }
@@ -1648,19 +2434,39 @@ class Content {
1648
2434
  { abortEarly: false, allowUnknown: false }
1649
2435
  );
1650
2436
  if (warrning) {
1651
- console.log("Parameter Validation warrnings for getDefaultNavigations");
1652
- console.log(warrning);
2437
+ Logger({
2438
+ level: "WARN",
2439
+ message: "Parameter Validation warrnings for getDefaultNavigations",
2440
+ });
2441
+ Logger({ level: "WARN", message: warrning });
1653
2442
  }
1654
2443
 
1655
2444
  const query_params = {};
1656
2445
 
1657
- return PlatformAPIClient.execute(
2446
+ const response = await PlatformAPIClient.execute(
1658
2447
  this.config,
1659
2448
  "get",
1660
2449
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/default`,
1661
2450
  query_params,
1662
2451
  undefined
1663
2452
  );
2453
+
2454
+ const {
2455
+ error: res_error,
2456
+ } = ContentModel.DefaultNavigationResponse().validate(response, {
2457
+ abortEarly: false,
2458
+ allowUnknown: false,
2459
+ });
2460
+
2461
+ if (res_error) {
2462
+ Logger({
2463
+ level: "WARN",
2464
+ message: "Response Validation Warnnings for getDefaultNavigations",
2465
+ });
2466
+ Logger({ level: "WARN", message: res_error });
2467
+ }
2468
+
2469
+ return response;
1664
2470
  }
1665
2471
 
1666
2472
  /**
@@ -1670,10 +2476,11 @@ class Content {
1670
2476
  * `getNavigations` API.
1671
2477
  * @param {string} arg.devicePlatform - Filter navigations by platform.
1672
2478
  * Acceptable values are: web, android, ios, all
2479
+ * @returns {Promise<NavigationSchema>} - Success response
1673
2480
  * @summary: Get a navigation by slug
1674
2481
  * @description: Use this API to retrieve a navigation by its slug.
1675
2482
  */
1676
- getNavigationBySlug({ slug, devicePlatform } = {}) {
2483
+ async getNavigationBySlug({ slug, devicePlatform } = {}) {
1677
2484
  const { error } = ContentValidator.getNavigationBySlug().validate(
1678
2485
  {
1679
2486
  slug,
@@ -1694,30 +2501,51 @@ class Content {
1694
2501
  { abortEarly: false, allowUnknown: false }
1695
2502
  );
1696
2503
  if (warrning) {
1697
- console.log("Parameter Validation warrnings for getNavigationBySlug");
1698
- console.log(warrning);
2504
+ Logger({
2505
+ level: "WARN",
2506
+ message: "Parameter Validation warrnings for getNavigationBySlug",
2507
+ });
2508
+ Logger({ level: "WARN", message: warrning });
1699
2509
  }
1700
2510
 
1701
2511
  const query_params = {};
1702
2512
  query_params["device_platform"] = devicePlatform;
1703
2513
 
1704
- return PlatformAPIClient.execute(
2514
+ const response = await PlatformAPIClient.execute(
1705
2515
  this.config,
1706
2516
  "get",
1707
2517
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/${slug}`,
1708
2518
  query_params,
1709
2519
  undefined
1710
2520
  );
2521
+
2522
+ const {
2523
+ error: res_error,
2524
+ } = ContentModel.NavigationSchema().validate(response, {
2525
+ abortEarly: false,
2526
+ allowUnknown: false,
2527
+ });
2528
+
2529
+ if (res_error) {
2530
+ Logger({
2531
+ level: "WARN",
2532
+ message: "Response Validation Warnnings for getNavigationBySlug",
2533
+ });
2534
+ Logger({ level: "WARN", message: res_error });
2535
+ }
2536
+
2537
+ return response;
1711
2538
  }
1712
2539
 
1713
2540
  /**
1714
2541
  * @param {Object} arg - Arg object.
1715
2542
  * @param {string} arg.id - ID allotted to the navigation.
1716
2543
  * @param {NavigationRequest} arg.body
2544
+ * @returns {Promise<NavigationSchema>} - Success response
1717
2545
  * @summary: Update a navigation
1718
2546
  * @description: Use this API to edit the details of an existing navigation.
1719
2547
  */
1720
- updateNavigation({ id, body } = {}) {
2548
+ async updateNavigation({ id, body } = {}) {
1721
2549
  const { error } = ContentValidator.updateNavigation().validate(
1722
2550
  {
1723
2551
  id,
@@ -1738,28 +2566,49 @@ class Content {
1738
2566
  { abortEarly: false, allowUnknown: false }
1739
2567
  );
1740
2568
  if (warrning) {
1741
- console.log("Parameter Validation warrnings for updateNavigation");
1742
- console.log(warrning);
2569
+ Logger({
2570
+ level: "WARN",
2571
+ message: "Parameter Validation warrnings for updateNavigation",
2572
+ });
2573
+ Logger({ level: "WARN", message: warrning });
1743
2574
  }
1744
2575
 
1745
2576
  const query_params = {};
1746
2577
 
1747
- return PlatformAPIClient.execute(
2578
+ const response = await PlatformAPIClient.execute(
1748
2579
  this.config,
1749
2580
  "put",
1750
2581
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/${id}`,
1751
2582
  query_params,
1752
2583
  body
1753
2584
  );
2585
+
2586
+ const {
2587
+ error: res_error,
2588
+ } = ContentModel.NavigationSchema().validate(response, {
2589
+ abortEarly: false,
2590
+ allowUnknown: false,
2591
+ });
2592
+
2593
+ if (res_error) {
2594
+ Logger({
2595
+ level: "WARN",
2596
+ message: "Response Validation Warnnings for updateNavigation",
2597
+ });
2598
+ Logger({ level: "WARN", message: res_error });
2599
+ }
2600
+
2601
+ return response;
1754
2602
  }
1755
2603
 
1756
2604
  /**
1757
2605
  * @param {Object} arg - Arg object.
1758
2606
  * @param {string} arg.id - ID allotted to the navigation.
2607
+ * @returns {Promise<NavigationSchema>} - Success response
1759
2608
  * @summary: Delete a navigation
1760
2609
  * @description: Use this API to delete an existing navigation.
1761
2610
  */
1762
- deleteNavigation({ id } = {}) {
2611
+ async deleteNavigation({ id } = {}) {
1763
2612
  const { error } = ContentValidator.deleteNavigation().validate(
1764
2613
  {
1765
2614
  id,
@@ -1778,27 +2627,48 @@ class Content {
1778
2627
  { abortEarly: false, allowUnknown: false }
1779
2628
  );
1780
2629
  if (warrning) {
1781
- console.log("Parameter Validation warrnings for deleteNavigation");
1782
- console.log(warrning);
2630
+ Logger({
2631
+ level: "WARN",
2632
+ message: "Parameter Validation warrnings for deleteNavigation",
2633
+ });
2634
+ Logger({ level: "WARN", message: warrning });
1783
2635
  }
1784
2636
 
1785
2637
  const query_params = {};
1786
2638
 
1787
- return PlatformAPIClient.execute(
2639
+ const response = await PlatformAPIClient.execute(
1788
2640
  this.config,
1789
2641
  "delete",
1790
2642
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/${id}`,
1791
2643
  query_params,
1792
2644
  undefined
1793
2645
  );
2646
+
2647
+ const {
2648
+ error: res_error,
2649
+ } = ContentModel.NavigationSchema().validate(response, {
2650
+ abortEarly: false,
2651
+ allowUnknown: false,
2652
+ });
2653
+
2654
+ if (res_error) {
2655
+ Logger({
2656
+ level: "WARN",
2657
+ message: "Response Validation Warnnings for deleteNavigation",
2658
+ });
2659
+ Logger({ level: "WARN", message: res_error });
2660
+ }
2661
+
2662
+ return response;
1794
2663
  }
1795
2664
 
1796
2665
  /**
1797
2666
  * @param {Object} arg - Arg object.
2667
+ * @returns {Promise<PageMetaSchema>} - Success response
1798
2668
  * @summary: Get page meta
1799
2669
  * @description: Use this API to get the meta of custom pages (blog, page) and default system pages (e.g. home/brand/category/collection).
1800
2670
  */
1801
- getPageMeta({} = {}) {
2671
+ async getPageMeta({} = {}) {
1802
2672
  const { error } = ContentValidator.getPageMeta().validate(
1803
2673
  {},
1804
2674
  { abortEarly: false, allowUnknown: true }
@@ -1813,27 +2683,48 @@ class Content {
1813
2683
  { abortEarly: false, allowUnknown: false }
1814
2684
  );
1815
2685
  if (warrning) {
1816
- console.log("Parameter Validation warrnings for getPageMeta");
1817
- console.log(warrning);
2686
+ Logger({
2687
+ level: "WARN",
2688
+ message: "Parameter Validation warrnings for getPageMeta",
2689
+ });
2690
+ Logger({ level: "WARN", message: warrning });
1818
2691
  }
1819
2692
 
1820
2693
  const query_params = {};
1821
2694
 
1822
- return PlatformAPIClient.execute(
2695
+ const response = await PlatformAPIClient.execute(
1823
2696
  this.config,
1824
2697
  "get",
1825
2698
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pages/meta`,
1826
2699
  query_params,
1827
2700
  undefined
1828
2701
  );
2702
+
2703
+ const {
2704
+ error: res_error,
2705
+ } = ContentModel.PageMetaSchema().validate(response, {
2706
+ abortEarly: false,
2707
+ allowUnknown: false,
2708
+ });
2709
+
2710
+ if (res_error) {
2711
+ Logger({
2712
+ level: "WARN",
2713
+ message: "Response Validation Warnnings for getPageMeta",
2714
+ });
2715
+ Logger({ level: "WARN", message: res_error });
2716
+ }
2717
+
2718
+ return response;
1829
2719
  }
1830
2720
 
1831
2721
  /**
1832
2722
  * @param {Object} arg - Arg object.
2723
+ * @returns {Promise<PageSpec>} - Success response
1833
2724
  * @summary: Get page spec
1834
2725
  * @description: Use this API to get the specifications of a page, such as page type, display name, params and query.
1835
2726
  */
1836
- getPageSpec({} = {}) {
2727
+ async getPageSpec({} = {}) {
1837
2728
  const { error } = ContentValidator.getPageSpec().validate(
1838
2729
  {},
1839
2730
  { abortEarly: false, allowUnknown: true }
@@ -1848,28 +2739,47 @@ class Content {
1848
2739
  { abortEarly: false, allowUnknown: false }
1849
2740
  );
1850
2741
  if (warrning) {
1851
- console.log("Parameter Validation warrnings for getPageSpec");
1852
- console.log(warrning);
2742
+ Logger({
2743
+ level: "WARN",
2744
+ message: "Parameter Validation warrnings for getPageSpec",
2745
+ });
2746
+ Logger({ level: "WARN", message: warrning });
1853
2747
  }
1854
2748
 
1855
2749
  const query_params = {};
1856
2750
 
1857
- return PlatformAPIClient.execute(
2751
+ const response = await PlatformAPIClient.execute(
1858
2752
  this.config,
1859
2753
  "get",
1860
2754
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pages/spec`,
1861
2755
  query_params,
1862
2756
  undefined
1863
2757
  );
2758
+
2759
+ const { error: res_error } = ContentModel.PageSpec().validate(response, {
2760
+ abortEarly: false,
2761
+ allowUnknown: false,
2762
+ });
2763
+
2764
+ if (res_error) {
2765
+ Logger({
2766
+ level: "WARN",
2767
+ message: "Response Validation Warnnings for getPageSpec",
2768
+ });
2769
+ Logger({ level: "WARN", message: res_error });
2770
+ }
2771
+
2772
+ return response;
1864
2773
  }
1865
2774
 
1866
2775
  /**
1867
2776
  * @param {Object} arg - Arg object.
1868
2777
  * @param {PageRequest} arg.body
2778
+ * @returns {Promise<PageSchema>} - Success response
1869
2779
  * @summary: Create a page preview
1870
2780
  * @description: Use this API to create a page preview to check the appearance of a custom page.
1871
2781
  */
1872
- createPagePreview({ body } = {}) {
2782
+ async createPagePreview({ body } = {}) {
1873
2783
  const { error } = ContentValidator.createPagePreview().validate(
1874
2784
  {
1875
2785
  body,
@@ -1888,19 +2798,37 @@ class Content {
1888
2798
  { abortEarly: false, allowUnknown: false }
1889
2799
  );
1890
2800
  if (warrning) {
1891
- console.log("Parameter Validation warrnings for createPagePreview");
1892
- console.log(warrning);
2801
+ Logger({
2802
+ level: "WARN",
2803
+ message: "Parameter Validation warrnings for createPagePreview",
2804
+ });
2805
+ Logger({ level: "WARN", message: warrning });
1893
2806
  }
1894
2807
 
1895
2808
  const query_params = {};
1896
2809
 
1897
- return PlatformAPIClient.execute(
2810
+ const response = await PlatformAPIClient.execute(
1898
2811
  this.config,
1899
2812
  "post",
1900
2813
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pages/preview/`,
1901
2814
  query_params,
1902
2815
  body
1903
2816
  );
2817
+
2818
+ const { error: res_error } = ContentModel.PageSchema().validate(response, {
2819
+ abortEarly: false,
2820
+ allowUnknown: false,
2821
+ });
2822
+
2823
+ if (res_error) {
2824
+ Logger({
2825
+ level: "WARN",
2826
+ message: "Response Validation Warnnings for createPagePreview",
2827
+ });
2828
+ Logger({ level: "WARN", message: res_error });
2829
+ }
2830
+
2831
+ return response;
1904
2832
  }
1905
2833
 
1906
2834
  /**
@@ -1908,10 +2836,11 @@ class Content {
1908
2836
  * @param {string} arg.slug - A short, human-readable, URL-friendly
1909
2837
  * identifier of a page. You can get slug value of a page from `getPages` API.
1910
2838
  * @param {PagePublishRequest} arg.body
2839
+ * @returns {Promise<PageSchema>} - Success response
1911
2840
  * @summary: Change the publish status of a page
1912
2841
  * @description: Use this API to change the publish status of an existing page. Allows you to publish and unpublish the page.
1913
2842
  */
1914
- updatePagePreview({ slug, body } = {}) {
2843
+ async updatePagePreview({ slug, body } = {}) {
1915
2844
  const { error } = ContentValidator.updatePagePreview().validate(
1916
2845
  {
1917
2846
  slug,
@@ -1932,28 +2861,47 @@ class Content {
1932
2861
  { abortEarly: false, allowUnknown: false }
1933
2862
  );
1934
2863
  if (warrning) {
1935
- console.log("Parameter Validation warrnings for updatePagePreview");
1936
- console.log(warrning);
2864
+ Logger({
2865
+ level: "WARN",
2866
+ message: "Parameter Validation warrnings for updatePagePreview",
2867
+ });
2868
+ Logger({ level: "WARN", message: warrning });
1937
2869
  }
1938
2870
 
1939
2871
  const query_params = {};
1940
2872
 
1941
- return PlatformAPIClient.execute(
2873
+ const response = await PlatformAPIClient.execute(
1942
2874
  this.config,
1943
2875
  "put",
1944
2876
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pages/publish/${slug}`,
1945
2877
  query_params,
1946
2878
  body
1947
2879
  );
2880
+
2881
+ const { error: res_error } = ContentModel.PageSchema().validate(response, {
2882
+ abortEarly: false,
2883
+ allowUnknown: false,
2884
+ });
2885
+
2886
+ if (res_error) {
2887
+ Logger({
2888
+ level: "WARN",
2889
+ message: "Response Validation Warnnings for updatePagePreview",
2890
+ });
2891
+ Logger({ level: "WARN", message: res_error });
2892
+ }
2893
+
2894
+ return response;
1948
2895
  }
1949
2896
 
1950
2897
  /**
1951
2898
  * @param {Object} arg - Arg object.
1952
2899
  * @param {string} arg.id - ID allotted to the page.
2900
+ * @returns {Promise<PageSchema>} - Success response
1953
2901
  * @summary: Delete a page
1954
2902
  * @description: Use this API to delete an existing page.
1955
2903
  */
1956
- deletePage({ id } = {}) {
2904
+ async deletePage({ id } = {}) {
1957
2905
  const { error } = ContentValidator.deletePage().validate(
1958
2906
  {
1959
2907
  id,
@@ -1972,28 +2920,47 @@ class Content {
1972
2920
  { abortEarly: false, allowUnknown: false }
1973
2921
  );
1974
2922
  if (warrning) {
1975
- console.log("Parameter Validation warrnings for deletePage");
1976
- console.log(warrning);
2923
+ Logger({
2924
+ level: "WARN",
2925
+ message: "Parameter Validation warrnings for deletePage",
2926
+ });
2927
+ Logger({ level: "WARN", message: warrning });
1977
2928
  }
1978
2929
 
1979
2930
  const query_params = {};
1980
2931
 
1981
- return PlatformAPIClient.execute(
2932
+ const response = await PlatformAPIClient.execute(
1982
2933
  this.config,
1983
2934
  "delete",
1984
2935
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pages/${id}`,
1985
2936
  query_params,
1986
2937
  undefined
1987
2938
  );
2939
+
2940
+ const { error: res_error } = ContentModel.PageSchema().validate(response, {
2941
+ abortEarly: false,
2942
+ allowUnknown: false,
2943
+ });
2944
+
2945
+ if (res_error) {
2946
+ Logger({
2947
+ level: "WARN",
2948
+ message: "Response Validation Warnnings for deletePage",
2949
+ });
2950
+ Logger({ level: "WARN", message: res_error });
2951
+ }
2952
+
2953
+ return response;
1988
2954
  }
1989
2955
 
1990
2956
  /**
1991
2957
  * @param {Object} arg - Arg object.
1992
2958
  * @param {PathMappingSchema} arg.body
2959
+ * @returns {Promise<PathMappingSchema>} - Success response
1993
2960
  * @summary: Save path based redirection rules
1994
2961
  * @description: Use this API to add redirection rules
1995
2962
  */
1996
- addPathRedirectionRules({ body } = {}) {
2963
+ async addPathRedirectionRules({ body } = {}) {
1997
2964
  const { error } = ContentValidator.addPathRedirectionRules().validate(
1998
2965
  {
1999
2966
  body,
@@ -2014,19 +2981,39 @@ class Content {
2014
2981
  { abortEarly: false, allowUnknown: false }
2015
2982
  );
2016
2983
  if (warrning) {
2017
- console.log("Parameter Validation warrnings for addPathRedirectionRules");
2018
- console.log(warrning);
2984
+ Logger({
2985
+ level: "WARN",
2986
+ message: "Parameter Validation warrnings for addPathRedirectionRules",
2987
+ });
2988
+ Logger({ level: "WARN", message: warrning });
2019
2989
  }
2020
2990
 
2021
2991
  const query_params = {};
2022
2992
 
2023
- return PlatformAPIClient.execute(
2993
+ const response = await PlatformAPIClient.execute(
2024
2994
  this.config,
2025
2995
  "post",
2026
2996
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/path-mappings`,
2027
2997
  query_params,
2028
2998
  body
2029
2999
  );
3000
+
3001
+ const {
3002
+ error: res_error,
3003
+ } = ContentModel.PathMappingSchema().validate(response, {
3004
+ abortEarly: false,
3005
+ allowUnknown: false,
3006
+ });
3007
+
3008
+ if (res_error) {
3009
+ Logger({
3010
+ level: "WARN",
3011
+ message: "Response Validation Warnnings for addPathRedirectionRules",
3012
+ });
3013
+ Logger({ level: "WARN", message: res_error });
3014
+ }
3015
+
3016
+ return response;
2030
3017
  }
2031
3018
 
2032
3019
  /**
@@ -2035,10 +3022,11 @@ class Content {
2035
3022
  * page. Default value is 5.
2036
3023
  * @param {number} [arg.pageNo] - The page number to navigate through the
2037
3024
  * given set of results. Default value is 1.
3025
+ * @returns {Promise<PathMappingSchema>} - Success response
2038
3026
  * @summary: Get path based redirection rules
2039
3027
  * @description: Use this API to get path based redirection rules.
2040
3028
  */
2041
- getPathRedirectionRules({ pageSize, pageNo } = {}) {
3029
+ async getPathRedirectionRules({ pageSize, pageNo } = {}) {
2042
3030
  const { error } = ContentValidator.getPathRedirectionRules().validate(
2043
3031
  {
2044
3032
  pageSize,
@@ -2061,30 +3049,51 @@ class Content {
2061
3049
  { abortEarly: false, allowUnknown: false }
2062
3050
  );
2063
3051
  if (warrning) {
2064
- console.log("Parameter Validation warrnings for getPathRedirectionRules");
2065
- console.log(warrning);
3052
+ Logger({
3053
+ level: "WARN",
3054
+ message: "Parameter Validation warrnings for getPathRedirectionRules",
3055
+ });
3056
+ Logger({ level: "WARN", message: warrning });
2066
3057
  }
2067
3058
 
2068
3059
  const query_params = {};
2069
3060
  query_params["page_size"] = pageSize;
2070
3061
  query_params["page_no"] = pageNo;
2071
3062
 
2072
- return PlatformAPIClient.execute(
3063
+ const response = await PlatformAPIClient.execute(
2073
3064
  this.config,
2074
3065
  "get",
2075
3066
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/path-mappings`,
2076
3067
  query_params,
2077
3068
  undefined
2078
3069
  );
3070
+
3071
+ const {
3072
+ error: res_error,
3073
+ } = ContentModel.PathMappingSchema().validate(response, {
3074
+ abortEarly: false,
3075
+ allowUnknown: false,
3076
+ });
3077
+
3078
+ if (res_error) {
3079
+ Logger({
3080
+ level: "WARN",
3081
+ message: "Response Validation Warnnings for getPathRedirectionRules",
3082
+ });
3083
+ Logger({ level: "WARN", message: res_error });
3084
+ }
3085
+
3086
+ return response;
2079
3087
  }
2080
3088
 
2081
3089
  /**
2082
3090
  * @param {Object} arg - Arg object.
2083
3091
  * @param {string} arg.pathId - ID allotted to the path redirection rule.
3092
+ * @returns {Promise<PathMappingSchema>} - Success response
2084
3093
  * @summary: Get path based redirection rule
2085
3094
  * @description: Use this API to get path based redirection rule.
2086
3095
  */
2087
- getPathRedirectionRule({ pathId } = {}) {
3096
+ async getPathRedirectionRule({ pathId } = {}) {
2088
3097
  const { error } = ContentValidator.getPathRedirectionRule().validate(
2089
3098
  {
2090
3099
  pathId,
@@ -2105,29 +3114,50 @@ class Content {
2105
3114
  { abortEarly: false, allowUnknown: false }
2106
3115
  );
2107
3116
  if (warrning) {
2108
- console.log("Parameter Validation warrnings for getPathRedirectionRule");
2109
- console.log(warrning);
3117
+ Logger({
3118
+ level: "WARN",
3119
+ message: "Parameter Validation warrnings for getPathRedirectionRule",
3120
+ });
3121
+ Logger({ level: "WARN", message: warrning });
2110
3122
  }
2111
3123
 
2112
3124
  const query_params = {};
2113
3125
 
2114
- return PlatformAPIClient.execute(
3126
+ const response = await PlatformAPIClient.execute(
2115
3127
  this.config,
2116
3128
  "get",
2117
3129
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/path-mappings/${pathId}`,
2118
3130
  query_params,
2119
3131
  undefined
2120
3132
  );
3133
+
3134
+ const {
3135
+ error: res_error,
3136
+ } = ContentModel.PathMappingSchema().validate(response, {
3137
+ abortEarly: false,
3138
+ allowUnknown: false,
3139
+ });
3140
+
3141
+ if (res_error) {
3142
+ Logger({
3143
+ level: "WARN",
3144
+ message: "Response Validation Warnnings for getPathRedirectionRule",
3145
+ });
3146
+ Logger({ level: "WARN", message: res_error });
3147
+ }
3148
+
3149
+ return response;
2121
3150
  }
2122
3151
 
2123
3152
  /**
2124
3153
  * @param {Object} arg - Arg object.
2125
3154
  * @param {string} arg.pathId - ID allotted to the path redirection rule.
2126
3155
  * @param {PathMappingSchema} arg.body
3156
+ * @returns {Promise<PathMappingSchema>} - Success response
2127
3157
  * @summary: Update path based redirection rules
2128
3158
  * @description: Use this API to update redirection rules
2129
3159
  */
2130
- updatePathRedirectionRules({ pathId, body } = {}) {
3160
+ async updatePathRedirectionRules({ pathId, body } = {}) {
2131
3161
  const { error } = ContentValidator.updatePathRedirectionRules().validate(
2132
3162
  {
2133
3163
  pathId,
@@ -2150,30 +3180,50 @@ class Content {
2150
3180
  { abortEarly: false, allowUnknown: false }
2151
3181
  );
2152
3182
  if (warrning) {
2153
- console.log(
2154
- "Parameter Validation warrnings for updatePathRedirectionRules"
2155
- );
2156
- console.log(warrning);
3183
+ Logger({
3184
+ level: "WARN",
3185
+ message:
3186
+ "Parameter Validation warrnings for updatePathRedirectionRules",
3187
+ });
3188
+ Logger({ level: "WARN", message: warrning });
2157
3189
  }
2158
3190
 
2159
3191
  const query_params = {};
2160
3192
 
2161
- return PlatformAPIClient.execute(
3193
+ const response = await PlatformAPIClient.execute(
2162
3194
  this.config,
2163
3195
  "put",
2164
3196
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/path-mappings/${pathId}`,
2165
3197
  query_params,
2166
3198
  body
2167
3199
  );
3200
+
3201
+ const {
3202
+ error: res_error,
3203
+ } = ContentModel.PathMappingSchema().validate(response, {
3204
+ abortEarly: false,
3205
+ allowUnknown: false,
3206
+ });
3207
+
3208
+ if (res_error) {
3209
+ Logger({
3210
+ level: "WARN",
3211
+ message: "Response Validation Warnnings for updatePathRedirectionRules",
3212
+ });
3213
+ Logger({ level: "WARN", message: res_error });
3214
+ }
3215
+
3216
+ return response;
2168
3217
  }
2169
3218
 
2170
3219
  /**
2171
3220
  * @param {Object} arg - Arg object.
2172
3221
  * @param {string} arg.pathId - ID allotted to the path redirection rule.
3222
+ * @returns {Promise<Object>} - Success response
2173
3223
  * @summary: Delete path based redirection rules
2174
3224
  * @description: Use this API to delete redirection rules
2175
3225
  */
2176
- deletePathRedirectionRules({ pathId } = {}) {
3226
+ async deletePathRedirectionRules({ pathId } = {}) {
2177
3227
  const { error } = ContentValidator.deletePathRedirectionRules().validate(
2178
3228
  {
2179
3229
  pathId,
@@ -2194,29 +3244,47 @@ class Content {
2194
3244
  { abortEarly: false, allowUnknown: false }
2195
3245
  );
2196
3246
  if (warrning) {
2197
- console.log(
2198
- "Parameter Validation warrnings for deletePathRedirectionRules"
2199
- );
2200
- console.log(warrning);
3247
+ Logger({
3248
+ level: "WARN",
3249
+ message:
3250
+ "Parameter Validation warrnings for deletePathRedirectionRules",
3251
+ });
3252
+ Logger({ level: "WARN", message: warrning });
2201
3253
  }
2202
3254
 
2203
3255
  const query_params = {};
2204
3256
 
2205
- return PlatformAPIClient.execute(
3257
+ const response = await PlatformAPIClient.execute(
2206
3258
  this.config,
2207
3259
  "delete",
2208
3260
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/path-mappings/${pathId}`,
2209
3261
  query_params,
2210
3262
  undefined
2211
3263
  );
3264
+
3265
+ const { error: res_error } = Joi.any().validate(response, {
3266
+ abortEarly: false,
3267
+ allowUnknown: false,
3268
+ });
3269
+
3270
+ if (res_error) {
3271
+ Logger({
3272
+ level: "WARN",
3273
+ message: "Response Validation Warnnings for deletePathRedirectionRules",
3274
+ });
3275
+ Logger({ level: "WARN", message: res_error });
3276
+ }
3277
+
3278
+ return response;
2212
3279
  }
2213
3280
 
2214
3281
  /**
2215
3282
  * @param {Object} arg - Arg object.
3283
+ * @returns {Promise<SeoComponent>} - Success response
2216
3284
  * @summary: Get SEO configuration of an application
2217
3285
  * @description: Use this API to know how the SEO is configured in the application. This includes the sitemap, robot.txt, custom meta tags, etc.
2218
3286
  */
2219
- getSEOConfiguration({} = {}) {
3287
+ async getSEOConfiguration({} = {}) {
2220
3288
  const { error } = ContentValidator.getSEOConfiguration().validate(
2221
3289
  {},
2222
3290
  { abortEarly: false, allowUnknown: true }
@@ -2231,28 +3299,47 @@ class Content {
2231
3299
  { abortEarly: false, allowUnknown: false }
2232
3300
  );
2233
3301
  if (warrning) {
2234
- console.log("Parameter Validation warrnings for getSEOConfiguration");
2235
- console.log(warrning);
3302
+ Logger({
3303
+ level: "WARN",
3304
+ message: "Parameter Validation warrnings for getSEOConfiguration",
3305
+ });
3306
+ Logger({ level: "WARN", message: warrning });
2236
3307
  }
2237
3308
 
2238
3309
  const query_params = {};
2239
3310
 
2240
- return PlatformAPIClient.execute(
3311
+ const response = await PlatformAPIClient.execute(
2241
3312
  this.config,
2242
3313
  "get",
2243
3314
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/seo`,
2244
3315
  query_params,
2245
3316
  undefined
2246
3317
  );
3318
+
3319
+ const { error: res_error } = ContentModel.SeoComponent().validate(
3320
+ response,
3321
+ { abortEarly: false, allowUnknown: false }
3322
+ );
3323
+
3324
+ if (res_error) {
3325
+ Logger({
3326
+ level: "WARN",
3327
+ message: "Response Validation Warnnings for getSEOConfiguration",
3328
+ });
3329
+ Logger({ level: "WARN", message: res_error });
3330
+ }
3331
+
3332
+ return response;
2247
3333
  }
2248
3334
 
2249
3335
  /**
2250
3336
  * @param {Object} arg - Arg object.
2251
3337
  * @param {SeoComponent} arg.body
3338
+ * @returns {Promise<SeoSchema>} - Success response
2252
3339
  * @summary: Update SEO of application
2253
3340
  * @description: Use this API to edit the SEO details of an application. This includes the sitemap, robot.txt, custom meta tags, etc.
2254
3341
  */
2255
- updateSEOConfiguration({ body } = {}) {
3342
+ async updateSEOConfiguration({ body } = {}) {
2256
3343
  const { error } = ContentValidator.updateSEOConfiguration().validate(
2257
3344
  {
2258
3345
  body,
@@ -2273,19 +3360,37 @@ class Content {
2273
3360
  { abortEarly: false, allowUnknown: false }
2274
3361
  );
2275
3362
  if (warrning) {
2276
- console.log("Parameter Validation warrnings for updateSEOConfiguration");
2277
- console.log(warrning);
3363
+ Logger({
3364
+ level: "WARN",
3365
+ message: "Parameter Validation warrnings for updateSEOConfiguration",
3366
+ });
3367
+ Logger({ level: "WARN", message: warrning });
2278
3368
  }
2279
3369
 
2280
3370
  const query_params = {};
2281
3371
 
2282
- return PlatformAPIClient.execute(
3372
+ const response = await PlatformAPIClient.execute(
2283
3373
  this.config,
2284
3374
  "post",
2285
3375
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/seo`,
2286
3376
  query_params,
2287
3377
  body
2288
3378
  );
3379
+
3380
+ const { error: res_error } = ContentModel.SeoSchema().validate(response, {
3381
+ abortEarly: false,
3382
+ allowUnknown: false,
3383
+ });
3384
+
3385
+ if (res_error) {
3386
+ Logger({
3387
+ level: "WARN",
3388
+ message: "Response Validation Warnnings for updateSEOConfiguration",
3389
+ });
3390
+ Logger({ level: "WARN", message: res_error });
3391
+ }
3392
+
3393
+ return response;
2289
3394
  }
2290
3395
 
2291
3396
  /**
@@ -2296,10 +3401,11 @@ class Content {
2296
3401
  * given set of results. Default value is 1.
2297
3402
  * @param {number} [arg.pageSize] - The number of items to retrieve in each
2298
3403
  * page. Default value is 10.
3404
+ * @returns {Promise<SlideshowGetResponse>} - Success response
2299
3405
  * @summary: Get slideshows
2300
3406
  * @description: A slideshow is a group of images, videos or a combination of both that are shown on the website in the form of slides. Use this API to fetch a list of slideshows.
2301
3407
  */
2302
- getSlideshows({ devicePlatform, pageNo, pageSize } = {}) {
3408
+ async getSlideshows({ devicePlatform, pageNo, pageSize } = {}) {
2303
3409
  const { error } = ContentValidator.getSlideshows().validate(
2304
3410
  {
2305
3411
  devicePlatform,
@@ -2322,8 +3428,11 @@ class Content {
2322
3428
  { abortEarly: false, allowUnknown: false }
2323
3429
  );
2324
3430
  if (warrning) {
2325
- console.log("Parameter Validation warrnings for getSlideshows");
2326
- console.log(warrning);
3431
+ Logger({
3432
+ level: "WARN",
3433
+ message: "Parameter Validation warrnings for getSlideshows",
3434
+ });
3435
+ Logger({ level: "WARN", message: warrning });
2327
3436
  }
2328
3437
 
2329
3438
  const query_params = {};
@@ -2331,13 +3440,30 @@ class Content {
2331
3440
  query_params["page_no"] = pageNo;
2332
3441
  query_params["page_size"] = pageSize;
2333
3442
 
2334
- return PlatformAPIClient.execute(
3443
+ const response = await PlatformAPIClient.execute(
2335
3444
  this.config,
2336
3445
  "get",
2337
3446
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/slideshows/`,
2338
3447
  query_params,
2339
3448
  undefined
2340
3449
  );
3450
+
3451
+ const {
3452
+ error: res_error,
3453
+ } = ContentModel.SlideshowGetResponse().validate(response, {
3454
+ abortEarly: false,
3455
+ allowUnknown: false,
3456
+ });
3457
+
3458
+ if (res_error) {
3459
+ Logger({
3460
+ level: "WARN",
3461
+ message: "Response Validation Warnnings for getSlideshows",
3462
+ });
3463
+ Logger({ level: "WARN", message: res_error });
3464
+ }
3465
+
3466
+ return response;
2341
3467
  }
2342
3468
 
2343
3469
  /**
@@ -2384,10 +3510,11 @@ class Content {
2384
3510
  /**
2385
3511
  * @param {Object} arg - Arg object.
2386
3512
  * @param {SlideshowRequest} arg.body
3513
+ * @returns {Promise<SlideshowSchema>} - Success response
2387
3514
  * @summary: Create a slideshow
2388
3515
  * @description: A slideshow is a group of images, videos or a combination of both that are shown on the website in the form of slides. Use this API to create a slideshow.
2389
3516
  */
2390
- createSlideshow({ body } = {}) {
3517
+ async createSlideshow({ body } = {}) {
2391
3518
  const { error } = ContentValidator.createSlideshow().validate(
2392
3519
  {
2393
3520
  body,
@@ -2406,19 +3533,39 @@ class Content {
2406
3533
  { abortEarly: false, allowUnknown: false }
2407
3534
  );
2408
3535
  if (warrning) {
2409
- console.log("Parameter Validation warrnings for createSlideshow");
2410
- console.log(warrning);
3536
+ Logger({
3537
+ level: "WARN",
3538
+ message: "Parameter Validation warrnings for createSlideshow",
3539
+ });
3540
+ Logger({ level: "WARN", message: warrning });
2411
3541
  }
2412
3542
 
2413
3543
  const query_params = {};
2414
3544
 
2415
- return PlatformAPIClient.execute(
3545
+ const response = await PlatformAPIClient.execute(
2416
3546
  this.config,
2417
3547
  "post",
2418
3548
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/slideshows/`,
2419
3549
  query_params,
2420
3550
  body
2421
3551
  );
3552
+
3553
+ const {
3554
+ error: res_error,
3555
+ } = ContentModel.SlideshowSchema().validate(response, {
3556
+ abortEarly: false,
3557
+ allowUnknown: false,
3558
+ });
3559
+
3560
+ if (res_error) {
3561
+ Logger({
3562
+ level: "WARN",
3563
+ message: "Response Validation Warnnings for createSlideshow",
3564
+ });
3565
+ Logger({ level: "WARN", message: res_error });
3566
+ }
3567
+
3568
+ return response;
2422
3569
  }
2423
3570
 
2424
3571
  /**
@@ -2428,10 +3575,11 @@ class Content {
2428
3575
  * `getSlideshows` API.
2429
3576
  * @param {string} arg.devicePlatform - Filter slideshows by platform.
2430
3577
  * Acceptable values are: web, android, ios and all
3578
+ * @returns {Promise<SlideshowSchema>} - Success response
2431
3579
  * @summary: Get slideshow by slug
2432
3580
  * @description: Use this API to retrieve the details of a slideshow by its slug.
2433
3581
  */
2434
- getSlideshowBySlug({ slug, devicePlatform } = {}) {
3582
+ async getSlideshowBySlug({ slug, devicePlatform } = {}) {
2435
3583
  const { error } = ContentValidator.getSlideshowBySlug().validate(
2436
3584
  {
2437
3585
  slug,
@@ -2452,30 +3600,51 @@ class Content {
2452
3600
  { abortEarly: false, allowUnknown: false }
2453
3601
  );
2454
3602
  if (warrning) {
2455
- console.log("Parameter Validation warrnings for getSlideshowBySlug");
2456
- console.log(warrning);
3603
+ Logger({
3604
+ level: "WARN",
3605
+ message: "Parameter Validation warrnings for getSlideshowBySlug",
3606
+ });
3607
+ Logger({ level: "WARN", message: warrning });
2457
3608
  }
2458
3609
 
2459
3610
  const query_params = {};
2460
3611
  query_params["device_platform"] = devicePlatform;
2461
3612
 
2462
- return PlatformAPIClient.execute(
3613
+ const response = await PlatformAPIClient.execute(
2463
3614
  this.config,
2464
3615
  "get",
2465
3616
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/slideshows/${slug}`,
2466
3617
  query_params,
2467
3618
  undefined
2468
3619
  );
3620
+
3621
+ const {
3622
+ error: res_error,
3623
+ } = ContentModel.SlideshowSchema().validate(response, {
3624
+ abortEarly: false,
3625
+ allowUnknown: false,
3626
+ });
3627
+
3628
+ if (res_error) {
3629
+ Logger({
3630
+ level: "WARN",
3631
+ message: "Response Validation Warnnings for getSlideshowBySlug",
3632
+ });
3633
+ Logger({ level: "WARN", message: res_error });
3634
+ }
3635
+
3636
+ return response;
2469
3637
  }
2470
3638
 
2471
3639
  /**
2472
3640
  * @param {Object} arg - Arg object.
2473
3641
  * @param {string} arg.id - ID allotted to the slideshow.
2474
3642
  * @param {SlideshowRequest} arg.body
3643
+ * @returns {Promise<SlideshowSchema>} - Success response
2475
3644
  * @summary: Update a slideshow
2476
3645
  * @description: Use this API to edit the details of an existing slideshow.
2477
3646
  */
2478
- updateSlideshow({ id, body } = {}) {
3647
+ async updateSlideshow({ id, body } = {}) {
2479
3648
  const { error } = ContentValidator.updateSlideshow().validate(
2480
3649
  {
2481
3650
  id,
@@ -2496,28 +3665,49 @@ class Content {
2496
3665
  { abortEarly: false, allowUnknown: false }
2497
3666
  );
2498
3667
  if (warrning) {
2499
- console.log("Parameter Validation warrnings for updateSlideshow");
2500
- console.log(warrning);
3668
+ Logger({
3669
+ level: "WARN",
3670
+ message: "Parameter Validation warrnings for updateSlideshow",
3671
+ });
3672
+ Logger({ level: "WARN", message: warrning });
2501
3673
  }
2502
3674
 
2503
3675
  const query_params = {};
2504
3676
 
2505
- return PlatformAPIClient.execute(
3677
+ const response = await PlatformAPIClient.execute(
2506
3678
  this.config,
2507
3679
  "put",
2508
3680
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/slideshows/${id}`,
2509
3681
  query_params,
2510
3682
  body
2511
3683
  );
3684
+
3685
+ const {
3686
+ error: res_error,
3687
+ } = ContentModel.SlideshowSchema().validate(response, {
3688
+ abortEarly: false,
3689
+ allowUnknown: false,
3690
+ });
3691
+
3692
+ if (res_error) {
3693
+ Logger({
3694
+ level: "WARN",
3695
+ message: "Response Validation Warnnings for updateSlideshow",
3696
+ });
3697
+ Logger({ level: "WARN", message: res_error });
3698
+ }
3699
+
3700
+ return response;
2512
3701
  }
2513
3702
 
2514
3703
  /**
2515
3704
  * @param {Object} arg - Arg object.
2516
3705
  * @param {string} arg.id - ID allotted to the slideshow.
3706
+ * @returns {Promise<SlideshowSchema>} - Success response
2517
3707
  * @summary: Delete a slideshow
2518
3708
  * @description: Use this API to delete an existing slideshow.
2519
3709
  */
2520
- deleteSlideshow({ id } = {}) {
3710
+ async deleteSlideshow({ id } = {}) {
2521
3711
  const { error } = ContentValidator.deleteSlideshow().validate(
2522
3712
  {
2523
3713
  id,
@@ -2536,27 +3726,48 @@ class Content {
2536
3726
  { abortEarly: false, allowUnknown: false }
2537
3727
  );
2538
3728
  if (warrning) {
2539
- console.log("Parameter Validation warrnings for deleteSlideshow");
2540
- console.log(warrning);
3729
+ Logger({
3730
+ level: "WARN",
3731
+ message: "Parameter Validation warrnings for deleteSlideshow",
3732
+ });
3733
+ Logger({ level: "WARN", message: warrning });
2541
3734
  }
2542
3735
 
2543
3736
  const query_params = {};
2544
3737
 
2545
- return PlatformAPIClient.execute(
3738
+ const response = await PlatformAPIClient.execute(
2546
3739
  this.config,
2547
3740
  "delete",
2548
3741
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/slideshows/${id}`,
2549
3742
  query_params,
2550
3743
  undefined
2551
3744
  );
3745
+
3746
+ const {
3747
+ error: res_error,
3748
+ } = ContentModel.SlideshowSchema().validate(response, {
3749
+ abortEarly: false,
3750
+ allowUnknown: false,
3751
+ });
3752
+
3753
+ if (res_error) {
3754
+ Logger({
3755
+ level: "WARN",
3756
+ message: "Response Validation Warnnings for deleteSlideshow",
3757
+ });
3758
+ Logger({ level: "WARN", message: res_error });
3759
+ }
3760
+
3761
+ return response;
2552
3762
  }
2553
3763
 
2554
3764
  /**
2555
3765
  * @param {Object} arg - Arg object.
3766
+ * @returns {Promise<Support>} - Success response
2556
3767
  * @summary: Get support information
2557
3768
  * @description: Use this API to get the contact details for customer support, including emails and phone numbers.
2558
3769
  */
2559
- getSupportInformation({} = {}) {
3770
+ async getSupportInformation({} = {}) {
2560
3771
  const { error } = ContentValidator.getSupportInformation().validate(
2561
3772
  {},
2562
3773
  { abortEarly: false, allowUnknown: true }
@@ -2573,28 +3784,47 @@ class Content {
2573
3784
  { abortEarly: false, allowUnknown: false }
2574
3785
  );
2575
3786
  if (warrning) {
2576
- console.log("Parameter Validation warrnings for getSupportInformation");
2577
- console.log(warrning);
3787
+ Logger({
3788
+ level: "WARN",
3789
+ message: "Parameter Validation warrnings for getSupportInformation",
3790
+ });
3791
+ Logger({ level: "WARN", message: warrning });
2578
3792
  }
2579
3793
 
2580
3794
  const query_params = {};
2581
3795
 
2582
- return PlatformAPIClient.execute(
3796
+ const response = await PlatformAPIClient.execute(
2583
3797
  this.config,
2584
3798
  "get",
2585
3799
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/support`,
2586
3800
  query_params,
2587
3801
  undefined
2588
3802
  );
3803
+
3804
+ const { error: res_error } = ContentModel.Support().validate(response, {
3805
+ abortEarly: false,
3806
+ allowUnknown: false,
3807
+ });
3808
+
3809
+ if (res_error) {
3810
+ Logger({
3811
+ level: "WARN",
3812
+ message: "Response Validation Warnnings for getSupportInformation",
3813
+ });
3814
+ Logger({ level: "WARN", message: res_error });
3815
+ }
3816
+
3817
+ return response;
2589
3818
  }
2590
3819
 
2591
3820
  /**
2592
3821
  * @param {Object} arg - Arg object.
2593
3822
  * @param {Support} arg.body
3823
+ * @returns {Promise<Support>} - Success response
2594
3824
  * @summary: Update the support data of an application
2595
3825
  * @description: Use this API to edit the existing contact details for customer support, including emails and phone numbers.
2596
3826
  */
2597
- updateSupportInformation({ body } = {}) {
3827
+ async updateSupportInformation({ body } = {}) {
2598
3828
  const { error } = ContentValidator.updateSupportInformation().validate(
2599
3829
  {
2600
3830
  body,
@@ -2615,30 +3845,47 @@ class Content {
2615
3845
  { abortEarly: false, allowUnknown: false }
2616
3846
  );
2617
3847
  if (warrning) {
2618
- console.log(
2619
- "Parameter Validation warrnings for updateSupportInformation"
2620
- );
2621
- console.log(warrning);
3848
+ Logger({
3849
+ level: "WARN",
3850
+ message: "Parameter Validation warrnings for updateSupportInformation",
3851
+ });
3852
+ Logger({ level: "WARN", message: warrning });
2622
3853
  }
2623
3854
 
2624
3855
  const query_params = {};
2625
3856
 
2626
- return PlatformAPIClient.execute(
3857
+ const response = await PlatformAPIClient.execute(
2627
3858
  this.config,
2628
3859
  "post",
2629
3860
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/support`,
2630
3861
  query_params,
2631
3862
  body
2632
3863
  );
3864
+
3865
+ const { error: res_error } = ContentModel.Support().validate(response, {
3866
+ abortEarly: false,
3867
+ allowUnknown: false,
3868
+ });
3869
+
3870
+ if (res_error) {
3871
+ Logger({
3872
+ level: "WARN",
3873
+ message: "Response Validation Warnnings for updateSupportInformation",
3874
+ });
3875
+ Logger({ level: "WARN", message: res_error });
3876
+ }
3877
+
3878
+ return response;
2633
3879
  }
2634
3880
 
2635
3881
  /**
2636
3882
  * @param {Object} arg - Arg object.
2637
3883
  * @param {CreateTagRequestSchema} arg.body
3884
+ * @returns {Promise<TagsSchema>} - Success response
2638
3885
  * @summary: Update a tag
2639
3886
  * @description: Use this API to edit the details of an existing tag. This includes the tag name, tag type (css/js), url and position of the tag.
2640
3887
  */
2641
- updateInjectableTag({ body } = {}) {
3888
+ async updateInjectableTag({ body } = {}) {
2642
3889
  const { error } = ContentValidator.updateInjectableTag().validate(
2643
3890
  {
2644
3891
  body,
@@ -2657,27 +3904,46 @@ class Content {
2657
3904
  { abortEarly: false, allowUnknown: false }
2658
3905
  );
2659
3906
  if (warrning) {
2660
- console.log("Parameter Validation warrnings for updateInjectableTag");
2661
- console.log(warrning);
3907
+ Logger({
3908
+ level: "WARN",
3909
+ message: "Parameter Validation warrnings for updateInjectableTag",
3910
+ });
3911
+ Logger({ level: "WARN", message: warrning });
2662
3912
  }
2663
3913
 
2664
3914
  const query_params = {};
2665
3915
 
2666
- return PlatformAPIClient.execute(
3916
+ const response = await PlatformAPIClient.execute(
2667
3917
  this.config,
2668
3918
  "put",
2669
3919
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags`,
2670
3920
  query_params,
2671
3921
  body
2672
3922
  );
3923
+
3924
+ const { error: res_error } = ContentModel.TagsSchema().validate(response, {
3925
+ abortEarly: false,
3926
+ allowUnknown: false,
3927
+ });
3928
+
3929
+ if (res_error) {
3930
+ Logger({
3931
+ level: "WARN",
3932
+ message: "Response Validation Warnnings for updateInjectableTag",
3933
+ });
3934
+ Logger({ level: "WARN", message: res_error });
3935
+ }
3936
+
3937
+ return response;
2673
3938
  }
2674
3939
 
2675
3940
  /**
2676
3941
  * @param {Object} arg - Arg object.
3942
+ * @returns {Promise<TagsSchema>} - Success response
2677
3943
  * @summary: Delete tags in application
2678
3944
  * @description: Use this API to delete all the existing tags at once.
2679
3945
  */
2680
- deleteAllInjectableTags({} = {}) {
3946
+ async deleteAllInjectableTags({} = {}) {
2681
3947
  const { error } = ContentValidator.deleteAllInjectableTags().validate(
2682
3948
  {},
2683
3949
  { abortEarly: false, allowUnknown: true }
@@ -2694,27 +3960,46 @@ class Content {
2694
3960
  { abortEarly: false, allowUnknown: false }
2695
3961
  );
2696
3962
  if (warrning) {
2697
- console.log("Parameter Validation warrnings for deleteAllInjectableTags");
2698
- console.log(warrning);
3963
+ Logger({
3964
+ level: "WARN",
3965
+ message: "Parameter Validation warrnings for deleteAllInjectableTags",
3966
+ });
3967
+ Logger({ level: "WARN", message: warrning });
2699
3968
  }
2700
3969
 
2701
3970
  const query_params = {};
2702
3971
 
2703
- return PlatformAPIClient.execute(
3972
+ const response = await PlatformAPIClient.execute(
2704
3973
  this.config,
2705
3974
  "delete",
2706
3975
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags`,
2707
3976
  query_params,
2708
3977
  undefined
2709
3978
  );
3979
+
3980
+ const { error: res_error } = ContentModel.TagsSchema().validate(response, {
3981
+ abortEarly: false,
3982
+ allowUnknown: false,
3983
+ });
3984
+
3985
+ if (res_error) {
3986
+ Logger({
3987
+ level: "WARN",
3988
+ message: "Response Validation Warnnings for deleteAllInjectableTags",
3989
+ });
3990
+ Logger({ level: "WARN", message: res_error });
3991
+ }
3992
+
3993
+ return response;
2710
3994
  }
2711
3995
 
2712
3996
  /**
2713
3997
  * @param {Object} arg - Arg object.
3998
+ * @returns {Promise<TagsSchema>} - Success response
2714
3999
  * @summary: Get all the tags in an application
2715
4000
  * @description: Use this API to get all the CSS and JS injected in the application in the form of tags.
2716
4001
  */
2717
- getInjectableTags({} = {}) {
4002
+ async getInjectableTags({} = {}) {
2718
4003
  const { error } = ContentValidator.getInjectableTags().validate(
2719
4004
  {},
2720
4005
  { abortEarly: false, allowUnknown: true }
@@ -2729,28 +4014,47 @@ class Content {
2729
4014
  { abortEarly: false, allowUnknown: false }
2730
4015
  );
2731
4016
  if (warrning) {
2732
- console.log("Parameter Validation warrnings for getInjectableTags");
2733
- console.log(warrning);
4017
+ Logger({
4018
+ level: "WARN",
4019
+ message: "Parameter Validation warrnings for getInjectableTags",
4020
+ });
4021
+ Logger({ level: "WARN", message: warrning });
2734
4022
  }
2735
4023
 
2736
4024
  const query_params = {};
2737
4025
 
2738
- return PlatformAPIClient.execute(
4026
+ const response = await PlatformAPIClient.execute(
2739
4027
  this.config,
2740
4028
  "get",
2741
4029
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags`,
2742
4030
  query_params,
2743
4031
  undefined
2744
4032
  );
4033
+
4034
+ const { error: res_error } = ContentModel.TagsSchema().validate(response, {
4035
+ abortEarly: false,
4036
+ allowUnknown: false,
4037
+ });
4038
+
4039
+ if (res_error) {
4040
+ Logger({
4041
+ level: "WARN",
4042
+ message: "Response Validation Warnnings for getInjectableTags",
4043
+ });
4044
+ Logger({ level: "WARN", message: res_error });
4045
+ }
4046
+
4047
+ return response;
2745
4048
  }
2746
4049
 
2747
4050
  /**
2748
4051
  * @param {Object} arg - Arg object.
2749
4052
  * @param {CreateTagRequestSchema} arg.body
4053
+ * @returns {Promise<TagsSchema>} - Success response
2750
4054
  * @summary: Add a tag
2751
4055
  * @description: CSS and JS can be injected in the application (website) with the help of tags. Use this API to create such tags by entering the tag name, tag type (css/js), url and position of the tag.
2752
4056
  */
2753
- addInjectableTag({ body } = {}) {
4057
+ async addInjectableTag({ body } = {}) {
2754
4058
  const { error } = ContentValidator.addInjectableTag().validate(
2755
4059
  {
2756
4060
  body,
@@ -2769,28 +4073,47 @@ class Content {
2769
4073
  { abortEarly: false, allowUnknown: false }
2770
4074
  );
2771
4075
  if (warrning) {
2772
- console.log("Parameter Validation warrnings for addInjectableTag");
2773
- console.log(warrning);
4076
+ Logger({
4077
+ level: "WARN",
4078
+ message: "Parameter Validation warrnings for addInjectableTag",
4079
+ });
4080
+ Logger({ level: "WARN", message: warrning });
2774
4081
  }
2775
4082
 
2776
4083
  const query_params = {};
2777
4084
 
2778
- return PlatformAPIClient.execute(
4085
+ const response = await PlatformAPIClient.execute(
2779
4086
  this.config,
2780
4087
  "put",
2781
4088
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags/add`,
2782
4089
  query_params,
2783
4090
  body
2784
4091
  );
4092
+
4093
+ const { error: res_error } = ContentModel.TagsSchema().validate(response, {
4094
+ abortEarly: false,
4095
+ allowUnknown: false,
4096
+ });
4097
+
4098
+ if (res_error) {
4099
+ Logger({
4100
+ level: "WARN",
4101
+ message: "Response Validation Warnnings for addInjectableTag",
4102
+ });
4103
+ Logger({ level: "WARN", message: res_error });
4104
+ }
4105
+
4106
+ return response;
2785
4107
  }
2786
4108
 
2787
4109
  /**
2788
4110
  * @param {Object} arg - Arg object.
2789
4111
  * @param {RemoveHandpickedSchema} arg.body
4112
+ * @returns {Promise<TagDeleteSuccessResponse>} - Success response
2790
4113
  * @summary: Remove a tag
2791
4114
  * @description: Use this API to delete an existing tag.
2792
4115
  */
2793
- removeInjectableTag({ body } = {}) {
4116
+ async removeInjectableTag({ body } = {}) {
2794
4117
  const { error } = ContentValidator.removeInjectableTag().validate(
2795
4118
  {
2796
4119
  body,
@@ -2809,29 +4132,50 @@ class Content {
2809
4132
  { abortEarly: false, allowUnknown: false }
2810
4133
  );
2811
4134
  if (warrning) {
2812
- console.log("Parameter Validation warrnings for removeInjectableTag");
2813
- console.log(warrning);
4135
+ Logger({
4136
+ level: "WARN",
4137
+ message: "Parameter Validation warrnings for removeInjectableTag",
4138
+ });
4139
+ Logger({ level: "WARN", message: warrning });
2814
4140
  }
2815
4141
 
2816
4142
  const query_params = {};
2817
4143
 
2818
- return PlatformAPIClient.execute(
4144
+ const response = await PlatformAPIClient.execute(
2819
4145
  this.config,
2820
4146
  "put",
2821
4147
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags/remove/handpicked`,
2822
4148
  query_params,
2823
4149
  body
2824
4150
  );
4151
+
4152
+ const {
4153
+ error: res_error,
4154
+ } = ContentModel.TagDeleteSuccessResponse().validate(response, {
4155
+ abortEarly: false,
4156
+ allowUnknown: false,
4157
+ });
4158
+
4159
+ if (res_error) {
4160
+ Logger({
4161
+ level: "WARN",
4162
+ message: "Response Validation Warnnings for removeInjectableTag",
4163
+ });
4164
+ Logger({ level: "WARN", message: res_error });
4165
+ }
4166
+
4167
+ return response;
2825
4168
  }
2826
4169
 
2827
4170
  /**
2828
4171
  * @param {Object} arg - Arg object.
2829
4172
  * @param {string} arg.tagId - ID allotted to the tag.
2830
4173
  * @param {UpdateHandpickedSchema} arg.body
4174
+ * @returns {Promise<TagsSchema>} - Success response
2831
4175
  * @summary: Edit a tag by id
2832
4176
  * @description: Use this API to edit the details of an existing tag by its ID.
2833
4177
  */
2834
- editInjectableTag({ tagId, body } = {}) {
4178
+ async editInjectableTag({ tagId, body } = {}) {
2835
4179
  const { error } = ContentValidator.editInjectableTag().validate(
2836
4180
  {
2837
4181
  tagId,
@@ -2852,28 +4196,47 @@ class Content {
2852
4196
  { abortEarly: false, allowUnknown: false }
2853
4197
  );
2854
4198
  if (warrning) {
2855
- console.log("Parameter Validation warrnings for editInjectableTag");
2856
- console.log(warrning);
4199
+ Logger({
4200
+ level: "WARN",
4201
+ message: "Parameter Validation warrnings for editInjectableTag",
4202
+ });
4203
+ Logger({ level: "WARN", message: warrning });
2857
4204
  }
2858
4205
 
2859
4206
  const query_params = {};
2860
4207
 
2861
- return PlatformAPIClient.execute(
4208
+ const response = await PlatformAPIClient.execute(
2862
4209
  this.config,
2863
4210
  "put",
2864
4211
  `/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags/edit/handpicked/${tagId}`,
2865
4212
  query_params,
2866
4213
  body
2867
4214
  );
4215
+
4216
+ const { error: res_error } = ContentModel.TagsSchema().validate(response, {
4217
+ abortEarly: false,
4218
+ allowUnknown: false,
4219
+ });
4220
+
4221
+ if (res_error) {
4222
+ Logger({
4223
+ level: "WARN",
4224
+ message: "Response Validation Warnnings for editInjectableTag",
4225
+ });
4226
+ Logger({ level: "WARN", message: res_error });
4227
+ }
4228
+
4229
+ return response;
2868
4230
  }
2869
4231
 
2870
4232
  /**
2871
4233
  * @param {Object} arg - Arg object.
2872
4234
  * @param {PageRequest} arg.body
4235
+ * @returns {Promise<PageSchema>} - Success response
2873
4236
  * @summary: Create a page
2874
4237
  * @description: Use this API to create a custom page using a title, seo, publish status, feature image, tags, meta, etc.
2875
4238
  */
2876
- createPage({ body } = {}) {
4239
+ async createPage({ body } = {}) {
2877
4240
  const { error } = ContentValidator.createPage().validate(
2878
4241
  {
2879
4242
  body,
@@ -2892,19 +4255,37 @@ class Content {
2892
4255
  { abortEarly: false, allowUnknown: false }
2893
4256
  );
2894
4257
  if (warrning) {
2895
- console.log("Parameter Validation warrnings for createPage");
2896
- console.log(warrning);
4258
+ Logger({
4259
+ level: "WARN",
4260
+ message: "Parameter Validation warrnings for createPage",
4261
+ });
4262
+ Logger({ level: "WARN", message: warrning });
2897
4263
  }
2898
4264
 
2899
4265
  const query_params = {};
2900
4266
 
2901
- return PlatformAPIClient.execute(
4267
+ const response = await PlatformAPIClient.execute(
2902
4268
  this.config,
2903
4269
  "post",
2904
4270
  `/service/platform/content/v2.0/company/${this.config.companyId}/application/${this.applicationId}/pages/`,
2905
4271
  query_params,
2906
4272
  body
2907
4273
  );
4274
+
4275
+ const { error: res_error } = ContentModel.PageSchema().validate(response, {
4276
+ abortEarly: false,
4277
+ allowUnknown: false,
4278
+ });
4279
+
4280
+ if (res_error) {
4281
+ Logger({
4282
+ level: "WARN",
4283
+ message: "Response Validation Warnnings for createPage",
4284
+ });
4285
+ Logger({ level: "WARN", message: res_error });
4286
+ }
4287
+
4288
+ return response;
2908
4289
  }
2909
4290
 
2910
4291
  /**
@@ -2913,10 +4294,11 @@ class Content {
2913
4294
  * given set of results. Default value is 1.
2914
4295
  * @param {number} [arg.pageSize] - The number of items to retrieve in each
2915
4296
  * page. Default value is 10.
4297
+ * @returns {Promise<PageGetResponse>} - Success response
2916
4298
  * @summary: Get a list of pages
2917
4299
  * @description: Use this API to retrieve a list of pages.
2918
4300
  */
2919
- getPages({ pageNo, pageSize } = {}) {
4301
+ async getPages({ pageNo, pageSize } = {}) {
2920
4302
  const { error } = ContentValidator.getPages().validate(
2921
4303
  {
2922
4304
  pageNo,
@@ -2937,21 +4319,41 @@ class Content {
2937
4319
  { abortEarly: false, allowUnknown: false }
2938
4320
  );
2939
4321
  if (warrning) {
2940
- console.log("Parameter Validation warrnings for getPages");
2941
- console.log(warrning);
4322
+ Logger({
4323
+ level: "WARN",
4324
+ message: "Parameter Validation warrnings for getPages",
4325
+ });
4326
+ Logger({ level: "WARN", message: warrning });
2942
4327
  }
2943
4328
 
2944
4329
  const query_params = {};
2945
4330
  query_params["page_no"] = pageNo;
2946
4331
  query_params["page_size"] = pageSize;
2947
4332
 
2948
- return PlatformAPIClient.execute(
4333
+ const response = await PlatformAPIClient.execute(
2949
4334
  this.config,
2950
4335
  "get",
2951
4336
  `/service/platform/content/v2.0/company/${this.config.companyId}/application/${this.applicationId}/pages/`,
2952
4337
  query_params,
2953
4338
  undefined
2954
4339
  );
4340
+
4341
+ const {
4342
+ error: res_error,
4343
+ } = ContentModel.PageGetResponse().validate(response, {
4344
+ abortEarly: false,
4345
+ allowUnknown: false,
4346
+ });
4347
+
4348
+ if (res_error) {
4349
+ Logger({
4350
+ level: "WARN",
4351
+ message: "Response Validation Warnnings for getPages",
4352
+ });
4353
+ Logger({ level: "WARN", message: res_error });
4354
+ }
4355
+
4356
+ return response;
2955
4357
  }
2956
4358
 
2957
4359
  /**
@@ -2991,10 +4393,11 @@ class Content {
2991
4393
  * @param {Object} arg - Arg object.
2992
4394
  * @param {string} arg.id - ID allotted to the page.
2993
4395
  * @param {PageSchema} arg.body
4396
+ * @returns {Promise<PageSchema>} - Success response
2994
4397
  * @summary: Update a page
2995
4398
  * @description: Use this API to edit the details of an existing page, such as its title, seo, publish status, feature image, tags, schedule, etc.
2996
4399
  */
2997
- updatePage({ id, body } = {}) {
4400
+ async updatePage({ id, body } = {}) {
2998
4401
  const { error } = ContentValidator.updatePage().validate(
2999
4402
  {
3000
4403
  id,
@@ -3015,29 +4418,48 @@ class Content {
3015
4418
  { abortEarly: false, allowUnknown: false }
3016
4419
  );
3017
4420
  if (warrning) {
3018
- console.log("Parameter Validation warrnings for updatePage");
3019
- console.log(warrning);
4421
+ Logger({
4422
+ level: "WARN",
4423
+ message: "Parameter Validation warrnings for updatePage",
4424
+ });
4425
+ Logger({ level: "WARN", message: warrning });
3020
4426
  }
3021
4427
 
3022
4428
  const query_params = {};
3023
4429
 
3024
- return PlatformAPIClient.execute(
4430
+ const response = await PlatformAPIClient.execute(
3025
4431
  this.config,
3026
4432
  "put",
3027
4433
  `/service/platform/content/v2.0/company/${this.config.companyId}/application/${this.applicationId}/pages/${id}`,
3028
4434
  query_params,
3029
4435
  body
3030
4436
  );
4437
+
4438
+ const { error: res_error } = ContentModel.PageSchema().validate(response, {
4439
+ abortEarly: false,
4440
+ allowUnknown: false,
4441
+ });
4442
+
4443
+ if (res_error) {
4444
+ Logger({
4445
+ level: "WARN",
4446
+ message: "Response Validation Warnnings for updatePage",
4447
+ });
4448
+ Logger({ level: "WARN", message: res_error });
4449
+ }
4450
+
4451
+ return response;
3031
4452
  }
3032
4453
 
3033
4454
  /**
3034
4455
  * @param {Object} arg - Arg object.
3035
4456
  * @param {string} arg.slug - A short, human-readable, URL-friendly
3036
4457
  * identifier of a page. You can get slug value of a page from `getPages` API.
4458
+ * @returns {Promise<PageSchema>} - Success response
3037
4459
  * @summary: Get pages by component Id
3038
4460
  * @description: Use this API to retrieve the components of a page, such as its title, seo, publish status, feature image, tags, schedule, etc.
3039
4461
  */
3040
- getPageBySlug({ slug } = {}) {
4462
+ async getPageBySlug({ slug } = {}) {
3041
4463
  const { error } = ContentValidator.getPageBySlug().validate(
3042
4464
  {
3043
4465
  slug,
@@ -3056,19 +4478,37 @@ class Content {
3056
4478
  { abortEarly: false, allowUnknown: false }
3057
4479
  );
3058
4480
  if (warrning) {
3059
- console.log("Parameter Validation warrnings for getPageBySlug");
3060
- console.log(warrning);
4481
+ Logger({
4482
+ level: "WARN",
4483
+ message: "Parameter Validation warrnings for getPageBySlug",
4484
+ });
4485
+ Logger({ level: "WARN", message: warrning });
3061
4486
  }
3062
4487
 
3063
4488
  const query_params = {};
3064
4489
 
3065
- return PlatformAPIClient.execute(
4490
+ const response = await PlatformAPIClient.execute(
3066
4491
  this.config,
3067
4492
  "get",
3068
4493
  `/service/platform/content/v2.0/company/${this.config.companyId}/application/${this.applicationId}/pages/${slug}`,
3069
4494
  query_params,
3070
4495
  undefined
3071
4496
  );
4497
+
4498
+ const { error: res_error } = ContentModel.PageSchema().validate(response, {
4499
+ abortEarly: false,
4500
+ allowUnknown: false,
4501
+ });
4502
+
4503
+ if (res_error) {
4504
+ Logger({
4505
+ level: "WARN",
4506
+ message: "Response Validation Warnnings for getPageBySlug",
4507
+ });
4508
+ Logger({ level: "WARN", message: res_error });
4509
+ }
4510
+
4511
+ return response;
3072
4512
  }
3073
4513
  }
3074
4514
  module.exports = Content;