@gofynd/fdk-client-javascript 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +414 -414
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +290 -290
- package/documentation/application/PAYMENT.md +255 -255
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3088 -2702
- package/documentation/platform/COMPANYPROFILE.md +201 -201
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1233 -1158
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +83 -83
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +619 -108
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
- package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
- package/sdk/application/Common/CommonApplicationClient.js +48 -8
- package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
- package/sdk/application/Content/ContentApplicationClient.js +444 -76
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
- package/sdk/application/Lead/LeadApplicationClient.js +164 -30
- package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +287 -54
- package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
- package/sdk/application/Order/OrderApplicationModel.js +357 -357
- package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
- package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
- package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
- package/sdk/application/Share/ShareApplicationClient.js +157 -32
- package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
- package/sdk/application/User/UserApplicationClient.js +806 -148
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +51 -8
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
- package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
- package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
- package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
- package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
- package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
- package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
- package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
- package/sdk/platform/PlatformApplicationClient.js +3420 -3212
- package/sdk/platform/PlatformClient.d.ts +2959 -2787
- package/sdk/platform/PlatformClient.js +3420 -3212
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
- package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
- package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
- package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
|
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
3
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
4
|
const 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,
|
|
@@ -43,8 +46,11 @@ class User {
|
|
|
43
46
|
{ abortEarly: false, allowUnknown: false }
|
|
44
47
|
);
|
|
45
48
|
if (warrning) {
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
Logger({
|
|
50
|
+
level: "WARN",
|
|
51
|
+
message: "Parameter Validation warrnings for getCustomers",
|
|
52
|
+
});
|
|
53
|
+
Logger({ level: "WARN", message: warrning });
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
const query_params = {};
|
|
@@ -52,23 +58,41 @@ class User {
|
|
|
52
58
|
query_params["page_size"] = pageSize;
|
|
53
59
|
query_params["page_no"] = pageNo;
|
|
54
60
|
|
|
55
|
-
|
|
61
|
+
const response = await PlatformAPIClient.execute(
|
|
56
62
|
this.config,
|
|
57
63
|
"get",
|
|
58
64
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/list`,
|
|
59
65
|
query_params,
|
|
60
66
|
undefined
|
|
61
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;
|
|
62
85
|
}
|
|
63
86
|
|
|
64
87
|
/**
|
|
65
88
|
* @param {Object} arg - Arg object.
|
|
66
89
|
* @param {string} [arg.q] - The search query. Mobile number or email ID of
|
|
67
90
|
* a customer.
|
|
91
|
+
* @returns {Promise<UserSearchResponseSchema>} - Success response
|
|
68
92
|
* @summary: Search an existing user.
|
|
69
93
|
* @description: Use this API to retrieve an existing user from a list.
|
|
70
94
|
*/
|
|
71
|
-
searchUsers({ q } = {}) {
|
|
95
|
+
async searchUsers({ q } = {}) {
|
|
72
96
|
const { error } = UserValidator.searchUsers().validate(
|
|
73
97
|
{
|
|
74
98
|
q,
|
|
@@ -87,29 +111,50 @@ class User {
|
|
|
87
111
|
{ abortEarly: false, allowUnknown: false }
|
|
88
112
|
);
|
|
89
113
|
if (warrning) {
|
|
90
|
-
|
|
91
|
-
|
|
114
|
+
Logger({
|
|
115
|
+
level: "WARN",
|
|
116
|
+
message: "Parameter Validation warrnings for searchUsers",
|
|
117
|
+
});
|
|
118
|
+
Logger({ level: "WARN", message: warrning });
|
|
92
119
|
}
|
|
93
120
|
|
|
94
121
|
const query_params = {};
|
|
95
122
|
query_params["q"] = q;
|
|
96
123
|
|
|
97
|
-
|
|
124
|
+
const response = await PlatformAPIClient.execute(
|
|
98
125
|
this.config,
|
|
99
126
|
"get",
|
|
100
127
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/search`,
|
|
101
128
|
query_params,
|
|
102
129
|
undefined
|
|
103
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;
|
|
104
148
|
}
|
|
105
149
|
|
|
106
150
|
/**
|
|
107
151
|
* @param {Object} arg - Arg object.
|
|
108
152
|
* @param {CreateUserRequestSchema} arg.body
|
|
153
|
+
* @returns {Promise<CreateUserResponseSchema>} - Success response
|
|
109
154
|
* @summary: Create user
|
|
110
155
|
* @description: Create user
|
|
111
156
|
*/
|
|
112
|
-
createUser({ body } = {}) {
|
|
157
|
+
async createUser({ body } = {}) {
|
|
113
158
|
const { error } = UserValidator.createUser().validate(
|
|
114
159
|
{
|
|
115
160
|
body,
|
|
@@ -128,28 +173,49 @@ class User {
|
|
|
128
173
|
{ abortEarly: false, allowUnknown: false }
|
|
129
174
|
);
|
|
130
175
|
if (warrning) {
|
|
131
|
-
|
|
132
|
-
|
|
176
|
+
Logger({
|
|
177
|
+
level: "WARN",
|
|
178
|
+
message: "Parameter Validation warrnings for createUser",
|
|
179
|
+
});
|
|
180
|
+
Logger({ level: "WARN", message: warrning });
|
|
133
181
|
}
|
|
134
182
|
|
|
135
183
|
const query_params = {};
|
|
136
184
|
|
|
137
|
-
|
|
185
|
+
const response = await PlatformAPIClient.execute(
|
|
138
186
|
this.config,
|
|
139
187
|
"post",
|
|
140
188
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers`,
|
|
141
189
|
query_params,
|
|
142
190
|
body
|
|
143
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;
|
|
144
209
|
}
|
|
145
210
|
|
|
146
211
|
/**
|
|
147
212
|
* @param {Object} arg - Arg object.
|
|
148
213
|
* @param {BlockUserRequestSchema} arg.body
|
|
214
|
+
* @returns {Promise<BlockUserSuccess>} - Success response
|
|
149
215
|
* @summary: Block/Unblock user
|
|
150
216
|
* @description: Block/Unblock user
|
|
151
217
|
*/
|
|
152
|
-
blockOrUnblockUsers({ body } = {}) {
|
|
218
|
+
async blockOrUnblockUsers({ body } = {}) {
|
|
153
219
|
const { error } = UserValidator.blockOrUnblockUsers().validate(
|
|
154
220
|
{
|
|
155
221
|
body,
|
|
@@ -168,28 +234,47 @@ class User {
|
|
|
168
234
|
{ abortEarly: false, allowUnknown: false }
|
|
169
235
|
);
|
|
170
236
|
if (warrning) {
|
|
171
|
-
|
|
172
|
-
|
|
237
|
+
Logger({
|
|
238
|
+
level: "WARN",
|
|
239
|
+
message: "Parameter Validation warrnings for blockOrUnblockUsers",
|
|
240
|
+
});
|
|
241
|
+
Logger({ level: "WARN", message: warrning });
|
|
173
242
|
}
|
|
174
243
|
|
|
175
244
|
const query_params = {};
|
|
176
245
|
|
|
177
|
-
|
|
246
|
+
const response = await PlatformAPIClient.execute(
|
|
178
247
|
this.config,
|
|
179
248
|
"put",
|
|
180
249
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/activation`,
|
|
181
250
|
query_params,
|
|
182
251
|
body
|
|
183
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;
|
|
184
268
|
}
|
|
185
269
|
|
|
186
270
|
/**
|
|
187
271
|
* @param {Object} arg - Arg object.
|
|
188
272
|
* @param {ArchiveUserRequestSchema} arg.body
|
|
273
|
+
* @returns {Promise<ArchiveUserSuccess>} - Success response
|
|
189
274
|
* @summary: archive user
|
|
190
275
|
* @description: archive user
|
|
191
276
|
*/
|
|
192
|
-
archiveUser({ body } = {}) {
|
|
277
|
+
async archiveUser({ body } = {}) {
|
|
193
278
|
const { error } = UserValidator.archiveUser().validate(
|
|
194
279
|
{
|
|
195
280
|
body,
|
|
@@ -208,28 +293,49 @@ class User {
|
|
|
208
293
|
{ abortEarly: false, allowUnknown: false }
|
|
209
294
|
);
|
|
210
295
|
if (warrning) {
|
|
211
|
-
|
|
212
|
-
|
|
296
|
+
Logger({
|
|
297
|
+
level: "WARN",
|
|
298
|
+
message: "Parameter Validation warrnings for archiveUser",
|
|
299
|
+
});
|
|
300
|
+
Logger({ level: "WARN", message: warrning });
|
|
213
301
|
}
|
|
214
302
|
|
|
215
303
|
const query_params = {};
|
|
216
304
|
|
|
217
|
-
|
|
305
|
+
const response = await PlatformAPIClient.execute(
|
|
218
306
|
this.config,
|
|
219
307
|
"put",
|
|
220
308
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/archive`,
|
|
221
309
|
query_params,
|
|
222
310
|
body
|
|
223
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;
|
|
224
329
|
}
|
|
225
330
|
|
|
226
331
|
/**
|
|
227
332
|
* @param {Object} arg - Arg object.
|
|
228
333
|
* @param {UnDeleteUserRequestSchema} arg.body
|
|
334
|
+
* @returns {Promise<UnDeleteUserSuccess>} - Success response
|
|
229
335
|
* @summary: undelete user who deleted from application and have not elapsed the platform configured delete days
|
|
230
336
|
* @description: undelete user who deleted from application and have not elapsed the platform configured delete days
|
|
231
337
|
*/
|
|
232
|
-
unDeleteUser({ body } = {}) {
|
|
338
|
+
async unDeleteUser({ body } = {}) {
|
|
233
339
|
const { error } = UserValidator.unDeleteUser().validate(
|
|
234
340
|
{
|
|
235
341
|
body,
|
|
@@ -248,29 +354,50 @@ class User {
|
|
|
248
354
|
{ abortEarly: false, allowUnknown: false }
|
|
249
355
|
);
|
|
250
356
|
if (warrning) {
|
|
251
|
-
|
|
252
|
-
|
|
357
|
+
Logger({
|
|
358
|
+
level: "WARN",
|
|
359
|
+
message: "Parameter Validation warrnings for unDeleteUser",
|
|
360
|
+
});
|
|
361
|
+
Logger({ level: "WARN", message: warrning });
|
|
253
362
|
}
|
|
254
363
|
|
|
255
364
|
const query_params = {};
|
|
256
365
|
|
|
257
|
-
|
|
366
|
+
const response = await PlatformAPIClient.execute(
|
|
258
367
|
this.config,
|
|
259
368
|
"put",
|
|
260
369
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/undelete`,
|
|
261
370
|
query_params,
|
|
262
371
|
body
|
|
263
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;
|
|
264
390
|
}
|
|
265
391
|
|
|
266
392
|
/**
|
|
267
393
|
* @param {Object} arg - Arg object.
|
|
268
394
|
* @param {string} arg.userId - User ID
|
|
269
395
|
* @param {UpdateUserRequestSchema} arg.body
|
|
396
|
+
* @returns {Promise<CreateUserResponseSchema>} - Success response
|
|
270
397
|
* @summary: Update user
|
|
271
398
|
* @description: Update user
|
|
272
399
|
*/
|
|
273
|
-
updateUser({ userId, body } = {}) {
|
|
400
|
+
async updateUser({ userId, body } = {}) {
|
|
274
401
|
const { error } = UserValidator.updateUser().validate(
|
|
275
402
|
{
|
|
276
403
|
userId,
|
|
@@ -291,28 +418,49 @@ class User {
|
|
|
291
418
|
{ abortEarly: false, allowUnknown: false }
|
|
292
419
|
);
|
|
293
420
|
if (warrning) {
|
|
294
|
-
|
|
295
|
-
|
|
421
|
+
Logger({
|
|
422
|
+
level: "WARN",
|
|
423
|
+
message: "Parameter Validation warrnings for updateUser",
|
|
424
|
+
});
|
|
425
|
+
Logger({ level: "WARN", message: warrning });
|
|
296
426
|
}
|
|
297
427
|
|
|
298
428
|
const query_params = {};
|
|
299
429
|
|
|
300
|
-
|
|
430
|
+
const response = await PlatformAPIClient.execute(
|
|
301
431
|
this.config,
|
|
302
432
|
"put",
|
|
303
433
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/${userId}`,
|
|
304
434
|
query_params,
|
|
305
435
|
body
|
|
306
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;
|
|
307
454
|
}
|
|
308
455
|
|
|
309
456
|
/**
|
|
310
457
|
* @param {Object} arg - Arg object.
|
|
311
458
|
* @param {CreateUserSessionRequestSchema} arg.body
|
|
459
|
+
* @returns {Promise<CreateUserSessionResponseSchema>} - Success response
|
|
312
460
|
* @summary: Create user session
|
|
313
461
|
* @description: Create user session
|
|
314
462
|
*/
|
|
315
|
-
createUserSession({ body } = {}) {
|
|
463
|
+
async createUserSession({ body } = {}) {
|
|
316
464
|
const { error } = UserValidator.createUserSession().validate(
|
|
317
465
|
{
|
|
318
466
|
body,
|
|
@@ -331,28 +479,49 @@ class User {
|
|
|
331
479
|
{ abortEarly: false, allowUnknown: false }
|
|
332
480
|
);
|
|
333
481
|
if (warrning) {
|
|
334
|
-
|
|
335
|
-
|
|
482
|
+
Logger({
|
|
483
|
+
level: "WARN",
|
|
484
|
+
message: "Parameter Validation warrnings for createUserSession",
|
|
485
|
+
});
|
|
486
|
+
Logger({ level: "WARN", message: warrning });
|
|
336
487
|
}
|
|
337
488
|
|
|
338
489
|
const query_params = {};
|
|
339
490
|
|
|
340
|
-
|
|
491
|
+
const response = await PlatformAPIClient.execute(
|
|
341
492
|
this.config,
|
|
342
493
|
"post",
|
|
343
494
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/session`,
|
|
344
495
|
query_params,
|
|
345
496
|
body
|
|
346
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;
|
|
347
515
|
}
|
|
348
516
|
|
|
349
517
|
/**
|
|
350
518
|
* @param {Object} arg - Arg object.
|
|
351
519
|
* @param {string} arg.id - ID of a customer.
|
|
520
|
+
* @returns {Promise<SessionListResponseSchema>} - Success response
|
|
352
521
|
* @summary: Get a list of all session for a user
|
|
353
522
|
* @description: Use this API to retrieve a list of session of customers who have registered in the application.
|
|
354
523
|
*/
|
|
355
|
-
getActiveSessions({ id } = {}) {
|
|
524
|
+
async getActiveSessions({ id } = {}) {
|
|
356
525
|
const { error } = UserValidator.getActiveSessions().validate(
|
|
357
526
|
{
|
|
358
527
|
id,
|
|
@@ -371,29 +540,50 @@ class User {
|
|
|
371
540
|
{ abortEarly: false, allowUnknown: false }
|
|
372
541
|
);
|
|
373
542
|
if (warrning) {
|
|
374
|
-
|
|
375
|
-
|
|
543
|
+
Logger({
|
|
544
|
+
level: "WARN",
|
|
545
|
+
message: "Parameter Validation warrnings for getActiveSessions",
|
|
546
|
+
});
|
|
547
|
+
Logger({ level: "WARN", message: warrning });
|
|
376
548
|
}
|
|
377
549
|
|
|
378
550
|
const query_params = {};
|
|
379
551
|
query_params["id"] = id;
|
|
380
552
|
|
|
381
|
-
|
|
553
|
+
const response = await PlatformAPIClient.execute(
|
|
382
554
|
this.config,
|
|
383
555
|
"get",
|
|
384
556
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/sesions`,
|
|
385
557
|
query_params,
|
|
386
558
|
undefined
|
|
387
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;
|
|
388
577
|
}
|
|
389
578
|
|
|
390
579
|
/**
|
|
391
580
|
* @param {Object} arg - Arg object.
|
|
392
581
|
* @param {string} arg.id - ID of a customer.
|
|
582
|
+
* @returns {Promise<SessionDeleteResponseSchema>} - Success response
|
|
393
583
|
* @summary: Delete a list of all session for a user
|
|
394
584
|
* @description: Use this API to Delete a list of session of customers who have registered in the application.
|
|
395
585
|
*/
|
|
396
|
-
deleteActiveSessions({ id } = {}) {
|
|
586
|
+
async deleteActiveSessions({ id } = {}) {
|
|
397
587
|
const { error } = UserValidator.deleteActiveSessions().validate(
|
|
398
588
|
{
|
|
399
589
|
id,
|
|
@@ -412,28 +602,49 @@ class User {
|
|
|
412
602
|
{ abortEarly: false, allowUnknown: false }
|
|
413
603
|
);
|
|
414
604
|
if (warrning) {
|
|
415
|
-
|
|
416
|
-
|
|
605
|
+
Logger({
|
|
606
|
+
level: "WARN",
|
|
607
|
+
message: "Parameter Validation warrnings for deleteActiveSessions",
|
|
608
|
+
});
|
|
609
|
+
Logger({ level: "WARN", message: warrning });
|
|
417
610
|
}
|
|
418
611
|
|
|
419
612
|
const query_params = {};
|
|
420
613
|
query_params["id"] = id;
|
|
421
614
|
|
|
422
|
-
|
|
615
|
+
const response = await PlatformAPIClient.execute(
|
|
423
616
|
this.config,
|
|
424
617
|
"delete",
|
|
425
618
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/sesions`,
|
|
426
619
|
query_params,
|
|
427
620
|
undefined
|
|
428
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;
|
|
429
639
|
}
|
|
430
640
|
|
|
431
641
|
/**
|
|
432
642
|
* @param {Object} arg - Arg object.
|
|
643
|
+
* @returns {Promise<PlatformSchema>} - Success response
|
|
433
644
|
* @summary: Get platform configurations
|
|
434
645
|
* @description: Use this API to get all the platform configurations such as mobile image, desktop image, social logins, and all other text.
|
|
435
646
|
*/
|
|
436
|
-
getPlatformConfig({} = {}) {
|
|
647
|
+
async getPlatformConfig({} = {}) {
|
|
437
648
|
const { error } = UserValidator.getPlatformConfig().validate(
|
|
438
649
|
{},
|
|
439
650
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -448,28 +659,47 @@ class User {
|
|
|
448
659
|
{ abortEarly: false, allowUnknown: false }
|
|
449
660
|
);
|
|
450
661
|
if (warrning) {
|
|
451
|
-
|
|
452
|
-
|
|
662
|
+
Logger({
|
|
663
|
+
level: "WARN",
|
|
664
|
+
message: "Parameter Validation warrnings for getPlatformConfig",
|
|
665
|
+
});
|
|
666
|
+
Logger({ level: "WARN", message: warrning });
|
|
453
667
|
}
|
|
454
668
|
|
|
455
669
|
const query_params = {};
|
|
456
670
|
|
|
457
|
-
|
|
671
|
+
const response = await PlatformAPIClient.execute(
|
|
458
672
|
this.config,
|
|
459
673
|
"get",
|
|
460
674
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/platform/config`,
|
|
461
675
|
query_params,
|
|
462
676
|
undefined
|
|
463
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;
|
|
464
693
|
}
|
|
465
694
|
|
|
466
695
|
/**
|
|
467
696
|
* @param {Object} arg - Arg object.
|
|
468
697
|
* @param {PlatformSchema} arg.body
|
|
698
|
+
* @returns {Promise<PlatformSchema>} - Success response
|
|
469
699
|
* @summary: Update platform configurations
|
|
470
700
|
* @description: Use this API to edit the existing platform configurations such as mobile image, desktop image, social logins, and all other text.
|
|
471
701
|
*/
|
|
472
|
-
updatePlatformConfig({ body } = {}) {
|
|
702
|
+
async updatePlatformConfig({ body } = {}) {
|
|
473
703
|
const { error } = UserValidator.updatePlatformConfig().validate(
|
|
474
704
|
{
|
|
475
705
|
body,
|
|
@@ -488,19 +718,37 @@ class User {
|
|
|
488
718
|
{ abortEarly: false, allowUnknown: false }
|
|
489
719
|
);
|
|
490
720
|
if (warrning) {
|
|
491
|
-
|
|
492
|
-
|
|
721
|
+
Logger({
|
|
722
|
+
level: "WARN",
|
|
723
|
+
message: "Parameter Validation warrnings for updatePlatformConfig",
|
|
724
|
+
});
|
|
725
|
+
Logger({ level: "WARN", message: warrning });
|
|
493
726
|
}
|
|
494
727
|
|
|
495
728
|
const query_params = {};
|
|
496
729
|
|
|
497
|
-
|
|
730
|
+
const response = await PlatformAPIClient.execute(
|
|
498
731
|
this.config,
|
|
499
732
|
"post",
|
|
500
733
|
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/platform/config`,
|
|
501
734
|
query_params,
|
|
502
735
|
body
|
|
503
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;
|
|
504
752
|
}
|
|
505
753
|
}
|
|
506
754
|
module.exports = User;
|