@gofynd/fdk-client-javascript 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +393 -393
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +268 -268
- package/documentation/application/PAYMENT.md +249 -249
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3497 -3097
- package/documentation/platform/COMPANYPROFILE.md +207 -207
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1518 -1324
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +96 -96
- package/index.js +7 -1
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +865 -52
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Cart/CartApplicationValidator.js +1 -0
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
- package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
- package/sdk/application/Common/CommonApplicationClient.js +66 -4
- package/sdk/application/Common/CommonApplicationValidator.js +1 -0
- package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
- package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
- package/sdk/application/Content/ContentApplicationClient.js +621 -38
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/Content/ContentApplicationValidator.js +1 -0
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
- package/sdk/application/Lead/LeadApplicationClient.js +229 -14
- package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
- package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
- package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +403 -24
- package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
- package/sdk/application/Order/OrderApplicationModel.js +334 -334
- package/sdk/application/Order/OrderApplicationValidator.js +1 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
- package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
- package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
- package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
- package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
- package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
- package/sdk/application/Share/ShareApplicationClient.js +226 -14
- package/sdk/application/Share/ShareApplicationValidator.js +1 -0
- package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
- package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
- package/sdk/application/User/UserApplicationClient.js +1133 -70
- package/sdk/application/User/UserApplicationValidator.js +1 -0
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
- package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +73 -4
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
- 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 +400 -22
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
- package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
- package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
- package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
- 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 +418 -22
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
- package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
- package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
- package/sdk/platform/PlatformApplicationClient.js +3461 -3263
- package/sdk/platform/PlatformClient.d.ts +2973 -2827
- package/sdk/platform/PlatformClient.js +3461 -3263
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
- package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
- package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
- package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
- package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
- package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
|
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
3
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
4
|
const 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,
|
|
@@ -30,18 +33,52 @@ class Communication {
|
|
|
30
33
|
return Promise.reject(new FDKClientValidationError(error));
|
|
31
34
|
}
|
|
32
35
|
|
|
36
|
+
// Showing warrnings if extra unknown parameters are found
|
|
37
|
+
const { error: warrning } = CommunicationValidator.getCampaigns().validate(
|
|
38
|
+
{
|
|
39
|
+
pageNo,
|
|
40
|
+
pageSize,
|
|
41
|
+
sort,
|
|
42
|
+
},
|
|
43
|
+
{ abortEarly: false, allowUnknown: false }
|
|
44
|
+
);
|
|
45
|
+
if (warrning) {
|
|
46
|
+
Logger({
|
|
47
|
+
level: "WARN",
|
|
48
|
+
message: "Parameter Validation warrnings for getCampaigns",
|
|
49
|
+
});
|
|
50
|
+
Logger({ level: "WARN", message: warrning });
|
|
51
|
+
}
|
|
52
|
+
|
|
33
53
|
const query_params = {};
|
|
34
54
|
query_params["page_no"] = pageNo;
|
|
35
55
|
query_params["page_size"] = pageSize;
|
|
36
56
|
query_params["sort"] = sort;
|
|
37
57
|
|
|
38
|
-
|
|
58
|
+
const response = await PlatformAPIClient.execute(
|
|
39
59
|
this.config,
|
|
40
60
|
"get",
|
|
41
61
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns`,
|
|
42
62
|
query_params,
|
|
43
63
|
undefined
|
|
44
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;
|
|
45
82
|
}
|
|
46
83
|
|
|
47
84
|
/**
|
|
@@ -79,10 +116,11 @@ class Communication {
|
|
|
79
116
|
/**
|
|
80
117
|
* @param {Object} arg - Arg object.
|
|
81
118
|
* @param {CampaignReq} arg.body
|
|
119
|
+
* @returns {Promise<Campaign>} - Success response
|
|
82
120
|
* @summary: Create campaign
|
|
83
121
|
* @description: Create campaign
|
|
84
122
|
*/
|
|
85
|
-
createCampaign({ body } = {}) {
|
|
123
|
+
async createCampaign({ body } = {}) {
|
|
86
124
|
const { error } = CommunicationValidator.createCampaign().validate(
|
|
87
125
|
{
|
|
88
126
|
body,
|
|
@@ -93,24 +131,59 @@ class Communication {
|
|
|
93
131
|
return Promise.reject(new FDKClientValidationError(error));
|
|
94
132
|
}
|
|
95
133
|
|
|
134
|
+
// Showing warrnings if extra unknown parameters are found
|
|
135
|
+
const {
|
|
136
|
+
error: warrning,
|
|
137
|
+
} = CommunicationValidator.createCampaign().validate(
|
|
138
|
+
{
|
|
139
|
+
body,
|
|
140
|
+
},
|
|
141
|
+
{ abortEarly: false, allowUnknown: false }
|
|
142
|
+
);
|
|
143
|
+
if (warrning) {
|
|
144
|
+
Logger({
|
|
145
|
+
level: "WARN",
|
|
146
|
+
message: "Parameter Validation warrnings for createCampaign",
|
|
147
|
+
});
|
|
148
|
+
Logger({ level: "WARN", message: warrning });
|
|
149
|
+
}
|
|
150
|
+
|
|
96
151
|
const query_params = {};
|
|
97
152
|
|
|
98
|
-
|
|
153
|
+
const response = await PlatformAPIClient.execute(
|
|
99
154
|
this.config,
|
|
100
155
|
"post",
|
|
101
156
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns`,
|
|
102
157
|
query_params,
|
|
103
158
|
body
|
|
104
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;
|
|
105
177
|
}
|
|
106
178
|
|
|
107
179
|
/**
|
|
108
180
|
* @param {Object} arg - Arg object.
|
|
109
181
|
* @param {string} arg.id - Campaign id
|
|
182
|
+
* @returns {Promise<Campaign>} - Success response
|
|
110
183
|
* @summary: Get campaign by id
|
|
111
184
|
* @description: Get campaign by id
|
|
112
185
|
*/
|
|
113
|
-
getCampaignById({ id } = {}) {
|
|
186
|
+
async getCampaignById({ id } = {}) {
|
|
114
187
|
const { error } = CommunicationValidator.getCampaignById().validate(
|
|
115
188
|
{
|
|
116
189
|
id,
|
|
@@ -121,25 +194,60 @@ class Communication {
|
|
|
121
194
|
return Promise.reject(new FDKClientValidationError(error));
|
|
122
195
|
}
|
|
123
196
|
|
|
197
|
+
// Showing warrnings if extra unknown parameters are found
|
|
198
|
+
const {
|
|
199
|
+
error: warrning,
|
|
200
|
+
} = CommunicationValidator.getCampaignById().validate(
|
|
201
|
+
{
|
|
202
|
+
id,
|
|
203
|
+
},
|
|
204
|
+
{ abortEarly: false, allowUnknown: false }
|
|
205
|
+
);
|
|
206
|
+
if (warrning) {
|
|
207
|
+
Logger({
|
|
208
|
+
level: "WARN",
|
|
209
|
+
message: "Parameter Validation warrnings for getCampaignById",
|
|
210
|
+
});
|
|
211
|
+
Logger({ level: "WARN", message: warrning });
|
|
212
|
+
}
|
|
213
|
+
|
|
124
214
|
const query_params = {};
|
|
125
215
|
|
|
126
|
-
|
|
216
|
+
const response = await PlatformAPIClient.execute(
|
|
127
217
|
this.config,
|
|
128
218
|
"get",
|
|
129
219
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns/${id}`,
|
|
130
220
|
query_params,
|
|
131
221
|
undefined
|
|
132
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;
|
|
133
240
|
}
|
|
134
241
|
|
|
135
242
|
/**
|
|
136
243
|
* @param {Object} arg - Arg object.
|
|
137
244
|
* @param {string} arg.id - Campaign id
|
|
138
245
|
* @param {CampaignReq} arg.body
|
|
246
|
+
* @returns {Promise<Campaign>} - Success response
|
|
139
247
|
* @summary: Update campaign by id
|
|
140
248
|
* @description: Update campaign by id
|
|
141
249
|
*/
|
|
142
|
-
updateCampaignById({ id, body } = {}) {
|
|
250
|
+
async updateCampaignById({ id, body } = {}) {
|
|
143
251
|
const { error } = CommunicationValidator.updateCampaignById().validate(
|
|
144
252
|
{
|
|
145
253
|
id,
|
|
@@ -151,24 +259,60 @@ class Communication {
|
|
|
151
259
|
return Promise.reject(new FDKClientValidationError(error));
|
|
152
260
|
}
|
|
153
261
|
|
|
262
|
+
// Showing warrnings if extra unknown parameters are found
|
|
263
|
+
const {
|
|
264
|
+
error: warrning,
|
|
265
|
+
} = CommunicationValidator.updateCampaignById().validate(
|
|
266
|
+
{
|
|
267
|
+
id,
|
|
268
|
+
body,
|
|
269
|
+
},
|
|
270
|
+
{ abortEarly: false, allowUnknown: false }
|
|
271
|
+
);
|
|
272
|
+
if (warrning) {
|
|
273
|
+
Logger({
|
|
274
|
+
level: "WARN",
|
|
275
|
+
message: "Parameter Validation warrnings for updateCampaignById",
|
|
276
|
+
});
|
|
277
|
+
Logger({ level: "WARN", message: warrning });
|
|
278
|
+
}
|
|
279
|
+
|
|
154
280
|
const query_params = {};
|
|
155
281
|
|
|
156
|
-
|
|
282
|
+
const response = await PlatformAPIClient.execute(
|
|
157
283
|
this.config,
|
|
158
284
|
"put",
|
|
159
285
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns/${id}`,
|
|
160
286
|
query_params,
|
|
161
287
|
body
|
|
162
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;
|
|
163
306
|
}
|
|
164
307
|
|
|
165
308
|
/**
|
|
166
309
|
* @param {Object} arg - Arg object.
|
|
167
310
|
* @param {string} arg.id - Campaign id
|
|
311
|
+
* @returns {Promise<GetStats>} - Success response
|
|
168
312
|
* @summary: Get stats of campaign by id
|
|
169
313
|
* @description: Get stats of campaign by id
|
|
170
314
|
*/
|
|
171
|
-
getStatsOfCampaignById({ id } = {}) {
|
|
315
|
+
async getStatsOfCampaignById({ id } = {}) {
|
|
172
316
|
const { error } = CommunicationValidator.getStatsOfCampaignById().validate(
|
|
173
317
|
{
|
|
174
318
|
id,
|
|
@@ -179,15 +323,49 @@ class Communication {
|
|
|
179
323
|
return Promise.reject(new FDKClientValidationError(error));
|
|
180
324
|
}
|
|
181
325
|
|
|
326
|
+
// Showing warrnings if extra unknown parameters are found
|
|
327
|
+
const {
|
|
328
|
+
error: warrning,
|
|
329
|
+
} = CommunicationValidator.getStatsOfCampaignById().validate(
|
|
330
|
+
{
|
|
331
|
+
id,
|
|
332
|
+
},
|
|
333
|
+
{ abortEarly: false, allowUnknown: false }
|
|
334
|
+
);
|
|
335
|
+
if (warrning) {
|
|
336
|
+
Logger({
|
|
337
|
+
level: "WARN",
|
|
338
|
+
message: "Parameter Validation warrnings for getStatsOfCampaignById",
|
|
339
|
+
});
|
|
340
|
+
Logger({ level: "WARN", message: warrning });
|
|
341
|
+
}
|
|
342
|
+
|
|
182
343
|
const query_params = {};
|
|
183
344
|
|
|
184
|
-
|
|
345
|
+
const response = await PlatformAPIClient.execute(
|
|
185
346
|
this.config,
|
|
186
347
|
"get",
|
|
187
348
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/get-stats/${id}`,
|
|
188
349
|
query_params,
|
|
189
350
|
undefined
|
|
190
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;
|
|
191
369
|
}
|
|
192
370
|
|
|
193
371
|
/**
|
|
@@ -195,10 +373,11 @@ class Communication {
|
|
|
195
373
|
* @param {number} [arg.pageNo] - Current page no
|
|
196
374
|
* @param {number} [arg.pageSize] - Current request items count
|
|
197
375
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
376
|
+
* @returns {Promise<Audiences>} - Success response
|
|
198
377
|
* @summary: Get audiences
|
|
199
378
|
* @description: Get audiences
|
|
200
379
|
*/
|
|
201
|
-
getAudiences({ pageNo, pageSize, sort } = {}) {
|
|
380
|
+
async getAudiences({ pageNo, pageSize, sort } = {}) {
|
|
202
381
|
const { error } = CommunicationValidator.getAudiences().validate(
|
|
203
382
|
{
|
|
204
383
|
pageNo,
|
|
@@ -211,18 +390,52 @@ class Communication {
|
|
|
211
390
|
return Promise.reject(new FDKClientValidationError(error));
|
|
212
391
|
}
|
|
213
392
|
|
|
393
|
+
// Showing warrnings if extra unknown parameters are found
|
|
394
|
+
const { error: warrning } = CommunicationValidator.getAudiences().validate(
|
|
395
|
+
{
|
|
396
|
+
pageNo,
|
|
397
|
+
pageSize,
|
|
398
|
+
sort,
|
|
399
|
+
},
|
|
400
|
+
{ abortEarly: false, allowUnknown: false }
|
|
401
|
+
);
|
|
402
|
+
if (warrning) {
|
|
403
|
+
Logger({
|
|
404
|
+
level: "WARN",
|
|
405
|
+
message: "Parameter Validation warrnings for getAudiences",
|
|
406
|
+
});
|
|
407
|
+
Logger({ level: "WARN", message: warrning });
|
|
408
|
+
}
|
|
409
|
+
|
|
214
410
|
const query_params = {};
|
|
215
411
|
query_params["page_no"] = pageNo;
|
|
216
412
|
query_params["page_size"] = pageSize;
|
|
217
413
|
query_params["sort"] = sort;
|
|
218
414
|
|
|
219
|
-
|
|
415
|
+
const response = await PlatformAPIClient.execute(
|
|
220
416
|
this.config,
|
|
221
417
|
"get",
|
|
222
418
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources`,
|
|
223
419
|
query_params,
|
|
224
420
|
undefined
|
|
225
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;
|
|
226
439
|
}
|
|
227
440
|
|
|
228
441
|
/**
|
|
@@ -260,10 +473,11 @@ class Communication {
|
|
|
260
473
|
/**
|
|
261
474
|
* @param {Object} arg - Arg object.
|
|
262
475
|
* @param {AudienceReq} arg.body
|
|
476
|
+
* @returns {Promise<Audience>} - Success response
|
|
263
477
|
* @summary: Create audience
|
|
264
478
|
* @description: Create audience
|
|
265
479
|
*/
|
|
266
|
-
createAudience({ body } = {}) {
|
|
480
|
+
async createAudience({ body } = {}) {
|
|
267
481
|
const { error } = CommunicationValidator.createAudience().validate(
|
|
268
482
|
{
|
|
269
483
|
body,
|
|
@@ -274,24 +488,59 @@ class Communication {
|
|
|
274
488
|
return Promise.reject(new FDKClientValidationError(error));
|
|
275
489
|
}
|
|
276
490
|
|
|
491
|
+
// Showing warrnings if extra unknown parameters are found
|
|
492
|
+
const {
|
|
493
|
+
error: warrning,
|
|
494
|
+
} = CommunicationValidator.createAudience().validate(
|
|
495
|
+
{
|
|
496
|
+
body,
|
|
497
|
+
},
|
|
498
|
+
{ abortEarly: false, allowUnknown: false }
|
|
499
|
+
);
|
|
500
|
+
if (warrning) {
|
|
501
|
+
Logger({
|
|
502
|
+
level: "WARN",
|
|
503
|
+
message: "Parameter Validation warrnings for createAudience",
|
|
504
|
+
});
|
|
505
|
+
Logger({ level: "WARN", message: warrning });
|
|
506
|
+
}
|
|
507
|
+
|
|
277
508
|
const query_params = {};
|
|
278
509
|
|
|
279
|
-
|
|
510
|
+
const response = await PlatformAPIClient.execute(
|
|
280
511
|
this.config,
|
|
281
512
|
"post",
|
|
282
513
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources`,
|
|
283
514
|
query_params,
|
|
284
515
|
body
|
|
285
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;
|
|
286
534
|
}
|
|
287
535
|
|
|
288
536
|
/**
|
|
289
537
|
* @param {Object} arg - Arg object.
|
|
290
538
|
* @param {BigqueryHeadersReq} arg.body
|
|
539
|
+
* @returns {Promise<BigqueryHeadersRes>} - Success response
|
|
291
540
|
* @summary: Get bigquery headers
|
|
292
541
|
* @description: Get bigquery headers
|
|
293
542
|
*/
|
|
294
|
-
getBigqueryHeaders({ body } = {}) {
|
|
543
|
+
async getBigqueryHeaders({ body } = {}) {
|
|
295
544
|
const { error } = CommunicationValidator.getBigqueryHeaders().validate(
|
|
296
545
|
{
|
|
297
546
|
body,
|
|
@@ -302,24 +551,59 @@ class Communication {
|
|
|
302
551
|
return Promise.reject(new FDKClientValidationError(error));
|
|
303
552
|
}
|
|
304
553
|
|
|
554
|
+
// Showing warrnings if extra unknown parameters are found
|
|
555
|
+
const {
|
|
556
|
+
error: warrning,
|
|
557
|
+
} = CommunicationValidator.getBigqueryHeaders().validate(
|
|
558
|
+
{
|
|
559
|
+
body,
|
|
560
|
+
},
|
|
561
|
+
{ abortEarly: false, allowUnknown: false }
|
|
562
|
+
);
|
|
563
|
+
if (warrning) {
|
|
564
|
+
Logger({
|
|
565
|
+
level: "WARN",
|
|
566
|
+
message: "Parameter Validation warrnings for getBigqueryHeaders",
|
|
567
|
+
});
|
|
568
|
+
Logger({ level: "WARN", message: warrning });
|
|
569
|
+
}
|
|
570
|
+
|
|
305
571
|
const query_params = {};
|
|
306
572
|
|
|
307
|
-
|
|
573
|
+
const response = await PlatformAPIClient.execute(
|
|
308
574
|
this.config,
|
|
309
575
|
"post",
|
|
310
576
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/bigquery-headers`,
|
|
311
577
|
query_params,
|
|
312
578
|
body
|
|
313
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;
|
|
314
597
|
}
|
|
315
598
|
|
|
316
599
|
/**
|
|
317
600
|
* @param {Object} arg - Arg object.
|
|
318
601
|
* @param {string} arg.id - Audience id
|
|
602
|
+
* @returns {Promise<Audience>} - Success response
|
|
319
603
|
* @summary: Get audience by id
|
|
320
604
|
* @description: Get audience by id
|
|
321
605
|
*/
|
|
322
|
-
getAudienceById({ id } = {}) {
|
|
606
|
+
async getAudienceById({ id } = {}) {
|
|
323
607
|
const { error } = CommunicationValidator.getAudienceById().validate(
|
|
324
608
|
{
|
|
325
609
|
id,
|
|
@@ -330,25 +614,60 @@ class Communication {
|
|
|
330
614
|
return Promise.reject(new FDKClientValidationError(error));
|
|
331
615
|
}
|
|
332
616
|
|
|
617
|
+
// Showing warrnings if extra unknown parameters are found
|
|
618
|
+
const {
|
|
619
|
+
error: warrning,
|
|
620
|
+
} = CommunicationValidator.getAudienceById().validate(
|
|
621
|
+
{
|
|
622
|
+
id,
|
|
623
|
+
},
|
|
624
|
+
{ abortEarly: false, allowUnknown: false }
|
|
625
|
+
);
|
|
626
|
+
if (warrning) {
|
|
627
|
+
Logger({
|
|
628
|
+
level: "WARN",
|
|
629
|
+
message: "Parameter Validation warrnings for getAudienceById",
|
|
630
|
+
});
|
|
631
|
+
Logger({ level: "WARN", message: warrning });
|
|
632
|
+
}
|
|
633
|
+
|
|
333
634
|
const query_params = {};
|
|
334
635
|
|
|
335
|
-
|
|
636
|
+
const response = await PlatformAPIClient.execute(
|
|
336
637
|
this.config,
|
|
337
638
|
"get",
|
|
338
639
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
|
|
339
640
|
query_params,
|
|
340
641
|
undefined
|
|
341
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;
|
|
342
660
|
}
|
|
343
661
|
|
|
344
662
|
/**
|
|
345
663
|
* @param {Object} arg - Arg object.
|
|
346
664
|
* @param {string} arg.id - Audience id
|
|
347
665
|
* @param {AudienceReq} arg.body
|
|
666
|
+
* @returns {Promise<Audience>} - Success response
|
|
348
667
|
* @summary: Update audience by id
|
|
349
668
|
* @description: Update audience by id
|
|
350
669
|
*/
|
|
351
|
-
updateAudienceById({ id, body } = {}) {
|
|
670
|
+
async updateAudienceById({ id, body } = {}) {
|
|
352
671
|
const { error } = CommunicationValidator.updateAudienceById().validate(
|
|
353
672
|
{
|
|
354
673
|
id,
|
|
@@ -360,24 +679,60 @@ class Communication {
|
|
|
360
679
|
return Promise.reject(new FDKClientValidationError(error));
|
|
361
680
|
}
|
|
362
681
|
|
|
682
|
+
// Showing warrnings if extra unknown parameters are found
|
|
683
|
+
const {
|
|
684
|
+
error: warrning,
|
|
685
|
+
} = CommunicationValidator.updateAudienceById().validate(
|
|
686
|
+
{
|
|
687
|
+
id,
|
|
688
|
+
body,
|
|
689
|
+
},
|
|
690
|
+
{ abortEarly: false, allowUnknown: false }
|
|
691
|
+
);
|
|
692
|
+
if (warrning) {
|
|
693
|
+
Logger({
|
|
694
|
+
level: "WARN",
|
|
695
|
+
message: "Parameter Validation warrnings for updateAudienceById",
|
|
696
|
+
});
|
|
697
|
+
Logger({ level: "WARN", message: warrning });
|
|
698
|
+
}
|
|
699
|
+
|
|
363
700
|
const query_params = {};
|
|
364
701
|
|
|
365
|
-
|
|
702
|
+
const response = await PlatformAPIClient.execute(
|
|
366
703
|
this.config,
|
|
367
704
|
"put",
|
|
368
705
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
|
|
369
706
|
query_params,
|
|
370
707
|
body
|
|
371
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;
|
|
372
726
|
}
|
|
373
727
|
|
|
374
728
|
/**
|
|
375
729
|
* @param {Object} arg - Arg object.
|
|
376
730
|
* @param {GetNRecordsCsvReq} arg.body
|
|
731
|
+
* @returns {Promise<GetNRecordsCsvRes>} - Success response
|
|
377
732
|
* @summary: Get n sample records from csv
|
|
378
733
|
* @description: Get n sample records from csv
|
|
379
734
|
*/
|
|
380
|
-
getNSampleRecordsFromCsv({ body } = {}) {
|
|
735
|
+
async getNSampleRecordsFromCsv({ body } = {}) {
|
|
381
736
|
const {
|
|
382
737
|
error,
|
|
383
738
|
} = CommunicationValidator.getNSampleRecordsFromCsv().validate(
|
|
@@ -390,15 +745,49 @@ class Communication {
|
|
|
390
745
|
return Promise.reject(new FDKClientValidationError(error));
|
|
391
746
|
}
|
|
392
747
|
|
|
748
|
+
// Showing warrnings if extra unknown parameters are found
|
|
749
|
+
const {
|
|
750
|
+
error: warrning,
|
|
751
|
+
} = CommunicationValidator.getNSampleRecordsFromCsv().validate(
|
|
752
|
+
{
|
|
753
|
+
body,
|
|
754
|
+
},
|
|
755
|
+
{ abortEarly: false, allowUnknown: false }
|
|
756
|
+
);
|
|
757
|
+
if (warrning) {
|
|
758
|
+
Logger({
|
|
759
|
+
level: "WARN",
|
|
760
|
+
message: "Parameter Validation warrnings for getNSampleRecordsFromCsv",
|
|
761
|
+
});
|
|
762
|
+
Logger({ level: "WARN", message: warrning });
|
|
763
|
+
}
|
|
764
|
+
|
|
393
765
|
const query_params = {};
|
|
394
766
|
|
|
395
|
-
|
|
767
|
+
const response = await PlatformAPIClient.execute(
|
|
396
768
|
this.config,
|
|
397
769
|
"post",
|
|
398
770
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/get-n-records`,
|
|
399
771
|
query_params,
|
|
400
772
|
body
|
|
401
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;
|
|
402
791
|
}
|
|
403
792
|
|
|
404
793
|
/**
|
|
@@ -406,10 +795,11 @@ class Communication {
|
|
|
406
795
|
* @param {number} [arg.pageNo] - Current page no
|
|
407
796
|
* @param {number} [arg.pageSize] - Current request items count
|
|
408
797
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
798
|
+
* @returns {Promise<EmailProviders>} - Success response
|
|
409
799
|
* @summary: Get email providers
|
|
410
800
|
* @description: Get email providers
|
|
411
801
|
*/
|
|
412
|
-
getEmailProviders({ pageNo, pageSize, sort } = {}) {
|
|
802
|
+
async getEmailProviders({ pageNo, pageSize, sort } = {}) {
|
|
413
803
|
const { error } = CommunicationValidator.getEmailProviders().validate(
|
|
414
804
|
{
|
|
415
805
|
pageNo,
|
|
@@ -422,18 +812,54 @@ class Communication {
|
|
|
422
812
|
return Promise.reject(new FDKClientValidationError(error));
|
|
423
813
|
}
|
|
424
814
|
|
|
815
|
+
// Showing warrnings if extra unknown parameters are found
|
|
816
|
+
const {
|
|
817
|
+
error: warrning,
|
|
818
|
+
} = CommunicationValidator.getEmailProviders().validate(
|
|
819
|
+
{
|
|
820
|
+
pageNo,
|
|
821
|
+
pageSize,
|
|
822
|
+
sort,
|
|
823
|
+
},
|
|
824
|
+
{ abortEarly: false, allowUnknown: false }
|
|
825
|
+
);
|
|
826
|
+
if (warrning) {
|
|
827
|
+
Logger({
|
|
828
|
+
level: "WARN",
|
|
829
|
+
message: "Parameter Validation warrnings for getEmailProviders",
|
|
830
|
+
});
|
|
831
|
+
Logger({ level: "WARN", message: warrning });
|
|
832
|
+
}
|
|
833
|
+
|
|
425
834
|
const query_params = {};
|
|
426
835
|
query_params["page_no"] = pageNo;
|
|
427
836
|
query_params["page_size"] = pageSize;
|
|
428
837
|
query_params["sort"] = sort;
|
|
429
838
|
|
|
430
|
-
|
|
839
|
+
const response = await PlatformAPIClient.execute(
|
|
431
840
|
this.config,
|
|
432
841
|
"get",
|
|
433
842
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers`,
|
|
434
843
|
query_params,
|
|
435
844
|
undefined
|
|
436
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;
|
|
437
863
|
}
|
|
438
864
|
|
|
439
865
|
/**
|
|
@@ -476,10 +902,11 @@ class Communication {
|
|
|
476
902
|
/**
|
|
477
903
|
* @param {Object} arg - Arg object.
|
|
478
904
|
* @param {EmailProviderReq} arg.body
|
|
905
|
+
* @returns {Promise<EmailProvider>} - Success response
|
|
479
906
|
* @summary: Create email provider
|
|
480
907
|
* @description: Create email provider
|
|
481
908
|
*/
|
|
482
|
-
createEmailProvider({ body } = {}) {
|
|
909
|
+
async createEmailProvider({ body } = {}) {
|
|
483
910
|
const { error } = CommunicationValidator.createEmailProvider().validate(
|
|
484
911
|
{
|
|
485
912
|
body,
|
|
@@ -490,24 +917,59 @@ class Communication {
|
|
|
490
917
|
return Promise.reject(new FDKClientValidationError(error));
|
|
491
918
|
}
|
|
492
919
|
|
|
920
|
+
// Showing warrnings if extra unknown parameters are found
|
|
921
|
+
const {
|
|
922
|
+
error: warrning,
|
|
923
|
+
} = CommunicationValidator.createEmailProvider().validate(
|
|
924
|
+
{
|
|
925
|
+
body,
|
|
926
|
+
},
|
|
927
|
+
{ abortEarly: false, allowUnknown: false }
|
|
928
|
+
);
|
|
929
|
+
if (warrning) {
|
|
930
|
+
Logger({
|
|
931
|
+
level: "WARN",
|
|
932
|
+
message: "Parameter Validation warrnings for createEmailProvider",
|
|
933
|
+
});
|
|
934
|
+
Logger({ level: "WARN", message: warrning });
|
|
935
|
+
}
|
|
936
|
+
|
|
493
937
|
const query_params = {};
|
|
494
938
|
|
|
495
|
-
|
|
939
|
+
const response = await PlatformAPIClient.execute(
|
|
496
940
|
this.config,
|
|
497
941
|
"post",
|
|
498
942
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers`,
|
|
499
943
|
query_params,
|
|
500
944
|
body
|
|
501
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;
|
|
502
963
|
}
|
|
503
964
|
|
|
504
965
|
/**
|
|
505
966
|
* @param {Object} arg - Arg object.
|
|
506
967
|
* @param {string} arg.id - Email provider id
|
|
968
|
+
* @returns {Promise<EmailProvider>} - Success response
|
|
507
969
|
* @summary: Get email provider by id
|
|
508
970
|
* @description: Get email provider by id
|
|
509
971
|
*/
|
|
510
|
-
getEmailProviderById({ id } = {}) {
|
|
972
|
+
async getEmailProviderById({ id } = {}) {
|
|
511
973
|
const { error } = CommunicationValidator.getEmailProviderById().validate(
|
|
512
974
|
{
|
|
513
975
|
id,
|
|
@@ -518,25 +980,60 @@ class Communication {
|
|
|
518
980
|
return Promise.reject(new FDKClientValidationError(error));
|
|
519
981
|
}
|
|
520
982
|
|
|
983
|
+
// Showing warrnings if extra unknown parameters are found
|
|
984
|
+
const {
|
|
985
|
+
error: warrning,
|
|
986
|
+
} = CommunicationValidator.getEmailProviderById().validate(
|
|
987
|
+
{
|
|
988
|
+
id,
|
|
989
|
+
},
|
|
990
|
+
{ abortEarly: false, allowUnknown: false }
|
|
991
|
+
);
|
|
992
|
+
if (warrning) {
|
|
993
|
+
Logger({
|
|
994
|
+
level: "WARN",
|
|
995
|
+
message: "Parameter Validation warrnings for getEmailProviderById",
|
|
996
|
+
});
|
|
997
|
+
Logger({ level: "WARN", message: warrning });
|
|
998
|
+
}
|
|
999
|
+
|
|
521
1000
|
const query_params = {};
|
|
522
1001
|
|
|
523
|
-
|
|
1002
|
+
const response = await PlatformAPIClient.execute(
|
|
524
1003
|
this.config,
|
|
525
1004
|
"get",
|
|
526
1005
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
|
|
527
1006
|
query_params,
|
|
528
1007
|
undefined
|
|
529
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;
|
|
530
1026
|
}
|
|
531
1027
|
|
|
532
1028
|
/**
|
|
533
1029
|
* @param {Object} arg - Arg object.
|
|
534
1030
|
* @param {string} arg.id - Email provider id
|
|
535
1031
|
* @param {EmailProviderReq} arg.body
|
|
1032
|
+
* @returns {Promise<EmailProvider>} - Success response
|
|
536
1033
|
* @summary: Update email provider by id
|
|
537
1034
|
* @description: Update email provider by id
|
|
538
1035
|
*/
|
|
539
|
-
updateEmailProviderById({ id, body } = {}) {
|
|
1036
|
+
async updateEmailProviderById({ id, body } = {}) {
|
|
540
1037
|
const { error } = CommunicationValidator.updateEmailProviderById().validate(
|
|
541
1038
|
{
|
|
542
1039
|
id,
|
|
@@ -548,15 +1045,50 @@ class Communication {
|
|
|
548
1045
|
return Promise.reject(new FDKClientValidationError(error));
|
|
549
1046
|
}
|
|
550
1047
|
|
|
1048
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1049
|
+
const {
|
|
1050
|
+
error: warrning,
|
|
1051
|
+
} = CommunicationValidator.updateEmailProviderById().validate(
|
|
1052
|
+
{
|
|
1053
|
+
id,
|
|
1054
|
+
body,
|
|
1055
|
+
},
|
|
1056
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1057
|
+
);
|
|
1058
|
+
if (warrning) {
|
|
1059
|
+
Logger({
|
|
1060
|
+
level: "WARN",
|
|
1061
|
+
message: "Parameter Validation warrnings for updateEmailProviderById",
|
|
1062
|
+
});
|
|
1063
|
+
Logger({ level: "WARN", message: warrning });
|
|
1064
|
+
}
|
|
1065
|
+
|
|
551
1066
|
const query_params = {};
|
|
552
1067
|
|
|
553
|
-
|
|
1068
|
+
const response = await PlatformAPIClient.execute(
|
|
554
1069
|
this.config,
|
|
555
1070
|
"put",
|
|
556
1071
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
|
|
557
1072
|
query_params,
|
|
558
1073
|
body
|
|
559
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;
|
|
560
1092
|
}
|
|
561
1093
|
|
|
562
1094
|
/**
|
|
@@ -564,10 +1096,11 @@ class Communication {
|
|
|
564
1096
|
* @param {number} [arg.pageNo] - Current page no
|
|
565
1097
|
* @param {number} [arg.pageSize] - Current request items count
|
|
566
1098
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1099
|
+
* @returns {Promise<EmailTemplates>} - Success response
|
|
567
1100
|
* @summary: Get email templates
|
|
568
1101
|
* @description: Get email templates
|
|
569
1102
|
*/
|
|
570
|
-
getEmailTemplates({ pageNo, pageSize, sort } = {}) {
|
|
1103
|
+
async getEmailTemplates({ pageNo, pageSize, sort } = {}) {
|
|
571
1104
|
const { error } = CommunicationValidator.getEmailTemplates().validate(
|
|
572
1105
|
{
|
|
573
1106
|
pageNo,
|
|
@@ -580,18 +1113,54 @@ class Communication {
|
|
|
580
1113
|
return Promise.reject(new FDKClientValidationError(error));
|
|
581
1114
|
}
|
|
582
1115
|
|
|
1116
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1117
|
+
const {
|
|
1118
|
+
error: warrning,
|
|
1119
|
+
} = CommunicationValidator.getEmailTemplates().validate(
|
|
1120
|
+
{
|
|
1121
|
+
pageNo,
|
|
1122
|
+
pageSize,
|
|
1123
|
+
sort,
|
|
1124
|
+
},
|
|
1125
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1126
|
+
);
|
|
1127
|
+
if (warrning) {
|
|
1128
|
+
Logger({
|
|
1129
|
+
level: "WARN",
|
|
1130
|
+
message: "Parameter Validation warrnings for getEmailTemplates",
|
|
1131
|
+
});
|
|
1132
|
+
Logger({ level: "WARN", message: warrning });
|
|
1133
|
+
}
|
|
1134
|
+
|
|
583
1135
|
const query_params = {};
|
|
584
1136
|
query_params["page_no"] = pageNo;
|
|
585
1137
|
query_params["page_size"] = pageSize;
|
|
586
1138
|
query_params["sort"] = sort;
|
|
587
1139
|
|
|
588
|
-
|
|
1140
|
+
const response = await PlatformAPIClient.execute(
|
|
589
1141
|
this.config,
|
|
590
1142
|
"get",
|
|
591
1143
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates`,
|
|
592
1144
|
query_params,
|
|
593
1145
|
undefined
|
|
594
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;
|
|
595
1164
|
}
|
|
596
1165
|
|
|
597
1166
|
/**
|
|
@@ -634,10 +1203,11 @@ class Communication {
|
|
|
634
1203
|
/**
|
|
635
1204
|
* @param {Object} arg - Arg object.
|
|
636
1205
|
* @param {EmailTemplateReq} arg.body
|
|
1206
|
+
* @returns {Promise<EmailTemplateRes>} - Success response
|
|
637
1207
|
* @summary: Create email template
|
|
638
1208
|
* @description: Create email template
|
|
639
1209
|
*/
|
|
640
|
-
createEmailTemplate({ body } = {}) {
|
|
1210
|
+
async createEmailTemplate({ body } = {}) {
|
|
641
1211
|
const { error } = CommunicationValidator.createEmailTemplate().validate(
|
|
642
1212
|
{
|
|
643
1213
|
body,
|
|
@@ -648,15 +1218,49 @@ class Communication {
|
|
|
648
1218
|
return Promise.reject(new FDKClientValidationError(error));
|
|
649
1219
|
}
|
|
650
1220
|
|
|
1221
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1222
|
+
const {
|
|
1223
|
+
error: warrning,
|
|
1224
|
+
} = CommunicationValidator.createEmailTemplate().validate(
|
|
1225
|
+
{
|
|
1226
|
+
body,
|
|
1227
|
+
},
|
|
1228
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1229
|
+
);
|
|
1230
|
+
if (warrning) {
|
|
1231
|
+
Logger({
|
|
1232
|
+
level: "WARN",
|
|
1233
|
+
message: "Parameter Validation warrnings for createEmailTemplate",
|
|
1234
|
+
});
|
|
1235
|
+
Logger({ level: "WARN", message: warrning });
|
|
1236
|
+
}
|
|
1237
|
+
|
|
651
1238
|
const query_params = {};
|
|
652
1239
|
|
|
653
|
-
|
|
1240
|
+
const response = await PlatformAPIClient.execute(
|
|
654
1241
|
this.config,
|
|
655
1242
|
"post",
|
|
656
1243
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates`,
|
|
657
1244
|
query_params,
|
|
658
1245
|
body
|
|
659
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;
|
|
660
1264
|
}
|
|
661
1265
|
|
|
662
1266
|
/**
|
|
@@ -664,10 +1268,11 @@ class Communication {
|
|
|
664
1268
|
* @param {number} [arg.pageNo] - Current page no
|
|
665
1269
|
* @param {number} [arg.pageSize] - Current request items count
|
|
666
1270
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1271
|
+
* @returns {Promise<SystemEmailTemplates>} - Success response
|
|
667
1272
|
* @summary: Get system email templates
|
|
668
1273
|
* @description: Get system email templates
|
|
669
1274
|
*/
|
|
670
|
-
getSystemEmailTemplates({ pageNo, pageSize, sort } = {}) {
|
|
1275
|
+
async getSystemEmailTemplates({ pageNo, pageSize, sort } = {}) {
|
|
671
1276
|
const { error } = CommunicationValidator.getSystemEmailTemplates().validate(
|
|
672
1277
|
{
|
|
673
1278
|
pageNo,
|
|
@@ -680,18 +1285,54 @@ class Communication {
|
|
|
680
1285
|
return Promise.reject(new FDKClientValidationError(error));
|
|
681
1286
|
}
|
|
682
1287
|
|
|
1288
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1289
|
+
const {
|
|
1290
|
+
error: warrning,
|
|
1291
|
+
} = CommunicationValidator.getSystemEmailTemplates().validate(
|
|
1292
|
+
{
|
|
1293
|
+
pageNo,
|
|
1294
|
+
pageSize,
|
|
1295
|
+
sort,
|
|
1296
|
+
},
|
|
1297
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1298
|
+
);
|
|
1299
|
+
if (warrning) {
|
|
1300
|
+
Logger({
|
|
1301
|
+
level: "WARN",
|
|
1302
|
+
message: "Parameter Validation warrnings for getSystemEmailTemplates",
|
|
1303
|
+
});
|
|
1304
|
+
Logger({ level: "WARN", message: warrning });
|
|
1305
|
+
}
|
|
1306
|
+
|
|
683
1307
|
const query_params = {};
|
|
684
1308
|
query_params["page_no"] = pageNo;
|
|
685
1309
|
query_params["page_size"] = pageSize;
|
|
686
1310
|
query_params["sort"] = sort;
|
|
687
1311
|
|
|
688
|
-
|
|
1312
|
+
const response = await PlatformAPIClient.execute(
|
|
689
1313
|
this.config,
|
|
690
1314
|
"get",
|
|
691
1315
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/system-templates`,
|
|
692
1316
|
query_params,
|
|
693
1317
|
undefined
|
|
694
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;
|
|
695
1336
|
}
|
|
696
1337
|
|
|
697
1338
|
/**
|
|
@@ -734,10 +1375,11 @@ class Communication {
|
|
|
734
1375
|
/**
|
|
735
1376
|
* @param {Object} arg - Arg object.
|
|
736
1377
|
* @param {string} arg.id - Email template id
|
|
1378
|
+
* @returns {Promise<EmailTemplate>} - Success response
|
|
737
1379
|
* @summary: Get email template by id
|
|
738
1380
|
* @description: Get email template by id
|
|
739
1381
|
*/
|
|
740
|
-
getEmailTemplateById({ id } = {}) {
|
|
1382
|
+
async getEmailTemplateById({ id } = {}) {
|
|
741
1383
|
const { error } = CommunicationValidator.getEmailTemplateById().validate(
|
|
742
1384
|
{
|
|
743
1385
|
id,
|
|
@@ -748,25 +1390,60 @@ class Communication {
|
|
|
748
1390
|
return Promise.reject(new FDKClientValidationError(error));
|
|
749
1391
|
}
|
|
750
1392
|
|
|
1393
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1394
|
+
const {
|
|
1395
|
+
error: warrning,
|
|
1396
|
+
} = CommunicationValidator.getEmailTemplateById().validate(
|
|
1397
|
+
{
|
|
1398
|
+
id,
|
|
1399
|
+
},
|
|
1400
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1401
|
+
);
|
|
1402
|
+
if (warrning) {
|
|
1403
|
+
Logger({
|
|
1404
|
+
level: "WARN",
|
|
1405
|
+
message: "Parameter Validation warrnings for getEmailTemplateById",
|
|
1406
|
+
});
|
|
1407
|
+
Logger({ level: "WARN", message: warrning });
|
|
1408
|
+
}
|
|
1409
|
+
|
|
751
1410
|
const query_params = {};
|
|
752
1411
|
|
|
753
|
-
|
|
1412
|
+
const response = await PlatformAPIClient.execute(
|
|
754
1413
|
this.config,
|
|
755
1414
|
"get",
|
|
756
1415
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
757
1416
|
query_params,
|
|
758
1417
|
undefined
|
|
759
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;
|
|
760
1436
|
}
|
|
761
1437
|
|
|
762
1438
|
/**
|
|
763
1439
|
* @param {Object} arg - Arg object.
|
|
764
1440
|
* @param {string} arg.id - Email template id
|
|
765
1441
|
* @param {EmailTemplateReq} arg.body
|
|
1442
|
+
* @returns {Promise<EmailTemplateRes>} - Success response
|
|
766
1443
|
* @summary: Update email template by id
|
|
767
1444
|
* @description: Update email template by id
|
|
768
1445
|
*/
|
|
769
|
-
updateEmailTemplateById({ id, body } = {}) {
|
|
1446
|
+
async updateEmailTemplateById({ id, body } = {}) {
|
|
770
1447
|
const { error } = CommunicationValidator.updateEmailTemplateById().validate(
|
|
771
1448
|
{
|
|
772
1449
|
id,
|
|
@@ -778,24 +1455,60 @@ class Communication {
|
|
|
778
1455
|
return Promise.reject(new FDKClientValidationError(error));
|
|
779
1456
|
}
|
|
780
1457
|
|
|
1458
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1459
|
+
const {
|
|
1460
|
+
error: warrning,
|
|
1461
|
+
} = CommunicationValidator.updateEmailTemplateById().validate(
|
|
1462
|
+
{
|
|
1463
|
+
id,
|
|
1464
|
+
body,
|
|
1465
|
+
},
|
|
1466
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1467
|
+
);
|
|
1468
|
+
if (warrning) {
|
|
1469
|
+
Logger({
|
|
1470
|
+
level: "WARN",
|
|
1471
|
+
message: "Parameter Validation warrnings for updateEmailTemplateById",
|
|
1472
|
+
});
|
|
1473
|
+
Logger({ level: "WARN", message: warrning });
|
|
1474
|
+
}
|
|
1475
|
+
|
|
781
1476
|
const query_params = {};
|
|
782
1477
|
|
|
783
|
-
|
|
1478
|
+
const response = await PlatformAPIClient.execute(
|
|
784
1479
|
this.config,
|
|
785
1480
|
"put",
|
|
786
1481
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
787
1482
|
query_params,
|
|
788
1483
|
body
|
|
789
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;
|
|
790
1502
|
}
|
|
791
1503
|
|
|
792
1504
|
/**
|
|
793
1505
|
* @param {Object} arg - Arg object.
|
|
794
1506
|
* @param {string} arg.id - Email template id
|
|
1507
|
+
* @returns {Promise<EmailTemplateDeleteSuccessRes>} - Success response
|
|
795
1508
|
* @summary: Delete email template by id
|
|
796
1509
|
* @description: Delete email template by id
|
|
797
1510
|
*/
|
|
798
|
-
deleteEmailTemplateById({ id } = {}) {
|
|
1511
|
+
async deleteEmailTemplateById({ id } = {}) {
|
|
799
1512
|
const { error } = CommunicationValidator.deleteEmailTemplateById().validate(
|
|
800
1513
|
{
|
|
801
1514
|
id,
|
|
@@ -806,24 +1519,59 @@ class Communication {
|
|
|
806
1519
|
return Promise.reject(new FDKClientValidationError(error));
|
|
807
1520
|
}
|
|
808
1521
|
|
|
1522
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1523
|
+
const {
|
|
1524
|
+
error: warrning,
|
|
1525
|
+
} = CommunicationValidator.deleteEmailTemplateById().validate(
|
|
1526
|
+
{
|
|
1527
|
+
id,
|
|
1528
|
+
},
|
|
1529
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1530
|
+
);
|
|
1531
|
+
if (warrning) {
|
|
1532
|
+
Logger({
|
|
1533
|
+
level: "WARN",
|
|
1534
|
+
message: "Parameter Validation warrnings for deleteEmailTemplateById",
|
|
1535
|
+
});
|
|
1536
|
+
Logger({ level: "WARN", message: warrning });
|
|
1537
|
+
}
|
|
1538
|
+
|
|
809
1539
|
const query_params = {};
|
|
810
1540
|
|
|
811
|
-
|
|
1541
|
+
const response = await PlatformAPIClient.execute(
|
|
812
1542
|
this.config,
|
|
813
1543
|
"delete",
|
|
814
1544
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
815
1545
|
query_params,
|
|
816
1546
|
undefined
|
|
817
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;
|
|
818
1565
|
}
|
|
819
1566
|
|
|
820
1567
|
/**
|
|
821
1568
|
* @param {Object} arg - Arg object.
|
|
822
1569
|
* @param {EngineRequest} arg.body
|
|
1570
|
+
* @returns {Promise<EngineResponse>} - Success response
|
|
823
1571
|
* @summary: Send email or sms synchronously
|
|
824
1572
|
* @description: Send email or sms synchronously
|
|
825
1573
|
*/
|
|
826
|
-
sendCommunicationSynchronously({ body } = {}) {
|
|
1574
|
+
async sendCommunicationSynchronously({ body } = {}) {
|
|
827
1575
|
const {
|
|
828
1576
|
error,
|
|
829
1577
|
} = CommunicationValidator.sendCommunicationSynchronously().validate(
|
|
@@ -836,24 +1584,61 @@ class Communication {
|
|
|
836
1584
|
return Promise.reject(new FDKClientValidationError(error));
|
|
837
1585
|
}
|
|
838
1586
|
|
|
1587
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1588
|
+
const {
|
|
1589
|
+
error: warrning,
|
|
1590
|
+
} = CommunicationValidator.sendCommunicationSynchronously().validate(
|
|
1591
|
+
{
|
|
1592
|
+
body,
|
|
1593
|
+
},
|
|
1594
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1595
|
+
);
|
|
1596
|
+
if (warrning) {
|
|
1597
|
+
Logger({
|
|
1598
|
+
level: "WARN",
|
|
1599
|
+
message:
|
|
1600
|
+
"Parameter Validation warrnings for sendCommunicationSynchronously",
|
|
1601
|
+
});
|
|
1602
|
+
Logger({ level: "WARN", message: warrning });
|
|
1603
|
+
}
|
|
1604
|
+
|
|
839
1605
|
const query_params = {};
|
|
840
1606
|
|
|
841
|
-
|
|
1607
|
+
const response = await PlatformAPIClient.execute(
|
|
842
1608
|
this.config,
|
|
843
1609
|
"post",
|
|
844
1610
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/engine/send-instant`,
|
|
845
1611
|
query_params,
|
|
846
1612
|
body
|
|
847
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;
|
|
848
1632
|
}
|
|
849
1633
|
|
|
850
1634
|
/**
|
|
851
1635
|
* @param {Object} arg - Arg object.
|
|
852
1636
|
* @param {EngineRequest} arg.body
|
|
1637
|
+
* @returns {Promise<EngineResponse>} - Success response
|
|
853
1638
|
* @summary: Send email or sms asynchronously
|
|
854
1639
|
* @description: Send email or sms asynchronously
|
|
855
1640
|
*/
|
|
856
|
-
sendCommunicationAsynchronously({ body } = {}) {
|
|
1641
|
+
async sendCommunicationAsynchronously({ body } = {}) {
|
|
857
1642
|
const {
|
|
858
1643
|
error,
|
|
859
1644
|
} = CommunicationValidator.sendCommunicationAsynchronously().validate(
|
|
@@ -866,15 +1651,51 @@ class Communication {
|
|
|
866
1651
|
return Promise.reject(new FDKClientValidationError(error));
|
|
867
1652
|
}
|
|
868
1653
|
|
|
1654
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1655
|
+
const {
|
|
1656
|
+
error: warrning,
|
|
1657
|
+
} = CommunicationValidator.sendCommunicationAsynchronously().validate(
|
|
1658
|
+
{
|
|
1659
|
+
body,
|
|
1660
|
+
},
|
|
1661
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1662
|
+
);
|
|
1663
|
+
if (warrning) {
|
|
1664
|
+
Logger({
|
|
1665
|
+
level: "WARN",
|
|
1666
|
+
message:
|
|
1667
|
+
"Parameter Validation warrnings for sendCommunicationAsynchronously",
|
|
1668
|
+
});
|
|
1669
|
+
Logger({ level: "WARN", message: warrning });
|
|
1670
|
+
}
|
|
1671
|
+
|
|
869
1672
|
const query_params = {};
|
|
870
1673
|
|
|
871
|
-
|
|
1674
|
+
const response = await PlatformAPIClient.execute(
|
|
872
1675
|
this.config,
|
|
873
1676
|
"post",
|
|
874
1677
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/engine/send-async`,
|
|
875
1678
|
query_params,
|
|
876
1679
|
body
|
|
877
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;
|
|
878
1699
|
}
|
|
879
1700
|
|
|
880
1701
|
/**
|
|
@@ -882,10 +1703,11 @@ class Communication {
|
|
|
882
1703
|
* @param {number} [arg.pageNo] - Current page no
|
|
883
1704
|
* @param {number} [arg.pageSize] - Current request items count
|
|
884
1705
|
* @param {string} [arg.populate] - Populate fields
|
|
1706
|
+
* @returns {Promise<EventSubscriptions>} - Success response
|
|
885
1707
|
* @summary: Get event subscriptions
|
|
886
1708
|
* @description: Get event subscriptions
|
|
887
1709
|
*/
|
|
888
|
-
getEventSubscriptions({ pageNo, pageSize, populate } = {}) {
|
|
1710
|
+
async getEventSubscriptions({ pageNo, pageSize, populate } = {}) {
|
|
889
1711
|
const { error } = CommunicationValidator.getEventSubscriptions().validate(
|
|
890
1712
|
{
|
|
891
1713
|
pageNo,
|
|
@@ -898,18 +1720,54 @@ class Communication {
|
|
|
898
1720
|
return Promise.reject(new FDKClientValidationError(error));
|
|
899
1721
|
}
|
|
900
1722
|
|
|
1723
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1724
|
+
const {
|
|
1725
|
+
error: warrning,
|
|
1726
|
+
} = CommunicationValidator.getEventSubscriptions().validate(
|
|
1727
|
+
{
|
|
1728
|
+
pageNo,
|
|
1729
|
+
pageSize,
|
|
1730
|
+
populate,
|
|
1731
|
+
},
|
|
1732
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1733
|
+
);
|
|
1734
|
+
if (warrning) {
|
|
1735
|
+
Logger({
|
|
1736
|
+
level: "WARN",
|
|
1737
|
+
message: "Parameter Validation warrnings for getEventSubscriptions",
|
|
1738
|
+
});
|
|
1739
|
+
Logger({ level: "WARN", message: warrning });
|
|
1740
|
+
}
|
|
1741
|
+
|
|
901
1742
|
const query_params = {};
|
|
902
1743
|
query_params["page_no"] = pageNo;
|
|
903
1744
|
query_params["page_size"] = pageSize;
|
|
904
1745
|
query_params["populate"] = populate;
|
|
905
1746
|
|
|
906
|
-
|
|
1747
|
+
const response = await PlatformAPIClient.execute(
|
|
907
1748
|
this.config,
|
|
908
1749
|
"get",
|
|
909
1750
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/event/event-subscriptions`,
|
|
910
1751
|
query_params,
|
|
911
1752
|
undefined
|
|
912
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;
|
|
913
1771
|
}
|
|
914
1772
|
|
|
915
1773
|
/**
|
|
@@ -954,10 +1812,11 @@ class Communication {
|
|
|
954
1812
|
* @param {number} [arg.pageNo] - Current page no
|
|
955
1813
|
* @param {number} [arg.pageSize] - Current request items count
|
|
956
1814
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1815
|
+
* @returns {Promise<Jobs>} - Success response
|
|
957
1816
|
* @summary: Get jobs
|
|
958
1817
|
* @description: Get jobs
|
|
959
1818
|
*/
|
|
960
|
-
getJobs({ pageNo, pageSize, sort } = {}) {
|
|
1819
|
+
async getJobs({ pageNo, pageSize, sort } = {}) {
|
|
961
1820
|
const { error } = CommunicationValidator.getJobs().validate(
|
|
962
1821
|
{
|
|
963
1822
|
pageNo,
|
|
@@ -970,18 +1829,50 @@ class Communication {
|
|
|
970
1829
|
return Promise.reject(new FDKClientValidationError(error));
|
|
971
1830
|
}
|
|
972
1831
|
|
|
1832
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1833
|
+
const { error: warrning } = CommunicationValidator.getJobs().validate(
|
|
1834
|
+
{
|
|
1835
|
+
pageNo,
|
|
1836
|
+
pageSize,
|
|
1837
|
+
sort,
|
|
1838
|
+
},
|
|
1839
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1840
|
+
);
|
|
1841
|
+
if (warrning) {
|
|
1842
|
+
Logger({
|
|
1843
|
+
level: "WARN",
|
|
1844
|
+
message: "Parameter Validation warrnings for getJobs",
|
|
1845
|
+
});
|
|
1846
|
+
Logger({ level: "WARN", message: warrning });
|
|
1847
|
+
}
|
|
1848
|
+
|
|
973
1849
|
const query_params = {};
|
|
974
1850
|
query_params["page_no"] = pageNo;
|
|
975
1851
|
query_params["page_size"] = pageSize;
|
|
976
1852
|
query_params["sort"] = sort;
|
|
977
1853
|
|
|
978
|
-
|
|
1854
|
+
const response = await PlatformAPIClient.execute(
|
|
979
1855
|
this.config,
|
|
980
1856
|
"get",
|
|
981
1857
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/jobs`,
|
|
982
1858
|
query_params,
|
|
983
1859
|
undefined
|
|
984
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;
|
|
985
1876
|
}
|
|
986
1877
|
|
|
987
1878
|
/**
|
|
@@ -1019,10 +1910,11 @@ class Communication {
|
|
|
1019
1910
|
/**
|
|
1020
1911
|
* @param {Object} arg - Arg object.
|
|
1021
1912
|
* @param {TriggerJobRequest} arg.body
|
|
1913
|
+
* @returns {Promise<TriggerJobResponse>} - Success response
|
|
1022
1914
|
* @summary: Trigger campaign job
|
|
1023
1915
|
* @description: Trigger campaign job
|
|
1024
1916
|
*/
|
|
1025
|
-
triggerCampaignJob({ body } = {}) {
|
|
1917
|
+
async triggerCampaignJob({ body } = {}) {
|
|
1026
1918
|
const { error } = CommunicationValidator.triggerCampaignJob().validate(
|
|
1027
1919
|
{
|
|
1028
1920
|
body,
|
|
@@ -1033,15 +1925,49 @@ class Communication {
|
|
|
1033
1925
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1034
1926
|
}
|
|
1035
1927
|
|
|
1928
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1929
|
+
const {
|
|
1930
|
+
error: warrning,
|
|
1931
|
+
} = CommunicationValidator.triggerCampaignJob().validate(
|
|
1932
|
+
{
|
|
1933
|
+
body,
|
|
1934
|
+
},
|
|
1935
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1936
|
+
);
|
|
1937
|
+
if (warrning) {
|
|
1938
|
+
Logger({
|
|
1939
|
+
level: "WARN",
|
|
1940
|
+
message: "Parameter Validation warrnings for triggerCampaignJob",
|
|
1941
|
+
});
|
|
1942
|
+
Logger({ level: "WARN", message: warrning });
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1036
1945
|
const query_params = {};
|
|
1037
1946
|
|
|
1038
|
-
|
|
1947
|
+
const response = await PlatformAPIClient.execute(
|
|
1039
1948
|
this.config,
|
|
1040
1949
|
"post",
|
|
1041
1950
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/trigger-job`,
|
|
1042
1951
|
query_params,
|
|
1043
1952
|
body
|
|
1044
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;
|
|
1045
1971
|
}
|
|
1046
1972
|
|
|
1047
1973
|
/**
|
|
@@ -1049,10 +1975,11 @@ class Communication {
|
|
|
1049
1975
|
* @param {number} [arg.pageNo] - Current page no
|
|
1050
1976
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1051
1977
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1978
|
+
* @returns {Promise<JobLogs>} - Success response
|
|
1052
1979
|
* @summary: Get job logs
|
|
1053
1980
|
* @description: Get job logs
|
|
1054
1981
|
*/
|
|
1055
|
-
getJobLogs({ pageNo, pageSize, sort } = {}) {
|
|
1982
|
+
async getJobLogs({ pageNo, pageSize, sort } = {}) {
|
|
1056
1983
|
const { error } = CommunicationValidator.getJobLogs().validate(
|
|
1057
1984
|
{
|
|
1058
1985
|
pageNo,
|
|
@@ -1065,18 +1992,50 @@ class Communication {
|
|
|
1065
1992
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1066
1993
|
}
|
|
1067
1994
|
|
|
1995
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1996
|
+
const { error: warrning } = CommunicationValidator.getJobLogs().validate(
|
|
1997
|
+
{
|
|
1998
|
+
pageNo,
|
|
1999
|
+
pageSize,
|
|
2000
|
+
sort,
|
|
2001
|
+
},
|
|
2002
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2003
|
+
);
|
|
2004
|
+
if (warrning) {
|
|
2005
|
+
Logger({
|
|
2006
|
+
level: "WARN",
|
|
2007
|
+
message: "Parameter Validation warrnings for getJobLogs",
|
|
2008
|
+
});
|
|
2009
|
+
Logger({ level: "WARN", message: warrning });
|
|
2010
|
+
}
|
|
2011
|
+
|
|
1068
2012
|
const query_params = {};
|
|
1069
2013
|
query_params["page_no"] = pageNo;
|
|
1070
2014
|
query_params["page_size"] = pageSize;
|
|
1071
2015
|
query_params["sort"] = sort;
|
|
1072
2016
|
|
|
1073
|
-
|
|
2017
|
+
const response = await PlatformAPIClient.execute(
|
|
1074
2018
|
this.config,
|
|
1075
2019
|
"get",
|
|
1076
2020
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/logs`,
|
|
1077
2021
|
query_params,
|
|
1078
2022
|
undefined
|
|
1079
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;
|
|
1080
2039
|
}
|
|
1081
2040
|
|
|
1082
2041
|
/**
|
|
@@ -1117,10 +2076,11 @@ class Communication {
|
|
|
1117
2076
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1118
2077
|
* @param {Object} [arg.sort] - To sort based on _id
|
|
1119
2078
|
* @param {Object} [arg.query] -
|
|
2079
|
+
* @returns {Promise<Logs>} - Success response
|
|
1120
2080
|
* @summary: Get communication logs
|
|
1121
2081
|
* @description: Get communication logs
|
|
1122
2082
|
*/
|
|
1123
|
-
getCommunicationLogs({ pageId, pageSize, sort, query } = {}) {
|
|
2083
|
+
async getCommunicationLogs({ pageId, pageSize, sort, query } = {}) {
|
|
1124
2084
|
const { error } = CommunicationValidator.getCommunicationLogs().validate(
|
|
1125
2085
|
{
|
|
1126
2086
|
pageId,
|
|
@@ -1134,19 +2094,54 @@ class Communication {
|
|
|
1134
2094
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1135
2095
|
}
|
|
1136
2096
|
|
|
2097
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2098
|
+
const {
|
|
2099
|
+
error: warrning,
|
|
2100
|
+
} = CommunicationValidator.getCommunicationLogs().validate(
|
|
2101
|
+
{
|
|
2102
|
+
pageId,
|
|
2103
|
+
pageSize,
|
|
2104
|
+
sort,
|
|
2105
|
+
query,
|
|
2106
|
+
},
|
|
2107
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2108
|
+
);
|
|
2109
|
+
if (warrning) {
|
|
2110
|
+
Logger({
|
|
2111
|
+
level: "WARN",
|
|
2112
|
+
message: "Parameter Validation warrnings for getCommunicationLogs",
|
|
2113
|
+
});
|
|
2114
|
+
Logger({ level: "WARN", message: warrning });
|
|
2115
|
+
}
|
|
2116
|
+
|
|
1137
2117
|
const query_params = {};
|
|
1138
2118
|
query_params["page_id"] = pageId;
|
|
1139
2119
|
query_params["page_size"] = pageSize;
|
|
1140
2120
|
query_params["sort"] = sort;
|
|
1141
2121
|
query_params["query"] = query;
|
|
1142
2122
|
|
|
1143
|
-
|
|
2123
|
+
const response = await PlatformAPIClient.execute(
|
|
1144
2124
|
this.config,
|
|
1145
2125
|
"get",
|
|
1146
2126
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/log`,
|
|
1147
2127
|
query_params,
|
|
1148
2128
|
undefined
|
|
1149
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;
|
|
1150
2145
|
}
|
|
1151
2146
|
|
|
1152
2147
|
/**
|
|
@@ -1192,10 +2187,11 @@ class Communication {
|
|
|
1192
2187
|
/**
|
|
1193
2188
|
* @param {Object} arg - Arg object.
|
|
1194
2189
|
* @param {SendOtpCommsReq} arg.body
|
|
2190
|
+
* @returns {Promise<SendOtpCommsRes>} - Success response
|
|
1195
2191
|
* @summary: Send OTP using email and sms
|
|
1196
2192
|
* @description: Send OTP Comms via email and sms
|
|
1197
2193
|
*/
|
|
1198
|
-
sendOtp({ body } = {}) {
|
|
2194
|
+
async sendOtp({ body } = {}) {
|
|
1199
2195
|
const { error } = CommunicationValidator.sendOtp().validate(
|
|
1200
2196
|
{
|
|
1201
2197
|
body,
|
|
@@ -1206,24 +2202,57 @@ class Communication {
|
|
|
1206
2202
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1207
2203
|
}
|
|
1208
2204
|
|
|
2205
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2206
|
+
const { error: warrning } = CommunicationValidator.sendOtp().validate(
|
|
2207
|
+
{
|
|
2208
|
+
body,
|
|
2209
|
+
},
|
|
2210
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2211
|
+
);
|
|
2212
|
+
if (warrning) {
|
|
2213
|
+
Logger({
|
|
2214
|
+
level: "WARN",
|
|
2215
|
+
message: "Parameter Validation warrnings for sendOtp",
|
|
2216
|
+
});
|
|
2217
|
+
Logger({ level: "WARN", message: warrning });
|
|
2218
|
+
}
|
|
2219
|
+
|
|
1209
2220
|
const query_params = {};
|
|
1210
2221
|
|
|
1211
|
-
|
|
2222
|
+
const response = await PlatformAPIClient.execute(
|
|
1212
2223
|
this.config,
|
|
1213
2224
|
"post",
|
|
1214
2225
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/otp/send-otp-comms`,
|
|
1215
2226
|
query_params,
|
|
1216
2227
|
body
|
|
1217
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;
|
|
1218
2246
|
}
|
|
1219
2247
|
|
|
1220
2248
|
/**
|
|
1221
2249
|
* @param {Object} arg - Arg object.
|
|
1222
2250
|
* @param {VerifyOtpCommsReq} arg.body
|
|
2251
|
+
* @returns {Promise<VerifyOtpCommsSuccessRes>} - Success response
|
|
1223
2252
|
* @summary: Verify OTP sent via email and sms
|
|
1224
2253
|
* @description: Verify OTP sent via email and sms
|
|
1225
2254
|
*/
|
|
1226
|
-
verfiyOtp({ body } = {}) {
|
|
2255
|
+
async verfiyOtp({ body } = {}) {
|
|
1227
2256
|
const { error } = CommunicationValidator.verfiyOtp().validate(
|
|
1228
2257
|
{
|
|
1229
2258
|
body,
|
|
@@ -1234,15 +2263,47 @@ class Communication {
|
|
|
1234
2263
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1235
2264
|
}
|
|
1236
2265
|
|
|
2266
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2267
|
+
const { error: warrning } = CommunicationValidator.verfiyOtp().validate(
|
|
2268
|
+
{
|
|
2269
|
+
body,
|
|
2270
|
+
},
|
|
2271
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2272
|
+
);
|
|
2273
|
+
if (warrning) {
|
|
2274
|
+
Logger({
|
|
2275
|
+
level: "WARN",
|
|
2276
|
+
message: "Parameter Validation warrnings for verfiyOtp",
|
|
2277
|
+
});
|
|
2278
|
+
Logger({ level: "WARN", message: warrning });
|
|
2279
|
+
}
|
|
2280
|
+
|
|
1237
2281
|
const query_params = {};
|
|
1238
2282
|
|
|
1239
|
-
|
|
2283
|
+
const response = await PlatformAPIClient.execute(
|
|
1240
2284
|
this.config,
|
|
1241
2285
|
"post",
|
|
1242
2286
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/otp/verify-otp-comms`,
|
|
1243
2287
|
query_params,
|
|
1244
2288
|
body
|
|
1245
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;
|
|
1246
2307
|
}
|
|
1247
2308
|
|
|
1248
2309
|
/**
|
|
@@ -1250,10 +2311,11 @@ class Communication {
|
|
|
1250
2311
|
* @param {number} [arg.pageNo] - Current page no
|
|
1251
2312
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1252
2313
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2314
|
+
* @returns {Promise<SmsProviders>} - Success response
|
|
1253
2315
|
* @summary: Get sms providers
|
|
1254
2316
|
* @description: Get sms providers
|
|
1255
2317
|
*/
|
|
1256
|
-
getSmsProviders({ pageNo, pageSize, sort } = {}) {
|
|
2318
|
+
async getSmsProviders({ pageNo, pageSize, sort } = {}) {
|
|
1257
2319
|
const { error } = CommunicationValidator.getSmsProviders().validate(
|
|
1258
2320
|
{
|
|
1259
2321
|
pageNo,
|
|
@@ -1266,18 +2328,54 @@ class Communication {
|
|
|
1266
2328
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1267
2329
|
}
|
|
1268
2330
|
|
|
2331
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2332
|
+
const {
|
|
2333
|
+
error: warrning,
|
|
2334
|
+
} = CommunicationValidator.getSmsProviders().validate(
|
|
2335
|
+
{
|
|
2336
|
+
pageNo,
|
|
2337
|
+
pageSize,
|
|
2338
|
+
sort,
|
|
2339
|
+
},
|
|
2340
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2341
|
+
);
|
|
2342
|
+
if (warrning) {
|
|
2343
|
+
Logger({
|
|
2344
|
+
level: "WARN",
|
|
2345
|
+
message: "Parameter Validation warrnings for getSmsProviders",
|
|
2346
|
+
});
|
|
2347
|
+
Logger({ level: "WARN", message: warrning });
|
|
2348
|
+
}
|
|
2349
|
+
|
|
1269
2350
|
const query_params = {};
|
|
1270
2351
|
query_params["page_no"] = pageNo;
|
|
1271
2352
|
query_params["page_size"] = pageSize;
|
|
1272
2353
|
query_params["sort"] = sort;
|
|
1273
2354
|
|
|
1274
|
-
|
|
2355
|
+
const response = await PlatformAPIClient.execute(
|
|
1275
2356
|
this.config,
|
|
1276
2357
|
"get",
|
|
1277
2358
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers`,
|
|
1278
2359
|
query_params,
|
|
1279
2360
|
undefined
|
|
1280
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;
|
|
1281
2379
|
}
|
|
1282
2380
|
|
|
1283
2381
|
/**
|
|
@@ -1315,10 +2413,11 @@ class Communication {
|
|
|
1315
2413
|
/**
|
|
1316
2414
|
* @param {Object} arg - Arg object.
|
|
1317
2415
|
* @param {SmsProviderReq} arg.body
|
|
2416
|
+
* @returns {Promise<SmsProvider>} - Success response
|
|
1318
2417
|
* @summary: Create sms provider
|
|
1319
2418
|
* @description: Create sms provider
|
|
1320
2419
|
*/
|
|
1321
|
-
createSmsProvider({ body } = {}) {
|
|
2420
|
+
async createSmsProvider({ body } = {}) {
|
|
1322
2421
|
const { error } = CommunicationValidator.createSmsProvider().validate(
|
|
1323
2422
|
{
|
|
1324
2423
|
body,
|
|
@@ -1329,24 +2428,59 @@ class Communication {
|
|
|
1329
2428
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1330
2429
|
}
|
|
1331
2430
|
|
|
2431
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2432
|
+
const {
|
|
2433
|
+
error: warrning,
|
|
2434
|
+
} = CommunicationValidator.createSmsProvider().validate(
|
|
2435
|
+
{
|
|
2436
|
+
body,
|
|
2437
|
+
},
|
|
2438
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2439
|
+
);
|
|
2440
|
+
if (warrning) {
|
|
2441
|
+
Logger({
|
|
2442
|
+
level: "WARN",
|
|
2443
|
+
message: "Parameter Validation warrnings for createSmsProvider",
|
|
2444
|
+
});
|
|
2445
|
+
Logger({ level: "WARN", message: warrning });
|
|
2446
|
+
}
|
|
2447
|
+
|
|
1332
2448
|
const query_params = {};
|
|
1333
2449
|
|
|
1334
|
-
|
|
2450
|
+
const response = await PlatformAPIClient.execute(
|
|
1335
2451
|
this.config,
|
|
1336
2452
|
"post",
|
|
1337
2453
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers`,
|
|
1338
2454
|
query_params,
|
|
1339
2455
|
body
|
|
1340
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;
|
|
1341
2474
|
}
|
|
1342
2475
|
|
|
1343
2476
|
/**
|
|
1344
2477
|
* @param {Object} arg - Arg object.
|
|
1345
2478
|
* @param {string} arg.id - Sms provider id
|
|
2479
|
+
* @returns {Promise<SmsProvider>} - Success response
|
|
1346
2480
|
* @summary: Get sms provider by id
|
|
1347
2481
|
* @description: Get sms provider by id
|
|
1348
2482
|
*/
|
|
1349
|
-
getSmsProviderById({ id } = {}) {
|
|
2483
|
+
async getSmsProviderById({ id } = {}) {
|
|
1350
2484
|
const { error } = CommunicationValidator.getSmsProviderById().validate(
|
|
1351
2485
|
{
|
|
1352
2486
|
id,
|
|
@@ -1357,25 +2491,60 @@ class Communication {
|
|
|
1357
2491
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1358
2492
|
}
|
|
1359
2493
|
|
|
2494
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2495
|
+
const {
|
|
2496
|
+
error: warrning,
|
|
2497
|
+
} = CommunicationValidator.getSmsProviderById().validate(
|
|
2498
|
+
{
|
|
2499
|
+
id,
|
|
2500
|
+
},
|
|
2501
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2502
|
+
);
|
|
2503
|
+
if (warrning) {
|
|
2504
|
+
Logger({
|
|
2505
|
+
level: "WARN",
|
|
2506
|
+
message: "Parameter Validation warrnings for getSmsProviderById",
|
|
2507
|
+
});
|
|
2508
|
+
Logger({ level: "WARN", message: warrning });
|
|
2509
|
+
}
|
|
2510
|
+
|
|
1360
2511
|
const query_params = {};
|
|
1361
2512
|
|
|
1362
|
-
|
|
2513
|
+
const response = await PlatformAPIClient.execute(
|
|
1363
2514
|
this.config,
|
|
1364
2515
|
"get",
|
|
1365
2516
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers/${id}`,
|
|
1366
2517
|
query_params,
|
|
1367
2518
|
undefined
|
|
1368
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;
|
|
1369
2537
|
}
|
|
1370
2538
|
|
|
1371
2539
|
/**
|
|
1372
2540
|
* @param {Object} arg - Arg object.
|
|
1373
2541
|
* @param {string} arg.id - Sms provider id
|
|
1374
2542
|
* @param {SmsProviderReq} arg.body
|
|
2543
|
+
* @returns {Promise<SmsProvider>} - Success response
|
|
1375
2544
|
* @summary: Update sms provider by id
|
|
1376
2545
|
* @description: Update sms provider by id
|
|
1377
2546
|
*/
|
|
1378
|
-
updateSmsProviderById({ id, body } = {}) {
|
|
2547
|
+
async updateSmsProviderById({ id, body } = {}) {
|
|
1379
2548
|
const { error } = CommunicationValidator.updateSmsProviderById().validate(
|
|
1380
2549
|
{
|
|
1381
2550
|
id,
|
|
@@ -1387,15 +2556,50 @@ class Communication {
|
|
|
1387
2556
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1388
2557
|
}
|
|
1389
2558
|
|
|
2559
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2560
|
+
const {
|
|
2561
|
+
error: warrning,
|
|
2562
|
+
} = CommunicationValidator.updateSmsProviderById().validate(
|
|
2563
|
+
{
|
|
2564
|
+
id,
|
|
2565
|
+
body,
|
|
2566
|
+
},
|
|
2567
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2568
|
+
);
|
|
2569
|
+
if (warrning) {
|
|
2570
|
+
Logger({
|
|
2571
|
+
level: "WARN",
|
|
2572
|
+
message: "Parameter Validation warrnings for updateSmsProviderById",
|
|
2573
|
+
});
|
|
2574
|
+
Logger({ level: "WARN", message: warrning });
|
|
2575
|
+
}
|
|
2576
|
+
|
|
1390
2577
|
const query_params = {};
|
|
1391
2578
|
|
|
1392
|
-
|
|
2579
|
+
const response = await PlatformAPIClient.execute(
|
|
1393
2580
|
this.config,
|
|
1394
2581
|
"put",
|
|
1395
2582
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers/${id}`,
|
|
1396
2583
|
query_params,
|
|
1397
2584
|
body
|
|
1398
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;
|
|
1399
2603
|
}
|
|
1400
2604
|
|
|
1401
2605
|
/**
|
|
@@ -1403,10 +2607,11 @@ class Communication {
|
|
|
1403
2607
|
* @param {number} [arg.pageNo] - Current page no
|
|
1404
2608
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1405
2609
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2610
|
+
* @returns {Promise<SmsTemplates>} - Success response
|
|
1406
2611
|
* @summary: Get sms templates
|
|
1407
2612
|
* @description: Get sms templates
|
|
1408
2613
|
*/
|
|
1409
|
-
getSmsTemplates({ pageNo, pageSize, sort } = {}) {
|
|
2614
|
+
async getSmsTemplates({ pageNo, pageSize, sort } = {}) {
|
|
1410
2615
|
const { error } = CommunicationValidator.getSmsTemplates().validate(
|
|
1411
2616
|
{
|
|
1412
2617
|
pageNo,
|
|
@@ -1419,18 +2624,54 @@ class Communication {
|
|
|
1419
2624
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1420
2625
|
}
|
|
1421
2626
|
|
|
2627
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2628
|
+
const {
|
|
2629
|
+
error: warrning,
|
|
2630
|
+
} = CommunicationValidator.getSmsTemplates().validate(
|
|
2631
|
+
{
|
|
2632
|
+
pageNo,
|
|
2633
|
+
pageSize,
|
|
2634
|
+
sort,
|
|
2635
|
+
},
|
|
2636
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2637
|
+
);
|
|
2638
|
+
if (warrning) {
|
|
2639
|
+
Logger({
|
|
2640
|
+
level: "WARN",
|
|
2641
|
+
message: "Parameter Validation warrnings for getSmsTemplates",
|
|
2642
|
+
});
|
|
2643
|
+
Logger({ level: "WARN", message: warrning });
|
|
2644
|
+
}
|
|
2645
|
+
|
|
1422
2646
|
const query_params = {};
|
|
1423
2647
|
query_params["page_no"] = pageNo;
|
|
1424
2648
|
query_params["page_size"] = pageSize;
|
|
1425
2649
|
query_params["sort"] = sort;
|
|
1426
2650
|
|
|
1427
|
-
|
|
2651
|
+
const response = await PlatformAPIClient.execute(
|
|
1428
2652
|
this.config,
|
|
1429
2653
|
"get",
|
|
1430
2654
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates`,
|
|
1431
2655
|
query_params,
|
|
1432
2656
|
undefined
|
|
1433
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;
|
|
1434
2675
|
}
|
|
1435
2676
|
|
|
1436
2677
|
/**
|
|
@@ -1468,10 +2709,11 @@ class Communication {
|
|
|
1468
2709
|
/**
|
|
1469
2710
|
* @param {Object} arg - Arg object.
|
|
1470
2711
|
* @param {SmsTemplateReq} arg.body
|
|
2712
|
+
* @returns {Promise<SmsTemplateRes>} - Success response
|
|
1471
2713
|
* @summary: Create sms template
|
|
1472
2714
|
* @description: Create sms template
|
|
1473
2715
|
*/
|
|
1474
|
-
createSmsTemplate({ body } = {}) {
|
|
2716
|
+
async createSmsTemplate({ body } = {}) {
|
|
1475
2717
|
const { error } = CommunicationValidator.createSmsTemplate().validate(
|
|
1476
2718
|
{
|
|
1477
2719
|
body,
|
|
@@ -1482,24 +2724,59 @@ class Communication {
|
|
|
1482
2724
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1483
2725
|
}
|
|
1484
2726
|
|
|
2727
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2728
|
+
const {
|
|
2729
|
+
error: warrning,
|
|
2730
|
+
} = CommunicationValidator.createSmsTemplate().validate(
|
|
2731
|
+
{
|
|
2732
|
+
body,
|
|
2733
|
+
},
|
|
2734
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2735
|
+
);
|
|
2736
|
+
if (warrning) {
|
|
2737
|
+
Logger({
|
|
2738
|
+
level: "WARN",
|
|
2739
|
+
message: "Parameter Validation warrnings for createSmsTemplate",
|
|
2740
|
+
});
|
|
2741
|
+
Logger({ level: "WARN", message: warrning });
|
|
2742
|
+
}
|
|
2743
|
+
|
|
1485
2744
|
const query_params = {};
|
|
1486
2745
|
|
|
1487
|
-
|
|
2746
|
+
const response = await PlatformAPIClient.execute(
|
|
1488
2747
|
this.config,
|
|
1489
2748
|
"post",
|
|
1490
2749
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates`,
|
|
1491
2750
|
query_params,
|
|
1492
2751
|
body
|
|
1493
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;
|
|
1494
2770
|
}
|
|
1495
2771
|
|
|
1496
2772
|
/**
|
|
1497
2773
|
* @param {Object} arg - Arg object.
|
|
1498
2774
|
* @param {string} arg.id - Sms template id
|
|
2775
|
+
* @returns {Promise<SmsTemplate>} - Success response
|
|
1499
2776
|
* @summary: Get sms template by id
|
|
1500
2777
|
* @description: Get sms template by id
|
|
1501
2778
|
*/
|
|
1502
|
-
getSmsTemplateById({ id } = {}) {
|
|
2779
|
+
async getSmsTemplateById({ id } = {}) {
|
|
1503
2780
|
const { error } = CommunicationValidator.getSmsTemplateById().validate(
|
|
1504
2781
|
{
|
|
1505
2782
|
id,
|
|
@@ -1510,25 +2787,60 @@ class Communication {
|
|
|
1510
2787
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1511
2788
|
}
|
|
1512
2789
|
|
|
2790
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2791
|
+
const {
|
|
2792
|
+
error: warrning,
|
|
2793
|
+
} = CommunicationValidator.getSmsTemplateById().validate(
|
|
2794
|
+
{
|
|
2795
|
+
id,
|
|
2796
|
+
},
|
|
2797
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2798
|
+
);
|
|
2799
|
+
if (warrning) {
|
|
2800
|
+
Logger({
|
|
2801
|
+
level: "WARN",
|
|
2802
|
+
message: "Parameter Validation warrnings for getSmsTemplateById",
|
|
2803
|
+
});
|
|
2804
|
+
Logger({ level: "WARN", message: warrning });
|
|
2805
|
+
}
|
|
2806
|
+
|
|
1513
2807
|
const query_params = {};
|
|
1514
2808
|
|
|
1515
|
-
|
|
2809
|
+
const response = await PlatformAPIClient.execute(
|
|
1516
2810
|
this.config,
|
|
1517
2811
|
"get",
|
|
1518
2812
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
1519
2813
|
query_params,
|
|
1520
2814
|
undefined
|
|
1521
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;
|
|
1522
2833
|
}
|
|
1523
2834
|
|
|
1524
2835
|
/**
|
|
1525
2836
|
* @param {Object} arg - Arg object.
|
|
1526
2837
|
* @param {string} arg.id - Sms template id
|
|
1527
2838
|
* @param {SmsTemplateReq} arg.body
|
|
2839
|
+
* @returns {Promise<SmsTemplateRes>} - Success response
|
|
1528
2840
|
* @summary: Update sms template by id
|
|
1529
2841
|
* @description: Update sms template by id
|
|
1530
2842
|
*/
|
|
1531
|
-
updateSmsTemplateById({ id, body } = {}) {
|
|
2843
|
+
async updateSmsTemplateById({ id, body } = {}) {
|
|
1532
2844
|
const { error } = CommunicationValidator.updateSmsTemplateById().validate(
|
|
1533
2845
|
{
|
|
1534
2846
|
id,
|
|
@@ -1540,24 +2852,60 @@ class Communication {
|
|
|
1540
2852
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1541
2853
|
}
|
|
1542
2854
|
|
|
2855
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2856
|
+
const {
|
|
2857
|
+
error: warrning,
|
|
2858
|
+
} = CommunicationValidator.updateSmsTemplateById().validate(
|
|
2859
|
+
{
|
|
2860
|
+
id,
|
|
2861
|
+
body,
|
|
2862
|
+
},
|
|
2863
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2864
|
+
);
|
|
2865
|
+
if (warrning) {
|
|
2866
|
+
Logger({
|
|
2867
|
+
level: "WARN",
|
|
2868
|
+
message: "Parameter Validation warrnings for updateSmsTemplateById",
|
|
2869
|
+
});
|
|
2870
|
+
Logger({ level: "WARN", message: warrning });
|
|
2871
|
+
}
|
|
2872
|
+
|
|
1543
2873
|
const query_params = {};
|
|
1544
2874
|
|
|
1545
|
-
|
|
2875
|
+
const response = await PlatformAPIClient.execute(
|
|
1546
2876
|
this.config,
|
|
1547
2877
|
"put",
|
|
1548
2878
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
1549
2879
|
query_params,
|
|
1550
2880
|
body
|
|
1551
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;
|
|
1552
2899
|
}
|
|
1553
2900
|
|
|
1554
2901
|
/**
|
|
1555
2902
|
* @param {Object} arg - Arg object.
|
|
1556
2903
|
* @param {string} arg.id - Sms template id
|
|
2904
|
+
* @returns {Promise<SmsTemplateDeleteSuccessRes>} - Success response
|
|
1557
2905
|
* @summary: Delete sms template by id
|
|
1558
2906
|
* @description: Delete sms template by id
|
|
1559
2907
|
*/
|
|
1560
|
-
deleteSmsTemplateById({ id } = {}) {
|
|
2908
|
+
async deleteSmsTemplateById({ id } = {}) {
|
|
1561
2909
|
const { error } = CommunicationValidator.deleteSmsTemplateById().validate(
|
|
1562
2910
|
{
|
|
1563
2911
|
id,
|
|
@@ -1568,15 +2916,49 @@ class Communication {
|
|
|
1568
2916
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1569
2917
|
}
|
|
1570
2918
|
|
|
2919
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2920
|
+
const {
|
|
2921
|
+
error: warrning,
|
|
2922
|
+
} = CommunicationValidator.deleteSmsTemplateById().validate(
|
|
2923
|
+
{
|
|
2924
|
+
id,
|
|
2925
|
+
},
|
|
2926
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2927
|
+
);
|
|
2928
|
+
if (warrning) {
|
|
2929
|
+
Logger({
|
|
2930
|
+
level: "WARN",
|
|
2931
|
+
message: "Parameter Validation warrnings for deleteSmsTemplateById",
|
|
2932
|
+
});
|
|
2933
|
+
Logger({ level: "WARN", message: warrning });
|
|
2934
|
+
}
|
|
2935
|
+
|
|
1571
2936
|
const query_params = {};
|
|
1572
2937
|
|
|
1573
|
-
|
|
2938
|
+
const response = await PlatformAPIClient.execute(
|
|
1574
2939
|
this.config,
|
|
1575
2940
|
"delete",
|
|
1576
2941
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
1577
2942
|
query_params,
|
|
1578
2943
|
undefined
|
|
1579
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;
|
|
1580
2962
|
}
|
|
1581
2963
|
|
|
1582
2964
|
/**
|
|
@@ -1584,10 +2966,11 @@ class Communication {
|
|
|
1584
2966
|
* @param {number} [arg.pageNo] - Current page no
|
|
1585
2967
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1586
2968
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2969
|
+
* @returns {Promise<SystemSmsTemplates>} - Success response
|
|
1587
2970
|
* @summary: Get system sms templates
|
|
1588
2971
|
* @description: Get system sms templates
|
|
1589
2972
|
*/
|
|
1590
|
-
getSystemSystemTemplates({ pageNo, pageSize, sort } = {}) {
|
|
2973
|
+
async getSystemSystemTemplates({ pageNo, pageSize, sort } = {}) {
|
|
1591
2974
|
const {
|
|
1592
2975
|
error,
|
|
1593
2976
|
} = CommunicationValidator.getSystemSystemTemplates().validate(
|
|
@@ -1602,18 +2985,54 @@ class Communication {
|
|
|
1602
2985
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1603
2986
|
}
|
|
1604
2987
|
|
|
2988
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2989
|
+
const {
|
|
2990
|
+
error: warrning,
|
|
2991
|
+
} = CommunicationValidator.getSystemSystemTemplates().validate(
|
|
2992
|
+
{
|
|
2993
|
+
pageNo,
|
|
2994
|
+
pageSize,
|
|
2995
|
+
sort,
|
|
2996
|
+
},
|
|
2997
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2998
|
+
);
|
|
2999
|
+
if (warrning) {
|
|
3000
|
+
Logger({
|
|
3001
|
+
level: "WARN",
|
|
3002
|
+
message: "Parameter Validation warrnings for getSystemSystemTemplates",
|
|
3003
|
+
});
|
|
3004
|
+
Logger({ level: "WARN", message: warrning });
|
|
3005
|
+
}
|
|
3006
|
+
|
|
1605
3007
|
const query_params = {};
|
|
1606
3008
|
query_params["page_no"] = pageNo;
|
|
1607
3009
|
query_params["page_size"] = pageSize;
|
|
1608
3010
|
query_params["sort"] = sort;
|
|
1609
3011
|
|
|
1610
|
-
|
|
3012
|
+
const response = await PlatformAPIClient.execute(
|
|
1611
3013
|
this.config,
|
|
1612
3014
|
"get",
|
|
1613
3015
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/system-templates`,
|
|
1614
3016
|
query_params,
|
|
1615
3017
|
undefined
|
|
1616
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;
|
|
1617
3036
|
}
|
|
1618
3037
|
|
|
1619
3038
|
/**
|