@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 UserValidator = require("./UserPlatformApplicationValidator");
5
+ const UserModel = require("./UserPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
5
7
 
6
8
  class User {
7
9
  constructor(config, applicationId) {
@@ -17,10 +19,11 @@ class User {
17
19
  * page. Default value is 10.
18
20
  * @param {number} [arg.pageNo] - The page number to navigate through the
19
21
  * given set of results. Default value is 1.
22
+ * @returns {Promise<CustomerListResponseSchema>} - Success response
20
23
  * @summary: Get a list of customers
21
24
  * @description: Use this API to retrieve a list of customers who have registered in the application.
22
25
  */
23
- getCustomers({ q, pageSize, pageNo } = {}) {
26
+ async getCustomers({ q, pageSize, pageNo } = {}) {
24
27
  const { error } = UserValidator.getCustomers().validate(
25
28
  {
26
29
  q,
@@ -33,28 +36,63 @@ class User {
33
36
  return Promise.reject(new FDKClientValidationError(error));
34
37
  }
35
38
 
39
+ // Showing warrnings if extra unknown parameters are found
40
+ const { error: warrning } = UserValidator.getCustomers().validate(
41
+ {
42
+ q,
43
+ pageSize,
44
+ pageNo,
45
+ },
46
+ { abortEarly: false, allowUnknown: false }
47
+ );
48
+ if (warrning) {
49
+ Logger({
50
+ level: "WARN",
51
+ message: "Parameter Validation warrnings for getCustomers",
52
+ });
53
+ Logger({ level: "WARN", message: warrning });
54
+ }
55
+
36
56
  const query_params = {};
37
57
  query_params["q"] = q;
38
58
  query_params["page_size"] = pageSize;
39
59
  query_params["page_no"] = pageNo;
40
60
 
41
- return PlatformAPIClient.execute(
61
+ const response = await PlatformAPIClient.execute(
42
62
  this.config,
43
63
  "get",
44
64
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/list`,
45
65
  query_params,
46
66
  undefined
47
67
  );
68
+
69
+ const {
70
+ error: res_error,
71
+ } = UserModel.CustomerListResponseSchema().validate(response, {
72
+ abortEarly: false,
73
+ allowUnknown: false,
74
+ });
75
+
76
+ if (res_error) {
77
+ Logger({
78
+ level: "WARN",
79
+ message: "Response Validation Warnnings for getCustomers",
80
+ });
81
+ Logger({ level: "WARN", message: res_error });
82
+ }
83
+
84
+ return response;
48
85
  }
49
86
 
50
87
  /**
51
88
  * @param {Object} arg - Arg object.
52
89
  * @param {string} [arg.q] - The search query. Mobile number or email ID of
53
90
  * a customer.
91
+ * @returns {Promise<UserSearchResponseSchema>} - Success response
54
92
  * @summary: Search an existing user.
55
93
  * @description: Use this API to retrieve an existing user from a list.
56
94
  */
57
- searchUsers({ q } = {}) {
95
+ async searchUsers({ q } = {}) {
58
96
  const { error } = UserValidator.searchUsers().validate(
59
97
  {
60
98
  q,
@@ -65,25 +103,58 @@ class User {
65
103
  return Promise.reject(new FDKClientValidationError(error));
66
104
  }
67
105
 
106
+ // Showing warrnings if extra unknown parameters are found
107
+ const { error: warrning } = UserValidator.searchUsers().validate(
108
+ {
109
+ q,
110
+ },
111
+ { abortEarly: false, allowUnknown: false }
112
+ );
113
+ if (warrning) {
114
+ Logger({
115
+ level: "WARN",
116
+ message: "Parameter Validation warrnings for searchUsers",
117
+ });
118
+ Logger({ level: "WARN", message: warrning });
119
+ }
120
+
68
121
  const query_params = {};
69
122
  query_params["q"] = q;
70
123
 
71
- return PlatformAPIClient.execute(
124
+ const response = await PlatformAPIClient.execute(
72
125
  this.config,
73
126
  "get",
74
127
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/search`,
75
128
  query_params,
76
129
  undefined
77
130
  );
131
+
132
+ const {
133
+ error: res_error,
134
+ } = UserModel.UserSearchResponseSchema().validate(response, {
135
+ abortEarly: false,
136
+ allowUnknown: false,
137
+ });
138
+
139
+ if (res_error) {
140
+ Logger({
141
+ level: "WARN",
142
+ message: "Response Validation Warnnings for searchUsers",
143
+ });
144
+ Logger({ level: "WARN", message: res_error });
145
+ }
146
+
147
+ return response;
78
148
  }
79
149
 
80
150
  /**
81
151
  * @param {Object} arg - Arg object.
82
152
  * @param {CreateUserRequestSchema} arg.body
153
+ * @returns {Promise<CreateUserResponseSchema>} - Success response
83
154
  * @summary: Create user
84
155
  * @description: Create user
85
156
  */
86
- createUser({ body } = {}) {
157
+ async createUser({ body } = {}) {
87
158
  const { error } = UserValidator.createUser().validate(
88
159
  {
89
160
  body,
@@ -94,24 +165,57 @@ class User {
94
165
  return Promise.reject(new FDKClientValidationError(error));
95
166
  }
96
167
 
168
+ // Showing warrnings if extra unknown parameters are found
169
+ const { error: warrning } = UserValidator.createUser().validate(
170
+ {
171
+ body,
172
+ },
173
+ { abortEarly: false, allowUnknown: false }
174
+ );
175
+ if (warrning) {
176
+ Logger({
177
+ level: "WARN",
178
+ message: "Parameter Validation warrnings for createUser",
179
+ });
180
+ Logger({ level: "WARN", message: warrning });
181
+ }
182
+
97
183
  const query_params = {};
98
184
 
99
- return PlatformAPIClient.execute(
185
+ const response = await PlatformAPIClient.execute(
100
186
  this.config,
101
187
  "post",
102
188
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers`,
103
189
  query_params,
104
190
  body
105
191
  );
192
+
193
+ const {
194
+ error: res_error,
195
+ } = UserModel.CreateUserResponseSchema().validate(response, {
196
+ abortEarly: false,
197
+ allowUnknown: false,
198
+ });
199
+
200
+ if (res_error) {
201
+ Logger({
202
+ level: "WARN",
203
+ message: "Response Validation Warnnings for createUser",
204
+ });
205
+ Logger({ level: "WARN", message: res_error });
206
+ }
207
+
208
+ return response;
106
209
  }
107
210
 
108
211
  /**
109
212
  * @param {Object} arg - Arg object.
110
213
  * @param {BlockUserRequestSchema} arg.body
214
+ * @returns {Promise<BlockUserSuccess>} - Success response
111
215
  * @summary: Block/Unblock user
112
216
  * @description: Block/Unblock user
113
217
  */
114
- blockOrUnblockUsers({ body } = {}) {
218
+ async blockOrUnblockUsers({ body } = {}) {
115
219
  const { error } = UserValidator.blockOrUnblockUsers().validate(
116
220
  {
117
221
  body,
@@ -122,24 +226,55 @@ class User {
122
226
  return Promise.reject(new FDKClientValidationError(error));
123
227
  }
124
228
 
229
+ // Showing warrnings if extra unknown parameters are found
230
+ const { error: warrning } = UserValidator.blockOrUnblockUsers().validate(
231
+ {
232
+ body,
233
+ },
234
+ { abortEarly: false, allowUnknown: false }
235
+ );
236
+ if (warrning) {
237
+ Logger({
238
+ level: "WARN",
239
+ message: "Parameter Validation warrnings for blockOrUnblockUsers",
240
+ });
241
+ Logger({ level: "WARN", message: warrning });
242
+ }
243
+
125
244
  const query_params = {};
126
245
 
127
- return PlatformAPIClient.execute(
246
+ const response = await PlatformAPIClient.execute(
128
247
  this.config,
129
248
  "put",
130
249
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/activation`,
131
250
  query_params,
132
251
  body
133
252
  );
253
+
254
+ const { error: res_error } = UserModel.BlockUserSuccess().validate(
255
+ response,
256
+ { abortEarly: false, allowUnknown: false }
257
+ );
258
+
259
+ if (res_error) {
260
+ Logger({
261
+ level: "WARN",
262
+ message: "Response Validation Warnnings for blockOrUnblockUsers",
263
+ });
264
+ Logger({ level: "WARN", message: res_error });
265
+ }
266
+
267
+ return response;
134
268
  }
135
269
 
136
270
  /**
137
271
  * @param {Object} arg - Arg object.
138
272
  * @param {ArchiveUserRequestSchema} arg.body
273
+ * @returns {Promise<ArchiveUserSuccess>} - Success response
139
274
  * @summary: archive user
140
275
  * @description: archive user
141
276
  */
142
- archiveUser({ body } = {}) {
277
+ async archiveUser({ body } = {}) {
143
278
  const { error } = UserValidator.archiveUser().validate(
144
279
  {
145
280
  body,
@@ -150,24 +285,57 @@ class User {
150
285
  return Promise.reject(new FDKClientValidationError(error));
151
286
  }
152
287
 
288
+ // Showing warrnings if extra unknown parameters are found
289
+ const { error: warrning } = UserValidator.archiveUser().validate(
290
+ {
291
+ body,
292
+ },
293
+ { abortEarly: false, allowUnknown: false }
294
+ );
295
+ if (warrning) {
296
+ Logger({
297
+ level: "WARN",
298
+ message: "Parameter Validation warrnings for archiveUser",
299
+ });
300
+ Logger({ level: "WARN", message: warrning });
301
+ }
302
+
153
303
  const query_params = {};
154
304
 
155
- return PlatformAPIClient.execute(
305
+ const response = await PlatformAPIClient.execute(
156
306
  this.config,
157
307
  "put",
158
308
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/archive`,
159
309
  query_params,
160
310
  body
161
311
  );
312
+
313
+ const {
314
+ error: res_error,
315
+ } = UserModel.ArchiveUserSuccess().validate(response, {
316
+ abortEarly: false,
317
+ allowUnknown: false,
318
+ });
319
+
320
+ if (res_error) {
321
+ Logger({
322
+ level: "WARN",
323
+ message: "Response Validation Warnnings for archiveUser",
324
+ });
325
+ Logger({ level: "WARN", message: res_error });
326
+ }
327
+
328
+ return response;
162
329
  }
163
330
 
164
331
  /**
165
332
  * @param {Object} arg - Arg object.
166
333
  * @param {UnDeleteUserRequestSchema} arg.body
334
+ * @returns {Promise<UnDeleteUserSuccess>} - Success response
167
335
  * @summary: undelete user who deleted from application and have not elapsed the platform configured delete days
168
336
  * @description: undelete user who deleted from application and have not elapsed the platform configured delete days
169
337
  */
170
- unDeleteUser({ body } = {}) {
338
+ async unDeleteUser({ body } = {}) {
171
339
  const { error } = UserValidator.unDeleteUser().validate(
172
340
  {
173
341
  body,
@@ -178,25 +346,58 @@ class User {
178
346
  return Promise.reject(new FDKClientValidationError(error));
179
347
  }
180
348
 
349
+ // Showing warrnings if extra unknown parameters are found
350
+ const { error: warrning } = UserValidator.unDeleteUser().validate(
351
+ {
352
+ body,
353
+ },
354
+ { abortEarly: false, allowUnknown: false }
355
+ );
356
+ if (warrning) {
357
+ Logger({
358
+ level: "WARN",
359
+ message: "Parameter Validation warrnings for unDeleteUser",
360
+ });
361
+ Logger({ level: "WARN", message: warrning });
362
+ }
363
+
181
364
  const query_params = {};
182
365
 
183
- return PlatformAPIClient.execute(
366
+ const response = await PlatformAPIClient.execute(
184
367
  this.config,
185
368
  "put",
186
369
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/undelete`,
187
370
  query_params,
188
371
  body
189
372
  );
373
+
374
+ const {
375
+ error: res_error,
376
+ } = UserModel.UnDeleteUserSuccess().validate(response, {
377
+ abortEarly: false,
378
+ allowUnknown: false,
379
+ });
380
+
381
+ if (res_error) {
382
+ Logger({
383
+ level: "WARN",
384
+ message: "Response Validation Warnnings for unDeleteUser",
385
+ });
386
+ Logger({ level: "WARN", message: res_error });
387
+ }
388
+
389
+ return response;
190
390
  }
191
391
 
192
392
  /**
193
393
  * @param {Object} arg - Arg object.
194
394
  * @param {string} arg.userId - User ID
195
395
  * @param {UpdateUserRequestSchema} arg.body
396
+ * @returns {Promise<CreateUserResponseSchema>} - Success response
196
397
  * @summary: Update user
197
398
  * @description: Update user
198
399
  */
199
- updateUser({ userId, body } = {}) {
400
+ async updateUser({ userId, body } = {}) {
200
401
  const { error } = UserValidator.updateUser().validate(
201
402
  {
202
403
  userId,
@@ -208,24 +409,58 @@ class User {
208
409
  return Promise.reject(new FDKClientValidationError(error));
209
410
  }
210
411
 
412
+ // Showing warrnings if extra unknown parameters are found
413
+ const { error: warrning } = UserValidator.updateUser().validate(
414
+ {
415
+ userId,
416
+ body,
417
+ },
418
+ { abortEarly: false, allowUnknown: false }
419
+ );
420
+ if (warrning) {
421
+ Logger({
422
+ level: "WARN",
423
+ message: "Parameter Validation warrnings for updateUser",
424
+ });
425
+ Logger({ level: "WARN", message: warrning });
426
+ }
427
+
211
428
  const query_params = {};
212
429
 
213
- return PlatformAPIClient.execute(
430
+ const response = await PlatformAPIClient.execute(
214
431
  this.config,
215
432
  "put",
216
433
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/${userId}`,
217
434
  query_params,
218
435
  body
219
436
  );
437
+
438
+ const {
439
+ error: res_error,
440
+ } = UserModel.CreateUserResponseSchema().validate(response, {
441
+ abortEarly: false,
442
+ allowUnknown: false,
443
+ });
444
+
445
+ if (res_error) {
446
+ Logger({
447
+ level: "WARN",
448
+ message: "Response Validation Warnnings for updateUser",
449
+ });
450
+ Logger({ level: "WARN", message: res_error });
451
+ }
452
+
453
+ return response;
220
454
  }
221
455
 
222
456
  /**
223
457
  * @param {Object} arg - Arg object.
224
458
  * @param {CreateUserSessionRequestSchema} arg.body
459
+ * @returns {Promise<CreateUserSessionResponseSchema>} - Success response
225
460
  * @summary: Create user session
226
461
  * @description: Create user session
227
462
  */
228
- createUserSession({ body } = {}) {
463
+ async createUserSession({ body } = {}) {
229
464
  const { error } = UserValidator.createUserSession().validate(
230
465
  {
231
466
  body,
@@ -236,24 +471,57 @@ class User {
236
471
  return Promise.reject(new FDKClientValidationError(error));
237
472
  }
238
473
 
474
+ // Showing warrnings if extra unknown parameters are found
475
+ const { error: warrning } = UserValidator.createUserSession().validate(
476
+ {
477
+ body,
478
+ },
479
+ { abortEarly: false, allowUnknown: false }
480
+ );
481
+ if (warrning) {
482
+ Logger({
483
+ level: "WARN",
484
+ message: "Parameter Validation warrnings for createUserSession",
485
+ });
486
+ Logger({ level: "WARN", message: warrning });
487
+ }
488
+
239
489
  const query_params = {};
240
490
 
241
- return PlatformAPIClient.execute(
491
+ const response = await PlatformAPIClient.execute(
242
492
  this.config,
243
493
  "post",
244
494
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/session`,
245
495
  query_params,
246
496
  body
247
497
  );
498
+
499
+ const {
500
+ error: res_error,
501
+ } = UserModel.CreateUserSessionResponseSchema().validate(response, {
502
+ abortEarly: false,
503
+ allowUnknown: false,
504
+ });
505
+
506
+ if (res_error) {
507
+ Logger({
508
+ level: "WARN",
509
+ message: "Response Validation Warnnings for createUserSession",
510
+ });
511
+ Logger({ level: "WARN", message: res_error });
512
+ }
513
+
514
+ return response;
248
515
  }
249
516
 
250
517
  /**
251
518
  * @param {Object} arg - Arg object.
252
519
  * @param {string} arg.id - ID of a customer.
520
+ * @returns {Promise<SessionListResponseSchema>} - Success response
253
521
  * @summary: Get a list of all session for a user
254
522
  * @description: Use this API to retrieve a list of session of customers who have registered in the application.
255
523
  */
256
- getActiveSessions({ id } = {}) {
524
+ async getActiveSessions({ id } = {}) {
257
525
  const { error } = UserValidator.getActiveSessions().validate(
258
526
  {
259
527
  id,
@@ -264,25 +532,58 @@ class User {
264
532
  return Promise.reject(new FDKClientValidationError(error));
265
533
  }
266
534
 
535
+ // Showing warrnings if extra unknown parameters are found
536
+ const { error: warrning } = UserValidator.getActiveSessions().validate(
537
+ {
538
+ id,
539
+ },
540
+ { abortEarly: false, allowUnknown: false }
541
+ );
542
+ if (warrning) {
543
+ Logger({
544
+ level: "WARN",
545
+ message: "Parameter Validation warrnings for getActiveSessions",
546
+ });
547
+ Logger({ level: "WARN", message: warrning });
548
+ }
549
+
267
550
  const query_params = {};
268
551
  query_params["id"] = id;
269
552
 
270
- return PlatformAPIClient.execute(
553
+ const response = await PlatformAPIClient.execute(
271
554
  this.config,
272
555
  "get",
273
556
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/sesions`,
274
557
  query_params,
275
558
  undefined
276
559
  );
560
+
561
+ const {
562
+ error: res_error,
563
+ } = UserModel.SessionListResponseSchema().validate(response, {
564
+ abortEarly: false,
565
+ allowUnknown: false,
566
+ });
567
+
568
+ if (res_error) {
569
+ Logger({
570
+ level: "WARN",
571
+ message: "Response Validation Warnnings for getActiveSessions",
572
+ });
573
+ Logger({ level: "WARN", message: res_error });
574
+ }
575
+
576
+ return response;
277
577
  }
278
578
 
279
579
  /**
280
580
  * @param {Object} arg - Arg object.
281
581
  * @param {string} arg.id - ID of a customer.
582
+ * @returns {Promise<SessionDeleteResponseSchema>} - Success response
282
583
  * @summary: Delete a list of all session for a user
283
584
  * @description: Use this API to Delete a list of session of customers who have registered in the application.
284
585
  */
285
- deleteActiveSessions({ id } = {}) {
586
+ async deleteActiveSessions({ id } = {}) {
286
587
  const { error } = UserValidator.deleteActiveSessions().validate(
287
588
  {
288
589
  id,
@@ -293,24 +594,57 @@ class User {
293
594
  return Promise.reject(new FDKClientValidationError(error));
294
595
  }
295
596
 
597
+ // Showing warrnings if extra unknown parameters are found
598
+ const { error: warrning } = UserValidator.deleteActiveSessions().validate(
599
+ {
600
+ id,
601
+ },
602
+ { abortEarly: false, allowUnknown: false }
603
+ );
604
+ if (warrning) {
605
+ Logger({
606
+ level: "WARN",
607
+ message: "Parameter Validation warrnings for deleteActiveSessions",
608
+ });
609
+ Logger({ level: "WARN", message: warrning });
610
+ }
611
+
296
612
  const query_params = {};
297
613
  query_params["id"] = id;
298
614
 
299
- return PlatformAPIClient.execute(
615
+ const response = await PlatformAPIClient.execute(
300
616
  this.config,
301
617
  "delete",
302
618
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/sesions`,
303
619
  query_params,
304
620
  undefined
305
621
  );
622
+
623
+ const {
624
+ error: res_error,
625
+ } = UserModel.SessionDeleteResponseSchema().validate(response, {
626
+ abortEarly: false,
627
+ allowUnknown: false,
628
+ });
629
+
630
+ if (res_error) {
631
+ Logger({
632
+ level: "WARN",
633
+ message: "Response Validation Warnnings for deleteActiveSessions",
634
+ });
635
+ Logger({ level: "WARN", message: res_error });
636
+ }
637
+
638
+ return response;
306
639
  }
307
640
 
308
641
  /**
309
642
  * @param {Object} arg - Arg object.
643
+ * @returns {Promise<PlatformSchema>} - Success response
310
644
  * @summary: Get platform configurations
311
645
  * @description: Use this API to get all the platform configurations such as mobile image, desktop image, social logins, and all other text.
312
646
  */
313
- getPlatformConfig({} = {}) {
647
+ async getPlatformConfig({} = {}) {
314
648
  const { error } = UserValidator.getPlatformConfig().validate(
315
649
  {},
316
650
  { abortEarly: false, allowUnknown: true }
@@ -319,24 +653,53 @@ class User {
319
653
  return Promise.reject(new FDKClientValidationError(error));
320
654
  }
321
655
 
656
+ // Showing warrnings if extra unknown parameters are found
657
+ const { error: warrning } = UserValidator.getPlatformConfig().validate(
658
+ {},
659
+ { abortEarly: false, allowUnknown: false }
660
+ );
661
+ if (warrning) {
662
+ Logger({
663
+ level: "WARN",
664
+ message: "Parameter Validation warrnings for getPlatformConfig",
665
+ });
666
+ Logger({ level: "WARN", message: warrning });
667
+ }
668
+
322
669
  const query_params = {};
323
670
 
324
- return PlatformAPIClient.execute(
671
+ const response = await PlatformAPIClient.execute(
325
672
  this.config,
326
673
  "get",
327
674
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/platform/config`,
328
675
  query_params,
329
676
  undefined
330
677
  );
678
+
679
+ const { error: res_error } = UserModel.PlatformSchema().validate(response, {
680
+ abortEarly: false,
681
+ allowUnknown: false,
682
+ });
683
+
684
+ if (res_error) {
685
+ Logger({
686
+ level: "WARN",
687
+ message: "Response Validation Warnnings for getPlatformConfig",
688
+ });
689
+ Logger({ level: "WARN", message: res_error });
690
+ }
691
+
692
+ return response;
331
693
  }
332
694
 
333
695
  /**
334
696
  * @param {Object} arg - Arg object.
335
697
  * @param {PlatformSchema} arg.body
698
+ * @returns {Promise<PlatformSchema>} - Success response
336
699
  * @summary: Update platform configurations
337
700
  * @description: Use this API to edit the existing platform configurations such as mobile image, desktop image, social logins, and all other text.
338
701
  */
339
- updatePlatformConfig({ body } = {}) {
702
+ async updatePlatformConfig({ body } = {}) {
340
703
  const { error } = UserValidator.updatePlatformConfig().validate(
341
704
  {
342
705
  body,
@@ -347,15 +710,45 @@ class User {
347
710
  return Promise.reject(new FDKClientValidationError(error));
348
711
  }
349
712
 
713
+ // Showing warrnings if extra unknown parameters are found
714
+ const { error: warrning } = UserValidator.updatePlatformConfig().validate(
715
+ {
716
+ body,
717
+ },
718
+ { abortEarly: false, allowUnknown: false }
719
+ );
720
+ if (warrning) {
721
+ Logger({
722
+ level: "WARN",
723
+ message: "Parameter Validation warrnings for updatePlatformConfig",
724
+ });
725
+ Logger({ level: "WARN", message: warrning });
726
+ }
727
+
350
728
  const query_params = {};
351
729
 
352
- return PlatformAPIClient.execute(
730
+ const response = await PlatformAPIClient.execute(
353
731
  this.config,
354
732
  "post",
355
733
  `/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/platform/config`,
356
734
  query_params,
357
735
  body
358
736
  );
737
+
738
+ const { error: res_error } = UserModel.PlatformSchema().validate(response, {
739
+ abortEarly: false,
740
+ allowUnknown: false,
741
+ });
742
+
743
+ if (res_error) {
744
+ Logger({
745
+ level: "WARN",
746
+ message: "Response Validation Warnnings for updatePlatformConfig",
747
+ });
748
+ Logger({ level: "WARN", message: res_error });
749
+ }
750
+
751
+ return response;
359
752
  }
360
753
  }
361
754
  module.exports = User;