@gofynd/fdk-client-javascript 1.0.0 → 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 (156) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +393 -393
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +268 -268
  5. package/documentation/application/PAYMENT.md +249 -249
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3497 -3097
  9. package/documentation/platform/COMPANYPROFILE.md +207 -207
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1518 -1324
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +96 -96
  14. package/index.js +7 -1
  15. package/package.json +1 -1
  16. package/sdk/application/ApplicationConfig.js +1 -1
  17. package/sdk/application/Cart/CartApplicationClient.js +865 -52
  18. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  19. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  20. package/sdk/application/Cart/CartApplicationValidator.js +1 -0
  21. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  22. package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
  23. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
  24. package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
  25. package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
  26. package/sdk/application/Common/CommonApplicationClient.js +66 -4
  27. package/sdk/application/Common/CommonApplicationValidator.js +1 -0
  28. package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
  29. package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
  30. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  31. package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
  32. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
  33. package/sdk/application/Content/ContentApplicationClient.js +621 -38
  34. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  35. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  36. package/sdk/application/Content/ContentApplicationValidator.js +1 -0
  37. package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
  38. package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
  39. package/sdk/application/Lead/LeadApplicationClient.js +229 -14
  40. package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
  41. package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
  42. package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
  43. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  44. package/sdk/application/Order/OrderApplicationClient.js +403 -24
  45. package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
  46. package/sdk/application/Order/OrderApplicationModel.js +334 -334
  47. package/sdk/application/Order/OrderApplicationValidator.js +1 -0
  48. package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
  49. package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
  50. package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
  51. package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
  52. package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
  53. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  54. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  55. package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
  56. package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
  57. package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
  58. package/sdk/application/Share/ShareApplicationClient.js +226 -14
  59. package/sdk/application/Share/ShareApplicationValidator.js +1 -0
  60. package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
  61. package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
  62. package/sdk/application/User/UserApplicationClient.js +1133 -70
  63. package/sdk/application/User/UserApplicationValidator.js +1 -0
  64. package/sdk/common/AxiosHelper.js +1 -1
  65. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  66. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
  67. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  68. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
  69. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  70. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
  71. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  72. package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
  73. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  74. package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
  75. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  76. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  77. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
  78. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
  79. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
  80. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
  81. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
  82. package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
  83. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
  84. package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
  85. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
  86. package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
  87. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  88. package/sdk/platform/Common/CommonPlatformClient.js +73 -4
  89. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  90. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
  91. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  92. package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
  93. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  94. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
  95. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
  96. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
  97. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  98. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
  99. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  100. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
  101. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  102. package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
  103. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  104. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  105. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  106. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  107. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  108. package/sdk/platform/Discount/DiscountPlatformClient.js +400 -22
  109. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  110. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
  111. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  112. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
  113. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  114. package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
  115. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  116. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
  117. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  118. package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
  119. package/sdk/platform/OAuthClient.js +8 -8
  120. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  121. package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
  122. package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
  123. package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
  124. package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
  125. package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
  126. package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
  127. package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
  128. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  129. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
  130. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  131. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  132. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  133. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +418 -22
  134. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  135. package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
  136. package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
  137. package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
  138. package/sdk/platform/PlatformApplicationClient.js +3461 -3263
  139. package/sdk/platform/PlatformClient.d.ts +2973 -2827
  140. package/sdk/platform/PlatformClient.js +3461 -3263
  141. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  142. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
  143. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  144. package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
  145. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  146. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
  147. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  148. package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
  149. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  150. package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
  151. package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
  152. package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
  153. package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
  154. package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
  155. package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
  156. package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
@@ -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 ThemeValidator = require("./ThemePlatformApplicationValidator");
5
+ const ThemeModel = require("./ThemePlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
5
7
 
6
8
  class Theme {
7
9
  constructor(config, applicationId) {
@@ -12,10 +14,11 @@ class Theme {
12
14
  /**
13
15
  * @param {Object} arg - Arg object.
14
16
  * @param {string} arg.themeId - ID of the theme to be retrieved
17
+ * @returns {Promise<AllAvailablePageSchema>} - Success response
15
18
  * @summary: Get all pages of a theme
16
19
  * @description: Use this API to retrieve all the available pages of a theme by its ID.
17
20
  */
18
- getAllPages({ themeId } = {}) {
21
+ async getAllPages({ themeId } = {}) {
19
22
  const { error } = ThemeValidator.getAllPages().validate(
20
23
  {
21
24
  themeId,
@@ -26,25 +29,58 @@ class Theme {
26
29
  return Promise.reject(new FDKClientValidationError(error));
27
30
  }
28
31
 
32
+ // Showing warrnings if extra unknown parameters are found
33
+ const { error: warrning } = ThemeValidator.getAllPages().validate(
34
+ {
35
+ themeId,
36
+ },
37
+ { abortEarly: false, allowUnknown: false }
38
+ );
39
+ if (warrning) {
40
+ Logger({
41
+ level: "WARN",
42
+ message: "Parameter Validation warrnings for getAllPages",
43
+ });
44
+ Logger({ level: "WARN", message: warrning });
45
+ }
46
+
29
47
  const query_params = {};
30
48
 
31
- return PlatformAPIClient.execute(
49
+ const response = await PlatformAPIClient.execute(
32
50
  this.config,
33
51
  "get",
34
52
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/page`,
35
53
  query_params,
36
54
  undefined
37
55
  );
56
+
57
+ const {
58
+ error: res_error,
59
+ } = ThemeModel.AllAvailablePageSchema().validate(response, {
60
+ abortEarly: false,
61
+ allowUnknown: false,
62
+ });
63
+
64
+ if (res_error) {
65
+ Logger({
66
+ level: "WARN",
67
+ message: "Response Validation Warnnings for getAllPages",
68
+ });
69
+ Logger({ level: "WARN", message: res_error });
70
+ }
71
+
72
+ return response;
38
73
  }
39
74
 
40
75
  /**
41
76
  * @param {Object} arg - Arg object.
42
77
  * @param {string} arg.themeId - ID of the theme
43
78
  * @param {AvailablePageSchema} arg.body
79
+ * @returns {Promise<AvailablePageSchema>} - Success response
44
80
  * @summary: Create a page
45
81
  * @description: Use this API to create a page for a theme by its ID.
46
82
  */
47
- createPage({ themeId, body } = {}) {
83
+ async createPage({ themeId, body } = {}) {
48
84
  const { error } = ThemeValidator.createPage().validate(
49
85
  {
50
86
  themeId,
@@ -56,25 +92,59 @@ class Theme {
56
92
  return Promise.reject(new FDKClientValidationError(error));
57
93
  }
58
94
 
95
+ // Showing warrnings if extra unknown parameters are found
96
+ const { error: warrning } = ThemeValidator.createPage().validate(
97
+ {
98
+ themeId,
99
+ body,
100
+ },
101
+ { abortEarly: false, allowUnknown: false }
102
+ );
103
+ if (warrning) {
104
+ Logger({
105
+ level: "WARN",
106
+ message: "Parameter Validation warrnings for createPage",
107
+ });
108
+ Logger({ level: "WARN", message: warrning });
109
+ }
110
+
59
111
  const query_params = {};
60
112
 
61
- return PlatformAPIClient.execute(
113
+ const response = await PlatformAPIClient.execute(
62
114
  this.config,
63
115
  "post",
64
116
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/page`,
65
117
  query_params,
66
118
  body
67
119
  );
120
+
121
+ const {
122
+ error: res_error,
123
+ } = ThemeModel.AvailablePageSchema().validate(response, {
124
+ abortEarly: false,
125
+ allowUnknown: false,
126
+ });
127
+
128
+ if (res_error) {
129
+ Logger({
130
+ level: "WARN",
131
+ message: "Response Validation Warnnings for createPage",
132
+ });
133
+ Logger({ level: "WARN", message: res_error });
134
+ }
135
+
136
+ return response;
68
137
  }
69
138
 
70
139
  /**
71
140
  * @param {Object} arg - Arg object.
72
141
  * @param {string} arg.themeId - ID of the theme to be retrieved
73
142
  * @param {AllAvailablePageSchema} arg.body
143
+ * @returns {Promise<AllAvailablePageSchema>} - Success response
74
144
  * @summary: Update multiple pages of a theme
75
145
  * @description: Use this API to update multiple pages of a theme by its ID.
76
146
  */
77
- updateMultiplePages({ themeId, body } = {}) {
147
+ async updateMultiplePages({ themeId, body } = {}) {
78
148
  const { error } = ThemeValidator.updateMultiplePages().validate(
79
149
  {
80
150
  themeId,
@@ -86,25 +156,59 @@ class Theme {
86
156
  return Promise.reject(new FDKClientValidationError(error));
87
157
  }
88
158
 
159
+ // Showing warrnings if extra unknown parameters are found
160
+ const { error: warrning } = ThemeValidator.updateMultiplePages().validate(
161
+ {
162
+ themeId,
163
+ body,
164
+ },
165
+ { abortEarly: false, allowUnknown: false }
166
+ );
167
+ if (warrning) {
168
+ Logger({
169
+ level: "WARN",
170
+ message: "Parameter Validation warrnings for updateMultiplePages",
171
+ });
172
+ Logger({ level: "WARN", message: warrning });
173
+ }
174
+
89
175
  const query_params = {};
90
176
 
91
- return PlatformAPIClient.execute(
177
+ const response = await PlatformAPIClient.execute(
92
178
  this.config,
93
179
  "put",
94
180
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/page`,
95
181
  query_params,
96
182
  body
97
183
  );
184
+
185
+ const {
186
+ error: res_error,
187
+ } = ThemeModel.AllAvailablePageSchema().validate(response, {
188
+ abortEarly: false,
189
+ allowUnknown: false,
190
+ });
191
+
192
+ if (res_error) {
193
+ Logger({
194
+ level: "WARN",
195
+ message: "Response Validation Warnnings for updateMultiplePages",
196
+ });
197
+ Logger({ level: "WARN", message: res_error });
198
+ }
199
+
200
+ return response;
98
201
  }
99
202
 
100
203
  /**
101
204
  * @param {Object} arg - Arg object.
102
205
  * @param {string} arg.themeId - ID of the theme to be retrieved
103
206
  * @param {string} arg.pageValue - Value of the page to be retrieved
207
+ * @returns {Promise<AvailablePageSchema>} - Success response
104
208
  * @summary: Get page of a theme
105
209
  * @description: Use this API to retrieve a page of a theme.
106
210
  */
107
- getPage({ themeId, pageValue } = {}) {
211
+ async getPage({ themeId, pageValue } = {}) {
108
212
  const { error } = ThemeValidator.getPage().validate(
109
213
  {
110
214
  themeId,
@@ -116,15 +220,48 @@ class Theme {
116
220
  return Promise.reject(new FDKClientValidationError(error));
117
221
  }
118
222
 
223
+ // Showing warrnings if extra unknown parameters are found
224
+ const { error: warrning } = ThemeValidator.getPage().validate(
225
+ {
226
+ themeId,
227
+ pageValue,
228
+ },
229
+ { abortEarly: false, allowUnknown: false }
230
+ );
231
+ if (warrning) {
232
+ Logger({
233
+ level: "WARN",
234
+ message: "Parameter Validation warrnings for getPage",
235
+ });
236
+ Logger({ level: "WARN", message: warrning });
237
+ }
238
+
119
239
  const query_params = {};
120
240
 
121
- return PlatformAPIClient.execute(
241
+ const response = await PlatformAPIClient.execute(
122
242
  this.config,
123
243
  "get",
124
244
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/${pageValue}`,
125
245
  query_params,
126
246
  undefined
127
247
  );
248
+
249
+ const {
250
+ error: res_error,
251
+ } = ThemeModel.AvailablePageSchema().validate(response, {
252
+ abortEarly: false,
253
+ allowUnknown: false,
254
+ });
255
+
256
+ if (res_error) {
257
+ Logger({
258
+ level: "WARN",
259
+ message: "Response Validation Warnnings for getPage",
260
+ });
261
+ Logger({ level: "WARN", message: res_error });
262
+ }
263
+
264
+ return response;
128
265
  }
129
266
 
130
267
  /**
@@ -132,10 +269,11 @@ class Theme {
132
269
  * @param {string} arg.themeId - ID of the theme
133
270
  * @param {string} arg.pageValue - Value of the page to be updated
134
271
  * @param {AvailablePageSchema} arg.body
272
+ * @returns {Promise<AvailablePageSchema>} - Success response
135
273
  * @summary: Updates a page
136
274
  * @description: Use this API to update a page for a theme by its ID.
137
275
  */
138
- updatePage({ themeId, pageValue, body } = {}) {
276
+ async updatePage({ themeId, pageValue, body } = {}) {
139
277
  const { error } = ThemeValidator.updatePage().validate(
140
278
  {
141
279
  themeId,
@@ -148,25 +286,60 @@ class Theme {
148
286
  return Promise.reject(new FDKClientValidationError(error));
149
287
  }
150
288
 
289
+ // Showing warrnings if extra unknown parameters are found
290
+ const { error: warrning } = ThemeValidator.updatePage().validate(
291
+ {
292
+ themeId,
293
+ pageValue,
294
+ body,
295
+ },
296
+ { abortEarly: false, allowUnknown: false }
297
+ );
298
+ if (warrning) {
299
+ Logger({
300
+ level: "WARN",
301
+ message: "Parameter Validation warrnings for updatePage",
302
+ });
303
+ Logger({ level: "WARN", message: warrning });
304
+ }
305
+
151
306
  const query_params = {};
152
307
 
153
- return PlatformAPIClient.execute(
308
+ const response = await PlatformAPIClient.execute(
154
309
  this.config,
155
310
  "put",
156
311
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/${pageValue}`,
157
312
  query_params,
158
313
  body
159
314
  );
315
+
316
+ const {
317
+ error: res_error,
318
+ } = ThemeModel.AvailablePageSchema().validate(response, {
319
+ abortEarly: false,
320
+ allowUnknown: false,
321
+ });
322
+
323
+ if (res_error) {
324
+ Logger({
325
+ level: "WARN",
326
+ message: "Response Validation Warnnings for updatePage",
327
+ });
328
+ Logger({ level: "WARN", message: res_error });
329
+ }
330
+
331
+ return response;
160
332
  }
161
333
 
162
334
  /**
163
335
  * @param {Object} arg - Arg object.
164
336
  * @param {string} arg.themeId - ID of the theme
165
337
  * @param {string} arg.pageValue - Value of the page to be updated
338
+ * @returns {Promise<AvailablePageSchema>} - Success response
166
339
  * @summary: Deletes a page
167
340
  * @description: Use this API to delete a page for a theme by its ID and page_value.
168
341
  */
169
- deletePage({ themeId, pageValue } = {}) {
342
+ async deletePage({ themeId, pageValue } = {}) {
170
343
  const { error } = ThemeValidator.deletePage().validate(
171
344
  {
172
345
  themeId,
@@ -178,15 +351,48 @@ class Theme {
178
351
  return Promise.reject(new FDKClientValidationError(error));
179
352
  }
180
353
 
354
+ // Showing warrnings if extra unknown parameters are found
355
+ const { error: warrning } = ThemeValidator.deletePage().validate(
356
+ {
357
+ themeId,
358
+ pageValue,
359
+ },
360
+ { abortEarly: false, allowUnknown: false }
361
+ );
362
+ if (warrning) {
363
+ Logger({
364
+ level: "WARN",
365
+ message: "Parameter Validation warrnings for deletePage",
366
+ });
367
+ Logger({ level: "WARN", message: warrning });
368
+ }
369
+
181
370
  const query_params = {};
182
371
 
183
- return PlatformAPIClient.execute(
372
+ const response = await PlatformAPIClient.execute(
184
373
  this.config,
185
374
  "delete",
186
375
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/${pageValue}`,
187
376
  query_params,
188
377
  undefined
189
378
  );
379
+
380
+ const {
381
+ error: res_error,
382
+ } = ThemeModel.AvailablePageSchema().validate(response, {
383
+ abortEarly: false,
384
+ allowUnknown: false,
385
+ });
386
+
387
+ if (res_error) {
388
+ Logger({
389
+ level: "WARN",
390
+ message: "Response Validation Warnnings for deletePage",
391
+ });
392
+ Logger({ level: "WARN", message: res_error });
393
+ }
394
+
395
+ return response;
190
396
  }
191
397
 
192
398
  /**
@@ -195,10 +401,11 @@ class Theme {
195
401
  * page. Default value is 10.
196
402
  * @param {number} [arg.pageNo] - The page number to navigate through the
197
403
  * given set of results. Default value is 1.
404
+ * @returns {Promise<ThemesListingResponseSchema>} - Success response
198
405
  * @summary: Get a list of themes from the theme library
199
406
  * @description: Theme library is a personalized collection of themes that are chosen and added from the available themes. Use this API to fetch a list of themes from the library along with their configuration details.
200
407
  */
201
- getThemeLibrary({ pageSize, pageNo } = {}) {
408
+ async getThemeLibrary({ pageSize, pageNo } = {}) {
202
409
  const { error } = ThemeValidator.getThemeLibrary().validate(
203
410
  {
204
411
  pageSize,
@@ -210,26 +417,60 @@ class Theme {
210
417
  return Promise.reject(new FDKClientValidationError(error));
211
418
  }
212
419
 
420
+ // Showing warrnings if extra unknown parameters are found
421
+ const { error: warrning } = ThemeValidator.getThemeLibrary().validate(
422
+ {
423
+ pageSize,
424
+ pageNo,
425
+ },
426
+ { abortEarly: false, allowUnknown: false }
427
+ );
428
+ if (warrning) {
429
+ Logger({
430
+ level: "WARN",
431
+ message: "Parameter Validation warrnings for getThemeLibrary",
432
+ });
433
+ Logger({ level: "WARN", message: warrning });
434
+ }
435
+
213
436
  const query_params = {};
214
437
  query_params["page_size"] = pageSize;
215
438
  query_params["page_no"] = pageNo;
216
439
 
217
- return PlatformAPIClient.execute(
440
+ const response = await PlatformAPIClient.execute(
218
441
  this.config,
219
442
  "get",
220
443
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/library`,
221
444
  query_params,
222
445
  undefined
223
446
  );
447
+
448
+ const {
449
+ error: res_error,
450
+ } = ThemeModel.ThemesListingResponseSchema().validate(response, {
451
+ abortEarly: false,
452
+ allowUnknown: false,
453
+ });
454
+
455
+ if (res_error) {
456
+ Logger({
457
+ level: "WARN",
458
+ message: "Response Validation Warnnings for getThemeLibrary",
459
+ });
460
+ Logger({ level: "WARN", message: res_error });
461
+ }
462
+
463
+ return response;
224
464
  }
225
465
 
226
466
  /**
227
467
  * @param {Object} arg - Arg object.
228
468
  * @param {AddThemeRequestSchema} arg.body
469
+ * @returns {Promise<ThemesSchema>} - Success response
229
470
  * @summary: Add a theme to the theme library
230
471
  * @description: Theme library is a personalized collection of themes that are chosen and added from the available themes. Use this API to choose a theme and add it to the theme library.
231
472
  */
232
- addToThemeLibrary({ body } = {}) {
473
+ async addToThemeLibrary({ body } = {}) {
233
474
  const { error } = ThemeValidator.addToThemeLibrary().validate(
234
475
  {
235
476
  body,
@@ -240,24 +481,55 @@ class Theme {
240
481
  return Promise.reject(new FDKClientValidationError(error));
241
482
  }
242
483
 
484
+ // Showing warrnings if extra unknown parameters are found
485
+ const { error: warrning } = ThemeValidator.addToThemeLibrary().validate(
486
+ {
487
+ body,
488
+ },
489
+ { abortEarly: false, allowUnknown: false }
490
+ );
491
+ if (warrning) {
492
+ Logger({
493
+ level: "WARN",
494
+ message: "Parameter Validation warrnings for addToThemeLibrary",
495
+ });
496
+ Logger({ level: "WARN", message: warrning });
497
+ }
498
+
243
499
  const query_params = {};
244
500
 
245
- return PlatformAPIClient.execute(
501
+ const response = await PlatformAPIClient.execute(
246
502
  this.config,
247
503
  "post",
248
504
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/library`,
249
505
  query_params,
250
506
  body
251
507
  );
508
+
509
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
510
+ abortEarly: false,
511
+ allowUnknown: false,
512
+ });
513
+
514
+ if (res_error) {
515
+ Logger({
516
+ level: "WARN",
517
+ message: "Response Validation Warnnings for addToThemeLibrary",
518
+ });
519
+ Logger({ level: "WARN", message: res_error });
520
+ }
521
+
522
+ return response;
252
523
  }
253
524
 
254
525
  /**
255
526
  * @param {Object} arg - Arg object.
256
527
  * @param {AddThemeRequestSchema} arg.body
528
+ * @returns {Promise<ThemesSchema>} - Success response
257
529
  * @summary: Apply a theme
258
530
  * @description: Use this API to apply a theme to the website.
259
531
  */
260
- applyTheme({ body } = {}) {
532
+ async applyTheme({ body } = {}) {
261
533
  const { error } = ThemeValidator.applyTheme().validate(
262
534
  {
263
535
  body,
@@ -268,24 +540,55 @@ class Theme {
268
540
  return Promise.reject(new FDKClientValidationError(error));
269
541
  }
270
542
 
543
+ // Showing warrnings if extra unknown parameters are found
544
+ const { error: warrning } = ThemeValidator.applyTheme().validate(
545
+ {
546
+ body,
547
+ },
548
+ { abortEarly: false, allowUnknown: false }
549
+ );
550
+ if (warrning) {
551
+ Logger({
552
+ level: "WARN",
553
+ message: "Parameter Validation warrnings for applyTheme",
554
+ });
555
+ Logger({ level: "WARN", message: warrning });
556
+ }
557
+
271
558
  const query_params = {};
272
559
 
273
- return PlatformAPIClient.execute(
560
+ const response = await PlatformAPIClient.execute(
274
561
  this.config,
275
562
  "post",
276
563
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/apply`,
277
564
  query_params,
278
565
  body
279
566
  );
567
+
568
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
569
+ abortEarly: false,
570
+ allowUnknown: false,
571
+ });
572
+
573
+ if (res_error) {
574
+ Logger({
575
+ level: "WARN",
576
+ message: "Response Validation Warnnings for applyTheme",
577
+ });
578
+ Logger({ level: "WARN", message: res_error });
579
+ }
580
+
581
+ return response;
280
582
  }
281
583
 
282
584
  /**
283
585
  * @param {Object} arg - Arg object.
284
586
  * @param {string} arg.themeId - Theme ID
587
+ * @returns {Promise<UpgradableThemeSchema>} - Success response
285
588
  * @summary: Checks if theme is upgradable
286
589
  * @description: There's always a possibility that new features get added to a theme. Use this API to check if the applied theme has an upgrade available.
287
590
  */
288
- isUpgradable({ themeId } = {}) {
591
+ async isUpgradable({ themeId } = {}) {
289
592
  const { error } = ThemeValidator.isUpgradable().validate(
290
593
  {
291
594
  themeId,
@@ -296,24 +599,57 @@ class Theme {
296
599
  return Promise.reject(new FDKClientValidationError(error));
297
600
  }
298
601
 
602
+ // Showing warrnings if extra unknown parameters are found
603
+ const { error: warrning } = ThemeValidator.isUpgradable().validate(
604
+ {
605
+ themeId,
606
+ },
607
+ { abortEarly: false, allowUnknown: false }
608
+ );
609
+ if (warrning) {
610
+ Logger({
611
+ level: "WARN",
612
+ message: "Parameter Validation warrnings for isUpgradable",
613
+ });
614
+ Logger({ level: "WARN", message: warrning });
615
+ }
616
+
299
617
  const query_params = {};
300
618
 
301
- return PlatformAPIClient.execute(
619
+ const response = await PlatformAPIClient.execute(
302
620
  this.config,
303
621
  "get",
304
622
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/upgradable`,
305
623
  query_params,
306
624
  undefined
307
625
  );
626
+
627
+ const {
628
+ error: res_error,
629
+ } = ThemeModel.UpgradableThemeSchema().validate(response, {
630
+ abortEarly: false,
631
+ allowUnknown: false,
632
+ });
633
+
634
+ if (res_error) {
635
+ Logger({
636
+ level: "WARN",
637
+ message: "Response Validation Warnnings for isUpgradable",
638
+ });
639
+ Logger({ level: "WARN", message: res_error });
640
+ }
641
+
642
+ return response;
308
643
  }
309
644
 
310
645
  /**
311
646
  * @param {Object} arg - Arg object.
312
647
  * @param {string} arg.themeId - ID allotted to the theme.
648
+ * @returns {Promise<ThemesSchema>} - Success response
313
649
  * @summary: Upgrade a theme
314
650
  * @description: Use this API to upgrade the current theme to its latest version.
315
651
  */
316
- upgradeTheme({ themeId } = {}) {
652
+ async upgradeTheme({ themeId } = {}) {
317
653
  const { error } = ThemeValidator.upgradeTheme().validate(
318
654
  {
319
655
  themeId,
@@ -324,15 +660,45 @@ class Theme {
324
660
  return Promise.reject(new FDKClientValidationError(error));
325
661
  }
326
662
 
663
+ // Showing warrnings if extra unknown parameters are found
664
+ const { error: warrning } = ThemeValidator.upgradeTheme().validate(
665
+ {
666
+ themeId,
667
+ },
668
+ { abortEarly: false, allowUnknown: false }
669
+ );
670
+ if (warrning) {
671
+ Logger({
672
+ level: "WARN",
673
+ message: "Parameter Validation warrnings for upgradeTheme",
674
+ });
675
+ Logger({ level: "WARN", message: warrning });
676
+ }
677
+
327
678
  const query_params = {};
328
679
 
329
- return PlatformAPIClient.execute(
680
+ const response = await PlatformAPIClient.execute(
330
681
  this.config,
331
682
  "put",
332
683
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/upgrade`,
333
684
  query_params,
334
685
  undefined
335
686
  );
687
+
688
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
689
+ abortEarly: false,
690
+ allowUnknown: false,
691
+ });
692
+
693
+ if (res_error) {
694
+ Logger({
695
+ level: "WARN",
696
+ message: "Response Validation Warnnings for upgradeTheme",
697
+ });
698
+ Logger({ level: "WARN", message: res_error });
699
+ }
700
+
701
+ return response;
336
702
  }
337
703
 
338
704
  /**
@@ -341,10 +707,11 @@ class Theme {
341
707
  * page. Default value is 10.
342
708
  * @param {number} [arg.pageNo] - The page number to navigate through the
343
709
  * given set of results. Default value is 1.
710
+ * @returns {Promise<ThemesListingResponseSchema>} - Success response
344
711
  * @summary: Get all public themes
345
712
  * @description: Use this API to get a list of free themes that you can apply to your website.
346
713
  */
347
- getPublicThemes({ pageSize, pageNo } = {}) {
714
+ async getPublicThemes({ pageSize, pageNo } = {}) {
348
715
  const { error } = ThemeValidator.getPublicThemes().validate(
349
716
  {
350
717
  pageSize,
@@ -356,26 +723,60 @@ class Theme {
356
723
  return Promise.reject(new FDKClientValidationError(error));
357
724
  }
358
725
 
726
+ // Showing warrnings if extra unknown parameters are found
727
+ const { error: warrning } = ThemeValidator.getPublicThemes().validate(
728
+ {
729
+ pageSize,
730
+ pageNo,
731
+ },
732
+ { abortEarly: false, allowUnknown: false }
733
+ );
734
+ if (warrning) {
735
+ Logger({
736
+ level: "WARN",
737
+ message: "Parameter Validation warrnings for getPublicThemes",
738
+ });
739
+ Logger({ level: "WARN", message: warrning });
740
+ }
741
+
359
742
  const query_params = {};
360
743
  query_params["page_size"] = pageSize;
361
744
  query_params["page_no"] = pageNo;
362
745
 
363
- return PlatformAPIClient.execute(
746
+ const response = await PlatformAPIClient.execute(
364
747
  this.config,
365
748
  "get",
366
749
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/list/public`,
367
750
  query_params,
368
751
  undefined
369
752
  );
753
+
754
+ const {
755
+ error: res_error,
756
+ } = ThemeModel.ThemesListingResponseSchema().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 getPublicThemes",
765
+ });
766
+ Logger({ level: "WARN", message: res_error });
767
+ }
768
+
769
+ return response;
370
770
  }
371
771
 
372
772
  /**
373
773
  * @param {Object} arg - Arg object.
374
774
  * @param {ThemesSchema} arg.body
775
+ * @returns {Promise<ThemesSchema>} - Success response
375
776
  * @summary: Create a new theme
376
777
  * @description: Themes improve the look and appearance of a website. Use this API to create a theme.
377
778
  */
378
- createTheme({ body } = {}) {
779
+ async createTheme({ body } = {}) {
379
780
  const { error } = ThemeValidator.createTheme().validate(
380
781
  {
381
782
  body,
@@ -386,23 +787,54 @@ class Theme {
386
787
  return Promise.reject(new FDKClientValidationError(error));
387
788
  }
388
789
 
790
+ // Showing warrnings if extra unknown parameters are found
791
+ const { error: warrning } = ThemeValidator.createTheme().validate(
792
+ {
793
+ body,
794
+ },
795
+ { abortEarly: false, allowUnknown: false }
796
+ );
797
+ if (warrning) {
798
+ Logger({
799
+ level: "WARN",
800
+ message: "Parameter Validation warrnings for createTheme",
801
+ });
802
+ Logger({ level: "WARN", message: warrning });
803
+ }
804
+
389
805
  const query_params = {};
390
806
 
391
- return PlatformAPIClient.execute(
807
+ const response = await PlatformAPIClient.execute(
392
808
  this.config,
393
809
  "post",
394
810
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/`,
395
811
  query_params,
396
812
  body
397
813
  );
814
+
815
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
816
+ abortEarly: false,
817
+ allowUnknown: false,
818
+ });
819
+
820
+ if (res_error) {
821
+ Logger({
822
+ level: "WARN",
823
+ message: "Response Validation Warnnings for createTheme",
824
+ });
825
+ Logger({ level: "WARN", message: res_error });
826
+ }
827
+
828
+ return response;
398
829
  }
399
830
 
400
831
  /**
401
832
  * @param {Object} arg - Arg object.
833
+ * @returns {Promise<ThemesSchema>} - Success response
402
834
  * @summary: Get the applied theme
403
835
  * @description: Use this API to retrieve the theme that is currently applied to the website along with its details.
404
836
  */
405
- getAppliedTheme({} = {}) {
837
+ async getAppliedTheme({} = {}) {
406
838
  const { error } = ThemeValidator.getAppliedTheme().validate(
407
839
  {},
408
840
  { abortEarly: false, allowUnknown: true }
@@ -411,23 +843,52 @@ class Theme {
411
843
  return Promise.reject(new FDKClientValidationError(error));
412
844
  }
413
845
 
846
+ // Showing warrnings if extra unknown parameters are found
847
+ const { error: warrning } = ThemeValidator.getAppliedTheme().validate(
848
+ {},
849
+ { abortEarly: false, allowUnknown: false }
850
+ );
851
+ if (warrning) {
852
+ Logger({
853
+ level: "WARN",
854
+ message: "Parameter Validation warrnings for getAppliedTheme",
855
+ });
856
+ Logger({ level: "WARN", message: warrning });
857
+ }
858
+
414
859
  const query_params = {};
415
860
 
416
- return PlatformAPIClient.execute(
861
+ const response = await PlatformAPIClient.execute(
417
862
  this.config,
418
863
  "get",
419
864
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/`,
420
865
  query_params,
421
866
  undefined
422
867
  );
868
+
869
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
870
+ abortEarly: false,
871
+ allowUnknown: false,
872
+ });
873
+
874
+ if (res_error) {
875
+ Logger({
876
+ level: "WARN",
877
+ message: "Response Validation Warnnings for getAppliedTheme",
878
+ });
879
+ Logger({ level: "WARN", message: res_error });
880
+ }
881
+
882
+ return response;
423
883
  }
424
884
 
425
885
  /**
426
886
  * @param {Object} arg - Arg object.
887
+ * @returns {Promise<FontsSchema>} - Success response
427
888
  * @summary: Get all the supported fonts in a theme
428
889
  * @description: Font is a collection of characters with a similar design. Use this API to retrieve a list of website fonts.
429
890
  */
430
- getFonts({} = {}) {
891
+ async getFonts({} = {}) {
431
892
  const { error } = ThemeValidator.getFonts().validate(
432
893
  {},
433
894
  { abortEarly: false, allowUnknown: true }
@@ -436,24 +897,53 @@ class Theme {
436
897
  return Promise.reject(new FDKClientValidationError(error));
437
898
  }
438
899
 
900
+ // Showing warrnings if extra unknown parameters are found
901
+ const { error: warrning } = ThemeValidator.getFonts().validate(
902
+ {},
903
+ { abortEarly: false, allowUnknown: false }
904
+ );
905
+ if (warrning) {
906
+ Logger({
907
+ level: "WARN",
908
+ message: "Parameter Validation warrnings for getFonts",
909
+ });
910
+ Logger({ level: "WARN", message: warrning });
911
+ }
912
+
439
913
  const query_params = {};
440
914
 
441
- return PlatformAPIClient.execute(
915
+ const response = await PlatformAPIClient.execute(
442
916
  this.config,
443
917
  "get",
444
918
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/fonts`,
445
919
  query_params,
446
920
  undefined
447
921
  );
922
+
923
+ const { error: res_error } = ThemeModel.FontsSchema().validate(response, {
924
+ abortEarly: false,
925
+ allowUnknown: false,
926
+ });
927
+
928
+ if (res_error) {
929
+ Logger({
930
+ level: "WARN",
931
+ message: "Response Validation Warnnings for getFonts",
932
+ });
933
+ Logger({ level: "WARN", message: res_error });
934
+ }
935
+
936
+ return response;
448
937
  }
449
938
 
450
939
  /**
451
940
  * @param {Object} arg - Arg object.
452
941
  * @param {string} arg.themeId - ID allotted to the theme.
942
+ * @returns {Promise<ThemesSchema>} - Success response
453
943
  * @summary: Gets theme by id
454
944
  * @description: Use this API to retrieve the details of a specific theme by using its ID.
455
945
  */
456
- getThemeById({ themeId } = {}) {
946
+ async getThemeById({ themeId } = {}) {
457
947
  const { error } = ThemeValidator.getThemeById().validate(
458
948
  {
459
949
  themeId,
@@ -464,25 +954,56 @@ class Theme {
464
954
  return Promise.reject(new FDKClientValidationError(error));
465
955
  }
466
956
 
957
+ // Showing warrnings if extra unknown parameters are found
958
+ const { error: warrning } = ThemeValidator.getThemeById().validate(
959
+ {
960
+ themeId,
961
+ },
962
+ { abortEarly: false, allowUnknown: false }
963
+ );
964
+ if (warrning) {
965
+ Logger({
966
+ level: "WARN",
967
+ message: "Parameter Validation warrnings for getThemeById",
968
+ });
969
+ Logger({ level: "WARN", message: warrning });
970
+ }
971
+
467
972
  const query_params = {};
468
973
 
469
- return PlatformAPIClient.execute(
974
+ const response = await PlatformAPIClient.execute(
470
975
  this.config,
471
976
  "get",
472
977
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}`,
473
978
  query_params,
474
979
  undefined
475
980
  );
981
+
982
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
983
+ abortEarly: false,
984
+ allowUnknown: false,
985
+ });
986
+
987
+ if (res_error) {
988
+ Logger({
989
+ level: "WARN",
990
+ message: "Response Validation Warnnings for getThemeById",
991
+ });
992
+ Logger({ level: "WARN", message: res_error });
993
+ }
994
+
995
+ return response;
476
996
  }
477
997
 
478
998
  /**
479
999
  * @param {Object} arg - Arg object.
480
1000
  * @param {string} arg.themeId - ID allotted to the theme.
481
1001
  * @param {ThemesSchema} arg.body
1002
+ * @returns {Promise<ThemesSchema>} - Success response
482
1003
  * @summary: Update a theme
483
1004
  * @description: Use this API to edit an existing theme. You can customize the website font, sections, images, styles, and many more.
484
1005
  */
485
- updateTheme({ themeId, body } = {}) {
1006
+ async updateTheme({ themeId, body } = {}) {
486
1007
  const { error } = ThemeValidator.updateTheme().validate(
487
1008
  {
488
1009
  themeId,
@@ -494,24 +1015,56 @@ class Theme {
494
1015
  return Promise.reject(new FDKClientValidationError(error));
495
1016
  }
496
1017
 
1018
+ // Showing warrnings if extra unknown parameters are found
1019
+ const { error: warrning } = ThemeValidator.updateTheme().validate(
1020
+ {
1021
+ themeId,
1022
+ body,
1023
+ },
1024
+ { abortEarly: false, allowUnknown: false }
1025
+ );
1026
+ if (warrning) {
1027
+ Logger({
1028
+ level: "WARN",
1029
+ message: "Parameter Validation warrnings for updateTheme",
1030
+ });
1031
+ Logger({ level: "WARN", message: warrning });
1032
+ }
1033
+
497
1034
  const query_params = {};
498
1035
 
499
- return PlatformAPIClient.execute(
1036
+ const response = await PlatformAPIClient.execute(
500
1037
  this.config,
501
1038
  "put",
502
1039
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}`,
503
1040
  query_params,
504
1041
  body
505
1042
  );
1043
+
1044
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
1045
+ abortEarly: false,
1046
+ allowUnknown: false,
1047
+ });
1048
+
1049
+ if (res_error) {
1050
+ Logger({
1051
+ level: "WARN",
1052
+ message: "Response Validation Warnnings for updateTheme",
1053
+ });
1054
+ Logger({ level: "WARN", message: res_error });
1055
+ }
1056
+
1057
+ return response;
506
1058
  }
507
1059
 
508
1060
  /**
509
1061
  * @param {Object} arg - Arg object.
510
1062
  * @param {string} arg.themeId - ID allotted to the theme.
1063
+ * @returns {Promise<ThemesSchema>} - Success response
511
1064
  * @summary: Delete a theme
512
1065
  * @description: Use this API to delete a theme from the theme library.
513
1066
  */
514
- deleteTheme({ themeId } = {}) {
1067
+ async deleteTheme({ themeId } = {}) {
515
1068
  const { error } = ThemeValidator.deleteTheme().validate(
516
1069
  {
517
1070
  themeId,
@@ -522,24 +1075,55 @@ class Theme {
522
1075
  return Promise.reject(new FDKClientValidationError(error));
523
1076
  }
524
1077
 
1078
+ // Showing warrnings if extra unknown parameters are found
1079
+ const { error: warrning } = ThemeValidator.deleteTheme().validate(
1080
+ {
1081
+ themeId,
1082
+ },
1083
+ { abortEarly: false, allowUnknown: false }
1084
+ );
1085
+ if (warrning) {
1086
+ Logger({
1087
+ level: "WARN",
1088
+ message: "Parameter Validation warrnings for deleteTheme",
1089
+ });
1090
+ Logger({ level: "WARN", message: warrning });
1091
+ }
1092
+
525
1093
  const query_params = {};
526
1094
 
527
- return PlatformAPIClient.execute(
1095
+ const response = await PlatformAPIClient.execute(
528
1096
  this.config,
529
1097
  "delete",
530
1098
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}`,
531
1099
  query_params,
532
1100
  undefined
533
1101
  );
1102
+
1103
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
1104
+ abortEarly: false,
1105
+ allowUnknown: false,
1106
+ });
1107
+
1108
+ if (res_error) {
1109
+ Logger({
1110
+ level: "WARN",
1111
+ message: "Response Validation Warnnings for deleteTheme",
1112
+ });
1113
+ Logger({ level: "WARN", message: res_error });
1114
+ }
1115
+
1116
+ return response;
534
1117
  }
535
1118
 
536
1119
  /**
537
1120
  * @param {Object} arg - Arg object.
538
1121
  * @param {string} arg.themeId - ID allotted to the theme.
1122
+ * @returns {Promise<ThemesSchema>} - Success response
539
1123
  * @summary: Get a theme preview
540
1124
  * @description: A theme can be previewed before applying it. Use this API to retrieve the theme preview by using its ID.
541
1125
  */
542
- getThemeForPreview({ themeId } = {}) {
1126
+ async getThemeForPreview({ themeId } = {}) {
543
1127
  const { error } = ThemeValidator.getThemeForPreview().validate(
544
1128
  {
545
1129
  themeId,
@@ -550,24 +1134,55 @@ class Theme {
550
1134
  return Promise.reject(new FDKClientValidationError(error));
551
1135
  }
552
1136
 
1137
+ // Showing warrnings if extra unknown parameters are found
1138
+ const { error: warrning } = ThemeValidator.getThemeForPreview().validate(
1139
+ {
1140
+ themeId,
1141
+ },
1142
+ { abortEarly: false, allowUnknown: false }
1143
+ );
1144
+ if (warrning) {
1145
+ Logger({
1146
+ level: "WARN",
1147
+ message: "Parameter Validation warrnings for getThemeForPreview",
1148
+ });
1149
+ Logger({ level: "WARN", message: warrning });
1150
+ }
1151
+
553
1152
  const query_params = {};
554
1153
 
555
- return PlatformAPIClient.execute(
1154
+ const response = await PlatformAPIClient.execute(
556
1155
  this.config,
557
1156
  "get",
558
1157
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/preview`,
559
1158
  query_params,
560
1159
  undefined
561
1160
  );
1161
+
1162
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
1163
+ abortEarly: false,
1164
+ allowUnknown: false,
1165
+ });
1166
+
1167
+ if (res_error) {
1168
+ Logger({
1169
+ level: "WARN",
1170
+ message: "Response Validation Warnnings for getThemeForPreview",
1171
+ });
1172
+ Logger({ level: "WARN", message: res_error });
1173
+ }
1174
+
1175
+ return response;
562
1176
  }
563
1177
 
564
1178
  /**
565
1179
  * @param {Object} arg - Arg object.
566
1180
  * @param {string} arg.themeId - ID allotted to the theme.
1181
+ * @returns {Promise<ThemesSchema>} - Success response
567
1182
  * @summary: Publish a theme
568
1183
  * @description: Use this API to publish a theme that is either newly created or edited.
569
1184
  */
570
- publishTheme({ themeId } = {}) {
1185
+ async publishTheme({ themeId } = {}) {
571
1186
  const { error } = ThemeValidator.publishTheme().validate(
572
1187
  {
573
1188
  themeId,
@@ -578,24 +1193,55 @@ class Theme {
578
1193
  return Promise.reject(new FDKClientValidationError(error));
579
1194
  }
580
1195
 
1196
+ // Showing warrnings if extra unknown parameters are found
1197
+ const { error: warrning } = ThemeValidator.publishTheme().validate(
1198
+ {
1199
+ themeId,
1200
+ },
1201
+ { abortEarly: false, allowUnknown: false }
1202
+ );
1203
+ if (warrning) {
1204
+ Logger({
1205
+ level: "WARN",
1206
+ message: "Parameter Validation warrnings for publishTheme",
1207
+ });
1208
+ Logger({ level: "WARN", message: warrning });
1209
+ }
1210
+
581
1211
  const query_params = {};
582
1212
 
583
- return PlatformAPIClient.execute(
1213
+ const response = await PlatformAPIClient.execute(
584
1214
  this.config,
585
1215
  "put",
586
1216
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/publish`,
587
1217
  query_params,
588
1218
  undefined
589
1219
  );
1220
+
1221
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
1222
+ abortEarly: false,
1223
+ allowUnknown: false,
1224
+ });
1225
+
1226
+ if (res_error) {
1227
+ Logger({
1228
+ level: "WARN",
1229
+ message: "Response Validation Warnnings for publishTheme",
1230
+ });
1231
+ Logger({ level: "WARN", message: res_error });
1232
+ }
1233
+
1234
+ return response;
590
1235
  }
591
1236
 
592
1237
  /**
593
1238
  * @param {Object} arg - Arg object.
594
1239
  * @param {string} arg.themeId - ID allotted to the theme.
1240
+ * @returns {Promise<ThemesSchema>} - Success response
595
1241
  * @summary: Unpublish a theme
596
1242
  * @description: Use this API to remove an existing theme from the list of available themes.
597
1243
  */
598
- unpublishTheme({ themeId } = {}) {
1244
+ async unpublishTheme({ themeId } = {}) {
599
1245
  const { error } = ThemeValidator.unpublishTheme().validate(
600
1246
  {
601
1247
  themeId,
@@ -606,24 +1252,55 @@ class Theme {
606
1252
  return Promise.reject(new FDKClientValidationError(error));
607
1253
  }
608
1254
 
1255
+ // Showing warrnings if extra unknown parameters are found
1256
+ const { error: warrning } = ThemeValidator.unpublishTheme().validate(
1257
+ {
1258
+ themeId,
1259
+ },
1260
+ { abortEarly: false, allowUnknown: false }
1261
+ );
1262
+ if (warrning) {
1263
+ Logger({
1264
+ level: "WARN",
1265
+ message: "Parameter Validation warrnings for unpublishTheme",
1266
+ });
1267
+ Logger({ level: "WARN", message: warrning });
1268
+ }
1269
+
609
1270
  const query_params = {};
610
1271
 
611
- return PlatformAPIClient.execute(
1272
+ const response = await PlatformAPIClient.execute(
612
1273
  this.config,
613
1274
  "put",
614
1275
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/unpublish`,
615
1276
  query_params,
616
1277
  undefined
617
1278
  );
1279
+
1280
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
1281
+ abortEarly: false,
1282
+ allowUnknown: false,
1283
+ });
1284
+
1285
+ if (res_error) {
1286
+ Logger({
1287
+ level: "WARN",
1288
+ message: "Response Validation Warnnings for unpublishTheme",
1289
+ });
1290
+ Logger({ level: "WARN", message: res_error });
1291
+ }
1292
+
1293
+ return response;
618
1294
  }
619
1295
 
620
1296
  /**
621
1297
  * @param {Object} arg - Arg object.
622
1298
  * @param {string} arg.themeId - ID allotted to the theme.
1299
+ * @returns {Promise<ThemesSchema>} - Success response
623
1300
  * @summary: Archive a theme
624
1301
  * @description: Use this API to store an existing theme but not delete it so that it can be used in future if required.
625
1302
  */
626
- archiveTheme({ themeId } = {}) {
1303
+ async archiveTheme({ themeId } = {}) {
627
1304
  const { error } = ThemeValidator.archiveTheme().validate(
628
1305
  {
629
1306
  themeId,
@@ -634,24 +1311,55 @@ class Theme {
634
1311
  return Promise.reject(new FDKClientValidationError(error));
635
1312
  }
636
1313
 
1314
+ // Showing warrnings if extra unknown parameters are found
1315
+ const { error: warrning } = ThemeValidator.archiveTheme().validate(
1316
+ {
1317
+ themeId,
1318
+ },
1319
+ { abortEarly: false, allowUnknown: false }
1320
+ );
1321
+ if (warrning) {
1322
+ Logger({
1323
+ level: "WARN",
1324
+ message: "Parameter Validation warrnings for archiveTheme",
1325
+ });
1326
+ Logger({ level: "WARN", message: warrning });
1327
+ }
1328
+
637
1329
  const query_params = {};
638
1330
 
639
- return PlatformAPIClient.execute(
1331
+ const response = await PlatformAPIClient.execute(
640
1332
  this.config,
641
1333
  "put",
642
1334
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/archive`,
643
1335
  query_params,
644
1336
  undefined
645
1337
  );
1338
+
1339
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
1340
+ abortEarly: false,
1341
+ allowUnknown: false,
1342
+ });
1343
+
1344
+ if (res_error) {
1345
+ Logger({
1346
+ level: "WARN",
1347
+ message: "Response Validation Warnnings for archiveTheme",
1348
+ });
1349
+ Logger({ level: "WARN", message: res_error });
1350
+ }
1351
+
1352
+ return response;
646
1353
  }
647
1354
 
648
1355
  /**
649
1356
  * @param {Object} arg - Arg object.
650
1357
  * @param {string} arg.themeId - ID allotted to the theme.
1358
+ * @returns {Promise<ThemesSchema>} - Success response
651
1359
  * @summary: Unarchive a theme
652
1360
  * @description: Use this API to restore an archived theme and bring it back for editing or publishing.
653
1361
  */
654
- unarchiveTheme({ themeId } = {}) {
1362
+ async unarchiveTheme({ themeId } = {}) {
655
1363
  const { error } = ThemeValidator.unarchiveTheme().validate(
656
1364
  {
657
1365
  themeId,
@@ -662,24 +1370,55 @@ class Theme {
662
1370
  return Promise.reject(new FDKClientValidationError(error));
663
1371
  }
664
1372
 
1373
+ // Showing warrnings if extra unknown parameters are found
1374
+ const { error: warrning } = ThemeValidator.unarchiveTheme().validate(
1375
+ {
1376
+ themeId,
1377
+ },
1378
+ { abortEarly: false, allowUnknown: false }
1379
+ );
1380
+ if (warrning) {
1381
+ Logger({
1382
+ level: "WARN",
1383
+ message: "Parameter Validation warrnings for unarchiveTheme",
1384
+ });
1385
+ Logger({ level: "WARN", message: warrning });
1386
+ }
1387
+
665
1388
  const query_params = {};
666
1389
 
667
- return PlatformAPIClient.execute(
1390
+ const response = await PlatformAPIClient.execute(
668
1391
  this.config,
669
1392
  "put",
670
1393
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/unarchive`,
671
1394
  query_params,
672
1395
  undefined
673
1396
  );
1397
+
1398
+ const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
1399
+ abortEarly: false,
1400
+ allowUnknown: false,
1401
+ });
1402
+
1403
+ if (res_error) {
1404
+ Logger({
1405
+ level: "WARN",
1406
+ message: "Response Validation Warnnings for unarchiveTheme",
1407
+ });
1408
+ Logger({ level: "WARN", message: res_error });
1409
+ }
1410
+
1411
+ return response;
674
1412
  }
675
1413
 
676
1414
  /**
677
1415
  * @param {Object} arg - Arg object.
678
1416
  * @param {string} arg.themeId - ID allotted to the theme.
1417
+ * @returns {Promise<any>} - Success response
679
1418
  * @summary: Fetch last modified timestamp
680
1419
  * @description: Use this API to fetch Last-Modified timestamp in header metadata.
681
1420
  */
682
- getThemeLastModified({ themeId } = {}) {
1421
+ async getThemeLastModified({ themeId } = {}) {
683
1422
  const { error } = ThemeValidator.getThemeLastModified().validate(
684
1423
  {
685
1424
  themeId,
@@ -690,15 +1429,44 @@ class Theme {
690
1429
  return Promise.reject(new FDKClientValidationError(error));
691
1430
  }
692
1431
 
1432
+ // Showing warrnings if extra unknown parameters are found
1433
+ const { error: warrning } = ThemeValidator.getThemeLastModified().validate(
1434
+ {
1435
+ themeId,
1436
+ },
1437
+ { abortEarly: false, allowUnknown: false }
1438
+ );
1439
+ if (warrning) {
1440
+ Logger({
1441
+ level: "WARN",
1442
+ message: "Parameter Validation warrnings for getThemeLastModified",
1443
+ });
1444
+ Logger({ level: "WARN", message: warrning });
1445
+ }
1446
+
693
1447
  const query_params = {};
694
1448
 
695
- return PlatformAPIClient.execute(
1449
+ const response = await PlatformAPIClient.execute(
696
1450
  this.config,
697
1451
  "head",
698
1452
  `/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/polling`,
699
1453
  query_params,
700
1454
  undefined
701
1455
  );
1456
+
1457
+ const { error: res_error } = Joi.string()
1458
+ .allow("")
1459
+ .validate(response, { abortEarly: false, allowUnknown: false });
1460
+
1461
+ if (res_error) {
1462
+ Logger({
1463
+ level: "WARN",
1464
+ message: "Response Validation Warnnings for getThemeLastModified",
1465
+ });
1466
+ Logger({ level: "WARN", message: res_error });
1467
+ }
1468
+
1469
+ return response;
702
1470
  }
703
1471
  }
704
1472
  module.exports = Theme;