@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 CommunicationValidator = require("./CommunicationPlatformApplicationValidator");
|
|
5
|
+
const CommunicationModel = require("./CommunicationPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
5
7
|
|
|
6
8
|
class Communication {
|
|
7
9
|
constructor(config, applicationId) {
|
|
@@ -14,10 +16,11 @@ class Communication {
|
|
|
14
16
|
* @param {number} [arg.pageNo] - Current page no
|
|
15
17
|
* @param {number} [arg.pageSize] - Current request items count
|
|
16
18
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
19
|
+
* @returns {Promise<Campaigns>} - Success response
|
|
17
20
|
* @summary: Get campaigns
|
|
18
21
|
* @description: Get campaigns
|
|
19
22
|
*/
|
|
20
|
-
getCampaigns({ pageNo, pageSize, sort } = {}) {
|
|
23
|
+
async getCampaigns({ pageNo, pageSize, sort } = {}) {
|
|
21
24
|
const { error } = CommunicationValidator.getCampaigns().validate(
|
|
22
25
|
{
|
|
23
26
|
pageNo,
|
|
@@ -40,8 +43,11 @@ class Communication {
|
|
|
40
43
|
{ abortEarly: false, allowUnknown: false }
|
|
41
44
|
);
|
|
42
45
|
if (warrning) {
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
Logger({
|
|
47
|
+
level: "WARN",
|
|
48
|
+
message: "Parameter Validation warrnings for getCampaigns",
|
|
49
|
+
});
|
|
50
|
+
Logger({ level: "WARN", message: warrning });
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
const query_params = {};
|
|
@@ -49,13 +55,30 @@ class Communication {
|
|
|
49
55
|
query_params["page_size"] = pageSize;
|
|
50
56
|
query_params["sort"] = sort;
|
|
51
57
|
|
|
52
|
-
|
|
58
|
+
const response = await PlatformAPIClient.execute(
|
|
53
59
|
this.config,
|
|
54
60
|
"get",
|
|
55
61
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns`,
|
|
56
62
|
query_params,
|
|
57
63
|
undefined
|
|
58
64
|
);
|
|
65
|
+
|
|
66
|
+
const {
|
|
67
|
+
error: res_error,
|
|
68
|
+
} = CommunicationModel.Campaigns().validate(response, {
|
|
69
|
+
abortEarly: false,
|
|
70
|
+
allowUnknown: false,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (res_error) {
|
|
74
|
+
Logger({
|
|
75
|
+
level: "WARN",
|
|
76
|
+
message: "Response Validation Warnnings for getCampaigns",
|
|
77
|
+
});
|
|
78
|
+
Logger({ level: "WARN", message: res_error });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return response;
|
|
59
82
|
}
|
|
60
83
|
|
|
61
84
|
/**
|
|
@@ -93,10 +116,11 @@ class Communication {
|
|
|
93
116
|
/**
|
|
94
117
|
* @param {Object} arg - Arg object.
|
|
95
118
|
* @param {CampaignReq} arg.body
|
|
119
|
+
* @returns {Promise<Campaign>} - Success response
|
|
96
120
|
* @summary: Create campaign
|
|
97
121
|
* @description: Create campaign
|
|
98
122
|
*/
|
|
99
|
-
createCampaign({ body } = {}) {
|
|
123
|
+
async createCampaign({ body } = {}) {
|
|
100
124
|
const { error } = CommunicationValidator.createCampaign().validate(
|
|
101
125
|
{
|
|
102
126
|
body,
|
|
@@ -117,28 +141,49 @@ class Communication {
|
|
|
117
141
|
{ abortEarly: false, allowUnknown: false }
|
|
118
142
|
);
|
|
119
143
|
if (warrning) {
|
|
120
|
-
|
|
121
|
-
|
|
144
|
+
Logger({
|
|
145
|
+
level: "WARN",
|
|
146
|
+
message: "Parameter Validation warrnings for createCampaign",
|
|
147
|
+
});
|
|
148
|
+
Logger({ level: "WARN", message: warrning });
|
|
122
149
|
}
|
|
123
150
|
|
|
124
151
|
const query_params = {};
|
|
125
152
|
|
|
126
|
-
|
|
153
|
+
const response = await PlatformAPIClient.execute(
|
|
127
154
|
this.config,
|
|
128
155
|
"post",
|
|
129
156
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns`,
|
|
130
157
|
query_params,
|
|
131
158
|
body
|
|
132
159
|
);
|
|
160
|
+
|
|
161
|
+
const {
|
|
162
|
+
error: res_error,
|
|
163
|
+
} = CommunicationModel.Campaign().validate(response, {
|
|
164
|
+
abortEarly: false,
|
|
165
|
+
allowUnknown: false,
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
if (res_error) {
|
|
169
|
+
Logger({
|
|
170
|
+
level: "WARN",
|
|
171
|
+
message: "Response Validation Warnnings for createCampaign",
|
|
172
|
+
});
|
|
173
|
+
Logger({ level: "WARN", message: res_error });
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return response;
|
|
133
177
|
}
|
|
134
178
|
|
|
135
179
|
/**
|
|
136
180
|
* @param {Object} arg - Arg object.
|
|
137
181
|
* @param {string} arg.id - Campaign id
|
|
182
|
+
* @returns {Promise<Campaign>} - Success response
|
|
138
183
|
* @summary: Get campaign by id
|
|
139
184
|
* @description: Get campaign by id
|
|
140
185
|
*/
|
|
141
|
-
getCampaignById({ id } = {}) {
|
|
186
|
+
async getCampaignById({ id } = {}) {
|
|
142
187
|
const { error } = CommunicationValidator.getCampaignById().validate(
|
|
143
188
|
{
|
|
144
189
|
id,
|
|
@@ -159,29 +204,50 @@ class Communication {
|
|
|
159
204
|
{ abortEarly: false, allowUnknown: false }
|
|
160
205
|
);
|
|
161
206
|
if (warrning) {
|
|
162
|
-
|
|
163
|
-
|
|
207
|
+
Logger({
|
|
208
|
+
level: "WARN",
|
|
209
|
+
message: "Parameter Validation warrnings for getCampaignById",
|
|
210
|
+
});
|
|
211
|
+
Logger({ level: "WARN", message: warrning });
|
|
164
212
|
}
|
|
165
213
|
|
|
166
214
|
const query_params = {};
|
|
167
215
|
|
|
168
|
-
|
|
216
|
+
const response = await PlatformAPIClient.execute(
|
|
169
217
|
this.config,
|
|
170
218
|
"get",
|
|
171
219
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns/${id}`,
|
|
172
220
|
query_params,
|
|
173
221
|
undefined
|
|
174
222
|
);
|
|
223
|
+
|
|
224
|
+
const {
|
|
225
|
+
error: res_error,
|
|
226
|
+
} = CommunicationModel.Campaign().validate(response, {
|
|
227
|
+
abortEarly: false,
|
|
228
|
+
allowUnknown: false,
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
if (res_error) {
|
|
232
|
+
Logger({
|
|
233
|
+
level: "WARN",
|
|
234
|
+
message: "Response Validation Warnnings for getCampaignById",
|
|
235
|
+
});
|
|
236
|
+
Logger({ level: "WARN", message: res_error });
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return response;
|
|
175
240
|
}
|
|
176
241
|
|
|
177
242
|
/**
|
|
178
243
|
* @param {Object} arg - Arg object.
|
|
179
244
|
* @param {string} arg.id - Campaign id
|
|
180
245
|
* @param {CampaignReq} arg.body
|
|
246
|
+
* @returns {Promise<Campaign>} - Success response
|
|
181
247
|
* @summary: Update campaign by id
|
|
182
248
|
* @description: Update campaign by id
|
|
183
249
|
*/
|
|
184
|
-
updateCampaignById({ id, body } = {}) {
|
|
250
|
+
async updateCampaignById({ id, body } = {}) {
|
|
185
251
|
const { error } = CommunicationValidator.updateCampaignById().validate(
|
|
186
252
|
{
|
|
187
253
|
id,
|
|
@@ -204,28 +270,49 @@ class Communication {
|
|
|
204
270
|
{ abortEarly: false, allowUnknown: false }
|
|
205
271
|
);
|
|
206
272
|
if (warrning) {
|
|
207
|
-
|
|
208
|
-
|
|
273
|
+
Logger({
|
|
274
|
+
level: "WARN",
|
|
275
|
+
message: "Parameter Validation warrnings for updateCampaignById",
|
|
276
|
+
});
|
|
277
|
+
Logger({ level: "WARN", message: warrning });
|
|
209
278
|
}
|
|
210
279
|
|
|
211
280
|
const query_params = {};
|
|
212
281
|
|
|
213
|
-
|
|
282
|
+
const response = await PlatformAPIClient.execute(
|
|
214
283
|
this.config,
|
|
215
284
|
"put",
|
|
216
285
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns/${id}`,
|
|
217
286
|
query_params,
|
|
218
287
|
body
|
|
219
288
|
);
|
|
289
|
+
|
|
290
|
+
const {
|
|
291
|
+
error: res_error,
|
|
292
|
+
} = CommunicationModel.Campaign().validate(response, {
|
|
293
|
+
abortEarly: false,
|
|
294
|
+
allowUnknown: false,
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
if (res_error) {
|
|
298
|
+
Logger({
|
|
299
|
+
level: "WARN",
|
|
300
|
+
message: "Response Validation Warnnings for updateCampaignById",
|
|
301
|
+
});
|
|
302
|
+
Logger({ level: "WARN", message: res_error });
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return response;
|
|
220
306
|
}
|
|
221
307
|
|
|
222
308
|
/**
|
|
223
309
|
* @param {Object} arg - Arg object.
|
|
224
310
|
* @param {string} arg.id - Campaign id
|
|
311
|
+
* @returns {Promise<GetStats>} - Success response
|
|
225
312
|
* @summary: Get stats of campaign by id
|
|
226
313
|
* @description: Get stats of campaign by id
|
|
227
314
|
*/
|
|
228
|
-
getStatsOfCampaignById({ id } = {}) {
|
|
315
|
+
async getStatsOfCampaignById({ id } = {}) {
|
|
229
316
|
const { error } = CommunicationValidator.getStatsOfCampaignById().validate(
|
|
230
317
|
{
|
|
231
318
|
id,
|
|
@@ -246,19 +333,39 @@ class Communication {
|
|
|
246
333
|
{ abortEarly: false, allowUnknown: false }
|
|
247
334
|
);
|
|
248
335
|
if (warrning) {
|
|
249
|
-
|
|
250
|
-
|
|
336
|
+
Logger({
|
|
337
|
+
level: "WARN",
|
|
338
|
+
message: "Parameter Validation warrnings for getStatsOfCampaignById",
|
|
339
|
+
});
|
|
340
|
+
Logger({ level: "WARN", message: warrning });
|
|
251
341
|
}
|
|
252
342
|
|
|
253
343
|
const query_params = {};
|
|
254
344
|
|
|
255
|
-
|
|
345
|
+
const response = await PlatformAPIClient.execute(
|
|
256
346
|
this.config,
|
|
257
347
|
"get",
|
|
258
348
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/get-stats/${id}`,
|
|
259
349
|
query_params,
|
|
260
350
|
undefined
|
|
261
351
|
);
|
|
352
|
+
|
|
353
|
+
const {
|
|
354
|
+
error: res_error,
|
|
355
|
+
} = CommunicationModel.GetStats().validate(response, {
|
|
356
|
+
abortEarly: false,
|
|
357
|
+
allowUnknown: false,
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
if (res_error) {
|
|
361
|
+
Logger({
|
|
362
|
+
level: "WARN",
|
|
363
|
+
message: "Response Validation Warnnings for getStatsOfCampaignById",
|
|
364
|
+
});
|
|
365
|
+
Logger({ level: "WARN", message: res_error });
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return response;
|
|
262
369
|
}
|
|
263
370
|
|
|
264
371
|
/**
|
|
@@ -266,10 +373,11 @@ class Communication {
|
|
|
266
373
|
* @param {number} [arg.pageNo] - Current page no
|
|
267
374
|
* @param {number} [arg.pageSize] - Current request items count
|
|
268
375
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
376
|
+
* @returns {Promise<Audiences>} - Success response
|
|
269
377
|
* @summary: Get audiences
|
|
270
378
|
* @description: Get audiences
|
|
271
379
|
*/
|
|
272
|
-
getAudiences({ pageNo, pageSize, sort } = {}) {
|
|
380
|
+
async getAudiences({ pageNo, pageSize, sort } = {}) {
|
|
273
381
|
const { error } = CommunicationValidator.getAudiences().validate(
|
|
274
382
|
{
|
|
275
383
|
pageNo,
|
|
@@ -292,8 +400,11 @@ class Communication {
|
|
|
292
400
|
{ abortEarly: false, allowUnknown: false }
|
|
293
401
|
);
|
|
294
402
|
if (warrning) {
|
|
295
|
-
|
|
296
|
-
|
|
403
|
+
Logger({
|
|
404
|
+
level: "WARN",
|
|
405
|
+
message: "Parameter Validation warrnings for getAudiences",
|
|
406
|
+
});
|
|
407
|
+
Logger({ level: "WARN", message: warrning });
|
|
297
408
|
}
|
|
298
409
|
|
|
299
410
|
const query_params = {};
|
|
@@ -301,13 +412,30 @@ class Communication {
|
|
|
301
412
|
query_params["page_size"] = pageSize;
|
|
302
413
|
query_params["sort"] = sort;
|
|
303
414
|
|
|
304
|
-
|
|
415
|
+
const response = await PlatformAPIClient.execute(
|
|
305
416
|
this.config,
|
|
306
417
|
"get",
|
|
307
418
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources`,
|
|
308
419
|
query_params,
|
|
309
420
|
undefined
|
|
310
421
|
);
|
|
422
|
+
|
|
423
|
+
const {
|
|
424
|
+
error: res_error,
|
|
425
|
+
} = CommunicationModel.Audiences().validate(response, {
|
|
426
|
+
abortEarly: false,
|
|
427
|
+
allowUnknown: false,
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
if (res_error) {
|
|
431
|
+
Logger({
|
|
432
|
+
level: "WARN",
|
|
433
|
+
message: "Response Validation Warnnings for getAudiences",
|
|
434
|
+
});
|
|
435
|
+
Logger({ level: "WARN", message: res_error });
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
return response;
|
|
311
439
|
}
|
|
312
440
|
|
|
313
441
|
/**
|
|
@@ -345,10 +473,11 @@ class Communication {
|
|
|
345
473
|
/**
|
|
346
474
|
* @param {Object} arg - Arg object.
|
|
347
475
|
* @param {AudienceReq} arg.body
|
|
476
|
+
* @returns {Promise<Audience>} - Success response
|
|
348
477
|
* @summary: Create audience
|
|
349
478
|
* @description: Create audience
|
|
350
479
|
*/
|
|
351
|
-
createAudience({ body } = {}) {
|
|
480
|
+
async createAudience({ body } = {}) {
|
|
352
481
|
const { error } = CommunicationValidator.createAudience().validate(
|
|
353
482
|
{
|
|
354
483
|
body,
|
|
@@ -369,28 +498,49 @@ class Communication {
|
|
|
369
498
|
{ abortEarly: false, allowUnknown: false }
|
|
370
499
|
);
|
|
371
500
|
if (warrning) {
|
|
372
|
-
|
|
373
|
-
|
|
501
|
+
Logger({
|
|
502
|
+
level: "WARN",
|
|
503
|
+
message: "Parameter Validation warrnings for createAudience",
|
|
504
|
+
});
|
|
505
|
+
Logger({ level: "WARN", message: warrning });
|
|
374
506
|
}
|
|
375
507
|
|
|
376
508
|
const query_params = {};
|
|
377
509
|
|
|
378
|
-
|
|
510
|
+
const response = await PlatformAPIClient.execute(
|
|
379
511
|
this.config,
|
|
380
512
|
"post",
|
|
381
513
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources`,
|
|
382
514
|
query_params,
|
|
383
515
|
body
|
|
384
516
|
);
|
|
517
|
+
|
|
518
|
+
const {
|
|
519
|
+
error: res_error,
|
|
520
|
+
} = CommunicationModel.Audience().validate(response, {
|
|
521
|
+
abortEarly: false,
|
|
522
|
+
allowUnknown: false,
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
if (res_error) {
|
|
526
|
+
Logger({
|
|
527
|
+
level: "WARN",
|
|
528
|
+
message: "Response Validation Warnnings for createAudience",
|
|
529
|
+
});
|
|
530
|
+
Logger({ level: "WARN", message: res_error });
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
return response;
|
|
385
534
|
}
|
|
386
535
|
|
|
387
536
|
/**
|
|
388
537
|
* @param {Object} arg - Arg object.
|
|
389
538
|
* @param {BigqueryHeadersReq} arg.body
|
|
539
|
+
* @returns {Promise<BigqueryHeadersRes>} - Success response
|
|
390
540
|
* @summary: Get bigquery headers
|
|
391
541
|
* @description: Get bigquery headers
|
|
392
542
|
*/
|
|
393
|
-
getBigqueryHeaders({ body } = {}) {
|
|
543
|
+
async getBigqueryHeaders({ body } = {}) {
|
|
394
544
|
const { error } = CommunicationValidator.getBigqueryHeaders().validate(
|
|
395
545
|
{
|
|
396
546
|
body,
|
|
@@ -411,28 +561,49 @@ class Communication {
|
|
|
411
561
|
{ abortEarly: false, allowUnknown: false }
|
|
412
562
|
);
|
|
413
563
|
if (warrning) {
|
|
414
|
-
|
|
415
|
-
|
|
564
|
+
Logger({
|
|
565
|
+
level: "WARN",
|
|
566
|
+
message: "Parameter Validation warrnings for getBigqueryHeaders",
|
|
567
|
+
});
|
|
568
|
+
Logger({ level: "WARN", message: warrning });
|
|
416
569
|
}
|
|
417
570
|
|
|
418
571
|
const query_params = {};
|
|
419
572
|
|
|
420
|
-
|
|
573
|
+
const response = await PlatformAPIClient.execute(
|
|
421
574
|
this.config,
|
|
422
575
|
"post",
|
|
423
576
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/bigquery-headers`,
|
|
424
577
|
query_params,
|
|
425
578
|
body
|
|
426
579
|
);
|
|
580
|
+
|
|
581
|
+
const {
|
|
582
|
+
error: res_error,
|
|
583
|
+
} = CommunicationModel.BigqueryHeadersRes().validate(response, {
|
|
584
|
+
abortEarly: false,
|
|
585
|
+
allowUnknown: false,
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
if (res_error) {
|
|
589
|
+
Logger({
|
|
590
|
+
level: "WARN",
|
|
591
|
+
message: "Response Validation Warnnings for getBigqueryHeaders",
|
|
592
|
+
});
|
|
593
|
+
Logger({ level: "WARN", message: res_error });
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
return response;
|
|
427
597
|
}
|
|
428
598
|
|
|
429
599
|
/**
|
|
430
600
|
* @param {Object} arg - Arg object.
|
|
431
601
|
* @param {string} arg.id - Audience id
|
|
602
|
+
* @returns {Promise<Audience>} - Success response
|
|
432
603
|
* @summary: Get audience by id
|
|
433
604
|
* @description: Get audience by id
|
|
434
605
|
*/
|
|
435
|
-
getAudienceById({ id } = {}) {
|
|
606
|
+
async getAudienceById({ id } = {}) {
|
|
436
607
|
const { error } = CommunicationValidator.getAudienceById().validate(
|
|
437
608
|
{
|
|
438
609
|
id,
|
|
@@ -453,29 +624,50 @@ class Communication {
|
|
|
453
624
|
{ abortEarly: false, allowUnknown: false }
|
|
454
625
|
);
|
|
455
626
|
if (warrning) {
|
|
456
|
-
|
|
457
|
-
|
|
627
|
+
Logger({
|
|
628
|
+
level: "WARN",
|
|
629
|
+
message: "Parameter Validation warrnings for getAudienceById",
|
|
630
|
+
});
|
|
631
|
+
Logger({ level: "WARN", message: warrning });
|
|
458
632
|
}
|
|
459
633
|
|
|
460
634
|
const query_params = {};
|
|
461
635
|
|
|
462
|
-
|
|
636
|
+
const response = await PlatformAPIClient.execute(
|
|
463
637
|
this.config,
|
|
464
638
|
"get",
|
|
465
639
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
|
|
466
640
|
query_params,
|
|
467
641
|
undefined
|
|
468
642
|
);
|
|
643
|
+
|
|
644
|
+
const {
|
|
645
|
+
error: res_error,
|
|
646
|
+
} = CommunicationModel.Audience().validate(response, {
|
|
647
|
+
abortEarly: false,
|
|
648
|
+
allowUnknown: false,
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
if (res_error) {
|
|
652
|
+
Logger({
|
|
653
|
+
level: "WARN",
|
|
654
|
+
message: "Response Validation Warnnings for getAudienceById",
|
|
655
|
+
});
|
|
656
|
+
Logger({ level: "WARN", message: res_error });
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
return response;
|
|
469
660
|
}
|
|
470
661
|
|
|
471
662
|
/**
|
|
472
663
|
* @param {Object} arg - Arg object.
|
|
473
664
|
* @param {string} arg.id - Audience id
|
|
474
665
|
* @param {AudienceReq} arg.body
|
|
666
|
+
* @returns {Promise<Audience>} - Success response
|
|
475
667
|
* @summary: Update audience by id
|
|
476
668
|
* @description: Update audience by id
|
|
477
669
|
*/
|
|
478
|
-
updateAudienceById({ id, body } = {}) {
|
|
670
|
+
async updateAudienceById({ id, body } = {}) {
|
|
479
671
|
const { error } = CommunicationValidator.updateAudienceById().validate(
|
|
480
672
|
{
|
|
481
673
|
id,
|
|
@@ -498,28 +690,49 @@ class Communication {
|
|
|
498
690
|
{ abortEarly: false, allowUnknown: false }
|
|
499
691
|
);
|
|
500
692
|
if (warrning) {
|
|
501
|
-
|
|
502
|
-
|
|
693
|
+
Logger({
|
|
694
|
+
level: "WARN",
|
|
695
|
+
message: "Parameter Validation warrnings for updateAudienceById",
|
|
696
|
+
});
|
|
697
|
+
Logger({ level: "WARN", message: warrning });
|
|
503
698
|
}
|
|
504
699
|
|
|
505
700
|
const query_params = {};
|
|
506
701
|
|
|
507
|
-
|
|
702
|
+
const response = await PlatformAPIClient.execute(
|
|
508
703
|
this.config,
|
|
509
704
|
"put",
|
|
510
705
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
|
|
511
706
|
query_params,
|
|
512
707
|
body
|
|
513
708
|
);
|
|
709
|
+
|
|
710
|
+
const {
|
|
711
|
+
error: res_error,
|
|
712
|
+
} = CommunicationModel.Audience().validate(response, {
|
|
713
|
+
abortEarly: false,
|
|
714
|
+
allowUnknown: false,
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
if (res_error) {
|
|
718
|
+
Logger({
|
|
719
|
+
level: "WARN",
|
|
720
|
+
message: "Response Validation Warnnings for updateAudienceById",
|
|
721
|
+
});
|
|
722
|
+
Logger({ level: "WARN", message: res_error });
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
return response;
|
|
514
726
|
}
|
|
515
727
|
|
|
516
728
|
/**
|
|
517
729
|
* @param {Object} arg - Arg object.
|
|
518
730
|
* @param {GetNRecordsCsvReq} arg.body
|
|
731
|
+
* @returns {Promise<GetNRecordsCsvRes>} - Success response
|
|
519
732
|
* @summary: Get n sample records from csv
|
|
520
733
|
* @description: Get n sample records from csv
|
|
521
734
|
*/
|
|
522
|
-
getNSampleRecordsFromCsv({ body } = {}) {
|
|
735
|
+
async getNSampleRecordsFromCsv({ body } = {}) {
|
|
523
736
|
const {
|
|
524
737
|
error,
|
|
525
738
|
} = CommunicationValidator.getNSampleRecordsFromCsv().validate(
|
|
@@ -542,21 +755,39 @@ class Communication {
|
|
|
542
755
|
{ abortEarly: false, allowUnknown: false }
|
|
543
756
|
);
|
|
544
757
|
if (warrning) {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
758
|
+
Logger({
|
|
759
|
+
level: "WARN",
|
|
760
|
+
message: "Parameter Validation warrnings for getNSampleRecordsFromCsv",
|
|
761
|
+
});
|
|
762
|
+
Logger({ level: "WARN", message: warrning });
|
|
549
763
|
}
|
|
550
764
|
|
|
551
765
|
const query_params = {};
|
|
552
766
|
|
|
553
|
-
|
|
767
|
+
const response = await PlatformAPIClient.execute(
|
|
554
768
|
this.config,
|
|
555
769
|
"post",
|
|
556
770
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/get-n-records`,
|
|
557
771
|
query_params,
|
|
558
772
|
body
|
|
559
773
|
);
|
|
774
|
+
|
|
775
|
+
const {
|
|
776
|
+
error: res_error,
|
|
777
|
+
} = CommunicationModel.GetNRecordsCsvRes().validate(response, {
|
|
778
|
+
abortEarly: false,
|
|
779
|
+
allowUnknown: false,
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
if (res_error) {
|
|
783
|
+
Logger({
|
|
784
|
+
level: "WARN",
|
|
785
|
+
message: "Response Validation Warnnings for getNSampleRecordsFromCsv",
|
|
786
|
+
});
|
|
787
|
+
Logger({ level: "WARN", message: res_error });
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
return response;
|
|
560
791
|
}
|
|
561
792
|
|
|
562
793
|
/**
|
|
@@ -564,10 +795,11 @@ class Communication {
|
|
|
564
795
|
* @param {number} [arg.pageNo] - Current page no
|
|
565
796
|
* @param {number} [arg.pageSize] - Current request items count
|
|
566
797
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
798
|
+
* @returns {Promise<EmailProviders>} - Success response
|
|
567
799
|
* @summary: Get email providers
|
|
568
800
|
* @description: Get email providers
|
|
569
801
|
*/
|
|
570
|
-
getEmailProviders({ pageNo, pageSize, sort } = {}) {
|
|
802
|
+
async getEmailProviders({ pageNo, pageSize, sort } = {}) {
|
|
571
803
|
const { error } = CommunicationValidator.getEmailProviders().validate(
|
|
572
804
|
{
|
|
573
805
|
pageNo,
|
|
@@ -592,8 +824,11 @@ class Communication {
|
|
|
592
824
|
{ abortEarly: false, allowUnknown: false }
|
|
593
825
|
);
|
|
594
826
|
if (warrning) {
|
|
595
|
-
|
|
596
|
-
|
|
827
|
+
Logger({
|
|
828
|
+
level: "WARN",
|
|
829
|
+
message: "Parameter Validation warrnings for getEmailProviders",
|
|
830
|
+
});
|
|
831
|
+
Logger({ level: "WARN", message: warrning });
|
|
597
832
|
}
|
|
598
833
|
|
|
599
834
|
const query_params = {};
|
|
@@ -601,13 +836,30 @@ class Communication {
|
|
|
601
836
|
query_params["page_size"] = pageSize;
|
|
602
837
|
query_params["sort"] = sort;
|
|
603
838
|
|
|
604
|
-
|
|
839
|
+
const response = await PlatformAPIClient.execute(
|
|
605
840
|
this.config,
|
|
606
841
|
"get",
|
|
607
842
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers`,
|
|
608
843
|
query_params,
|
|
609
844
|
undefined
|
|
610
845
|
);
|
|
846
|
+
|
|
847
|
+
const {
|
|
848
|
+
error: res_error,
|
|
849
|
+
} = CommunicationModel.EmailProviders().validate(response, {
|
|
850
|
+
abortEarly: false,
|
|
851
|
+
allowUnknown: false,
|
|
852
|
+
});
|
|
853
|
+
|
|
854
|
+
if (res_error) {
|
|
855
|
+
Logger({
|
|
856
|
+
level: "WARN",
|
|
857
|
+
message: "Response Validation Warnnings for getEmailProviders",
|
|
858
|
+
});
|
|
859
|
+
Logger({ level: "WARN", message: res_error });
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
return response;
|
|
611
863
|
}
|
|
612
864
|
|
|
613
865
|
/**
|
|
@@ -650,10 +902,11 @@ class Communication {
|
|
|
650
902
|
/**
|
|
651
903
|
* @param {Object} arg - Arg object.
|
|
652
904
|
* @param {EmailProviderReq} arg.body
|
|
905
|
+
* @returns {Promise<EmailProvider>} - Success response
|
|
653
906
|
* @summary: Create email provider
|
|
654
907
|
* @description: Create email provider
|
|
655
908
|
*/
|
|
656
|
-
createEmailProvider({ body } = {}) {
|
|
909
|
+
async createEmailProvider({ body } = {}) {
|
|
657
910
|
const { error } = CommunicationValidator.createEmailProvider().validate(
|
|
658
911
|
{
|
|
659
912
|
body,
|
|
@@ -674,28 +927,49 @@ class Communication {
|
|
|
674
927
|
{ abortEarly: false, allowUnknown: false }
|
|
675
928
|
);
|
|
676
929
|
if (warrning) {
|
|
677
|
-
|
|
678
|
-
|
|
930
|
+
Logger({
|
|
931
|
+
level: "WARN",
|
|
932
|
+
message: "Parameter Validation warrnings for createEmailProvider",
|
|
933
|
+
});
|
|
934
|
+
Logger({ level: "WARN", message: warrning });
|
|
679
935
|
}
|
|
680
936
|
|
|
681
937
|
const query_params = {};
|
|
682
938
|
|
|
683
|
-
|
|
939
|
+
const response = await PlatformAPIClient.execute(
|
|
684
940
|
this.config,
|
|
685
941
|
"post",
|
|
686
942
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers`,
|
|
687
943
|
query_params,
|
|
688
944
|
body
|
|
689
945
|
);
|
|
946
|
+
|
|
947
|
+
const {
|
|
948
|
+
error: res_error,
|
|
949
|
+
} = CommunicationModel.EmailProvider().validate(response, {
|
|
950
|
+
abortEarly: false,
|
|
951
|
+
allowUnknown: false,
|
|
952
|
+
});
|
|
953
|
+
|
|
954
|
+
if (res_error) {
|
|
955
|
+
Logger({
|
|
956
|
+
level: "WARN",
|
|
957
|
+
message: "Response Validation Warnnings for createEmailProvider",
|
|
958
|
+
});
|
|
959
|
+
Logger({ level: "WARN", message: res_error });
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
return response;
|
|
690
963
|
}
|
|
691
964
|
|
|
692
965
|
/**
|
|
693
966
|
* @param {Object} arg - Arg object.
|
|
694
967
|
* @param {string} arg.id - Email provider id
|
|
968
|
+
* @returns {Promise<EmailProvider>} - Success response
|
|
695
969
|
* @summary: Get email provider by id
|
|
696
970
|
* @description: Get email provider by id
|
|
697
971
|
*/
|
|
698
|
-
getEmailProviderById({ id } = {}) {
|
|
972
|
+
async getEmailProviderById({ id } = {}) {
|
|
699
973
|
const { error } = CommunicationValidator.getEmailProviderById().validate(
|
|
700
974
|
{
|
|
701
975
|
id,
|
|
@@ -716,29 +990,50 @@ class Communication {
|
|
|
716
990
|
{ abortEarly: false, allowUnknown: false }
|
|
717
991
|
);
|
|
718
992
|
if (warrning) {
|
|
719
|
-
|
|
720
|
-
|
|
993
|
+
Logger({
|
|
994
|
+
level: "WARN",
|
|
995
|
+
message: "Parameter Validation warrnings for getEmailProviderById",
|
|
996
|
+
});
|
|
997
|
+
Logger({ level: "WARN", message: warrning });
|
|
721
998
|
}
|
|
722
999
|
|
|
723
1000
|
const query_params = {};
|
|
724
1001
|
|
|
725
|
-
|
|
1002
|
+
const response = await PlatformAPIClient.execute(
|
|
726
1003
|
this.config,
|
|
727
1004
|
"get",
|
|
728
1005
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
|
|
729
1006
|
query_params,
|
|
730
1007
|
undefined
|
|
731
1008
|
);
|
|
1009
|
+
|
|
1010
|
+
const {
|
|
1011
|
+
error: res_error,
|
|
1012
|
+
} = CommunicationModel.EmailProvider().validate(response, {
|
|
1013
|
+
abortEarly: false,
|
|
1014
|
+
allowUnknown: false,
|
|
1015
|
+
});
|
|
1016
|
+
|
|
1017
|
+
if (res_error) {
|
|
1018
|
+
Logger({
|
|
1019
|
+
level: "WARN",
|
|
1020
|
+
message: "Response Validation Warnnings for getEmailProviderById",
|
|
1021
|
+
});
|
|
1022
|
+
Logger({ level: "WARN", message: res_error });
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
return response;
|
|
732
1026
|
}
|
|
733
1027
|
|
|
734
1028
|
/**
|
|
735
1029
|
* @param {Object} arg - Arg object.
|
|
736
1030
|
* @param {string} arg.id - Email provider id
|
|
737
1031
|
* @param {EmailProviderReq} arg.body
|
|
1032
|
+
* @returns {Promise<EmailProvider>} - Success response
|
|
738
1033
|
* @summary: Update email provider by id
|
|
739
1034
|
* @description: Update email provider by id
|
|
740
1035
|
*/
|
|
741
|
-
updateEmailProviderById({ id, body } = {}) {
|
|
1036
|
+
async updateEmailProviderById({ id, body } = {}) {
|
|
742
1037
|
const { error } = CommunicationValidator.updateEmailProviderById().validate(
|
|
743
1038
|
{
|
|
744
1039
|
id,
|
|
@@ -761,19 +1056,39 @@ class Communication {
|
|
|
761
1056
|
{ abortEarly: false, allowUnknown: false }
|
|
762
1057
|
);
|
|
763
1058
|
if (warrning) {
|
|
764
|
-
|
|
765
|
-
|
|
1059
|
+
Logger({
|
|
1060
|
+
level: "WARN",
|
|
1061
|
+
message: "Parameter Validation warrnings for updateEmailProviderById",
|
|
1062
|
+
});
|
|
1063
|
+
Logger({ level: "WARN", message: warrning });
|
|
766
1064
|
}
|
|
767
1065
|
|
|
768
1066
|
const query_params = {};
|
|
769
1067
|
|
|
770
|
-
|
|
1068
|
+
const response = await PlatformAPIClient.execute(
|
|
771
1069
|
this.config,
|
|
772
1070
|
"put",
|
|
773
1071
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
|
|
774
1072
|
query_params,
|
|
775
1073
|
body
|
|
776
1074
|
);
|
|
1075
|
+
|
|
1076
|
+
const {
|
|
1077
|
+
error: res_error,
|
|
1078
|
+
} = CommunicationModel.EmailProvider().validate(response, {
|
|
1079
|
+
abortEarly: false,
|
|
1080
|
+
allowUnknown: false,
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
if (res_error) {
|
|
1084
|
+
Logger({
|
|
1085
|
+
level: "WARN",
|
|
1086
|
+
message: "Response Validation Warnnings for updateEmailProviderById",
|
|
1087
|
+
});
|
|
1088
|
+
Logger({ level: "WARN", message: res_error });
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
return response;
|
|
777
1092
|
}
|
|
778
1093
|
|
|
779
1094
|
/**
|
|
@@ -781,10 +1096,11 @@ class Communication {
|
|
|
781
1096
|
* @param {number} [arg.pageNo] - Current page no
|
|
782
1097
|
* @param {number} [arg.pageSize] - Current request items count
|
|
783
1098
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1099
|
+
* @returns {Promise<EmailTemplates>} - Success response
|
|
784
1100
|
* @summary: Get email templates
|
|
785
1101
|
* @description: Get email templates
|
|
786
1102
|
*/
|
|
787
|
-
getEmailTemplates({ pageNo, pageSize, sort } = {}) {
|
|
1103
|
+
async getEmailTemplates({ pageNo, pageSize, sort } = {}) {
|
|
788
1104
|
const { error } = CommunicationValidator.getEmailTemplates().validate(
|
|
789
1105
|
{
|
|
790
1106
|
pageNo,
|
|
@@ -809,8 +1125,11 @@ class Communication {
|
|
|
809
1125
|
{ abortEarly: false, allowUnknown: false }
|
|
810
1126
|
);
|
|
811
1127
|
if (warrning) {
|
|
812
|
-
|
|
813
|
-
|
|
1128
|
+
Logger({
|
|
1129
|
+
level: "WARN",
|
|
1130
|
+
message: "Parameter Validation warrnings for getEmailTemplates",
|
|
1131
|
+
});
|
|
1132
|
+
Logger({ level: "WARN", message: warrning });
|
|
814
1133
|
}
|
|
815
1134
|
|
|
816
1135
|
const query_params = {};
|
|
@@ -818,13 +1137,30 @@ class Communication {
|
|
|
818
1137
|
query_params["page_size"] = pageSize;
|
|
819
1138
|
query_params["sort"] = sort;
|
|
820
1139
|
|
|
821
|
-
|
|
1140
|
+
const response = await PlatformAPIClient.execute(
|
|
822
1141
|
this.config,
|
|
823
1142
|
"get",
|
|
824
1143
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates`,
|
|
825
1144
|
query_params,
|
|
826
1145
|
undefined
|
|
827
1146
|
);
|
|
1147
|
+
|
|
1148
|
+
const {
|
|
1149
|
+
error: res_error,
|
|
1150
|
+
} = CommunicationModel.EmailTemplates().validate(response, {
|
|
1151
|
+
abortEarly: false,
|
|
1152
|
+
allowUnknown: false,
|
|
1153
|
+
});
|
|
1154
|
+
|
|
1155
|
+
if (res_error) {
|
|
1156
|
+
Logger({
|
|
1157
|
+
level: "WARN",
|
|
1158
|
+
message: "Response Validation Warnnings for getEmailTemplates",
|
|
1159
|
+
});
|
|
1160
|
+
Logger({ level: "WARN", message: res_error });
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
return response;
|
|
828
1164
|
}
|
|
829
1165
|
|
|
830
1166
|
/**
|
|
@@ -867,10 +1203,11 @@ class Communication {
|
|
|
867
1203
|
/**
|
|
868
1204
|
* @param {Object} arg - Arg object.
|
|
869
1205
|
* @param {EmailTemplateReq} arg.body
|
|
1206
|
+
* @returns {Promise<EmailTemplateRes>} - Success response
|
|
870
1207
|
* @summary: Create email template
|
|
871
1208
|
* @description: Create email template
|
|
872
1209
|
*/
|
|
873
|
-
createEmailTemplate({ body } = {}) {
|
|
1210
|
+
async createEmailTemplate({ body } = {}) {
|
|
874
1211
|
const { error } = CommunicationValidator.createEmailTemplate().validate(
|
|
875
1212
|
{
|
|
876
1213
|
body,
|
|
@@ -891,19 +1228,39 @@ class Communication {
|
|
|
891
1228
|
{ abortEarly: false, allowUnknown: false }
|
|
892
1229
|
);
|
|
893
1230
|
if (warrning) {
|
|
894
|
-
|
|
895
|
-
|
|
1231
|
+
Logger({
|
|
1232
|
+
level: "WARN",
|
|
1233
|
+
message: "Parameter Validation warrnings for createEmailTemplate",
|
|
1234
|
+
});
|
|
1235
|
+
Logger({ level: "WARN", message: warrning });
|
|
896
1236
|
}
|
|
897
1237
|
|
|
898
1238
|
const query_params = {};
|
|
899
1239
|
|
|
900
|
-
|
|
1240
|
+
const response = await PlatformAPIClient.execute(
|
|
901
1241
|
this.config,
|
|
902
1242
|
"post",
|
|
903
1243
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates`,
|
|
904
1244
|
query_params,
|
|
905
1245
|
body
|
|
906
1246
|
);
|
|
1247
|
+
|
|
1248
|
+
const {
|
|
1249
|
+
error: res_error,
|
|
1250
|
+
} = CommunicationModel.EmailTemplateRes().validate(response, {
|
|
1251
|
+
abortEarly: false,
|
|
1252
|
+
allowUnknown: false,
|
|
1253
|
+
});
|
|
1254
|
+
|
|
1255
|
+
if (res_error) {
|
|
1256
|
+
Logger({
|
|
1257
|
+
level: "WARN",
|
|
1258
|
+
message: "Response Validation Warnnings for createEmailTemplate",
|
|
1259
|
+
});
|
|
1260
|
+
Logger({ level: "WARN", message: res_error });
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
return response;
|
|
907
1264
|
}
|
|
908
1265
|
|
|
909
1266
|
/**
|
|
@@ -911,10 +1268,11 @@ class Communication {
|
|
|
911
1268
|
* @param {number} [arg.pageNo] - Current page no
|
|
912
1269
|
* @param {number} [arg.pageSize] - Current request items count
|
|
913
1270
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1271
|
+
* @returns {Promise<SystemEmailTemplates>} - Success response
|
|
914
1272
|
* @summary: Get system email templates
|
|
915
1273
|
* @description: Get system email templates
|
|
916
1274
|
*/
|
|
917
|
-
getSystemEmailTemplates({ pageNo, pageSize, sort } = {}) {
|
|
1275
|
+
async getSystemEmailTemplates({ pageNo, pageSize, sort } = {}) {
|
|
918
1276
|
const { error } = CommunicationValidator.getSystemEmailTemplates().validate(
|
|
919
1277
|
{
|
|
920
1278
|
pageNo,
|
|
@@ -939,8 +1297,11 @@ class Communication {
|
|
|
939
1297
|
{ abortEarly: false, allowUnknown: false }
|
|
940
1298
|
);
|
|
941
1299
|
if (warrning) {
|
|
942
|
-
|
|
943
|
-
|
|
1300
|
+
Logger({
|
|
1301
|
+
level: "WARN",
|
|
1302
|
+
message: "Parameter Validation warrnings for getSystemEmailTemplates",
|
|
1303
|
+
});
|
|
1304
|
+
Logger({ level: "WARN", message: warrning });
|
|
944
1305
|
}
|
|
945
1306
|
|
|
946
1307
|
const query_params = {};
|
|
@@ -948,13 +1309,30 @@ class Communication {
|
|
|
948
1309
|
query_params["page_size"] = pageSize;
|
|
949
1310
|
query_params["sort"] = sort;
|
|
950
1311
|
|
|
951
|
-
|
|
1312
|
+
const response = await PlatformAPIClient.execute(
|
|
952
1313
|
this.config,
|
|
953
1314
|
"get",
|
|
954
1315
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/system-templates`,
|
|
955
1316
|
query_params,
|
|
956
1317
|
undefined
|
|
957
1318
|
);
|
|
1319
|
+
|
|
1320
|
+
const {
|
|
1321
|
+
error: res_error,
|
|
1322
|
+
} = CommunicationModel.SystemEmailTemplates().validate(response, {
|
|
1323
|
+
abortEarly: false,
|
|
1324
|
+
allowUnknown: false,
|
|
1325
|
+
});
|
|
1326
|
+
|
|
1327
|
+
if (res_error) {
|
|
1328
|
+
Logger({
|
|
1329
|
+
level: "WARN",
|
|
1330
|
+
message: "Response Validation Warnnings for getSystemEmailTemplates",
|
|
1331
|
+
});
|
|
1332
|
+
Logger({ level: "WARN", message: res_error });
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
return response;
|
|
958
1336
|
}
|
|
959
1337
|
|
|
960
1338
|
/**
|
|
@@ -997,10 +1375,11 @@ class Communication {
|
|
|
997
1375
|
/**
|
|
998
1376
|
* @param {Object} arg - Arg object.
|
|
999
1377
|
* @param {string} arg.id - Email template id
|
|
1378
|
+
* @returns {Promise<EmailTemplate>} - Success response
|
|
1000
1379
|
* @summary: Get email template by id
|
|
1001
1380
|
* @description: Get email template by id
|
|
1002
1381
|
*/
|
|
1003
|
-
getEmailTemplateById({ id } = {}) {
|
|
1382
|
+
async getEmailTemplateById({ id } = {}) {
|
|
1004
1383
|
const { error } = CommunicationValidator.getEmailTemplateById().validate(
|
|
1005
1384
|
{
|
|
1006
1385
|
id,
|
|
@@ -1021,29 +1400,50 @@ class Communication {
|
|
|
1021
1400
|
{ abortEarly: false, allowUnknown: false }
|
|
1022
1401
|
);
|
|
1023
1402
|
if (warrning) {
|
|
1024
|
-
|
|
1025
|
-
|
|
1403
|
+
Logger({
|
|
1404
|
+
level: "WARN",
|
|
1405
|
+
message: "Parameter Validation warrnings for getEmailTemplateById",
|
|
1406
|
+
});
|
|
1407
|
+
Logger({ level: "WARN", message: warrning });
|
|
1026
1408
|
}
|
|
1027
1409
|
|
|
1028
1410
|
const query_params = {};
|
|
1029
1411
|
|
|
1030
|
-
|
|
1412
|
+
const response = await PlatformAPIClient.execute(
|
|
1031
1413
|
this.config,
|
|
1032
1414
|
"get",
|
|
1033
1415
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
1034
1416
|
query_params,
|
|
1035
1417
|
undefined
|
|
1036
1418
|
);
|
|
1419
|
+
|
|
1420
|
+
const {
|
|
1421
|
+
error: res_error,
|
|
1422
|
+
} = CommunicationModel.EmailTemplate().validate(response, {
|
|
1423
|
+
abortEarly: false,
|
|
1424
|
+
allowUnknown: false,
|
|
1425
|
+
});
|
|
1426
|
+
|
|
1427
|
+
if (res_error) {
|
|
1428
|
+
Logger({
|
|
1429
|
+
level: "WARN",
|
|
1430
|
+
message: "Response Validation Warnnings for getEmailTemplateById",
|
|
1431
|
+
});
|
|
1432
|
+
Logger({ level: "WARN", message: res_error });
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
return response;
|
|
1037
1436
|
}
|
|
1038
1437
|
|
|
1039
1438
|
/**
|
|
1040
1439
|
* @param {Object} arg - Arg object.
|
|
1041
1440
|
* @param {string} arg.id - Email template id
|
|
1042
1441
|
* @param {EmailTemplateReq} arg.body
|
|
1442
|
+
* @returns {Promise<EmailTemplateRes>} - Success response
|
|
1043
1443
|
* @summary: Update email template by id
|
|
1044
1444
|
* @description: Update email template by id
|
|
1045
1445
|
*/
|
|
1046
|
-
updateEmailTemplateById({ id, body } = {}) {
|
|
1446
|
+
async updateEmailTemplateById({ id, body } = {}) {
|
|
1047
1447
|
const { error } = CommunicationValidator.updateEmailTemplateById().validate(
|
|
1048
1448
|
{
|
|
1049
1449
|
id,
|
|
@@ -1066,28 +1466,49 @@ class Communication {
|
|
|
1066
1466
|
{ abortEarly: false, allowUnknown: false }
|
|
1067
1467
|
);
|
|
1068
1468
|
if (warrning) {
|
|
1069
|
-
|
|
1070
|
-
|
|
1469
|
+
Logger({
|
|
1470
|
+
level: "WARN",
|
|
1471
|
+
message: "Parameter Validation warrnings for updateEmailTemplateById",
|
|
1472
|
+
});
|
|
1473
|
+
Logger({ level: "WARN", message: warrning });
|
|
1071
1474
|
}
|
|
1072
1475
|
|
|
1073
1476
|
const query_params = {};
|
|
1074
1477
|
|
|
1075
|
-
|
|
1478
|
+
const response = await PlatformAPIClient.execute(
|
|
1076
1479
|
this.config,
|
|
1077
1480
|
"put",
|
|
1078
1481
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
1079
1482
|
query_params,
|
|
1080
1483
|
body
|
|
1081
1484
|
);
|
|
1485
|
+
|
|
1486
|
+
const {
|
|
1487
|
+
error: res_error,
|
|
1488
|
+
} = CommunicationModel.EmailTemplateRes().validate(response, {
|
|
1489
|
+
abortEarly: false,
|
|
1490
|
+
allowUnknown: false,
|
|
1491
|
+
});
|
|
1492
|
+
|
|
1493
|
+
if (res_error) {
|
|
1494
|
+
Logger({
|
|
1495
|
+
level: "WARN",
|
|
1496
|
+
message: "Response Validation Warnnings for updateEmailTemplateById",
|
|
1497
|
+
});
|
|
1498
|
+
Logger({ level: "WARN", message: res_error });
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
return response;
|
|
1082
1502
|
}
|
|
1083
1503
|
|
|
1084
1504
|
/**
|
|
1085
1505
|
* @param {Object} arg - Arg object.
|
|
1086
1506
|
* @param {string} arg.id - Email template id
|
|
1507
|
+
* @returns {Promise<EmailTemplateDeleteSuccessRes>} - Success response
|
|
1087
1508
|
* @summary: Delete email template by id
|
|
1088
1509
|
* @description: Delete email template by id
|
|
1089
1510
|
*/
|
|
1090
|
-
deleteEmailTemplateById({ id } = {}) {
|
|
1511
|
+
async deleteEmailTemplateById({ id } = {}) {
|
|
1091
1512
|
const { error } = CommunicationValidator.deleteEmailTemplateById().validate(
|
|
1092
1513
|
{
|
|
1093
1514
|
id,
|
|
@@ -1108,28 +1529,49 @@ class Communication {
|
|
|
1108
1529
|
{ abortEarly: false, allowUnknown: false }
|
|
1109
1530
|
);
|
|
1110
1531
|
if (warrning) {
|
|
1111
|
-
|
|
1112
|
-
|
|
1532
|
+
Logger({
|
|
1533
|
+
level: "WARN",
|
|
1534
|
+
message: "Parameter Validation warrnings for deleteEmailTemplateById",
|
|
1535
|
+
});
|
|
1536
|
+
Logger({ level: "WARN", message: warrning });
|
|
1113
1537
|
}
|
|
1114
1538
|
|
|
1115
1539
|
const query_params = {};
|
|
1116
1540
|
|
|
1117
|
-
|
|
1541
|
+
const response = await PlatformAPIClient.execute(
|
|
1118
1542
|
this.config,
|
|
1119
1543
|
"delete",
|
|
1120
1544
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
1121
1545
|
query_params,
|
|
1122
1546
|
undefined
|
|
1123
1547
|
);
|
|
1548
|
+
|
|
1549
|
+
const {
|
|
1550
|
+
error: res_error,
|
|
1551
|
+
} = CommunicationModel.EmailTemplateDeleteSuccessRes().validate(response, {
|
|
1552
|
+
abortEarly: false,
|
|
1553
|
+
allowUnknown: false,
|
|
1554
|
+
});
|
|
1555
|
+
|
|
1556
|
+
if (res_error) {
|
|
1557
|
+
Logger({
|
|
1558
|
+
level: "WARN",
|
|
1559
|
+
message: "Response Validation Warnnings for deleteEmailTemplateById",
|
|
1560
|
+
});
|
|
1561
|
+
Logger({ level: "WARN", message: res_error });
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
return response;
|
|
1124
1565
|
}
|
|
1125
1566
|
|
|
1126
1567
|
/**
|
|
1127
1568
|
* @param {Object} arg - Arg object.
|
|
1128
1569
|
* @param {EngineRequest} arg.body
|
|
1570
|
+
* @returns {Promise<EngineResponse>} - Success response
|
|
1129
1571
|
* @summary: Send email or sms synchronously
|
|
1130
1572
|
* @description: Send email or sms synchronously
|
|
1131
1573
|
*/
|
|
1132
|
-
sendCommunicationSynchronously({ body } = {}) {
|
|
1574
|
+
async sendCommunicationSynchronously({ body } = {}) {
|
|
1133
1575
|
const {
|
|
1134
1576
|
error,
|
|
1135
1577
|
} = CommunicationValidator.sendCommunicationSynchronously().validate(
|
|
@@ -1152,30 +1594,51 @@ class Communication {
|
|
|
1152
1594
|
{ abortEarly: false, allowUnknown: false }
|
|
1153
1595
|
);
|
|
1154
1596
|
if (warrning) {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1597
|
+
Logger({
|
|
1598
|
+
level: "WARN",
|
|
1599
|
+
message:
|
|
1600
|
+
"Parameter Validation warrnings for sendCommunicationSynchronously",
|
|
1601
|
+
});
|
|
1602
|
+
Logger({ level: "WARN", message: warrning });
|
|
1159
1603
|
}
|
|
1160
1604
|
|
|
1161
1605
|
const query_params = {};
|
|
1162
1606
|
|
|
1163
|
-
|
|
1607
|
+
const response = await PlatformAPIClient.execute(
|
|
1164
1608
|
this.config,
|
|
1165
1609
|
"post",
|
|
1166
1610
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/engine/send-instant`,
|
|
1167
1611
|
query_params,
|
|
1168
1612
|
body
|
|
1169
1613
|
);
|
|
1614
|
+
|
|
1615
|
+
const {
|
|
1616
|
+
error: res_error,
|
|
1617
|
+
} = CommunicationModel.EngineResponse().validate(response, {
|
|
1618
|
+
abortEarly: false,
|
|
1619
|
+
allowUnknown: false,
|
|
1620
|
+
});
|
|
1621
|
+
|
|
1622
|
+
if (res_error) {
|
|
1623
|
+
Logger({
|
|
1624
|
+
level: "WARN",
|
|
1625
|
+
message:
|
|
1626
|
+
"Response Validation Warnnings for sendCommunicationSynchronously",
|
|
1627
|
+
});
|
|
1628
|
+
Logger({ level: "WARN", message: res_error });
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
return response;
|
|
1170
1632
|
}
|
|
1171
1633
|
|
|
1172
1634
|
/**
|
|
1173
1635
|
* @param {Object} arg - Arg object.
|
|
1174
1636
|
* @param {EngineRequest} arg.body
|
|
1637
|
+
* @returns {Promise<EngineResponse>} - Success response
|
|
1175
1638
|
* @summary: Send email or sms asynchronously
|
|
1176
1639
|
* @description: Send email or sms asynchronously
|
|
1177
1640
|
*/
|
|
1178
|
-
sendCommunicationAsynchronously({ body } = {}) {
|
|
1641
|
+
async sendCommunicationAsynchronously({ body } = {}) {
|
|
1179
1642
|
const {
|
|
1180
1643
|
error,
|
|
1181
1644
|
} = CommunicationValidator.sendCommunicationAsynchronously().validate(
|
|
@@ -1198,21 +1661,41 @@ class Communication {
|
|
|
1198
1661
|
{ abortEarly: false, allowUnknown: false }
|
|
1199
1662
|
);
|
|
1200
1663
|
if (warrning) {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1664
|
+
Logger({
|
|
1665
|
+
level: "WARN",
|
|
1666
|
+
message:
|
|
1667
|
+
"Parameter Validation warrnings for sendCommunicationAsynchronously",
|
|
1668
|
+
});
|
|
1669
|
+
Logger({ level: "WARN", message: warrning });
|
|
1205
1670
|
}
|
|
1206
1671
|
|
|
1207
1672
|
const query_params = {};
|
|
1208
1673
|
|
|
1209
|
-
|
|
1674
|
+
const response = await PlatformAPIClient.execute(
|
|
1210
1675
|
this.config,
|
|
1211
1676
|
"post",
|
|
1212
1677
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/engine/send-async`,
|
|
1213
1678
|
query_params,
|
|
1214
1679
|
body
|
|
1215
1680
|
);
|
|
1681
|
+
|
|
1682
|
+
const {
|
|
1683
|
+
error: res_error,
|
|
1684
|
+
} = CommunicationModel.EngineResponse().validate(response, {
|
|
1685
|
+
abortEarly: false,
|
|
1686
|
+
allowUnknown: false,
|
|
1687
|
+
});
|
|
1688
|
+
|
|
1689
|
+
if (res_error) {
|
|
1690
|
+
Logger({
|
|
1691
|
+
level: "WARN",
|
|
1692
|
+
message:
|
|
1693
|
+
"Response Validation Warnnings for sendCommunicationAsynchronously",
|
|
1694
|
+
});
|
|
1695
|
+
Logger({ level: "WARN", message: res_error });
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
return response;
|
|
1216
1699
|
}
|
|
1217
1700
|
|
|
1218
1701
|
/**
|
|
@@ -1220,10 +1703,11 @@ class Communication {
|
|
|
1220
1703
|
* @param {number} [arg.pageNo] - Current page no
|
|
1221
1704
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1222
1705
|
* @param {string} [arg.populate] - Populate fields
|
|
1706
|
+
* @returns {Promise<EventSubscriptions>} - Success response
|
|
1223
1707
|
* @summary: Get event subscriptions
|
|
1224
1708
|
* @description: Get event subscriptions
|
|
1225
1709
|
*/
|
|
1226
|
-
getEventSubscriptions({ pageNo, pageSize, populate } = {}) {
|
|
1710
|
+
async getEventSubscriptions({ pageNo, pageSize, populate } = {}) {
|
|
1227
1711
|
const { error } = CommunicationValidator.getEventSubscriptions().validate(
|
|
1228
1712
|
{
|
|
1229
1713
|
pageNo,
|
|
@@ -1248,8 +1732,11 @@ class Communication {
|
|
|
1248
1732
|
{ abortEarly: false, allowUnknown: false }
|
|
1249
1733
|
);
|
|
1250
1734
|
if (warrning) {
|
|
1251
|
-
|
|
1252
|
-
|
|
1735
|
+
Logger({
|
|
1736
|
+
level: "WARN",
|
|
1737
|
+
message: "Parameter Validation warrnings for getEventSubscriptions",
|
|
1738
|
+
});
|
|
1739
|
+
Logger({ level: "WARN", message: warrning });
|
|
1253
1740
|
}
|
|
1254
1741
|
|
|
1255
1742
|
const query_params = {};
|
|
@@ -1257,13 +1744,30 @@ class Communication {
|
|
|
1257
1744
|
query_params["page_size"] = pageSize;
|
|
1258
1745
|
query_params["populate"] = populate;
|
|
1259
1746
|
|
|
1260
|
-
|
|
1747
|
+
const response = await PlatformAPIClient.execute(
|
|
1261
1748
|
this.config,
|
|
1262
1749
|
"get",
|
|
1263
1750
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/event/event-subscriptions`,
|
|
1264
1751
|
query_params,
|
|
1265
1752
|
undefined
|
|
1266
1753
|
);
|
|
1754
|
+
|
|
1755
|
+
const {
|
|
1756
|
+
error: res_error,
|
|
1757
|
+
} = CommunicationModel.EventSubscriptions().validate(response, {
|
|
1758
|
+
abortEarly: false,
|
|
1759
|
+
allowUnknown: false,
|
|
1760
|
+
});
|
|
1761
|
+
|
|
1762
|
+
if (res_error) {
|
|
1763
|
+
Logger({
|
|
1764
|
+
level: "WARN",
|
|
1765
|
+
message: "Response Validation Warnnings for getEventSubscriptions",
|
|
1766
|
+
});
|
|
1767
|
+
Logger({ level: "WARN", message: res_error });
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
return response;
|
|
1267
1771
|
}
|
|
1268
1772
|
|
|
1269
1773
|
/**
|
|
@@ -1308,10 +1812,11 @@ class Communication {
|
|
|
1308
1812
|
* @param {number} [arg.pageNo] - Current page no
|
|
1309
1813
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1310
1814
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1815
|
+
* @returns {Promise<Jobs>} - Success response
|
|
1311
1816
|
* @summary: Get jobs
|
|
1312
1817
|
* @description: Get jobs
|
|
1313
1818
|
*/
|
|
1314
|
-
getJobs({ pageNo, pageSize, sort } = {}) {
|
|
1819
|
+
async getJobs({ pageNo, pageSize, sort } = {}) {
|
|
1315
1820
|
const { error } = CommunicationValidator.getJobs().validate(
|
|
1316
1821
|
{
|
|
1317
1822
|
pageNo,
|
|
@@ -1334,8 +1839,11 @@ class Communication {
|
|
|
1334
1839
|
{ abortEarly: false, allowUnknown: false }
|
|
1335
1840
|
);
|
|
1336
1841
|
if (warrning) {
|
|
1337
|
-
|
|
1338
|
-
|
|
1842
|
+
Logger({
|
|
1843
|
+
level: "WARN",
|
|
1844
|
+
message: "Parameter Validation warrnings for getJobs",
|
|
1845
|
+
});
|
|
1846
|
+
Logger({ level: "WARN", message: warrning });
|
|
1339
1847
|
}
|
|
1340
1848
|
|
|
1341
1849
|
const query_params = {};
|
|
@@ -1343,13 +1851,28 @@ class Communication {
|
|
|
1343
1851
|
query_params["page_size"] = pageSize;
|
|
1344
1852
|
query_params["sort"] = sort;
|
|
1345
1853
|
|
|
1346
|
-
|
|
1854
|
+
const response = await PlatformAPIClient.execute(
|
|
1347
1855
|
this.config,
|
|
1348
1856
|
"get",
|
|
1349
1857
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/jobs`,
|
|
1350
1858
|
query_params,
|
|
1351
1859
|
undefined
|
|
1352
1860
|
);
|
|
1861
|
+
|
|
1862
|
+
const { error: res_error } = CommunicationModel.Jobs().validate(response, {
|
|
1863
|
+
abortEarly: false,
|
|
1864
|
+
allowUnknown: false,
|
|
1865
|
+
});
|
|
1866
|
+
|
|
1867
|
+
if (res_error) {
|
|
1868
|
+
Logger({
|
|
1869
|
+
level: "WARN",
|
|
1870
|
+
message: "Response Validation Warnnings for getJobs",
|
|
1871
|
+
});
|
|
1872
|
+
Logger({ level: "WARN", message: res_error });
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
return response;
|
|
1353
1876
|
}
|
|
1354
1877
|
|
|
1355
1878
|
/**
|
|
@@ -1387,10 +1910,11 @@ class Communication {
|
|
|
1387
1910
|
/**
|
|
1388
1911
|
* @param {Object} arg - Arg object.
|
|
1389
1912
|
* @param {TriggerJobRequest} arg.body
|
|
1913
|
+
* @returns {Promise<TriggerJobResponse>} - Success response
|
|
1390
1914
|
* @summary: Trigger campaign job
|
|
1391
1915
|
* @description: Trigger campaign job
|
|
1392
1916
|
*/
|
|
1393
|
-
triggerCampaignJob({ body } = {}) {
|
|
1917
|
+
async triggerCampaignJob({ body } = {}) {
|
|
1394
1918
|
const { error } = CommunicationValidator.triggerCampaignJob().validate(
|
|
1395
1919
|
{
|
|
1396
1920
|
body,
|
|
@@ -1411,19 +1935,39 @@ class Communication {
|
|
|
1411
1935
|
{ abortEarly: false, allowUnknown: false }
|
|
1412
1936
|
);
|
|
1413
1937
|
if (warrning) {
|
|
1414
|
-
|
|
1415
|
-
|
|
1938
|
+
Logger({
|
|
1939
|
+
level: "WARN",
|
|
1940
|
+
message: "Parameter Validation warrnings for triggerCampaignJob",
|
|
1941
|
+
});
|
|
1942
|
+
Logger({ level: "WARN", message: warrning });
|
|
1416
1943
|
}
|
|
1417
1944
|
|
|
1418
1945
|
const query_params = {};
|
|
1419
1946
|
|
|
1420
|
-
|
|
1947
|
+
const response = await PlatformAPIClient.execute(
|
|
1421
1948
|
this.config,
|
|
1422
1949
|
"post",
|
|
1423
1950
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/trigger-job`,
|
|
1424
1951
|
query_params,
|
|
1425
1952
|
body
|
|
1426
1953
|
);
|
|
1954
|
+
|
|
1955
|
+
const {
|
|
1956
|
+
error: res_error,
|
|
1957
|
+
} = CommunicationModel.TriggerJobResponse().validate(response, {
|
|
1958
|
+
abortEarly: false,
|
|
1959
|
+
allowUnknown: false,
|
|
1960
|
+
});
|
|
1961
|
+
|
|
1962
|
+
if (res_error) {
|
|
1963
|
+
Logger({
|
|
1964
|
+
level: "WARN",
|
|
1965
|
+
message: "Response Validation Warnnings for triggerCampaignJob",
|
|
1966
|
+
});
|
|
1967
|
+
Logger({ level: "WARN", message: res_error });
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
return response;
|
|
1427
1971
|
}
|
|
1428
1972
|
|
|
1429
1973
|
/**
|
|
@@ -1431,10 +1975,11 @@ class Communication {
|
|
|
1431
1975
|
* @param {number} [arg.pageNo] - Current page no
|
|
1432
1976
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1433
1977
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1978
|
+
* @returns {Promise<JobLogs>} - Success response
|
|
1434
1979
|
* @summary: Get job logs
|
|
1435
1980
|
* @description: Get job logs
|
|
1436
1981
|
*/
|
|
1437
|
-
getJobLogs({ pageNo, pageSize, sort } = {}) {
|
|
1982
|
+
async getJobLogs({ pageNo, pageSize, sort } = {}) {
|
|
1438
1983
|
const { error } = CommunicationValidator.getJobLogs().validate(
|
|
1439
1984
|
{
|
|
1440
1985
|
pageNo,
|
|
@@ -1457,8 +2002,11 @@ class Communication {
|
|
|
1457
2002
|
{ abortEarly: false, allowUnknown: false }
|
|
1458
2003
|
);
|
|
1459
2004
|
if (warrning) {
|
|
1460
|
-
|
|
1461
|
-
|
|
2005
|
+
Logger({
|
|
2006
|
+
level: "WARN",
|
|
2007
|
+
message: "Parameter Validation warrnings for getJobLogs",
|
|
2008
|
+
});
|
|
2009
|
+
Logger({ level: "WARN", message: warrning });
|
|
1462
2010
|
}
|
|
1463
2011
|
|
|
1464
2012
|
const query_params = {};
|
|
@@ -1466,13 +2014,28 @@ class Communication {
|
|
|
1466
2014
|
query_params["page_size"] = pageSize;
|
|
1467
2015
|
query_params["sort"] = sort;
|
|
1468
2016
|
|
|
1469
|
-
|
|
2017
|
+
const response = await PlatformAPIClient.execute(
|
|
1470
2018
|
this.config,
|
|
1471
2019
|
"get",
|
|
1472
2020
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/logs`,
|
|
1473
2021
|
query_params,
|
|
1474
2022
|
undefined
|
|
1475
2023
|
);
|
|
2024
|
+
|
|
2025
|
+
const { error: res_error } = CommunicationModel.JobLogs().validate(
|
|
2026
|
+
response,
|
|
2027
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2028
|
+
);
|
|
2029
|
+
|
|
2030
|
+
if (res_error) {
|
|
2031
|
+
Logger({
|
|
2032
|
+
level: "WARN",
|
|
2033
|
+
message: "Response Validation Warnnings for getJobLogs",
|
|
2034
|
+
});
|
|
2035
|
+
Logger({ level: "WARN", message: res_error });
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
return response;
|
|
1476
2039
|
}
|
|
1477
2040
|
|
|
1478
2041
|
/**
|
|
@@ -1513,10 +2076,11 @@ class Communication {
|
|
|
1513
2076
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1514
2077
|
* @param {Object} [arg.sort] - To sort based on _id
|
|
1515
2078
|
* @param {Object} [arg.query] -
|
|
2079
|
+
* @returns {Promise<Logs>} - Success response
|
|
1516
2080
|
* @summary: Get communication logs
|
|
1517
2081
|
* @description: Get communication logs
|
|
1518
2082
|
*/
|
|
1519
|
-
getCommunicationLogs({ pageId, pageSize, sort, query } = {}) {
|
|
2083
|
+
async getCommunicationLogs({ pageId, pageSize, sort, query } = {}) {
|
|
1520
2084
|
const { error } = CommunicationValidator.getCommunicationLogs().validate(
|
|
1521
2085
|
{
|
|
1522
2086
|
pageId,
|
|
@@ -1543,8 +2107,11 @@ class Communication {
|
|
|
1543
2107
|
{ abortEarly: false, allowUnknown: false }
|
|
1544
2108
|
);
|
|
1545
2109
|
if (warrning) {
|
|
1546
|
-
|
|
1547
|
-
|
|
2110
|
+
Logger({
|
|
2111
|
+
level: "WARN",
|
|
2112
|
+
message: "Parameter Validation warrnings for getCommunicationLogs",
|
|
2113
|
+
});
|
|
2114
|
+
Logger({ level: "WARN", message: warrning });
|
|
1548
2115
|
}
|
|
1549
2116
|
|
|
1550
2117
|
const query_params = {};
|
|
@@ -1553,13 +2120,28 @@ class Communication {
|
|
|
1553
2120
|
query_params["sort"] = sort;
|
|
1554
2121
|
query_params["query"] = query;
|
|
1555
2122
|
|
|
1556
|
-
|
|
2123
|
+
const response = await PlatformAPIClient.execute(
|
|
1557
2124
|
this.config,
|
|
1558
2125
|
"get",
|
|
1559
2126
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/log`,
|
|
1560
2127
|
query_params,
|
|
1561
2128
|
undefined
|
|
1562
2129
|
);
|
|
2130
|
+
|
|
2131
|
+
const { error: res_error } = CommunicationModel.Logs().validate(response, {
|
|
2132
|
+
abortEarly: false,
|
|
2133
|
+
allowUnknown: false,
|
|
2134
|
+
});
|
|
2135
|
+
|
|
2136
|
+
if (res_error) {
|
|
2137
|
+
Logger({
|
|
2138
|
+
level: "WARN",
|
|
2139
|
+
message: "Response Validation Warnnings for getCommunicationLogs",
|
|
2140
|
+
});
|
|
2141
|
+
Logger({ level: "WARN", message: res_error });
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
return response;
|
|
1563
2145
|
}
|
|
1564
2146
|
|
|
1565
2147
|
/**
|
|
@@ -1605,10 +2187,11 @@ class Communication {
|
|
|
1605
2187
|
/**
|
|
1606
2188
|
* @param {Object} arg - Arg object.
|
|
1607
2189
|
* @param {SendOtpCommsReq} arg.body
|
|
2190
|
+
* @returns {Promise<SendOtpCommsRes>} - Success response
|
|
1608
2191
|
* @summary: Send OTP using email and sms
|
|
1609
2192
|
* @description: Send OTP Comms via email and sms
|
|
1610
2193
|
*/
|
|
1611
|
-
sendOtp({ body } = {}) {
|
|
2194
|
+
async sendOtp({ body } = {}) {
|
|
1612
2195
|
const { error } = CommunicationValidator.sendOtp().validate(
|
|
1613
2196
|
{
|
|
1614
2197
|
body,
|
|
@@ -1627,28 +2210,49 @@ class Communication {
|
|
|
1627
2210
|
{ abortEarly: false, allowUnknown: false }
|
|
1628
2211
|
);
|
|
1629
2212
|
if (warrning) {
|
|
1630
|
-
|
|
1631
|
-
|
|
2213
|
+
Logger({
|
|
2214
|
+
level: "WARN",
|
|
2215
|
+
message: "Parameter Validation warrnings for sendOtp",
|
|
2216
|
+
});
|
|
2217
|
+
Logger({ level: "WARN", message: warrning });
|
|
1632
2218
|
}
|
|
1633
2219
|
|
|
1634
2220
|
const query_params = {};
|
|
1635
2221
|
|
|
1636
|
-
|
|
2222
|
+
const response = await PlatformAPIClient.execute(
|
|
1637
2223
|
this.config,
|
|
1638
2224
|
"post",
|
|
1639
2225
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/otp/send-otp-comms`,
|
|
1640
2226
|
query_params,
|
|
1641
2227
|
body
|
|
1642
2228
|
);
|
|
2229
|
+
|
|
2230
|
+
const {
|
|
2231
|
+
error: res_error,
|
|
2232
|
+
} = CommunicationModel.SendOtpCommsRes().validate(response, {
|
|
2233
|
+
abortEarly: false,
|
|
2234
|
+
allowUnknown: false,
|
|
2235
|
+
});
|
|
2236
|
+
|
|
2237
|
+
if (res_error) {
|
|
2238
|
+
Logger({
|
|
2239
|
+
level: "WARN",
|
|
2240
|
+
message: "Response Validation Warnnings for sendOtp",
|
|
2241
|
+
});
|
|
2242
|
+
Logger({ level: "WARN", message: res_error });
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
return response;
|
|
1643
2246
|
}
|
|
1644
2247
|
|
|
1645
2248
|
/**
|
|
1646
2249
|
* @param {Object} arg - Arg object.
|
|
1647
2250
|
* @param {VerifyOtpCommsReq} arg.body
|
|
2251
|
+
* @returns {Promise<VerifyOtpCommsSuccessRes>} - Success response
|
|
1648
2252
|
* @summary: Verify OTP sent via email and sms
|
|
1649
2253
|
* @description: Verify OTP sent via email and sms
|
|
1650
2254
|
*/
|
|
1651
|
-
verfiyOtp({ body } = {}) {
|
|
2255
|
+
async verfiyOtp({ body } = {}) {
|
|
1652
2256
|
const { error } = CommunicationValidator.verfiyOtp().validate(
|
|
1653
2257
|
{
|
|
1654
2258
|
body,
|
|
@@ -1667,19 +2271,39 @@ class Communication {
|
|
|
1667
2271
|
{ abortEarly: false, allowUnknown: false }
|
|
1668
2272
|
);
|
|
1669
2273
|
if (warrning) {
|
|
1670
|
-
|
|
1671
|
-
|
|
2274
|
+
Logger({
|
|
2275
|
+
level: "WARN",
|
|
2276
|
+
message: "Parameter Validation warrnings for verfiyOtp",
|
|
2277
|
+
});
|
|
2278
|
+
Logger({ level: "WARN", message: warrning });
|
|
1672
2279
|
}
|
|
1673
2280
|
|
|
1674
2281
|
const query_params = {};
|
|
1675
2282
|
|
|
1676
|
-
|
|
2283
|
+
const response = await PlatformAPIClient.execute(
|
|
1677
2284
|
this.config,
|
|
1678
2285
|
"post",
|
|
1679
2286
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/otp/verify-otp-comms`,
|
|
1680
2287
|
query_params,
|
|
1681
2288
|
body
|
|
1682
2289
|
);
|
|
2290
|
+
|
|
2291
|
+
const {
|
|
2292
|
+
error: res_error,
|
|
2293
|
+
} = CommunicationModel.VerifyOtpCommsSuccessRes().validate(response, {
|
|
2294
|
+
abortEarly: false,
|
|
2295
|
+
allowUnknown: false,
|
|
2296
|
+
});
|
|
2297
|
+
|
|
2298
|
+
if (res_error) {
|
|
2299
|
+
Logger({
|
|
2300
|
+
level: "WARN",
|
|
2301
|
+
message: "Response Validation Warnnings for verfiyOtp",
|
|
2302
|
+
});
|
|
2303
|
+
Logger({ level: "WARN", message: res_error });
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
return response;
|
|
1683
2307
|
}
|
|
1684
2308
|
|
|
1685
2309
|
/**
|
|
@@ -1687,10 +2311,11 @@ class Communication {
|
|
|
1687
2311
|
* @param {number} [arg.pageNo] - Current page no
|
|
1688
2312
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1689
2313
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2314
|
+
* @returns {Promise<SmsProviders>} - Success response
|
|
1690
2315
|
* @summary: Get sms providers
|
|
1691
2316
|
* @description: Get sms providers
|
|
1692
2317
|
*/
|
|
1693
|
-
getSmsProviders({ pageNo, pageSize, sort } = {}) {
|
|
2318
|
+
async getSmsProviders({ pageNo, pageSize, sort } = {}) {
|
|
1694
2319
|
const { error } = CommunicationValidator.getSmsProviders().validate(
|
|
1695
2320
|
{
|
|
1696
2321
|
pageNo,
|
|
@@ -1715,8 +2340,11 @@ class Communication {
|
|
|
1715
2340
|
{ abortEarly: false, allowUnknown: false }
|
|
1716
2341
|
);
|
|
1717
2342
|
if (warrning) {
|
|
1718
|
-
|
|
1719
|
-
|
|
2343
|
+
Logger({
|
|
2344
|
+
level: "WARN",
|
|
2345
|
+
message: "Parameter Validation warrnings for getSmsProviders",
|
|
2346
|
+
});
|
|
2347
|
+
Logger({ level: "WARN", message: warrning });
|
|
1720
2348
|
}
|
|
1721
2349
|
|
|
1722
2350
|
const query_params = {};
|
|
@@ -1724,13 +2352,30 @@ class Communication {
|
|
|
1724
2352
|
query_params["page_size"] = pageSize;
|
|
1725
2353
|
query_params["sort"] = sort;
|
|
1726
2354
|
|
|
1727
|
-
|
|
2355
|
+
const response = await PlatformAPIClient.execute(
|
|
1728
2356
|
this.config,
|
|
1729
2357
|
"get",
|
|
1730
2358
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers`,
|
|
1731
2359
|
query_params,
|
|
1732
2360
|
undefined
|
|
1733
2361
|
);
|
|
2362
|
+
|
|
2363
|
+
const {
|
|
2364
|
+
error: res_error,
|
|
2365
|
+
} = CommunicationModel.SmsProviders().validate(response, {
|
|
2366
|
+
abortEarly: false,
|
|
2367
|
+
allowUnknown: false,
|
|
2368
|
+
});
|
|
2369
|
+
|
|
2370
|
+
if (res_error) {
|
|
2371
|
+
Logger({
|
|
2372
|
+
level: "WARN",
|
|
2373
|
+
message: "Response Validation Warnnings for getSmsProviders",
|
|
2374
|
+
});
|
|
2375
|
+
Logger({ level: "WARN", message: res_error });
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
return response;
|
|
1734
2379
|
}
|
|
1735
2380
|
|
|
1736
2381
|
/**
|
|
@@ -1768,10 +2413,11 @@ class Communication {
|
|
|
1768
2413
|
/**
|
|
1769
2414
|
* @param {Object} arg - Arg object.
|
|
1770
2415
|
* @param {SmsProviderReq} arg.body
|
|
2416
|
+
* @returns {Promise<SmsProvider>} - Success response
|
|
1771
2417
|
* @summary: Create sms provider
|
|
1772
2418
|
* @description: Create sms provider
|
|
1773
2419
|
*/
|
|
1774
|
-
createSmsProvider({ body } = {}) {
|
|
2420
|
+
async createSmsProvider({ body } = {}) {
|
|
1775
2421
|
const { error } = CommunicationValidator.createSmsProvider().validate(
|
|
1776
2422
|
{
|
|
1777
2423
|
body,
|
|
@@ -1792,28 +2438,49 @@ class Communication {
|
|
|
1792
2438
|
{ abortEarly: false, allowUnknown: false }
|
|
1793
2439
|
);
|
|
1794
2440
|
if (warrning) {
|
|
1795
|
-
|
|
1796
|
-
|
|
2441
|
+
Logger({
|
|
2442
|
+
level: "WARN",
|
|
2443
|
+
message: "Parameter Validation warrnings for createSmsProvider",
|
|
2444
|
+
});
|
|
2445
|
+
Logger({ level: "WARN", message: warrning });
|
|
1797
2446
|
}
|
|
1798
2447
|
|
|
1799
2448
|
const query_params = {};
|
|
1800
2449
|
|
|
1801
|
-
|
|
2450
|
+
const response = await PlatformAPIClient.execute(
|
|
1802
2451
|
this.config,
|
|
1803
2452
|
"post",
|
|
1804
2453
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers`,
|
|
1805
2454
|
query_params,
|
|
1806
2455
|
body
|
|
1807
2456
|
);
|
|
2457
|
+
|
|
2458
|
+
const {
|
|
2459
|
+
error: res_error,
|
|
2460
|
+
} = CommunicationModel.SmsProvider().validate(response, {
|
|
2461
|
+
abortEarly: false,
|
|
2462
|
+
allowUnknown: false,
|
|
2463
|
+
});
|
|
2464
|
+
|
|
2465
|
+
if (res_error) {
|
|
2466
|
+
Logger({
|
|
2467
|
+
level: "WARN",
|
|
2468
|
+
message: "Response Validation Warnnings for createSmsProvider",
|
|
2469
|
+
});
|
|
2470
|
+
Logger({ level: "WARN", message: res_error });
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
return response;
|
|
1808
2474
|
}
|
|
1809
2475
|
|
|
1810
2476
|
/**
|
|
1811
2477
|
* @param {Object} arg - Arg object.
|
|
1812
2478
|
* @param {string} arg.id - Sms provider id
|
|
2479
|
+
* @returns {Promise<SmsProvider>} - Success response
|
|
1813
2480
|
* @summary: Get sms provider by id
|
|
1814
2481
|
* @description: Get sms provider by id
|
|
1815
2482
|
*/
|
|
1816
|
-
getSmsProviderById({ id } = {}) {
|
|
2483
|
+
async getSmsProviderById({ id } = {}) {
|
|
1817
2484
|
const { error } = CommunicationValidator.getSmsProviderById().validate(
|
|
1818
2485
|
{
|
|
1819
2486
|
id,
|
|
@@ -1834,29 +2501,50 @@ class Communication {
|
|
|
1834
2501
|
{ abortEarly: false, allowUnknown: false }
|
|
1835
2502
|
);
|
|
1836
2503
|
if (warrning) {
|
|
1837
|
-
|
|
1838
|
-
|
|
2504
|
+
Logger({
|
|
2505
|
+
level: "WARN",
|
|
2506
|
+
message: "Parameter Validation warrnings for getSmsProviderById",
|
|
2507
|
+
});
|
|
2508
|
+
Logger({ level: "WARN", message: warrning });
|
|
1839
2509
|
}
|
|
1840
2510
|
|
|
1841
2511
|
const query_params = {};
|
|
1842
2512
|
|
|
1843
|
-
|
|
2513
|
+
const response = await PlatformAPIClient.execute(
|
|
1844
2514
|
this.config,
|
|
1845
2515
|
"get",
|
|
1846
2516
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers/${id}`,
|
|
1847
2517
|
query_params,
|
|
1848
2518
|
undefined
|
|
1849
2519
|
);
|
|
2520
|
+
|
|
2521
|
+
const {
|
|
2522
|
+
error: res_error,
|
|
2523
|
+
} = CommunicationModel.SmsProvider().validate(response, {
|
|
2524
|
+
abortEarly: false,
|
|
2525
|
+
allowUnknown: false,
|
|
2526
|
+
});
|
|
2527
|
+
|
|
2528
|
+
if (res_error) {
|
|
2529
|
+
Logger({
|
|
2530
|
+
level: "WARN",
|
|
2531
|
+
message: "Response Validation Warnnings for getSmsProviderById",
|
|
2532
|
+
});
|
|
2533
|
+
Logger({ level: "WARN", message: res_error });
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
return response;
|
|
1850
2537
|
}
|
|
1851
2538
|
|
|
1852
2539
|
/**
|
|
1853
2540
|
* @param {Object} arg - Arg object.
|
|
1854
2541
|
* @param {string} arg.id - Sms provider id
|
|
1855
2542
|
* @param {SmsProviderReq} arg.body
|
|
2543
|
+
* @returns {Promise<SmsProvider>} - Success response
|
|
1856
2544
|
* @summary: Update sms provider by id
|
|
1857
2545
|
* @description: Update sms provider by id
|
|
1858
2546
|
*/
|
|
1859
|
-
updateSmsProviderById({ id, body } = {}) {
|
|
2547
|
+
async updateSmsProviderById({ id, body } = {}) {
|
|
1860
2548
|
const { error } = CommunicationValidator.updateSmsProviderById().validate(
|
|
1861
2549
|
{
|
|
1862
2550
|
id,
|
|
@@ -1879,19 +2567,39 @@ class Communication {
|
|
|
1879
2567
|
{ abortEarly: false, allowUnknown: false }
|
|
1880
2568
|
);
|
|
1881
2569
|
if (warrning) {
|
|
1882
|
-
|
|
1883
|
-
|
|
2570
|
+
Logger({
|
|
2571
|
+
level: "WARN",
|
|
2572
|
+
message: "Parameter Validation warrnings for updateSmsProviderById",
|
|
2573
|
+
});
|
|
2574
|
+
Logger({ level: "WARN", message: warrning });
|
|
1884
2575
|
}
|
|
1885
2576
|
|
|
1886
2577
|
const query_params = {};
|
|
1887
2578
|
|
|
1888
|
-
|
|
2579
|
+
const response = await PlatformAPIClient.execute(
|
|
1889
2580
|
this.config,
|
|
1890
2581
|
"put",
|
|
1891
2582
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers/${id}`,
|
|
1892
2583
|
query_params,
|
|
1893
2584
|
body
|
|
1894
2585
|
);
|
|
2586
|
+
|
|
2587
|
+
const {
|
|
2588
|
+
error: res_error,
|
|
2589
|
+
} = CommunicationModel.SmsProvider().validate(response, {
|
|
2590
|
+
abortEarly: false,
|
|
2591
|
+
allowUnknown: false,
|
|
2592
|
+
});
|
|
2593
|
+
|
|
2594
|
+
if (res_error) {
|
|
2595
|
+
Logger({
|
|
2596
|
+
level: "WARN",
|
|
2597
|
+
message: "Response Validation Warnnings for updateSmsProviderById",
|
|
2598
|
+
});
|
|
2599
|
+
Logger({ level: "WARN", message: res_error });
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
return response;
|
|
1895
2603
|
}
|
|
1896
2604
|
|
|
1897
2605
|
/**
|
|
@@ -1899,10 +2607,11 @@ class Communication {
|
|
|
1899
2607
|
* @param {number} [arg.pageNo] - Current page no
|
|
1900
2608
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1901
2609
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2610
|
+
* @returns {Promise<SmsTemplates>} - Success response
|
|
1902
2611
|
* @summary: Get sms templates
|
|
1903
2612
|
* @description: Get sms templates
|
|
1904
2613
|
*/
|
|
1905
|
-
getSmsTemplates({ pageNo, pageSize, sort } = {}) {
|
|
2614
|
+
async getSmsTemplates({ pageNo, pageSize, sort } = {}) {
|
|
1906
2615
|
const { error } = CommunicationValidator.getSmsTemplates().validate(
|
|
1907
2616
|
{
|
|
1908
2617
|
pageNo,
|
|
@@ -1927,8 +2636,11 @@ class Communication {
|
|
|
1927
2636
|
{ abortEarly: false, allowUnknown: false }
|
|
1928
2637
|
);
|
|
1929
2638
|
if (warrning) {
|
|
1930
|
-
|
|
1931
|
-
|
|
2639
|
+
Logger({
|
|
2640
|
+
level: "WARN",
|
|
2641
|
+
message: "Parameter Validation warrnings for getSmsTemplates",
|
|
2642
|
+
});
|
|
2643
|
+
Logger({ level: "WARN", message: warrning });
|
|
1932
2644
|
}
|
|
1933
2645
|
|
|
1934
2646
|
const query_params = {};
|
|
@@ -1936,13 +2648,30 @@ class Communication {
|
|
|
1936
2648
|
query_params["page_size"] = pageSize;
|
|
1937
2649
|
query_params["sort"] = sort;
|
|
1938
2650
|
|
|
1939
|
-
|
|
2651
|
+
const response = await PlatformAPIClient.execute(
|
|
1940
2652
|
this.config,
|
|
1941
2653
|
"get",
|
|
1942
2654
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates`,
|
|
1943
2655
|
query_params,
|
|
1944
2656
|
undefined
|
|
1945
2657
|
);
|
|
2658
|
+
|
|
2659
|
+
const {
|
|
2660
|
+
error: res_error,
|
|
2661
|
+
} = CommunicationModel.SmsTemplates().validate(response, {
|
|
2662
|
+
abortEarly: false,
|
|
2663
|
+
allowUnknown: false,
|
|
2664
|
+
});
|
|
2665
|
+
|
|
2666
|
+
if (res_error) {
|
|
2667
|
+
Logger({
|
|
2668
|
+
level: "WARN",
|
|
2669
|
+
message: "Response Validation Warnnings for getSmsTemplates",
|
|
2670
|
+
});
|
|
2671
|
+
Logger({ level: "WARN", message: res_error });
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
return response;
|
|
1946
2675
|
}
|
|
1947
2676
|
|
|
1948
2677
|
/**
|
|
@@ -1980,10 +2709,11 @@ class Communication {
|
|
|
1980
2709
|
/**
|
|
1981
2710
|
* @param {Object} arg - Arg object.
|
|
1982
2711
|
* @param {SmsTemplateReq} arg.body
|
|
2712
|
+
* @returns {Promise<SmsTemplateRes>} - Success response
|
|
1983
2713
|
* @summary: Create sms template
|
|
1984
2714
|
* @description: Create sms template
|
|
1985
2715
|
*/
|
|
1986
|
-
createSmsTemplate({ body } = {}) {
|
|
2716
|
+
async createSmsTemplate({ body } = {}) {
|
|
1987
2717
|
const { error } = CommunicationValidator.createSmsTemplate().validate(
|
|
1988
2718
|
{
|
|
1989
2719
|
body,
|
|
@@ -2004,28 +2734,49 @@ class Communication {
|
|
|
2004
2734
|
{ abortEarly: false, allowUnknown: false }
|
|
2005
2735
|
);
|
|
2006
2736
|
if (warrning) {
|
|
2007
|
-
|
|
2008
|
-
|
|
2737
|
+
Logger({
|
|
2738
|
+
level: "WARN",
|
|
2739
|
+
message: "Parameter Validation warrnings for createSmsTemplate",
|
|
2740
|
+
});
|
|
2741
|
+
Logger({ level: "WARN", message: warrning });
|
|
2009
2742
|
}
|
|
2010
2743
|
|
|
2011
2744
|
const query_params = {};
|
|
2012
2745
|
|
|
2013
|
-
|
|
2746
|
+
const response = await PlatformAPIClient.execute(
|
|
2014
2747
|
this.config,
|
|
2015
2748
|
"post",
|
|
2016
2749
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates`,
|
|
2017
2750
|
query_params,
|
|
2018
2751
|
body
|
|
2019
2752
|
);
|
|
2753
|
+
|
|
2754
|
+
const {
|
|
2755
|
+
error: res_error,
|
|
2756
|
+
} = CommunicationModel.SmsTemplateRes().validate(response, {
|
|
2757
|
+
abortEarly: false,
|
|
2758
|
+
allowUnknown: false,
|
|
2759
|
+
});
|
|
2760
|
+
|
|
2761
|
+
if (res_error) {
|
|
2762
|
+
Logger({
|
|
2763
|
+
level: "WARN",
|
|
2764
|
+
message: "Response Validation Warnnings for createSmsTemplate",
|
|
2765
|
+
});
|
|
2766
|
+
Logger({ level: "WARN", message: res_error });
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
return response;
|
|
2020
2770
|
}
|
|
2021
2771
|
|
|
2022
2772
|
/**
|
|
2023
2773
|
* @param {Object} arg - Arg object.
|
|
2024
2774
|
* @param {string} arg.id - Sms template id
|
|
2775
|
+
* @returns {Promise<SmsTemplate>} - Success response
|
|
2025
2776
|
* @summary: Get sms template by id
|
|
2026
2777
|
* @description: Get sms template by id
|
|
2027
2778
|
*/
|
|
2028
|
-
getSmsTemplateById({ id } = {}) {
|
|
2779
|
+
async getSmsTemplateById({ id } = {}) {
|
|
2029
2780
|
const { error } = CommunicationValidator.getSmsTemplateById().validate(
|
|
2030
2781
|
{
|
|
2031
2782
|
id,
|
|
@@ -2046,29 +2797,50 @@ class Communication {
|
|
|
2046
2797
|
{ abortEarly: false, allowUnknown: false }
|
|
2047
2798
|
);
|
|
2048
2799
|
if (warrning) {
|
|
2049
|
-
|
|
2050
|
-
|
|
2800
|
+
Logger({
|
|
2801
|
+
level: "WARN",
|
|
2802
|
+
message: "Parameter Validation warrnings for getSmsTemplateById",
|
|
2803
|
+
});
|
|
2804
|
+
Logger({ level: "WARN", message: warrning });
|
|
2051
2805
|
}
|
|
2052
2806
|
|
|
2053
2807
|
const query_params = {};
|
|
2054
2808
|
|
|
2055
|
-
|
|
2809
|
+
const response = await PlatformAPIClient.execute(
|
|
2056
2810
|
this.config,
|
|
2057
2811
|
"get",
|
|
2058
2812
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
2059
2813
|
query_params,
|
|
2060
2814
|
undefined
|
|
2061
2815
|
);
|
|
2816
|
+
|
|
2817
|
+
const {
|
|
2818
|
+
error: res_error,
|
|
2819
|
+
} = CommunicationModel.SmsTemplate().validate(response, {
|
|
2820
|
+
abortEarly: false,
|
|
2821
|
+
allowUnknown: false,
|
|
2822
|
+
});
|
|
2823
|
+
|
|
2824
|
+
if (res_error) {
|
|
2825
|
+
Logger({
|
|
2826
|
+
level: "WARN",
|
|
2827
|
+
message: "Response Validation Warnnings for getSmsTemplateById",
|
|
2828
|
+
});
|
|
2829
|
+
Logger({ level: "WARN", message: res_error });
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
return response;
|
|
2062
2833
|
}
|
|
2063
2834
|
|
|
2064
2835
|
/**
|
|
2065
2836
|
* @param {Object} arg - Arg object.
|
|
2066
2837
|
* @param {string} arg.id - Sms template id
|
|
2067
2838
|
* @param {SmsTemplateReq} arg.body
|
|
2839
|
+
* @returns {Promise<SmsTemplateRes>} - Success response
|
|
2068
2840
|
* @summary: Update sms template by id
|
|
2069
2841
|
* @description: Update sms template by id
|
|
2070
2842
|
*/
|
|
2071
|
-
updateSmsTemplateById({ id, body } = {}) {
|
|
2843
|
+
async updateSmsTemplateById({ id, body } = {}) {
|
|
2072
2844
|
const { error } = CommunicationValidator.updateSmsTemplateById().validate(
|
|
2073
2845
|
{
|
|
2074
2846
|
id,
|
|
@@ -2091,28 +2863,49 @@ class Communication {
|
|
|
2091
2863
|
{ abortEarly: false, allowUnknown: false }
|
|
2092
2864
|
);
|
|
2093
2865
|
if (warrning) {
|
|
2094
|
-
|
|
2095
|
-
|
|
2866
|
+
Logger({
|
|
2867
|
+
level: "WARN",
|
|
2868
|
+
message: "Parameter Validation warrnings for updateSmsTemplateById",
|
|
2869
|
+
});
|
|
2870
|
+
Logger({ level: "WARN", message: warrning });
|
|
2096
2871
|
}
|
|
2097
2872
|
|
|
2098
2873
|
const query_params = {};
|
|
2099
2874
|
|
|
2100
|
-
|
|
2875
|
+
const response = await PlatformAPIClient.execute(
|
|
2101
2876
|
this.config,
|
|
2102
2877
|
"put",
|
|
2103
2878
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
2104
2879
|
query_params,
|
|
2105
2880
|
body
|
|
2106
2881
|
);
|
|
2882
|
+
|
|
2883
|
+
const {
|
|
2884
|
+
error: res_error,
|
|
2885
|
+
} = CommunicationModel.SmsTemplateRes().validate(response, {
|
|
2886
|
+
abortEarly: false,
|
|
2887
|
+
allowUnknown: false,
|
|
2888
|
+
});
|
|
2889
|
+
|
|
2890
|
+
if (res_error) {
|
|
2891
|
+
Logger({
|
|
2892
|
+
level: "WARN",
|
|
2893
|
+
message: "Response Validation Warnnings for updateSmsTemplateById",
|
|
2894
|
+
});
|
|
2895
|
+
Logger({ level: "WARN", message: res_error });
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2898
|
+
return response;
|
|
2107
2899
|
}
|
|
2108
2900
|
|
|
2109
2901
|
/**
|
|
2110
2902
|
* @param {Object} arg - Arg object.
|
|
2111
2903
|
* @param {string} arg.id - Sms template id
|
|
2904
|
+
* @returns {Promise<SmsTemplateDeleteSuccessRes>} - Success response
|
|
2112
2905
|
* @summary: Delete sms template by id
|
|
2113
2906
|
* @description: Delete sms template by id
|
|
2114
2907
|
*/
|
|
2115
|
-
deleteSmsTemplateById({ id } = {}) {
|
|
2908
|
+
async deleteSmsTemplateById({ id } = {}) {
|
|
2116
2909
|
const { error } = CommunicationValidator.deleteSmsTemplateById().validate(
|
|
2117
2910
|
{
|
|
2118
2911
|
id,
|
|
@@ -2133,19 +2926,39 @@ class Communication {
|
|
|
2133
2926
|
{ abortEarly: false, allowUnknown: false }
|
|
2134
2927
|
);
|
|
2135
2928
|
if (warrning) {
|
|
2136
|
-
|
|
2137
|
-
|
|
2929
|
+
Logger({
|
|
2930
|
+
level: "WARN",
|
|
2931
|
+
message: "Parameter Validation warrnings for deleteSmsTemplateById",
|
|
2932
|
+
});
|
|
2933
|
+
Logger({ level: "WARN", message: warrning });
|
|
2138
2934
|
}
|
|
2139
2935
|
|
|
2140
2936
|
const query_params = {};
|
|
2141
2937
|
|
|
2142
|
-
|
|
2938
|
+
const response = await PlatformAPIClient.execute(
|
|
2143
2939
|
this.config,
|
|
2144
2940
|
"delete",
|
|
2145
2941
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
2146
2942
|
query_params,
|
|
2147
2943
|
undefined
|
|
2148
2944
|
);
|
|
2945
|
+
|
|
2946
|
+
const {
|
|
2947
|
+
error: res_error,
|
|
2948
|
+
} = CommunicationModel.SmsTemplateDeleteSuccessRes().validate(response, {
|
|
2949
|
+
abortEarly: false,
|
|
2950
|
+
allowUnknown: false,
|
|
2951
|
+
});
|
|
2952
|
+
|
|
2953
|
+
if (res_error) {
|
|
2954
|
+
Logger({
|
|
2955
|
+
level: "WARN",
|
|
2956
|
+
message: "Response Validation Warnnings for deleteSmsTemplateById",
|
|
2957
|
+
});
|
|
2958
|
+
Logger({ level: "WARN", message: res_error });
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
return response;
|
|
2149
2962
|
}
|
|
2150
2963
|
|
|
2151
2964
|
/**
|
|
@@ -2153,10 +2966,11 @@ class Communication {
|
|
|
2153
2966
|
* @param {number} [arg.pageNo] - Current page no
|
|
2154
2967
|
* @param {number} [arg.pageSize] - Current request items count
|
|
2155
2968
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2969
|
+
* @returns {Promise<SystemSmsTemplates>} - Success response
|
|
2156
2970
|
* @summary: Get system sms templates
|
|
2157
2971
|
* @description: Get system sms templates
|
|
2158
2972
|
*/
|
|
2159
|
-
getSystemSystemTemplates({ pageNo, pageSize, sort } = {}) {
|
|
2973
|
+
async getSystemSystemTemplates({ pageNo, pageSize, sort } = {}) {
|
|
2160
2974
|
const {
|
|
2161
2975
|
error,
|
|
2162
2976
|
} = CommunicationValidator.getSystemSystemTemplates().validate(
|
|
@@ -2183,10 +2997,11 @@ class Communication {
|
|
|
2183
2997
|
{ abortEarly: false, allowUnknown: false }
|
|
2184
2998
|
);
|
|
2185
2999
|
if (warrning) {
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
3000
|
+
Logger({
|
|
3001
|
+
level: "WARN",
|
|
3002
|
+
message: "Parameter Validation warrnings for getSystemSystemTemplates",
|
|
3003
|
+
});
|
|
3004
|
+
Logger({ level: "WARN", message: warrning });
|
|
2190
3005
|
}
|
|
2191
3006
|
|
|
2192
3007
|
const query_params = {};
|
|
@@ -2194,13 +3009,30 @@ class Communication {
|
|
|
2194
3009
|
query_params["page_size"] = pageSize;
|
|
2195
3010
|
query_params["sort"] = sort;
|
|
2196
3011
|
|
|
2197
|
-
|
|
3012
|
+
const response = await PlatformAPIClient.execute(
|
|
2198
3013
|
this.config,
|
|
2199
3014
|
"get",
|
|
2200
3015
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/system-templates`,
|
|
2201
3016
|
query_params,
|
|
2202
3017
|
undefined
|
|
2203
3018
|
);
|
|
3019
|
+
|
|
3020
|
+
const {
|
|
3021
|
+
error: res_error,
|
|
3022
|
+
} = CommunicationModel.SystemSmsTemplates().validate(response, {
|
|
3023
|
+
abortEarly: false,
|
|
3024
|
+
allowUnknown: false,
|
|
3025
|
+
});
|
|
3026
|
+
|
|
3027
|
+
if (res_error) {
|
|
3028
|
+
Logger({
|
|
3029
|
+
level: "WARN",
|
|
3030
|
+
message: "Response Validation Warnnings for getSystemSystemTemplates",
|
|
3031
|
+
});
|
|
3032
|
+
Logger({ level: "WARN", message: res_error });
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
return response;
|
|
2204
3036
|
}
|
|
2205
3037
|
|
|
2206
3038
|
/**
|