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