@gofynd/fdk-client-javascript 1.0.1 → 1.0.3
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 +5934 -4502
- package/documentation/application/CATALOG.md +6338 -7245
- package/documentation/application/COMMON.md +95 -222
- package/documentation/application/COMMUNICATION.md +106 -186
- package/documentation/application/CONFIGURATION.md +903 -1597
- package/documentation/application/CONTENT.md +562 -1270
- package/documentation/application/FILESTORAGE.md +84 -220
- package/documentation/application/LEAD.md +314 -660
- package/documentation/application/LOGISTIC.md +229 -305
- package/documentation/application/ORDER.md +642 -1137
- package/documentation/application/PAYMENT.md +2285 -3031
- package/documentation/application/POSCART.md +6079 -4642
- package/documentation/application/REWARDS.md +94 -248
- package/documentation/application/SHARE.md +152 -250
- package/documentation/application/THEME.md +952 -1235
- package/documentation/application/USER.md +1228 -1765
- package/documentation/platform/ANALYTICS.md +207 -349
- package/documentation/platform/AUDITTRAIL.md +121 -204
- package/documentation/platform/BILLING.md +865 -1376
- package/documentation/platform/CART.md +2814 -3662
- package/documentation/platform/CATALOG.md +15266 -17619
- package/documentation/platform/COMMON.md +95 -222
- package/documentation/platform/COMMUNICATION.md +1632 -2380
- package/documentation/platform/COMPANYPROFILE.md +572 -957
- package/documentation/platform/CONFIGURATION.md +3050 -4073
- package/documentation/platform/CONTENT.md +3509 -4121
- package/documentation/platform/DISCOUNT.md +140 -236
- package/documentation/platform/FILESTORAGE.md +187 -323
- package/documentation/platform/INVENTORY.md +268 -911
- package/documentation/platform/LEAD.md +2195 -2541
- package/documentation/platform/ORDER.md +3750 -5636
- package/documentation/platform/PARTNER.md +9 -36
- package/documentation/platform/PAYMENT.md +903 -1213
- package/documentation/platform/REWARDS.md +183 -347
- package/documentation/platform/SHARE.md +120 -213
- package/documentation/platform/THEME.md +12956 -13239
- package/documentation/platform/USER.md +975 -1120
- package/documentation/platform/WEBHOOK.md +78 -184
- package/documentation/public/CONFIGURATION.md +95 -222
- package/documentation/public/INVENTORY.md +100 -282
- package/documentation/public/WEBHOOK.md +27 -133
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.d.ts +243 -243
- package/sdk/application/Cart/CartApplicationClient.js +1058 -547
- package/sdk/application/Cart/CartApplicationModel.d.ts +64 -63
- package/sdk/application/Cart/CartApplicationModel.js +489 -886
- package/sdk/application/Cart/CartApplicationValidator.d.ts +17 -17
- package/sdk/application/Cart/CartApplicationValidator.js +98 -98
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +358 -358
- package/sdk/application/Catalog/CatalogApplicationClient.js +1545 -949
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +90 -90
- package/sdk/application/Catalog/CatalogApplicationModel.js +692 -1258
- package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationValidator.js +110 -110
- package/sdk/application/Common/CommonApplicationClient.d.ts +13 -13
- package/sdk/application/Common/CommonApplicationClient.js +76 -36
- package/sdk/application/Common/CommonApplicationModel.d.ts +12 -12
- package/sdk/application/Common/CommonApplicationModel.js +83 -160
- package/sdk/application/Common/CommonApplicationValidator.d.ts +1 -1
- package/sdk/application/Common/CommonApplicationValidator.js +6 -6
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +11 -11
- package/sdk/application/Communication/CommunicationApplicationClient.js +92 -31
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +6 -6
- package/sdk/application/Communication/CommunicationApplicationModel.js +38 -83
- package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +1 -1
- package/sdk/application/Communication/CommunicationApplicationValidator.js +4 -4
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +116 -116
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +638 -312
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +85 -85
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +480 -851
- package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +8 -8
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +33 -33
- package/sdk/application/Content/ContentApplicationClient.d.ts +67 -67
- package/sdk/application/Content/ContentApplicationClient.js +581 -213
- package/sdk/application/Content/ContentApplicationModel.d.ts +76 -75
- package/sdk/application/Content/ContentApplicationModel.js +468 -875
- package/sdk/application/Content/ContentApplicationValidator.d.ts +5 -5
- package/sdk/application/Content/ContentApplicationValidator.js +24 -24
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +25 -25
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +121 -59
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +13 -13
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +86 -169
- package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +1 -1
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +7 -7
- package/sdk/application/Lead/LeadApplicationClient.d.ts +24 -24
- package/sdk/application/Lead/LeadApplicationClient.js +230 -96
- package/sdk/application/Lead/LeadApplicationModel.d.ts +35 -35
- package/sdk/application/Lead/LeadApplicationModel.js +267 -474
- package/sdk/application/Lead/LeadApplicationValidator.d.ts +2 -2
- package/sdk/application/Lead/LeadApplicationValidator.js +11 -11
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +30 -19
- package/sdk/application/Logistic/LogisticApplicationClient.js +196 -47
- package/sdk/application/Logistic/LogisticApplicationModel.d.ts +17 -14
- package/sdk/application/Logistic/LogisticApplicationModel.js +133 -201
- package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +3 -2
- package/sdk/application/Logistic/LogisticApplicationValidator.js +14 -8
- package/sdk/application/Order/OrderApplicationClient.d.ts +86 -86
- package/sdk/application/Order/OrderApplicationClient.js +448 -215
- package/sdk/application/Order/OrderApplicationModel.d.ts +50 -50
- package/sdk/application/Order/OrderApplicationModel.js +357 -661
- package/sdk/application/Order/OrderApplicationValidator.d.ts +7 -7
- package/sdk/application/Order/OrderApplicationValidator.js +28 -28
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +318 -318
- package/sdk/application/Payment/PaymentApplicationClient.js +1525 -750
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +72 -72
- package/sdk/application/Payment/PaymentApplicationModel.js +565 -1033
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +28 -28
- package/sdk/application/Payment/PaymentApplicationValidator.js +107 -107
- package/sdk/application/PosCart/PosCartApplicationClient.d.ts +254 -254
- package/sdk/application/PosCart/PosCartApplicationClient.js +1137 -606
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +61 -60
- package/sdk/application/PosCart/PosCartApplicationModel.js +477 -873
- package/sdk/application/PosCart/PosCartApplicationValidator.d.ts +18 -18
- package/sdk/application/PosCart/PosCartApplicationValidator.js +103 -103
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +27 -27
- package/sdk/application/Rewards/RewardsApplicationClient.js +253 -113
- package/sdk/application/Rewards/RewardsApplicationModel.d.ts +14 -14
- package/sdk/application/Rewards/RewardsApplicationModel.js +96 -191
- package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +3 -3
- package/sdk/application/Rewards/RewardsApplicationValidator.js +12 -12
- package/sdk/application/Share/ShareApplicationClient.d.ts +37 -37
- package/sdk/application/Share/ShareApplicationClient.js +221 -96
- package/sdk/application/Share/ShareApplicationModel.d.ts +8 -8
- package/sdk/application/Share/ShareApplicationModel.js +63 -123
- package/sdk/application/Share/ShareApplicationValidator.d.ts +4 -4
- package/sdk/application/Share/ShareApplicationValidator.js +12 -12
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -8
- package/sdk/application/Theme/ThemeApplicationClient.js +115 -37
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +34 -34
- package/sdk/application/Theme/ThemeApplicationModel.js +190 -336
- package/sdk/application/Theme/ThemeApplicationValidator.d.ts +1 -1
- package/sdk/application/Theme/ThemeApplicationValidator.js +4 -4
- package/sdk/application/User/UserApplicationClient.d.ts +280 -280
- package/sdk/application/User/UserApplicationClient.js +1201 -543
- package/sdk/application/User/UserApplicationModel.d.ts +79 -72
- package/sdk/application/User/UserApplicationModel.js +440 -689
- package/sdk/application/User/UserApplicationValidator.d.ts +24 -24
- package/sdk/application/User/UserApplicationValidator.js +89 -89
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +55 -47
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +308 -151
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +6 -6
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +20 -20
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +11 -11
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +95 -178
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +16 -12
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +131 -44
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +10 -10
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +50 -89
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.d.ts +1 -1
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +6 -6
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +68 -56
- package/sdk/platform/Billing/BillingPlatformClient.js +416 -171
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +40 -40
- package/sdk/platform/Billing/BillingPlatformModel.js +342 -668
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +8 -8
- package/sdk/platform/Billing/BillingPlatformValidator.js +25 -25
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +176 -159
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +837 -500
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +63 -63
- package/sdk/platform/Cart/CartPlatformModel.d.ts +86 -85
- package/sdk/platform/Cart/CartPlatformModel.js +677 -1211
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +582 -529
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2642 -1533
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +40 -40
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +175 -175
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +708 -590
- package/sdk/platform/Catalog/CatalogPlatformClient.js +3103 -1362
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +293 -284
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2149 -3660
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +66 -64
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +235 -216
- package/sdk/platform/Common/CommonPlatformClient.d.ts +14 -12
- package/sdk/platform/Common/CommonPlatformClient.js +80 -37
- package/sdk/platform/Common/CommonPlatformModel.d.ts +12 -12
- package/sdk/platform/Common/CommonPlatformModel.js +83 -160
- package/sdk/platform/Common/CommonPlatformValidator.d.ts +1 -1
- package/sdk/platform/Common/CommonPlatformValidator.js +6 -6
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +333 -293
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1687 -855
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +30 -30
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +87 -87
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +67 -67
- package/sdk/platform/Communication/CommunicationPlatformModel.js +522 -974
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +70 -57
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +463 -182
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +28 -28
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +294 -557
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +7 -7
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +24 -24
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +175 -137
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1168 -521
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +22 -21
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +69 -63
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +137 -119
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +691 -316
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +148 -146
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +854 -1508
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +9 -9
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +38 -38
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +542 -461
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +2600 -1160
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +50 -49
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +159 -152
- package/sdk/platform/Content/ContentPlatformModel.d.ts +79 -75
- package/sdk/platform/Content/ContentPlatformModel.js +486 -867
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +72 -61
- package/sdk/platform/Discount/DiscountPlatformClient.js +424 -198
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +7 -7
- package/sdk/platform/Discount/DiscountPlatformModel.js +60 -121
- package/sdk/platform/Discount/DiscountPlatformValidator.d.ts +6 -6
- package/sdk/platform/Discount/DiscountPlatformValidator.js +29 -29
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +26 -22
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +145 -59
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +8 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +58 -52
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +240 -114
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +13 -13
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +86 -169
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.d.ts +3 -3
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +11 -11
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +76 -63
- package/sdk/platform/Inventory/InventoryPlatformClient.js +461 -197
- package/sdk/platform/Inventory/InventoryPlatformModel.d.ts +30 -30
- package/sdk/platform/Inventory/InventoryPlatformModel.js +497 -964
- package/sdk/platform/Inventory/InventoryPlatformValidator.d.ts +7 -7
- package/sdk/platform/Inventory/InventoryPlatformValidator.js +28 -28
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +84 -71
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +441 -182
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +7 -7
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +28 -28
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +86 -75
- package/sdk/platform/Lead/LeadPlatformClient.js +434 -212
- package/sdk/platform/Lead/LeadPlatformModel.d.ts +35 -35
- package/sdk/platform/Lead/LeadPlatformModel.js +267 -474
- package/sdk/platform/Lead/LeadPlatformValidator.d.ts +6 -6
- package/sdk/platform/Lead/LeadPlatformValidator.js +24 -24
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +14 -11
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +113 -49
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +6 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +367 -315
- package/sdk/platform/Order/OrderPlatformClient.js +1775 -893
- package/sdk/platform/Order/OrderPlatformModel.d.ts +198 -192
- package/sdk/platform/Order/OrderPlatformModel.js +1591 -2822
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +32 -32
- package/sdk/platform/Order/OrderPlatformValidator.js +160 -155
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
- package/sdk/platform/Partner/PartnerPlatformModel.js +6 -22
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +65 -54
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +395 -164
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +6 -6
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +23 -23
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +55 -45
- package/sdk/platform/Payment/PaymentPlatformClient.js +362 -147
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +27 -27
- package/sdk/platform/Payment/PaymentPlatformModel.js +220 -408
- package/sdk/platform/Payment/PaymentPlatformValidator.d.ts +4 -4
- package/sdk/platform/Payment/PaymentPlatformValidator.js +21 -21
- package/sdk/platform/PlatformApplicationClient.d.ts +1496 -10153
- package/sdk/platform/PlatformApplicationClient.js +1584 -13691
- package/sdk/platform/PlatformClient.d.ts +7918 -7666
- package/sdk/platform/PlatformClient.js +8701 -9926
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +91 -78
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +507 -253
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +34 -34
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +15 -15
- package/sdk/platform/Rewards/RewardsPlatformModel.js +92 -194
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +16 -12
- package/sdk/platform/Share/SharePlatformApplicationClient.js +130 -52
- package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Share/SharePlatformApplicationValidator.js +6 -6
- package/sdk/platform/Share/SharePlatformModel.d.ts +8 -8
- package/sdk/platform/Share/SharePlatformModel.js +60 -118
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +148 -124
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +770 -295
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +15 -15
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +44 -44
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +34 -34
- package/sdk/platform/Theme/ThemePlatformModel.js +190 -336
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +146 -67
- package/sdk/platform/User/UserPlatformApplicationClient.js +742 -155
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +12 -7
- package/sdk/platform/User/UserPlatformApplicationValidator.js +61 -23
- package/sdk/platform/User/UserPlatformModel.d.ts +79 -72
- package/sdk/platform/User/UserPlatformModel.js +440 -689
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +35 -29
- package/sdk/platform/Webhook/WebhookPlatformClient.js +218 -91
- package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +7 -7
- package/sdk/platform/Webhook/WebhookPlatformModel.js +68 -136
- package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +3 -3
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +14 -14
- package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +13 -13
- package/sdk/public/Configuration/ConfigurationPublicClient.js +81 -38
- package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +12 -12
- package/sdk/public/Configuration/ConfigurationPublicModel.js +85 -162
- package/sdk/public/Configuration/ConfigurationPublicValidator.d.ts +1 -1
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +6 -6
- package/sdk/public/Inventory/InventoryPublicClient.d.ts +34 -34
- package/sdk/public/Inventory/InventoryPublicClient.js +228 -105
- package/sdk/public/Inventory/InventoryPublicModel.d.ts +10 -10
- package/sdk/public/Inventory/InventoryPublicModel.js +119 -245
- package/sdk/public/Inventory/InventoryPublicValidator.d.ts +3 -3
- package/sdk/public/Inventory/InventoryPublicValidator.js +15 -15
- package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
- package/sdk/public/Webhook/WebhookPublicModel.d.ts +7 -7
- package/sdk/public/Webhook/WebhookPublicModel.js +68 -136
- package/tests/application/catalog.spec.js +7 -0
|
@@ -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) {
|
|
@@ -11,18 +13,15 @@ class Communication {
|
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* @param {Object} arg - Arg object.
|
|
14
|
-
* @param {
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
17
|
-
* @
|
|
18
|
-
* @description: Get campaigns
|
|
16
|
+
* @param {AudienceReq} arg.body
|
|
17
|
+
* @returns {Promise<Audience>} - Success response
|
|
18
|
+
* @summary: Create audience
|
|
19
|
+
* @description: Create audience
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
-
const { error } = CommunicationValidator.
|
|
21
|
+
async createAudience({ body } = {}) {
|
|
22
|
+
const { error } = CommunicationValidator.createAudience().validate(
|
|
22
23
|
{
|
|
23
|
-
|
|
24
|
-
pageSize,
|
|
25
|
-
sort,
|
|
24
|
+
body,
|
|
26
25
|
},
|
|
27
26
|
{ abortEarly: false, allowUnknown: true }
|
|
28
27
|
);
|
|
@@ -31,72 +30,58 @@ class Communication {
|
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
// Showing warrnings if extra unknown parameters are found
|
|
34
|
-
const {
|
|
33
|
+
const {
|
|
34
|
+
error: warrning,
|
|
35
|
+
} = CommunicationValidator.createAudience().validate(
|
|
35
36
|
{
|
|
36
|
-
|
|
37
|
-
pageSize,
|
|
38
|
-
sort,
|
|
37
|
+
body,
|
|
39
38
|
},
|
|
40
39
|
{ abortEarly: false, allowUnknown: false }
|
|
41
40
|
);
|
|
42
41
|
if (warrning) {
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
Logger({
|
|
43
|
+
level: "WARN",
|
|
44
|
+
message: "Parameter Validation warrnings for createAudience",
|
|
45
|
+
});
|
|
46
|
+
Logger({ level: "WARN", message: warrning });
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
const query_params = {};
|
|
48
|
-
query_params["page_no"] = pageNo;
|
|
49
|
-
query_params["page_size"] = pageSize;
|
|
50
|
-
query_params["sort"] = sort;
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
const response = await PlatformAPIClient.execute(
|
|
53
52
|
this.config,
|
|
54
|
-
"
|
|
55
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
53
|
+
"post",
|
|
54
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources`,
|
|
56
55
|
query_params,
|
|
57
|
-
|
|
56
|
+
body
|
|
58
57
|
);
|
|
59
|
-
}
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const callback = async () => {
|
|
73
|
-
const pageId = paginator.nextId;
|
|
74
|
-
const pageNo = paginator.pageNo;
|
|
75
|
-
const pageType = "number";
|
|
76
|
-
const data = await this.getCampaigns({
|
|
77
|
-
companyId: companyId,
|
|
78
|
-
applicationId: applicationId,
|
|
79
|
-
pageNo: pageNo,
|
|
80
|
-
pageSize: pageSize,
|
|
81
|
-
sort: sort,
|
|
82
|
-
});
|
|
83
|
-
paginator.setPaginator({
|
|
84
|
-
hasNext: data.page.has_next ? true : false,
|
|
85
|
-
nextId: data.page.next_id,
|
|
59
|
+
const {
|
|
60
|
+
error: res_error,
|
|
61
|
+
} = CommunicationModel.Audience().validate(response, {
|
|
62
|
+
abortEarly: false,
|
|
63
|
+
allowUnknown: false,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (res_error) {
|
|
67
|
+
Logger({
|
|
68
|
+
level: "WARN",
|
|
69
|
+
message: "Response Validation Warnnings for createAudience",
|
|
86
70
|
});
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return
|
|
71
|
+
Logger({ level: "WARN", message: res_error });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return response;
|
|
91
75
|
}
|
|
92
76
|
|
|
93
77
|
/**
|
|
94
78
|
* @param {Object} arg - Arg object.
|
|
95
79
|
* @param {CampaignReq} arg.body
|
|
80
|
+
* @returns {Promise<Campaign>} - Success response
|
|
96
81
|
* @summary: Create campaign
|
|
97
82
|
* @description: Create campaign
|
|
98
83
|
*/
|
|
99
|
-
createCampaign({ body } = {}) {
|
|
84
|
+
async createCampaign({ body } = {}) {
|
|
100
85
|
const { error } = CommunicationValidator.createCampaign().validate(
|
|
101
86
|
{
|
|
102
87
|
body,
|
|
@@ -117,31 +102,52 @@ class Communication {
|
|
|
117
102
|
{ abortEarly: false, allowUnknown: false }
|
|
118
103
|
);
|
|
119
104
|
if (warrning) {
|
|
120
|
-
|
|
121
|
-
|
|
105
|
+
Logger({
|
|
106
|
+
level: "WARN",
|
|
107
|
+
message: "Parameter Validation warrnings for createCampaign",
|
|
108
|
+
});
|
|
109
|
+
Logger({ level: "WARN", message: warrning });
|
|
122
110
|
}
|
|
123
111
|
|
|
124
112
|
const query_params = {};
|
|
125
113
|
|
|
126
|
-
|
|
114
|
+
const response = await PlatformAPIClient.execute(
|
|
127
115
|
this.config,
|
|
128
116
|
"post",
|
|
129
117
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns`,
|
|
130
118
|
query_params,
|
|
131
119
|
body
|
|
132
120
|
);
|
|
121
|
+
|
|
122
|
+
const {
|
|
123
|
+
error: res_error,
|
|
124
|
+
} = CommunicationModel.Campaign().validate(response, {
|
|
125
|
+
abortEarly: false,
|
|
126
|
+
allowUnknown: false,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
if (res_error) {
|
|
130
|
+
Logger({
|
|
131
|
+
level: "WARN",
|
|
132
|
+
message: "Response Validation Warnnings for createCampaign",
|
|
133
|
+
});
|
|
134
|
+
Logger({ level: "WARN", message: res_error });
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return response;
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
/**
|
|
136
141
|
* @param {Object} arg - Arg object.
|
|
137
|
-
* @param {
|
|
138
|
-
* @
|
|
139
|
-
* @
|
|
142
|
+
* @param {EmailProviderReq} arg.body
|
|
143
|
+
* @returns {Promise<EmailProvider>} - Success response
|
|
144
|
+
* @summary: Create email provider
|
|
145
|
+
* @description: Create email provider
|
|
140
146
|
*/
|
|
141
|
-
|
|
142
|
-
const { error } = CommunicationValidator.
|
|
147
|
+
async createEmailProvider({ body } = {}) {
|
|
148
|
+
const { error } = CommunicationValidator.createEmailProvider().validate(
|
|
143
149
|
{
|
|
144
|
-
|
|
150
|
+
body,
|
|
145
151
|
},
|
|
146
152
|
{ abortEarly: false, allowUnknown: true }
|
|
147
153
|
);
|
|
@@ -152,39 +158,58 @@ class Communication {
|
|
|
152
158
|
// Showing warrnings if extra unknown parameters are found
|
|
153
159
|
const {
|
|
154
160
|
error: warrning,
|
|
155
|
-
} = CommunicationValidator.
|
|
161
|
+
} = CommunicationValidator.createEmailProvider().validate(
|
|
156
162
|
{
|
|
157
|
-
|
|
163
|
+
body,
|
|
158
164
|
},
|
|
159
165
|
{ abortEarly: false, allowUnknown: false }
|
|
160
166
|
);
|
|
161
167
|
if (warrning) {
|
|
162
|
-
|
|
163
|
-
|
|
168
|
+
Logger({
|
|
169
|
+
level: "WARN",
|
|
170
|
+
message: "Parameter Validation warrnings for createEmailProvider",
|
|
171
|
+
});
|
|
172
|
+
Logger({ level: "WARN", message: warrning });
|
|
164
173
|
}
|
|
165
174
|
|
|
166
175
|
const query_params = {};
|
|
167
176
|
|
|
168
|
-
|
|
177
|
+
const response = await PlatformAPIClient.execute(
|
|
169
178
|
this.config,
|
|
170
|
-
"
|
|
171
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
179
|
+
"post",
|
|
180
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers`,
|
|
172
181
|
query_params,
|
|
173
|
-
|
|
182
|
+
body
|
|
174
183
|
);
|
|
184
|
+
|
|
185
|
+
const {
|
|
186
|
+
error: res_error,
|
|
187
|
+
} = CommunicationModel.EmailProvider().validate(response, {
|
|
188
|
+
abortEarly: false,
|
|
189
|
+
allowUnknown: false,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
if (res_error) {
|
|
193
|
+
Logger({
|
|
194
|
+
level: "WARN",
|
|
195
|
+
message: "Response Validation Warnnings for createEmailProvider",
|
|
196
|
+
});
|
|
197
|
+
Logger({ level: "WARN", message: res_error });
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return response;
|
|
175
201
|
}
|
|
176
202
|
|
|
177
203
|
/**
|
|
178
204
|
* @param {Object} arg - Arg object.
|
|
179
|
-
* @param {
|
|
180
|
-
* @
|
|
181
|
-
* @summary:
|
|
182
|
-
* @description:
|
|
205
|
+
* @param {EmailTemplateReq} arg.body
|
|
206
|
+
* @returns {Promise<EmailTemplateRes>} - Success response
|
|
207
|
+
* @summary: Create email template
|
|
208
|
+
* @description: Create email template
|
|
183
209
|
*/
|
|
184
|
-
|
|
185
|
-
const { error } = CommunicationValidator.
|
|
210
|
+
async createEmailTemplate({ body } = {}) {
|
|
211
|
+
const { error } = CommunicationValidator.createEmailTemplate().validate(
|
|
186
212
|
{
|
|
187
|
-
id,
|
|
188
213
|
body,
|
|
189
214
|
},
|
|
190
215
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -196,39 +221,59 @@ class Communication {
|
|
|
196
221
|
// Showing warrnings if extra unknown parameters are found
|
|
197
222
|
const {
|
|
198
223
|
error: warrning,
|
|
199
|
-
} = CommunicationValidator.
|
|
224
|
+
} = CommunicationValidator.createEmailTemplate().validate(
|
|
200
225
|
{
|
|
201
|
-
id,
|
|
202
226
|
body,
|
|
203
227
|
},
|
|
204
228
|
{ abortEarly: false, allowUnknown: false }
|
|
205
229
|
);
|
|
206
230
|
if (warrning) {
|
|
207
|
-
|
|
208
|
-
|
|
231
|
+
Logger({
|
|
232
|
+
level: "WARN",
|
|
233
|
+
message: "Parameter Validation warrnings for createEmailTemplate",
|
|
234
|
+
});
|
|
235
|
+
Logger({ level: "WARN", message: warrning });
|
|
209
236
|
}
|
|
210
237
|
|
|
211
238
|
const query_params = {};
|
|
212
239
|
|
|
213
|
-
|
|
240
|
+
const response = await PlatformAPIClient.execute(
|
|
214
241
|
this.config,
|
|
215
|
-
"
|
|
216
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
242
|
+
"post",
|
|
243
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates`,
|
|
217
244
|
query_params,
|
|
218
245
|
body
|
|
219
246
|
);
|
|
247
|
+
|
|
248
|
+
const {
|
|
249
|
+
error: res_error,
|
|
250
|
+
} = CommunicationModel.EmailTemplateRes().validate(response, {
|
|
251
|
+
abortEarly: false,
|
|
252
|
+
allowUnknown: false,
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
if (res_error) {
|
|
256
|
+
Logger({
|
|
257
|
+
level: "WARN",
|
|
258
|
+
message: "Response Validation Warnnings for createEmailTemplate",
|
|
259
|
+
});
|
|
260
|
+
Logger({ level: "WARN", message: res_error });
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return response;
|
|
220
264
|
}
|
|
221
265
|
|
|
222
266
|
/**
|
|
223
267
|
* @param {Object} arg - Arg object.
|
|
224
|
-
* @param {
|
|
225
|
-
* @
|
|
226
|
-
* @
|
|
268
|
+
* @param {SmsProviderReq} arg.body
|
|
269
|
+
* @returns {Promise<SmsProvider>} - Success response
|
|
270
|
+
* @summary: Create sms provider
|
|
271
|
+
* @description: Create sms provider
|
|
227
272
|
*/
|
|
228
|
-
|
|
229
|
-
const { error } = CommunicationValidator.
|
|
273
|
+
async createSmsProvider({ body } = {}) {
|
|
274
|
+
const { error } = CommunicationValidator.createSmsProvider().validate(
|
|
230
275
|
{
|
|
231
|
-
|
|
276
|
+
body,
|
|
232
277
|
},
|
|
233
278
|
{ abortEarly: false, allowUnknown: true }
|
|
234
279
|
);
|
|
@@ -239,42 +284,59 @@ class Communication {
|
|
|
239
284
|
// Showing warrnings if extra unknown parameters are found
|
|
240
285
|
const {
|
|
241
286
|
error: warrning,
|
|
242
|
-
} = CommunicationValidator.
|
|
287
|
+
} = CommunicationValidator.createSmsProvider().validate(
|
|
243
288
|
{
|
|
244
|
-
|
|
289
|
+
body,
|
|
245
290
|
},
|
|
246
291
|
{ abortEarly: false, allowUnknown: false }
|
|
247
292
|
);
|
|
248
293
|
if (warrning) {
|
|
249
|
-
|
|
250
|
-
|
|
294
|
+
Logger({
|
|
295
|
+
level: "WARN",
|
|
296
|
+
message: "Parameter Validation warrnings for createSmsProvider",
|
|
297
|
+
});
|
|
298
|
+
Logger({ level: "WARN", message: warrning });
|
|
251
299
|
}
|
|
252
300
|
|
|
253
301
|
const query_params = {};
|
|
254
302
|
|
|
255
|
-
|
|
303
|
+
const response = await PlatformAPIClient.execute(
|
|
256
304
|
this.config,
|
|
257
|
-
"
|
|
258
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
305
|
+
"post",
|
|
306
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers`,
|
|
259
307
|
query_params,
|
|
260
|
-
|
|
308
|
+
body
|
|
261
309
|
);
|
|
310
|
+
|
|
311
|
+
const {
|
|
312
|
+
error: res_error,
|
|
313
|
+
} = CommunicationModel.SmsProvider().validate(response, {
|
|
314
|
+
abortEarly: false,
|
|
315
|
+
allowUnknown: false,
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
if (res_error) {
|
|
319
|
+
Logger({
|
|
320
|
+
level: "WARN",
|
|
321
|
+
message: "Response Validation Warnnings for createSmsProvider",
|
|
322
|
+
});
|
|
323
|
+
Logger({ level: "WARN", message: res_error });
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return response;
|
|
262
327
|
}
|
|
263
328
|
|
|
264
329
|
/**
|
|
265
330
|
* @param {Object} arg - Arg object.
|
|
266
|
-
* @param {
|
|
267
|
-
* @
|
|
268
|
-
* @
|
|
269
|
-
* @
|
|
270
|
-
* @description: Get audiences
|
|
331
|
+
* @param {SmsTemplateReq} arg.body
|
|
332
|
+
* @returns {Promise<SmsTemplateRes>} - Success response
|
|
333
|
+
* @summary: Create sms template
|
|
334
|
+
* @description: Create sms template
|
|
271
335
|
*/
|
|
272
|
-
|
|
273
|
-
const { error } = CommunicationValidator.
|
|
336
|
+
async createSmsTemplate({ body } = {}) {
|
|
337
|
+
const { error } = CommunicationValidator.createSmsTemplate().validate(
|
|
274
338
|
{
|
|
275
|
-
|
|
276
|
-
pageSize,
|
|
277
|
-
sort,
|
|
339
|
+
body,
|
|
278
340
|
},
|
|
279
341
|
{ abortEarly: false, allowUnknown: true }
|
|
280
342
|
);
|
|
@@ -283,75 +345,61 @@ class Communication {
|
|
|
283
345
|
}
|
|
284
346
|
|
|
285
347
|
// Showing warrnings if extra unknown parameters are found
|
|
286
|
-
const {
|
|
348
|
+
const {
|
|
349
|
+
error: warrning,
|
|
350
|
+
} = CommunicationValidator.createSmsTemplate().validate(
|
|
287
351
|
{
|
|
288
|
-
|
|
289
|
-
pageSize,
|
|
290
|
-
sort,
|
|
352
|
+
body,
|
|
291
353
|
},
|
|
292
354
|
{ abortEarly: false, allowUnknown: false }
|
|
293
355
|
);
|
|
294
356
|
if (warrning) {
|
|
295
|
-
|
|
296
|
-
|
|
357
|
+
Logger({
|
|
358
|
+
level: "WARN",
|
|
359
|
+
message: "Parameter Validation warrnings for createSmsTemplate",
|
|
360
|
+
});
|
|
361
|
+
Logger({ level: "WARN", message: warrning });
|
|
297
362
|
}
|
|
298
363
|
|
|
299
364
|
const query_params = {};
|
|
300
|
-
query_params["page_no"] = pageNo;
|
|
301
|
-
query_params["page_size"] = pageSize;
|
|
302
|
-
query_params["sort"] = sort;
|
|
303
365
|
|
|
304
|
-
|
|
366
|
+
const response = await PlatformAPIClient.execute(
|
|
305
367
|
this.config,
|
|
306
|
-
"
|
|
307
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
368
|
+
"post",
|
|
369
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates`,
|
|
308
370
|
query_params,
|
|
309
|
-
|
|
371
|
+
body
|
|
310
372
|
);
|
|
311
|
-
}
|
|
312
373
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const callback = async () => {
|
|
325
|
-
const pageId = paginator.nextId;
|
|
326
|
-
const pageNo = paginator.pageNo;
|
|
327
|
-
const pageType = "number";
|
|
328
|
-
const data = await this.getAudiences({
|
|
329
|
-
companyId: companyId,
|
|
330
|
-
applicationId: applicationId,
|
|
331
|
-
pageNo: pageNo,
|
|
332
|
-
pageSize: pageSize,
|
|
333
|
-
sort: sort,
|
|
334
|
-
});
|
|
335
|
-
paginator.setPaginator({
|
|
336
|
-
hasNext: data.page.has_next ? true : false,
|
|
337
|
-
nextId: data.page.next_id,
|
|
374
|
+
const {
|
|
375
|
+
error: res_error,
|
|
376
|
+
} = CommunicationModel.SmsTemplateRes().validate(response, {
|
|
377
|
+
abortEarly: false,
|
|
378
|
+
allowUnknown: false,
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
if (res_error) {
|
|
382
|
+
Logger({
|
|
383
|
+
level: "WARN",
|
|
384
|
+
message: "Response Validation Warnnings for createSmsTemplate",
|
|
338
385
|
});
|
|
339
|
-
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
return
|
|
386
|
+
Logger({ level: "WARN", message: res_error });
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return response;
|
|
343
390
|
}
|
|
344
391
|
|
|
345
392
|
/**
|
|
346
393
|
* @param {Object} arg - Arg object.
|
|
347
|
-
* @param {
|
|
348
|
-
* @
|
|
349
|
-
* @
|
|
394
|
+
* @param {string} arg.id - Email template id
|
|
395
|
+
* @returns {Promise<EmailTemplateDeleteSuccessRes>} - Success response
|
|
396
|
+
* @summary: Delete email template by id
|
|
397
|
+
* @description: Delete email template by id
|
|
350
398
|
*/
|
|
351
|
-
|
|
352
|
-
const { error } = CommunicationValidator.
|
|
399
|
+
async deleteEmailTemplateById({ id } = {}) {
|
|
400
|
+
const { error } = CommunicationValidator.deleteEmailTemplateById().validate(
|
|
353
401
|
{
|
|
354
|
-
|
|
402
|
+
id,
|
|
355
403
|
},
|
|
356
404
|
{ abortEarly: false, allowUnknown: true }
|
|
357
405
|
);
|
|
@@ -362,38 +410,59 @@ class Communication {
|
|
|
362
410
|
// Showing warrnings if extra unknown parameters are found
|
|
363
411
|
const {
|
|
364
412
|
error: warrning,
|
|
365
|
-
} = CommunicationValidator.
|
|
413
|
+
} = CommunicationValidator.deleteEmailTemplateById().validate(
|
|
366
414
|
{
|
|
367
|
-
|
|
415
|
+
id,
|
|
368
416
|
},
|
|
369
417
|
{ abortEarly: false, allowUnknown: false }
|
|
370
418
|
);
|
|
371
419
|
if (warrning) {
|
|
372
|
-
|
|
373
|
-
|
|
420
|
+
Logger({
|
|
421
|
+
level: "WARN",
|
|
422
|
+
message: "Parameter Validation warrnings for deleteEmailTemplateById",
|
|
423
|
+
});
|
|
424
|
+
Logger({ level: "WARN", message: warrning });
|
|
374
425
|
}
|
|
375
426
|
|
|
376
427
|
const query_params = {};
|
|
377
428
|
|
|
378
|
-
|
|
429
|
+
const response = await PlatformAPIClient.execute(
|
|
379
430
|
this.config,
|
|
380
|
-
"
|
|
381
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
431
|
+
"delete",
|
|
432
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
382
433
|
query_params,
|
|
383
|
-
|
|
434
|
+
undefined
|
|
384
435
|
);
|
|
436
|
+
|
|
437
|
+
const {
|
|
438
|
+
error: res_error,
|
|
439
|
+
} = CommunicationModel.EmailTemplateDeleteSuccessRes().validate(response, {
|
|
440
|
+
abortEarly: false,
|
|
441
|
+
allowUnknown: false,
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
if (res_error) {
|
|
445
|
+
Logger({
|
|
446
|
+
level: "WARN",
|
|
447
|
+
message: "Response Validation Warnnings for deleteEmailTemplateById",
|
|
448
|
+
});
|
|
449
|
+
Logger({ level: "WARN", message: res_error });
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return response;
|
|
385
453
|
}
|
|
386
454
|
|
|
387
455
|
/**
|
|
388
456
|
* @param {Object} arg - Arg object.
|
|
389
|
-
* @param {
|
|
390
|
-
* @
|
|
391
|
-
* @
|
|
457
|
+
* @param {string} arg.id - Sms template id
|
|
458
|
+
* @returns {Promise<SmsTemplateDeleteSuccessRes>} - Success response
|
|
459
|
+
* @summary: Delete sms template by id
|
|
460
|
+
* @description: Delete sms template by id
|
|
392
461
|
*/
|
|
393
|
-
|
|
394
|
-
const { error } = CommunicationValidator.
|
|
462
|
+
async deleteSmsTemplateById({ id } = {}) {
|
|
463
|
+
const { error } = CommunicationValidator.deleteSmsTemplateById().validate(
|
|
395
464
|
{
|
|
396
|
-
|
|
465
|
+
id,
|
|
397
466
|
},
|
|
398
467
|
{ abortEarly: false, allowUnknown: true }
|
|
399
468
|
);
|
|
@@ -404,35 +473,56 @@ class Communication {
|
|
|
404
473
|
// Showing warrnings if extra unknown parameters are found
|
|
405
474
|
const {
|
|
406
475
|
error: warrning,
|
|
407
|
-
} = CommunicationValidator.
|
|
476
|
+
} = CommunicationValidator.deleteSmsTemplateById().validate(
|
|
408
477
|
{
|
|
409
|
-
|
|
478
|
+
id,
|
|
410
479
|
},
|
|
411
480
|
{ abortEarly: false, allowUnknown: false }
|
|
412
481
|
);
|
|
413
482
|
if (warrning) {
|
|
414
|
-
|
|
415
|
-
|
|
483
|
+
Logger({
|
|
484
|
+
level: "WARN",
|
|
485
|
+
message: "Parameter Validation warrnings for deleteSmsTemplateById",
|
|
486
|
+
});
|
|
487
|
+
Logger({ level: "WARN", message: warrning });
|
|
416
488
|
}
|
|
417
489
|
|
|
418
490
|
const query_params = {};
|
|
419
491
|
|
|
420
|
-
|
|
492
|
+
const response = await PlatformAPIClient.execute(
|
|
421
493
|
this.config,
|
|
422
|
-
"
|
|
423
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
494
|
+
"delete",
|
|
495
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
424
496
|
query_params,
|
|
425
|
-
|
|
497
|
+
undefined
|
|
426
498
|
);
|
|
499
|
+
|
|
500
|
+
const {
|
|
501
|
+
error: res_error,
|
|
502
|
+
} = CommunicationModel.SmsTemplateDeleteSuccessRes().validate(response, {
|
|
503
|
+
abortEarly: false,
|
|
504
|
+
allowUnknown: false,
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
if (res_error) {
|
|
508
|
+
Logger({
|
|
509
|
+
level: "WARN",
|
|
510
|
+
message: "Response Validation Warnnings for deleteSmsTemplateById",
|
|
511
|
+
});
|
|
512
|
+
Logger({ level: "WARN", message: res_error });
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
return response;
|
|
427
516
|
}
|
|
428
517
|
|
|
429
518
|
/**
|
|
430
519
|
* @param {Object} arg - Arg object.
|
|
431
520
|
* @param {string} arg.id - Audience id
|
|
521
|
+
* @returns {Promise<Audience>} - Success response
|
|
432
522
|
* @summary: Get audience by id
|
|
433
523
|
* @description: Get audience by id
|
|
434
524
|
*/
|
|
435
|
-
getAudienceById({ id } = {}) {
|
|
525
|
+
async getAudienceById({ id } = {}) {
|
|
436
526
|
const { error } = CommunicationValidator.getAudienceById().validate(
|
|
437
527
|
{
|
|
438
528
|
id,
|
|
@@ -453,110 +543,39 @@ class Communication {
|
|
|
453
543
|
{ abortEarly: false, allowUnknown: false }
|
|
454
544
|
);
|
|
455
545
|
if (warrning) {
|
|
456
|
-
|
|
457
|
-
|
|
546
|
+
Logger({
|
|
547
|
+
level: "WARN",
|
|
548
|
+
message: "Parameter Validation warrnings for getAudienceById",
|
|
549
|
+
});
|
|
550
|
+
Logger({ level: "WARN", message: warrning });
|
|
458
551
|
}
|
|
459
552
|
|
|
460
553
|
const query_params = {};
|
|
461
554
|
|
|
462
|
-
|
|
555
|
+
const response = await PlatformAPIClient.execute(
|
|
463
556
|
this.config,
|
|
464
557
|
"get",
|
|
465
558
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
|
|
466
559
|
query_params,
|
|
467
560
|
undefined
|
|
468
561
|
);
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* @param {Object} arg - Arg object.
|
|
473
|
-
* @param {string} arg.id - Audience id
|
|
474
|
-
* @param {AudienceReq} arg.body
|
|
475
|
-
* @summary: Update audience by id
|
|
476
|
-
* @description: Update audience by id
|
|
477
|
-
*/
|
|
478
|
-
updateAudienceById({ id, body } = {}) {
|
|
479
|
-
const { error } = CommunicationValidator.updateAudienceById().validate(
|
|
480
|
-
{
|
|
481
|
-
id,
|
|
482
|
-
body,
|
|
483
|
-
},
|
|
484
|
-
{ abortEarly: false, allowUnknown: true }
|
|
485
|
-
);
|
|
486
|
-
if (error) {
|
|
487
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
// Showing warrnings if extra unknown parameters are found
|
|
491
|
-
const {
|
|
492
|
-
error: warrning,
|
|
493
|
-
} = CommunicationValidator.updateAudienceById().validate(
|
|
494
|
-
{
|
|
495
|
-
id,
|
|
496
|
-
body,
|
|
497
|
-
},
|
|
498
|
-
{ abortEarly: false, allowUnknown: false }
|
|
499
|
-
);
|
|
500
|
-
if (warrning) {
|
|
501
|
-
console.log("Parameter Validation warrnings for updateAudienceById");
|
|
502
|
-
console.log(warrning);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
const query_params = {};
|
|
506
|
-
|
|
507
|
-
return PlatformAPIClient.execute(
|
|
508
|
-
this.config,
|
|
509
|
-
"put",
|
|
510
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
|
|
511
|
-
query_params,
|
|
512
|
-
body
|
|
513
|
-
);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
* @param {Object} arg - Arg object.
|
|
518
|
-
* @param {GetNRecordsCsvReq} arg.body
|
|
519
|
-
* @summary: Get n sample records from csv
|
|
520
|
-
* @description: Get n sample records from csv
|
|
521
|
-
*/
|
|
522
|
-
getNSampleRecordsFromCsv({ body } = {}) {
|
|
523
|
-
const {
|
|
524
|
-
error,
|
|
525
|
-
} = CommunicationValidator.getNSampleRecordsFromCsv().validate(
|
|
526
|
-
{
|
|
527
|
-
body,
|
|
528
|
-
},
|
|
529
|
-
{ abortEarly: false, allowUnknown: true }
|
|
530
|
-
);
|
|
531
|
-
if (error) {
|
|
532
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
533
|
-
}
|
|
534
562
|
|
|
535
|
-
// Showing warrnings if extra unknown parameters are found
|
|
536
563
|
const {
|
|
537
|
-
error:
|
|
538
|
-
} =
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
)
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
"
|
|
547
|
-
);
|
|
548
|
-
|
|
564
|
+
error: res_error,
|
|
565
|
+
} = CommunicationModel.Audience().validate(response, {
|
|
566
|
+
abortEarly: false,
|
|
567
|
+
allowUnknown: false,
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
if (res_error) {
|
|
571
|
+
Logger({
|
|
572
|
+
level: "WARN",
|
|
573
|
+
message: "Response Validation Warnnings for getAudienceById",
|
|
574
|
+
});
|
|
575
|
+
Logger({ level: "WARN", message: res_error });
|
|
549
576
|
}
|
|
550
577
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
return PlatformAPIClient.execute(
|
|
554
|
-
this.config,
|
|
555
|
-
"post",
|
|
556
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/get-n-records`,
|
|
557
|
-
query_params,
|
|
558
|
-
body
|
|
559
|
-
);
|
|
578
|
+
return response;
|
|
560
579
|
}
|
|
561
580
|
|
|
562
581
|
/**
|
|
@@ -564,11 +583,12 @@ class Communication {
|
|
|
564
583
|
* @param {number} [arg.pageNo] - Current page no
|
|
565
584
|
* @param {number} [arg.pageSize] - Current request items count
|
|
566
585
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
567
|
-
* @
|
|
568
|
-
* @
|
|
586
|
+
* @returns {Promise<Audiences>} - Success response
|
|
587
|
+
* @summary: Get audiences
|
|
588
|
+
* @description: Get audiences
|
|
569
589
|
*/
|
|
570
|
-
|
|
571
|
-
const { error } = CommunicationValidator.
|
|
590
|
+
async getAudiences({ pageNo, pageSize, sort } = {}) {
|
|
591
|
+
const { error } = CommunicationValidator.getAudiences().validate(
|
|
572
592
|
{
|
|
573
593
|
pageNo,
|
|
574
594
|
pageSize,
|
|
@@ -581,9 +601,7 @@ class Communication {
|
|
|
581
601
|
}
|
|
582
602
|
|
|
583
603
|
// Showing warrnings if extra unknown parameters are found
|
|
584
|
-
const {
|
|
585
|
-
error: warrning,
|
|
586
|
-
} = CommunicationValidator.getEmailProviders().validate(
|
|
604
|
+
const { error: warrning } = CommunicationValidator.getAudiences().validate(
|
|
587
605
|
{
|
|
588
606
|
pageNo,
|
|
589
607
|
pageSize,
|
|
@@ -592,8 +610,11 @@ class Communication {
|
|
|
592
610
|
{ abortEarly: false, allowUnknown: false }
|
|
593
611
|
);
|
|
594
612
|
if (warrning) {
|
|
595
|
-
|
|
596
|
-
|
|
613
|
+
Logger({
|
|
614
|
+
level: "WARN",
|
|
615
|
+
message: "Parameter Validation warrnings for getAudiences",
|
|
616
|
+
});
|
|
617
|
+
Logger({ level: "WARN", message: warrning });
|
|
597
618
|
}
|
|
598
619
|
|
|
599
620
|
const query_params = {};
|
|
@@ -601,13 +622,30 @@ class Communication {
|
|
|
601
622
|
query_params["page_size"] = pageSize;
|
|
602
623
|
query_params["sort"] = sort;
|
|
603
624
|
|
|
604
|
-
|
|
625
|
+
const response = await PlatformAPIClient.execute(
|
|
605
626
|
this.config,
|
|
606
627
|
"get",
|
|
607
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
628
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources`,
|
|
608
629
|
query_params,
|
|
609
630
|
undefined
|
|
610
631
|
);
|
|
632
|
+
|
|
633
|
+
const {
|
|
634
|
+
error: res_error,
|
|
635
|
+
} = CommunicationModel.Audiences().validate(response, {
|
|
636
|
+
abortEarly: false,
|
|
637
|
+
allowUnknown: false,
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
if (res_error) {
|
|
641
|
+
Logger({
|
|
642
|
+
level: "WARN",
|
|
643
|
+
message: "Response Validation Warnnings for getAudiences",
|
|
644
|
+
});
|
|
645
|
+
Logger({ level: "WARN", message: res_error });
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
return response;
|
|
611
649
|
}
|
|
612
650
|
|
|
613
651
|
/**
|
|
@@ -616,21 +654,16 @@ class Communication {
|
|
|
616
654
|
* @param {string} arg.applicationId - Application id
|
|
617
655
|
* @param {number} [arg.pageSize] - Current request items count
|
|
618
656
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
619
|
-
* @summary: Get
|
|
620
|
-
* @description: Get
|
|
657
|
+
* @summary: Get audiences
|
|
658
|
+
* @description: Get audiences
|
|
621
659
|
*/
|
|
622
|
-
|
|
623
|
-
companyId,
|
|
624
|
-
applicationId,
|
|
625
|
-
pageSize,
|
|
626
|
-
sort,
|
|
627
|
-
} = {}) {
|
|
660
|
+
getAudiencesPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
628
661
|
const paginator = new Paginator();
|
|
629
662
|
const callback = async () => {
|
|
630
663
|
const pageId = paginator.nextId;
|
|
631
664
|
const pageNo = paginator.pageNo;
|
|
632
665
|
const pageType = "number";
|
|
633
|
-
const data = await this.
|
|
666
|
+
const data = await this.getAudiences({
|
|
634
667
|
companyId: companyId,
|
|
635
668
|
applicationId: applicationId,
|
|
636
669
|
pageNo: pageNo,
|
|
@@ -649,12 +682,13 @@ class Communication {
|
|
|
649
682
|
|
|
650
683
|
/**
|
|
651
684
|
* @param {Object} arg - Arg object.
|
|
652
|
-
* @param {
|
|
653
|
-
* @
|
|
654
|
-
* @
|
|
685
|
+
* @param {BigqueryHeadersReq} arg.body
|
|
686
|
+
* @returns {Promise<BigqueryHeadersRes>} - Success response
|
|
687
|
+
* @summary: Get bigquery headers
|
|
688
|
+
* @description: Get bigquery headers
|
|
655
689
|
*/
|
|
656
|
-
|
|
657
|
-
const { error } = CommunicationValidator.
|
|
690
|
+
async getBigqueryHeaders({ body } = {}) {
|
|
691
|
+
const { error } = CommunicationValidator.getBigqueryHeaders().validate(
|
|
658
692
|
{
|
|
659
693
|
body,
|
|
660
694
|
},
|
|
@@ -667,36 +701,57 @@ class Communication {
|
|
|
667
701
|
// Showing warrnings if extra unknown parameters are found
|
|
668
702
|
const {
|
|
669
703
|
error: warrning,
|
|
670
|
-
} = CommunicationValidator.
|
|
704
|
+
} = CommunicationValidator.getBigqueryHeaders().validate(
|
|
671
705
|
{
|
|
672
706
|
body,
|
|
673
707
|
},
|
|
674
708
|
{ abortEarly: false, allowUnknown: false }
|
|
675
709
|
);
|
|
676
710
|
if (warrning) {
|
|
677
|
-
|
|
678
|
-
|
|
711
|
+
Logger({
|
|
712
|
+
level: "WARN",
|
|
713
|
+
message: "Parameter Validation warrnings for getBigqueryHeaders",
|
|
714
|
+
});
|
|
715
|
+
Logger({ level: "WARN", message: warrning });
|
|
679
716
|
}
|
|
680
717
|
|
|
681
718
|
const query_params = {};
|
|
682
719
|
|
|
683
|
-
|
|
720
|
+
const response = await PlatformAPIClient.execute(
|
|
684
721
|
this.config,
|
|
685
722
|
"post",
|
|
686
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
723
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/bigquery-headers`,
|
|
687
724
|
query_params,
|
|
688
725
|
body
|
|
689
726
|
);
|
|
727
|
+
|
|
728
|
+
const {
|
|
729
|
+
error: res_error,
|
|
730
|
+
} = CommunicationModel.BigqueryHeadersRes().validate(response, {
|
|
731
|
+
abortEarly: false,
|
|
732
|
+
allowUnknown: false,
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
if (res_error) {
|
|
736
|
+
Logger({
|
|
737
|
+
level: "WARN",
|
|
738
|
+
message: "Response Validation Warnnings for getBigqueryHeaders",
|
|
739
|
+
});
|
|
740
|
+
Logger({ level: "WARN", message: res_error });
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
return response;
|
|
690
744
|
}
|
|
691
745
|
|
|
692
746
|
/**
|
|
693
747
|
* @param {Object} arg - Arg object.
|
|
694
|
-
* @param {string} arg.id -
|
|
695
|
-
* @
|
|
696
|
-
* @
|
|
748
|
+
* @param {string} arg.id - Campaign id
|
|
749
|
+
* @returns {Promise<Campaign>} - Success response
|
|
750
|
+
* @summary: Get campaign by id
|
|
751
|
+
* @description: Get campaign by id
|
|
697
752
|
*/
|
|
698
|
-
|
|
699
|
-
const { error } = CommunicationValidator.
|
|
753
|
+
async getCampaignById({ id } = {}) {
|
|
754
|
+
const { error } = CommunicationValidator.getCampaignById().validate(
|
|
700
755
|
{
|
|
701
756
|
id,
|
|
702
757
|
},
|
|
@@ -709,71 +764,46 @@ class Communication {
|
|
|
709
764
|
// Showing warrnings if extra unknown parameters are found
|
|
710
765
|
const {
|
|
711
766
|
error: warrning,
|
|
712
|
-
} = CommunicationValidator.
|
|
767
|
+
} = CommunicationValidator.getCampaignById().validate(
|
|
713
768
|
{
|
|
714
769
|
id,
|
|
715
770
|
},
|
|
716
771
|
{ abortEarly: false, allowUnknown: false }
|
|
717
772
|
);
|
|
718
773
|
if (warrning) {
|
|
719
|
-
|
|
720
|
-
|
|
774
|
+
Logger({
|
|
775
|
+
level: "WARN",
|
|
776
|
+
message: "Parameter Validation warrnings for getCampaignById",
|
|
777
|
+
});
|
|
778
|
+
Logger({ level: "WARN", message: warrning });
|
|
721
779
|
}
|
|
722
780
|
|
|
723
781
|
const query_params = {};
|
|
724
782
|
|
|
725
|
-
|
|
783
|
+
const response = await PlatformAPIClient.execute(
|
|
726
784
|
this.config,
|
|
727
785
|
"get",
|
|
728
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
786
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns/${id}`,
|
|
729
787
|
query_params,
|
|
730
788
|
undefined
|
|
731
789
|
);
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
/**
|
|
735
|
-
* @param {Object} arg - Arg object.
|
|
736
|
-
* @param {string} arg.id - Email provider id
|
|
737
|
-
* @param {EmailProviderReq} arg.body
|
|
738
|
-
* @summary: Update email provider by id
|
|
739
|
-
* @description: Update email provider by id
|
|
740
|
-
*/
|
|
741
|
-
updateEmailProviderById({ id, body } = {}) {
|
|
742
|
-
const { error } = CommunicationValidator.updateEmailProviderById().validate(
|
|
743
|
-
{
|
|
744
|
-
id,
|
|
745
|
-
body,
|
|
746
|
-
},
|
|
747
|
-
{ abortEarly: false, allowUnknown: true }
|
|
748
|
-
);
|
|
749
|
-
if (error) {
|
|
750
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
751
|
-
}
|
|
752
790
|
|
|
753
|
-
// Showing warrnings if extra unknown parameters are found
|
|
754
791
|
const {
|
|
755
|
-
error:
|
|
756
|
-
} =
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
792
|
+
error: res_error,
|
|
793
|
+
} = CommunicationModel.Campaign().validate(response, {
|
|
794
|
+
abortEarly: false,
|
|
795
|
+
allowUnknown: false,
|
|
796
|
+
});
|
|
797
|
+
|
|
798
|
+
if (res_error) {
|
|
799
|
+
Logger({
|
|
800
|
+
level: "WARN",
|
|
801
|
+
message: "Response Validation Warnnings for getCampaignById",
|
|
802
|
+
});
|
|
803
|
+
Logger({ level: "WARN", message: res_error });
|
|
766
804
|
}
|
|
767
805
|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
return PlatformAPIClient.execute(
|
|
771
|
-
this.config,
|
|
772
|
-
"put",
|
|
773
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
|
|
774
|
-
query_params,
|
|
775
|
-
body
|
|
776
|
-
);
|
|
806
|
+
return response;
|
|
777
807
|
}
|
|
778
808
|
|
|
779
809
|
/**
|
|
@@ -781,11 +811,12 @@ class Communication {
|
|
|
781
811
|
* @param {number} [arg.pageNo] - Current page no
|
|
782
812
|
* @param {number} [arg.pageSize] - Current request items count
|
|
783
813
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
784
|
-
* @
|
|
785
|
-
* @
|
|
814
|
+
* @returns {Promise<Campaigns>} - Success response
|
|
815
|
+
* @summary: Get campaigns
|
|
816
|
+
* @description: Get campaigns
|
|
786
817
|
*/
|
|
787
|
-
|
|
788
|
-
const { error } = CommunicationValidator.
|
|
818
|
+
async getCampaigns({ pageNo, pageSize, sort } = {}) {
|
|
819
|
+
const { error } = CommunicationValidator.getCampaigns().validate(
|
|
789
820
|
{
|
|
790
821
|
pageNo,
|
|
791
822
|
pageSize,
|
|
@@ -798,9 +829,7 @@ class Communication {
|
|
|
798
829
|
}
|
|
799
830
|
|
|
800
831
|
// Showing warrnings if extra unknown parameters are found
|
|
801
|
-
const {
|
|
802
|
-
error: warrning,
|
|
803
|
-
} = CommunicationValidator.getEmailTemplates().validate(
|
|
832
|
+
const { error: warrning } = CommunicationValidator.getCampaigns().validate(
|
|
804
833
|
{
|
|
805
834
|
pageNo,
|
|
806
835
|
pageSize,
|
|
@@ -809,8 +838,11 @@ class Communication {
|
|
|
809
838
|
{ abortEarly: false, allowUnknown: false }
|
|
810
839
|
);
|
|
811
840
|
if (warrning) {
|
|
812
|
-
|
|
813
|
-
|
|
841
|
+
Logger({
|
|
842
|
+
level: "WARN",
|
|
843
|
+
message: "Parameter Validation warrnings for getCampaigns",
|
|
844
|
+
});
|
|
845
|
+
Logger({ level: "WARN", message: warrning });
|
|
814
846
|
}
|
|
815
847
|
|
|
816
848
|
const query_params = {};
|
|
@@ -818,13 +850,30 @@ class Communication {
|
|
|
818
850
|
query_params["page_size"] = pageSize;
|
|
819
851
|
query_params["sort"] = sort;
|
|
820
852
|
|
|
821
|
-
|
|
853
|
+
const response = await PlatformAPIClient.execute(
|
|
822
854
|
this.config,
|
|
823
855
|
"get",
|
|
824
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
856
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns`,
|
|
825
857
|
query_params,
|
|
826
858
|
undefined
|
|
827
859
|
);
|
|
860
|
+
|
|
861
|
+
const {
|
|
862
|
+
error: res_error,
|
|
863
|
+
} = CommunicationModel.Campaigns().validate(response, {
|
|
864
|
+
abortEarly: false,
|
|
865
|
+
allowUnknown: false,
|
|
866
|
+
});
|
|
867
|
+
|
|
868
|
+
if (res_error) {
|
|
869
|
+
Logger({
|
|
870
|
+
level: "WARN",
|
|
871
|
+
message: "Response Validation Warnnings for getCampaigns",
|
|
872
|
+
});
|
|
873
|
+
Logger({ level: "WARN", message: res_error });
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
return response;
|
|
828
877
|
}
|
|
829
878
|
|
|
830
879
|
/**
|
|
@@ -833,21 +882,16 @@ class Communication {
|
|
|
833
882
|
* @param {string} arg.applicationId - Application id
|
|
834
883
|
* @param {number} [arg.pageSize] - Current request items count
|
|
835
884
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
836
|
-
* @summary: Get
|
|
837
|
-
* @description: Get
|
|
885
|
+
* @summary: Get campaigns
|
|
886
|
+
* @description: Get campaigns
|
|
838
887
|
*/
|
|
839
|
-
|
|
840
|
-
companyId,
|
|
841
|
-
applicationId,
|
|
842
|
-
pageSize,
|
|
843
|
-
sort,
|
|
844
|
-
} = {}) {
|
|
888
|
+
getCampaignsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
845
889
|
const paginator = new Paginator();
|
|
846
890
|
const callback = async () => {
|
|
847
891
|
const pageId = paginator.nextId;
|
|
848
892
|
const pageNo = paginator.pageNo;
|
|
849
893
|
const pageType = "number";
|
|
850
|
-
const data = await this.
|
|
894
|
+
const data = await this.getCampaigns({
|
|
851
895
|
companyId: companyId,
|
|
852
896
|
applicationId: applicationId,
|
|
853
897
|
pageNo: pageNo,
|
|
@@ -866,14 +910,21 @@ class Communication {
|
|
|
866
910
|
|
|
867
911
|
/**
|
|
868
912
|
* @param {Object} arg - Arg object.
|
|
869
|
-
* @param {
|
|
870
|
-
* @
|
|
871
|
-
* @
|
|
913
|
+
* @param {string} [arg.pageId] - Current page no
|
|
914
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
915
|
+
* @param {Object} [arg.sort] - To sort based on _id
|
|
916
|
+
* @param {Object} [arg.query] -
|
|
917
|
+
* @returns {Promise<Logs>} - Success response
|
|
918
|
+
* @summary: Get communication logs
|
|
919
|
+
* @description: Get communication logs
|
|
872
920
|
*/
|
|
873
|
-
|
|
874
|
-
const { error } = CommunicationValidator.
|
|
921
|
+
async getCommunicationLogs({ pageId, pageSize, sort, query } = {}) {
|
|
922
|
+
const { error } = CommunicationValidator.getCommunicationLogs().validate(
|
|
875
923
|
{
|
|
876
|
-
|
|
924
|
+
pageId,
|
|
925
|
+
pageSize,
|
|
926
|
+
sort,
|
|
927
|
+
query,
|
|
877
928
|
},
|
|
878
929
|
{ abortEarly: false, allowUnknown: true }
|
|
879
930
|
);
|
|
@@ -884,26 +935,154 @@ class Communication {
|
|
|
884
935
|
// Showing warrnings if extra unknown parameters are found
|
|
885
936
|
const {
|
|
886
937
|
error: warrning,
|
|
887
|
-
} = CommunicationValidator.
|
|
938
|
+
} = CommunicationValidator.getCommunicationLogs().validate(
|
|
888
939
|
{
|
|
889
|
-
|
|
940
|
+
pageId,
|
|
941
|
+
pageSize,
|
|
942
|
+
sort,
|
|
943
|
+
query,
|
|
890
944
|
},
|
|
891
945
|
{ abortEarly: false, allowUnknown: false }
|
|
892
946
|
);
|
|
893
947
|
if (warrning) {
|
|
894
|
-
|
|
895
|
-
|
|
948
|
+
Logger({
|
|
949
|
+
level: "WARN",
|
|
950
|
+
message: "Parameter Validation warrnings for getCommunicationLogs",
|
|
951
|
+
});
|
|
952
|
+
Logger({ level: "WARN", message: warrning });
|
|
896
953
|
}
|
|
897
954
|
|
|
898
955
|
const query_params = {};
|
|
956
|
+
query_params["page_id"] = pageId;
|
|
957
|
+
query_params["page_size"] = pageSize;
|
|
958
|
+
query_params["sort"] = sort;
|
|
959
|
+
query_params["query"] = query;
|
|
899
960
|
|
|
900
|
-
|
|
961
|
+
const response = await PlatformAPIClient.execute(
|
|
901
962
|
this.config,
|
|
902
|
-
"
|
|
903
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
963
|
+
"get",
|
|
964
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/log`,
|
|
904
965
|
query_params,
|
|
905
|
-
|
|
966
|
+
undefined
|
|
906
967
|
);
|
|
968
|
+
|
|
969
|
+
const { error: res_error } = CommunicationModel.Logs().validate(response, {
|
|
970
|
+
abortEarly: false,
|
|
971
|
+
allowUnknown: false,
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
if (res_error) {
|
|
975
|
+
Logger({
|
|
976
|
+
level: "WARN",
|
|
977
|
+
message: "Response Validation Warnnings for getCommunicationLogs",
|
|
978
|
+
});
|
|
979
|
+
Logger({ level: "WARN", message: res_error });
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
return response;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* @param {Object} arg - Arg object.
|
|
987
|
+
* @param {string} arg.companyId - Company id
|
|
988
|
+
* @param {string} arg.applicationId - Application id
|
|
989
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
990
|
+
* @param {Object} [arg.sort] - To sort based on _id
|
|
991
|
+
* @param {Object} [arg.query] -
|
|
992
|
+
* @summary: Get communication logs
|
|
993
|
+
* @description: Get communication logs
|
|
994
|
+
*/
|
|
995
|
+
getCommunicationLogsPaginator({
|
|
996
|
+
companyId,
|
|
997
|
+
applicationId,
|
|
998
|
+
pageSize,
|
|
999
|
+
sort,
|
|
1000
|
+
query,
|
|
1001
|
+
} = {}) {
|
|
1002
|
+
const paginator = new Paginator();
|
|
1003
|
+
const callback = async () => {
|
|
1004
|
+
const pageId = paginator.nextId;
|
|
1005
|
+
const pageNo = paginator.pageNo;
|
|
1006
|
+
const pageType = "cursor";
|
|
1007
|
+
const data = await this.getCommunicationLogs({
|
|
1008
|
+
companyId: companyId,
|
|
1009
|
+
applicationId: applicationId,
|
|
1010
|
+
pageId: pageId,
|
|
1011
|
+
pageSize: pageSize,
|
|
1012
|
+
sort: sort,
|
|
1013
|
+
query: query,
|
|
1014
|
+
});
|
|
1015
|
+
paginator.setPaginator({
|
|
1016
|
+
hasNext: data.page.has_next ? true : false,
|
|
1017
|
+
nextId: data.page.next_id,
|
|
1018
|
+
});
|
|
1019
|
+
return data;
|
|
1020
|
+
};
|
|
1021
|
+
paginator.setCallback(callback.bind(this));
|
|
1022
|
+
return paginator;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* @param {Object} arg - Arg object.
|
|
1027
|
+
* @param {string} arg.id - Email provider id
|
|
1028
|
+
* @returns {Promise<EmailProvider>} - Success response
|
|
1029
|
+
* @summary: Get email provider by id
|
|
1030
|
+
* @description: Get email provider by id
|
|
1031
|
+
*/
|
|
1032
|
+
async getEmailProviderById({ id } = {}) {
|
|
1033
|
+
const { error } = CommunicationValidator.getEmailProviderById().validate(
|
|
1034
|
+
{
|
|
1035
|
+
id,
|
|
1036
|
+
},
|
|
1037
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1038
|
+
);
|
|
1039
|
+
if (error) {
|
|
1040
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1044
|
+
const {
|
|
1045
|
+
error: warrning,
|
|
1046
|
+
} = CommunicationValidator.getEmailProviderById().validate(
|
|
1047
|
+
{
|
|
1048
|
+
id,
|
|
1049
|
+
},
|
|
1050
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1051
|
+
);
|
|
1052
|
+
if (warrning) {
|
|
1053
|
+
Logger({
|
|
1054
|
+
level: "WARN",
|
|
1055
|
+
message: "Parameter Validation warrnings for getEmailProviderById",
|
|
1056
|
+
});
|
|
1057
|
+
Logger({ level: "WARN", message: warrning });
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
const query_params = {};
|
|
1061
|
+
|
|
1062
|
+
const response = await PlatformAPIClient.execute(
|
|
1063
|
+
this.config,
|
|
1064
|
+
"get",
|
|
1065
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
|
|
1066
|
+
query_params,
|
|
1067
|
+
undefined
|
|
1068
|
+
);
|
|
1069
|
+
|
|
1070
|
+
const {
|
|
1071
|
+
error: res_error,
|
|
1072
|
+
} = CommunicationModel.EmailProvider().validate(response, {
|
|
1073
|
+
abortEarly: false,
|
|
1074
|
+
allowUnknown: false,
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1077
|
+
if (res_error) {
|
|
1078
|
+
Logger({
|
|
1079
|
+
level: "WARN",
|
|
1080
|
+
message: "Response Validation Warnnings for getEmailProviderById",
|
|
1081
|
+
});
|
|
1082
|
+
Logger({ level: "WARN", message: res_error });
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
return response;
|
|
907
1086
|
}
|
|
908
1087
|
|
|
909
1088
|
/**
|
|
@@ -911,11 +1090,12 @@ class Communication {
|
|
|
911
1090
|
* @param {number} [arg.pageNo] - Current page no
|
|
912
1091
|
* @param {number} [arg.pageSize] - Current request items count
|
|
913
1092
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
914
|
-
* @
|
|
915
|
-
* @
|
|
1093
|
+
* @returns {Promise<EmailProviders>} - Success response
|
|
1094
|
+
* @summary: Get email providers
|
|
1095
|
+
* @description: Get email providers
|
|
916
1096
|
*/
|
|
917
|
-
|
|
918
|
-
const { error } = CommunicationValidator.
|
|
1097
|
+
async getEmailProviders({ pageNo, pageSize, sort } = {}) {
|
|
1098
|
+
const { error } = CommunicationValidator.getEmailProviders().validate(
|
|
919
1099
|
{
|
|
920
1100
|
pageNo,
|
|
921
1101
|
pageSize,
|
|
@@ -930,7 +1110,7 @@ class Communication {
|
|
|
930
1110
|
// Showing warrnings if extra unknown parameters are found
|
|
931
1111
|
const {
|
|
932
1112
|
error: warrning,
|
|
933
|
-
} = CommunicationValidator.
|
|
1113
|
+
} = CommunicationValidator.getEmailProviders().validate(
|
|
934
1114
|
{
|
|
935
1115
|
pageNo,
|
|
936
1116
|
pageSize,
|
|
@@ -939,8 +1119,11 @@ class Communication {
|
|
|
939
1119
|
{ abortEarly: false, allowUnknown: false }
|
|
940
1120
|
);
|
|
941
1121
|
if (warrning) {
|
|
942
|
-
|
|
943
|
-
|
|
1122
|
+
Logger({
|
|
1123
|
+
level: "WARN",
|
|
1124
|
+
message: "Parameter Validation warrnings for getEmailProviders",
|
|
1125
|
+
});
|
|
1126
|
+
Logger({ level: "WARN", message: warrning });
|
|
944
1127
|
}
|
|
945
1128
|
|
|
946
1129
|
const query_params = {};
|
|
@@ -948,13 +1131,30 @@ class Communication {
|
|
|
948
1131
|
query_params["page_size"] = pageSize;
|
|
949
1132
|
query_params["sort"] = sort;
|
|
950
1133
|
|
|
951
|
-
|
|
1134
|
+
const response = await PlatformAPIClient.execute(
|
|
952
1135
|
this.config,
|
|
953
1136
|
"get",
|
|
954
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/
|
|
1137
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers`,
|
|
955
1138
|
query_params,
|
|
956
1139
|
undefined
|
|
957
1140
|
);
|
|
1141
|
+
|
|
1142
|
+
const {
|
|
1143
|
+
error: res_error,
|
|
1144
|
+
} = CommunicationModel.EmailProviders().validate(response, {
|
|
1145
|
+
abortEarly: false,
|
|
1146
|
+
allowUnknown: false,
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1149
|
+
if (res_error) {
|
|
1150
|
+
Logger({
|
|
1151
|
+
level: "WARN",
|
|
1152
|
+
message: "Response Validation Warnnings for getEmailProviders",
|
|
1153
|
+
});
|
|
1154
|
+
Logger({ level: "WARN", message: res_error });
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
return response;
|
|
958
1158
|
}
|
|
959
1159
|
|
|
960
1160
|
/**
|
|
@@ -963,10 +1163,10 @@ class Communication {
|
|
|
963
1163
|
* @param {string} arg.applicationId - Application id
|
|
964
1164
|
* @param {number} [arg.pageSize] - Current request items count
|
|
965
1165
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
966
|
-
* @summary: Get
|
|
967
|
-
* @description: Get
|
|
1166
|
+
* @summary: Get email providers
|
|
1167
|
+
* @description: Get email providers
|
|
968
1168
|
*/
|
|
969
|
-
|
|
1169
|
+
getEmailProvidersPaginator({
|
|
970
1170
|
companyId,
|
|
971
1171
|
applicationId,
|
|
972
1172
|
pageSize,
|
|
@@ -977,7 +1177,7 @@ class Communication {
|
|
|
977
1177
|
const pageId = paginator.nextId;
|
|
978
1178
|
const pageNo = paginator.pageNo;
|
|
979
1179
|
const pageType = "number";
|
|
980
|
-
const data = await this.
|
|
1180
|
+
const data = await this.getEmailProviders({
|
|
981
1181
|
companyId: companyId,
|
|
982
1182
|
applicationId: applicationId,
|
|
983
1183
|
pageNo: pageNo,
|
|
@@ -997,10 +1197,11 @@ class Communication {
|
|
|
997
1197
|
/**
|
|
998
1198
|
* @param {Object} arg - Arg object.
|
|
999
1199
|
* @param {string} arg.id - Email template id
|
|
1200
|
+
* @returns {Promise<EmailTemplate>} - Success response
|
|
1000
1201
|
* @summary: Get email template by id
|
|
1001
1202
|
* @description: Get email template by id
|
|
1002
1203
|
*/
|
|
1003
|
-
getEmailTemplateById({ id } = {}) {
|
|
1204
|
+
async getEmailTemplateById({ id } = {}) {
|
|
1004
1205
|
const { error } = CommunicationValidator.getEmailTemplateById().validate(
|
|
1005
1206
|
{
|
|
1006
1207
|
id,
|
|
@@ -1021,33 +1222,56 @@ class Communication {
|
|
|
1021
1222
|
{ abortEarly: false, allowUnknown: false }
|
|
1022
1223
|
);
|
|
1023
1224
|
if (warrning) {
|
|
1024
|
-
|
|
1025
|
-
|
|
1225
|
+
Logger({
|
|
1226
|
+
level: "WARN",
|
|
1227
|
+
message: "Parameter Validation warrnings for getEmailTemplateById",
|
|
1228
|
+
});
|
|
1229
|
+
Logger({ level: "WARN", message: warrning });
|
|
1026
1230
|
}
|
|
1027
1231
|
|
|
1028
1232
|
const query_params = {};
|
|
1029
1233
|
|
|
1030
|
-
|
|
1234
|
+
const response = await PlatformAPIClient.execute(
|
|
1031
1235
|
this.config,
|
|
1032
1236
|
"get",
|
|
1033
1237
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
1034
1238
|
query_params,
|
|
1035
1239
|
undefined
|
|
1036
1240
|
);
|
|
1241
|
+
|
|
1242
|
+
const {
|
|
1243
|
+
error: res_error,
|
|
1244
|
+
} = CommunicationModel.EmailTemplate().validate(response, {
|
|
1245
|
+
abortEarly: false,
|
|
1246
|
+
allowUnknown: false,
|
|
1247
|
+
});
|
|
1248
|
+
|
|
1249
|
+
if (res_error) {
|
|
1250
|
+
Logger({
|
|
1251
|
+
level: "WARN",
|
|
1252
|
+
message: "Response Validation Warnnings for getEmailTemplateById",
|
|
1253
|
+
});
|
|
1254
|
+
Logger({ level: "WARN", message: res_error });
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
return response;
|
|
1037
1258
|
}
|
|
1038
1259
|
|
|
1039
1260
|
/**
|
|
1040
1261
|
* @param {Object} arg - Arg object.
|
|
1041
|
-
* @param {
|
|
1042
|
-
* @param {
|
|
1043
|
-
* @
|
|
1044
|
-
* @
|
|
1262
|
+
* @param {number} [arg.pageNo] - Current page no
|
|
1263
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
1264
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1265
|
+
* @returns {Promise<EmailTemplates>} - Success response
|
|
1266
|
+
* @summary: Get email templates
|
|
1267
|
+
* @description: Get email templates
|
|
1045
1268
|
*/
|
|
1046
|
-
|
|
1047
|
-
const { error } = CommunicationValidator.
|
|
1269
|
+
async getEmailTemplates({ pageNo, pageSize, sort } = {}) {
|
|
1270
|
+
const { error } = CommunicationValidator.getEmailTemplates().validate(
|
|
1048
1271
|
{
|
|
1049
|
-
|
|
1050
|
-
|
|
1272
|
+
pageNo,
|
|
1273
|
+
pageSize,
|
|
1274
|
+
sort,
|
|
1051
1275
|
},
|
|
1052
1276
|
{ abortEarly: false, allowUnknown: true }
|
|
1053
1277
|
);
|
|
@@ -1058,39 +1282,314 @@ class Communication {
|
|
|
1058
1282
|
// Showing warrnings if extra unknown parameters are found
|
|
1059
1283
|
const {
|
|
1060
1284
|
error: warrning,
|
|
1061
|
-
} = CommunicationValidator.
|
|
1285
|
+
} = CommunicationValidator.getEmailTemplates().validate(
|
|
1062
1286
|
{
|
|
1063
|
-
|
|
1064
|
-
|
|
1287
|
+
pageNo,
|
|
1288
|
+
pageSize,
|
|
1289
|
+
sort,
|
|
1065
1290
|
},
|
|
1066
1291
|
{ abortEarly: false, allowUnknown: false }
|
|
1067
1292
|
);
|
|
1068
1293
|
if (warrning) {
|
|
1069
|
-
|
|
1070
|
-
|
|
1294
|
+
Logger({
|
|
1295
|
+
level: "WARN",
|
|
1296
|
+
message: "Parameter Validation warrnings for getEmailTemplates",
|
|
1297
|
+
});
|
|
1298
|
+
Logger({ level: "WARN", message: warrning });
|
|
1071
1299
|
}
|
|
1072
1300
|
|
|
1073
1301
|
const query_params = {};
|
|
1302
|
+
query_params["page_no"] = pageNo;
|
|
1303
|
+
query_params["page_size"] = pageSize;
|
|
1304
|
+
query_params["sort"] = sort;
|
|
1074
1305
|
|
|
1075
|
-
|
|
1306
|
+
const response = await PlatformAPIClient.execute(
|
|
1076
1307
|
this.config,
|
|
1077
|
-
"
|
|
1078
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates
|
|
1308
|
+
"get",
|
|
1309
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates`,
|
|
1079
1310
|
query_params,
|
|
1080
|
-
|
|
1311
|
+
undefined
|
|
1312
|
+
);
|
|
1313
|
+
|
|
1314
|
+
const {
|
|
1315
|
+
error: res_error,
|
|
1316
|
+
} = CommunicationModel.EmailTemplates().validate(response, {
|
|
1317
|
+
abortEarly: false,
|
|
1318
|
+
allowUnknown: false,
|
|
1319
|
+
});
|
|
1320
|
+
|
|
1321
|
+
if (res_error) {
|
|
1322
|
+
Logger({
|
|
1323
|
+
level: "WARN",
|
|
1324
|
+
message: "Response Validation Warnnings for getEmailTemplates",
|
|
1325
|
+
});
|
|
1326
|
+
Logger({ level: "WARN", message: res_error });
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
return response;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* @param {Object} arg - Arg object.
|
|
1334
|
+
* @param {string} arg.companyId - Company id
|
|
1335
|
+
* @param {string} arg.applicationId - Application id
|
|
1336
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
1337
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1338
|
+
* @summary: Get email templates
|
|
1339
|
+
* @description: Get email templates
|
|
1340
|
+
*/
|
|
1341
|
+
getEmailTemplatesPaginator({
|
|
1342
|
+
companyId,
|
|
1343
|
+
applicationId,
|
|
1344
|
+
pageSize,
|
|
1345
|
+
sort,
|
|
1346
|
+
} = {}) {
|
|
1347
|
+
const paginator = new Paginator();
|
|
1348
|
+
const callback = async () => {
|
|
1349
|
+
const pageId = paginator.nextId;
|
|
1350
|
+
const pageNo = paginator.pageNo;
|
|
1351
|
+
const pageType = "number";
|
|
1352
|
+
const data = await this.getEmailTemplates({
|
|
1353
|
+
companyId: companyId,
|
|
1354
|
+
applicationId: applicationId,
|
|
1355
|
+
pageNo: pageNo,
|
|
1356
|
+
pageSize: pageSize,
|
|
1357
|
+
sort: sort,
|
|
1358
|
+
});
|
|
1359
|
+
paginator.setPaginator({
|
|
1360
|
+
hasNext: data.page.has_next ? true : false,
|
|
1361
|
+
nextId: data.page.next_id,
|
|
1362
|
+
});
|
|
1363
|
+
return data;
|
|
1364
|
+
};
|
|
1365
|
+
paginator.setCallback(callback.bind(this));
|
|
1366
|
+
return paginator;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
/**
|
|
1370
|
+
* @param {Object} arg - Arg object.
|
|
1371
|
+
* @param {number} [arg.pageNo] - Current page no
|
|
1372
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
1373
|
+
* @param {string} [arg.populate] - Populate fields
|
|
1374
|
+
* @returns {Promise<EventSubscriptions>} - Success response
|
|
1375
|
+
* @summary: Get event subscriptions
|
|
1376
|
+
* @description: Get event subscriptions
|
|
1377
|
+
*/
|
|
1378
|
+
async getEventSubscriptions({ pageNo, pageSize, populate } = {}) {
|
|
1379
|
+
const { error } = CommunicationValidator.getEventSubscriptions().validate(
|
|
1380
|
+
{
|
|
1381
|
+
pageNo,
|
|
1382
|
+
pageSize,
|
|
1383
|
+
populate,
|
|
1384
|
+
},
|
|
1385
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1386
|
+
);
|
|
1387
|
+
if (error) {
|
|
1388
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1392
|
+
const {
|
|
1393
|
+
error: warrning,
|
|
1394
|
+
} = CommunicationValidator.getEventSubscriptions().validate(
|
|
1395
|
+
{
|
|
1396
|
+
pageNo,
|
|
1397
|
+
pageSize,
|
|
1398
|
+
populate,
|
|
1399
|
+
},
|
|
1400
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1401
|
+
);
|
|
1402
|
+
if (warrning) {
|
|
1403
|
+
Logger({
|
|
1404
|
+
level: "WARN",
|
|
1405
|
+
message: "Parameter Validation warrnings for getEventSubscriptions",
|
|
1406
|
+
});
|
|
1407
|
+
Logger({ level: "WARN", message: warrning });
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
const query_params = {};
|
|
1411
|
+
query_params["page_no"] = pageNo;
|
|
1412
|
+
query_params["page_size"] = pageSize;
|
|
1413
|
+
query_params["populate"] = populate;
|
|
1414
|
+
|
|
1415
|
+
const response = await PlatformAPIClient.execute(
|
|
1416
|
+
this.config,
|
|
1417
|
+
"get",
|
|
1418
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/event/event-subscriptions`,
|
|
1419
|
+
query_params,
|
|
1420
|
+
undefined
|
|
1421
|
+
);
|
|
1422
|
+
|
|
1423
|
+
const {
|
|
1424
|
+
error: res_error,
|
|
1425
|
+
} = CommunicationModel.EventSubscriptions().validate(response, {
|
|
1426
|
+
abortEarly: false,
|
|
1427
|
+
allowUnknown: false,
|
|
1428
|
+
});
|
|
1429
|
+
|
|
1430
|
+
if (res_error) {
|
|
1431
|
+
Logger({
|
|
1432
|
+
level: "WARN",
|
|
1433
|
+
message: "Response Validation Warnnings for getEventSubscriptions",
|
|
1434
|
+
});
|
|
1435
|
+
Logger({ level: "WARN", message: res_error });
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
return response;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
/**
|
|
1442
|
+
* @param {Object} arg - Arg object.
|
|
1443
|
+
* @param {string} arg.companyId - Company id
|
|
1444
|
+
* @param {string} arg.applicationId - Application id
|
|
1445
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
1446
|
+
* @param {string} [arg.populate] - Populate fields
|
|
1447
|
+
* @summary: Get event subscriptions
|
|
1448
|
+
* @description: Get event subscriptions
|
|
1449
|
+
*/
|
|
1450
|
+
getEventSubscriptionsPaginator({
|
|
1451
|
+
companyId,
|
|
1452
|
+
applicationId,
|
|
1453
|
+
pageSize,
|
|
1454
|
+
populate,
|
|
1455
|
+
} = {}) {
|
|
1456
|
+
const paginator = new Paginator();
|
|
1457
|
+
const callback = async () => {
|
|
1458
|
+
const pageId = paginator.nextId;
|
|
1459
|
+
const pageNo = paginator.pageNo;
|
|
1460
|
+
const pageType = "number";
|
|
1461
|
+
const data = await this.getEventSubscriptions({
|
|
1462
|
+
companyId: companyId,
|
|
1463
|
+
applicationId: applicationId,
|
|
1464
|
+
pageNo: pageNo,
|
|
1465
|
+
pageSize: pageSize,
|
|
1466
|
+
populate: populate,
|
|
1467
|
+
});
|
|
1468
|
+
paginator.setPaginator({
|
|
1469
|
+
hasNext: data.page.has_next ? true : false,
|
|
1470
|
+
nextId: data.page.next_id,
|
|
1471
|
+
});
|
|
1472
|
+
return data;
|
|
1473
|
+
};
|
|
1474
|
+
paginator.setCallback(callback.bind(this));
|
|
1475
|
+
return paginator;
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
/**
|
|
1479
|
+
* @param {Object} arg - Arg object.
|
|
1480
|
+
* @param {number} [arg.pageNo] - Current page no
|
|
1481
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
1482
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1483
|
+
* @returns {Promise<JobLogs>} - Success response
|
|
1484
|
+
* @summary: Get job logs
|
|
1485
|
+
* @description: Get job logs
|
|
1486
|
+
*/
|
|
1487
|
+
async getJobLogs({ pageNo, pageSize, sort } = {}) {
|
|
1488
|
+
const { error } = CommunicationValidator.getJobLogs().validate(
|
|
1489
|
+
{
|
|
1490
|
+
pageNo,
|
|
1491
|
+
pageSize,
|
|
1492
|
+
sort,
|
|
1493
|
+
},
|
|
1494
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1495
|
+
);
|
|
1496
|
+
if (error) {
|
|
1497
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1501
|
+
const { error: warrning } = CommunicationValidator.getJobLogs().validate(
|
|
1502
|
+
{
|
|
1503
|
+
pageNo,
|
|
1504
|
+
pageSize,
|
|
1505
|
+
sort,
|
|
1506
|
+
},
|
|
1507
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1508
|
+
);
|
|
1509
|
+
if (warrning) {
|
|
1510
|
+
Logger({
|
|
1511
|
+
level: "WARN",
|
|
1512
|
+
message: "Parameter Validation warrnings for getJobLogs",
|
|
1513
|
+
});
|
|
1514
|
+
Logger({ level: "WARN", message: warrning });
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
const query_params = {};
|
|
1518
|
+
query_params["page_no"] = pageNo;
|
|
1519
|
+
query_params["page_size"] = pageSize;
|
|
1520
|
+
query_params["sort"] = sort;
|
|
1521
|
+
|
|
1522
|
+
const response = await PlatformAPIClient.execute(
|
|
1523
|
+
this.config,
|
|
1524
|
+
"get",
|
|
1525
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/logs`,
|
|
1526
|
+
query_params,
|
|
1527
|
+
undefined
|
|
1081
1528
|
);
|
|
1529
|
+
|
|
1530
|
+
const { error: res_error } = CommunicationModel.JobLogs().validate(
|
|
1531
|
+
response,
|
|
1532
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1533
|
+
);
|
|
1534
|
+
|
|
1535
|
+
if (res_error) {
|
|
1536
|
+
Logger({
|
|
1537
|
+
level: "WARN",
|
|
1538
|
+
message: "Response Validation Warnnings for getJobLogs",
|
|
1539
|
+
});
|
|
1540
|
+
Logger({ level: "WARN", message: res_error });
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
return response;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
/**
|
|
1547
|
+
* @param {Object} arg - Arg object.
|
|
1548
|
+
* @param {string} arg.companyId - Company id
|
|
1549
|
+
* @param {string} arg.applicationId - Application id
|
|
1550
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
1551
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1552
|
+
* @summary: Get job logs
|
|
1553
|
+
* @description: Get job logs
|
|
1554
|
+
*/
|
|
1555
|
+
getJobLogsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
1556
|
+
const paginator = new Paginator();
|
|
1557
|
+
const callback = async () => {
|
|
1558
|
+
const pageId = paginator.nextId;
|
|
1559
|
+
const pageNo = paginator.pageNo;
|
|
1560
|
+
const pageType = "number";
|
|
1561
|
+
const data = await this.getJobLogs({
|
|
1562
|
+
companyId: companyId,
|
|
1563
|
+
applicationId: applicationId,
|
|
1564
|
+
pageNo: pageNo,
|
|
1565
|
+
pageSize: pageSize,
|
|
1566
|
+
sort: sort,
|
|
1567
|
+
});
|
|
1568
|
+
paginator.setPaginator({
|
|
1569
|
+
hasNext: data.page.has_next ? true : false,
|
|
1570
|
+
nextId: data.page.next_id,
|
|
1571
|
+
});
|
|
1572
|
+
return data;
|
|
1573
|
+
};
|
|
1574
|
+
paginator.setCallback(callback.bind(this));
|
|
1575
|
+
return paginator;
|
|
1082
1576
|
}
|
|
1083
1577
|
|
|
1084
1578
|
/**
|
|
1085
1579
|
* @param {Object} arg - Arg object.
|
|
1086
|
-
* @param {
|
|
1087
|
-
* @
|
|
1088
|
-
* @
|
|
1580
|
+
* @param {number} [arg.pageNo] - Current page no
|
|
1581
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
1582
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1583
|
+
* @returns {Promise<Jobs>} - Success response
|
|
1584
|
+
* @summary: Get jobs
|
|
1585
|
+
* @description: Get jobs
|
|
1089
1586
|
*/
|
|
1090
|
-
|
|
1091
|
-
const { error } = CommunicationValidator.
|
|
1587
|
+
async getJobs({ pageNo, pageSize, sort } = {}) {
|
|
1588
|
+
const { error } = CommunicationValidator.getJobs().validate(
|
|
1092
1589
|
{
|
|
1093
|
-
|
|
1590
|
+
pageNo,
|
|
1591
|
+
pageSize,
|
|
1592
|
+
sort,
|
|
1094
1593
|
},
|
|
1095
1594
|
{ abortEarly: false, allowUnknown: true }
|
|
1096
1595
|
);
|
|
@@ -1099,40 +1598,94 @@ class Communication {
|
|
|
1099
1598
|
}
|
|
1100
1599
|
|
|
1101
1600
|
// Showing warrnings if extra unknown parameters are found
|
|
1102
|
-
const {
|
|
1103
|
-
error: warrning,
|
|
1104
|
-
} = CommunicationValidator.deleteEmailTemplateById().validate(
|
|
1601
|
+
const { error: warrning } = CommunicationValidator.getJobs().validate(
|
|
1105
1602
|
{
|
|
1106
|
-
|
|
1603
|
+
pageNo,
|
|
1604
|
+
pageSize,
|
|
1605
|
+
sort,
|
|
1107
1606
|
},
|
|
1108
1607
|
{ abortEarly: false, allowUnknown: false }
|
|
1109
1608
|
);
|
|
1110
1609
|
if (warrning) {
|
|
1111
|
-
|
|
1112
|
-
|
|
1610
|
+
Logger({
|
|
1611
|
+
level: "WARN",
|
|
1612
|
+
message: "Parameter Validation warrnings for getJobs",
|
|
1613
|
+
});
|
|
1614
|
+
Logger({ level: "WARN", message: warrning });
|
|
1113
1615
|
}
|
|
1114
1616
|
|
|
1115
1617
|
const query_params = {};
|
|
1618
|
+
query_params["page_no"] = pageNo;
|
|
1619
|
+
query_params["page_size"] = pageSize;
|
|
1620
|
+
query_params["sort"] = sort;
|
|
1116
1621
|
|
|
1117
|
-
|
|
1622
|
+
const response = await PlatformAPIClient.execute(
|
|
1118
1623
|
this.config,
|
|
1119
|
-
"
|
|
1120
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1624
|
+
"get",
|
|
1625
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/jobs`,
|
|
1121
1626
|
query_params,
|
|
1122
1627
|
undefined
|
|
1123
1628
|
);
|
|
1629
|
+
|
|
1630
|
+
const { error: res_error } = CommunicationModel.Jobs().validate(response, {
|
|
1631
|
+
abortEarly: false,
|
|
1632
|
+
allowUnknown: false,
|
|
1633
|
+
});
|
|
1634
|
+
|
|
1635
|
+
if (res_error) {
|
|
1636
|
+
Logger({
|
|
1637
|
+
level: "WARN",
|
|
1638
|
+
message: "Response Validation Warnnings for getJobs",
|
|
1639
|
+
});
|
|
1640
|
+
Logger({ level: "WARN", message: res_error });
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
return response;
|
|
1124
1644
|
}
|
|
1125
1645
|
|
|
1126
1646
|
/**
|
|
1127
1647
|
* @param {Object} arg - Arg object.
|
|
1128
|
-
* @param {
|
|
1129
|
-
* @
|
|
1130
|
-
* @
|
|
1648
|
+
* @param {string} arg.companyId - Company id
|
|
1649
|
+
* @param {string} arg.applicationId - Application id
|
|
1650
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
1651
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1652
|
+
* @summary: Get jobs
|
|
1653
|
+
* @description: Get jobs
|
|
1654
|
+
*/
|
|
1655
|
+
getJobsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
1656
|
+
const paginator = new Paginator();
|
|
1657
|
+
const callback = async () => {
|
|
1658
|
+
const pageId = paginator.nextId;
|
|
1659
|
+
const pageNo = paginator.pageNo;
|
|
1660
|
+
const pageType = "number";
|
|
1661
|
+
const data = await this.getJobs({
|
|
1662
|
+
companyId: companyId,
|
|
1663
|
+
applicationId: applicationId,
|
|
1664
|
+
pageNo: pageNo,
|
|
1665
|
+
pageSize: pageSize,
|
|
1666
|
+
sort: sort,
|
|
1667
|
+
});
|
|
1668
|
+
paginator.setPaginator({
|
|
1669
|
+
hasNext: data.page.has_next ? true : false,
|
|
1670
|
+
nextId: data.page.next_id,
|
|
1671
|
+
});
|
|
1672
|
+
return data;
|
|
1673
|
+
};
|
|
1674
|
+
paginator.setCallback(callback.bind(this));
|
|
1675
|
+
return paginator;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
/**
|
|
1679
|
+
* @param {Object} arg - Arg object.
|
|
1680
|
+
* @param {GetNRecordsCsvReq} arg.body
|
|
1681
|
+
* @returns {Promise<GetNRecordsCsvRes>} - Success response
|
|
1682
|
+
* @summary: Get n sample records from csv
|
|
1683
|
+
* @description: Get n sample records from csv
|
|
1131
1684
|
*/
|
|
1132
|
-
|
|
1685
|
+
async getNSampleRecordsFromCsv({ body } = {}) {
|
|
1133
1686
|
const {
|
|
1134
1687
|
error,
|
|
1135
|
-
} = CommunicationValidator.
|
|
1688
|
+
} = CommunicationValidator.getNSampleRecordsFromCsv().validate(
|
|
1136
1689
|
{
|
|
1137
1690
|
body,
|
|
1138
1691
|
},
|
|
@@ -1145,42 +1698,59 @@ class Communication {
|
|
|
1145
1698
|
// Showing warrnings if extra unknown parameters are found
|
|
1146
1699
|
const {
|
|
1147
1700
|
error: warrning,
|
|
1148
|
-
} = CommunicationValidator.
|
|
1701
|
+
} = CommunicationValidator.getNSampleRecordsFromCsv().validate(
|
|
1149
1702
|
{
|
|
1150
1703
|
body,
|
|
1151
1704
|
},
|
|
1152
1705
|
{ abortEarly: false, allowUnknown: false }
|
|
1153
1706
|
);
|
|
1154
1707
|
if (warrning) {
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1708
|
+
Logger({
|
|
1709
|
+
level: "WARN",
|
|
1710
|
+
message: "Parameter Validation warrnings for getNSampleRecordsFromCsv",
|
|
1711
|
+
});
|
|
1712
|
+
Logger({ level: "WARN", message: warrning });
|
|
1159
1713
|
}
|
|
1160
1714
|
|
|
1161
1715
|
const query_params = {};
|
|
1162
1716
|
|
|
1163
|
-
|
|
1717
|
+
const response = await PlatformAPIClient.execute(
|
|
1164
1718
|
this.config,
|
|
1165
1719
|
"post",
|
|
1166
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1720
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/get-n-records`,
|
|
1167
1721
|
query_params,
|
|
1168
1722
|
body
|
|
1169
1723
|
);
|
|
1724
|
+
|
|
1725
|
+
const {
|
|
1726
|
+
error: res_error,
|
|
1727
|
+
} = CommunicationModel.GetNRecordsCsvRes().validate(response, {
|
|
1728
|
+
abortEarly: false,
|
|
1729
|
+
allowUnknown: false,
|
|
1730
|
+
});
|
|
1731
|
+
|
|
1732
|
+
if (res_error) {
|
|
1733
|
+
Logger({
|
|
1734
|
+
level: "WARN",
|
|
1735
|
+
message: "Response Validation Warnnings for getNSampleRecordsFromCsv",
|
|
1736
|
+
});
|
|
1737
|
+
Logger({ level: "WARN", message: res_error });
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
return response;
|
|
1170
1741
|
}
|
|
1171
1742
|
|
|
1172
1743
|
/**
|
|
1173
1744
|
* @param {Object} arg - Arg object.
|
|
1174
|
-
* @param {
|
|
1175
|
-
* @
|
|
1176
|
-
* @
|
|
1745
|
+
* @param {string} arg.id - Sms provider id
|
|
1746
|
+
* @returns {Promise<SmsProvider>} - Success response
|
|
1747
|
+
* @summary: Get sms provider by id
|
|
1748
|
+
* @description: Get sms provider by id
|
|
1177
1749
|
*/
|
|
1178
|
-
|
|
1179
|
-
const {
|
|
1180
|
-
error,
|
|
1181
|
-
} = CommunicationValidator.sendCommunicationAsynchronously().validate(
|
|
1750
|
+
async getSmsProviderById({ id } = {}) {
|
|
1751
|
+
const { error } = CommunicationValidator.getSmsProviderById().validate(
|
|
1182
1752
|
{
|
|
1183
|
-
|
|
1753
|
+
id,
|
|
1184
1754
|
},
|
|
1185
1755
|
{ abortEarly: false, allowUnknown: true }
|
|
1186
1756
|
);
|
|
@@ -1191,44 +1761,63 @@ class Communication {
|
|
|
1191
1761
|
// Showing warrnings if extra unknown parameters are found
|
|
1192
1762
|
const {
|
|
1193
1763
|
error: warrning,
|
|
1194
|
-
} = CommunicationValidator.
|
|
1764
|
+
} = CommunicationValidator.getSmsProviderById().validate(
|
|
1195
1765
|
{
|
|
1196
|
-
|
|
1766
|
+
id,
|
|
1197
1767
|
},
|
|
1198
1768
|
{ abortEarly: false, allowUnknown: false }
|
|
1199
1769
|
);
|
|
1200
1770
|
if (warrning) {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1771
|
+
Logger({
|
|
1772
|
+
level: "WARN",
|
|
1773
|
+
message: "Parameter Validation warrnings for getSmsProviderById",
|
|
1774
|
+
});
|
|
1775
|
+
Logger({ level: "WARN", message: warrning });
|
|
1205
1776
|
}
|
|
1206
1777
|
|
|
1207
1778
|
const query_params = {};
|
|
1208
1779
|
|
|
1209
|
-
|
|
1780
|
+
const response = await PlatformAPIClient.execute(
|
|
1210
1781
|
this.config,
|
|
1211
|
-
"
|
|
1212
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1782
|
+
"get",
|
|
1783
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers/${id}`,
|
|
1213
1784
|
query_params,
|
|
1214
|
-
|
|
1785
|
+
undefined
|
|
1215
1786
|
);
|
|
1787
|
+
|
|
1788
|
+
const {
|
|
1789
|
+
error: res_error,
|
|
1790
|
+
} = CommunicationModel.SmsProvider().validate(response, {
|
|
1791
|
+
abortEarly: false,
|
|
1792
|
+
allowUnknown: false,
|
|
1793
|
+
});
|
|
1794
|
+
|
|
1795
|
+
if (res_error) {
|
|
1796
|
+
Logger({
|
|
1797
|
+
level: "WARN",
|
|
1798
|
+
message: "Response Validation Warnnings for getSmsProviderById",
|
|
1799
|
+
});
|
|
1800
|
+
Logger({ level: "WARN", message: res_error });
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
return response;
|
|
1216
1804
|
}
|
|
1217
1805
|
|
|
1218
1806
|
/**
|
|
1219
1807
|
* @param {Object} arg - Arg object.
|
|
1220
1808
|
* @param {number} [arg.pageNo] - Current page no
|
|
1221
1809
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1222
|
-
* @param {
|
|
1223
|
-
* @
|
|
1224
|
-
* @
|
|
1810
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1811
|
+
* @returns {Promise<SmsProviders>} - Success response
|
|
1812
|
+
* @summary: Get sms providers
|
|
1813
|
+
* @description: Get sms providers
|
|
1225
1814
|
*/
|
|
1226
|
-
|
|
1227
|
-
const { error } = CommunicationValidator.
|
|
1815
|
+
async getSmsProviders({ pageNo, pageSize, sort } = {}) {
|
|
1816
|
+
const { error } = CommunicationValidator.getSmsProviders().validate(
|
|
1228
1817
|
{
|
|
1229
1818
|
pageNo,
|
|
1230
1819
|
pageSize,
|
|
1231
|
-
|
|
1820
|
+
sort,
|
|
1232
1821
|
},
|
|
1233
1822
|
{ abortEarly: false, allowUnknown: true }
|
|
1234
1823
|
);
|
|
@@ -1239,31 +1828,51 @@ class Communication {
|
|
|
1239
1828
|
// Showing warrnings if extra unknown parameters are found
|
|
1240
1829
|
const {
|
|
1241
1830
|
error: warrning,
|
|
1242
|
-
} = CommunicationValidator.
|
|
1831
|
+
} = CommunicationValidator.getSmsProviders().validate(
|
|
1243
1832
|
{
|
|
1244
1833
|
pageNo,
|
|
1245
1834
|
pageSize,
|
|
1246
|
-
|
|
1835
|
+
sort,
|
|
1247
1836
|
},
|
|
1248
1837
|
{ abortEarly: false, allowUnknown: false }
|
|
1249
1838
|
);
|
|
1250
1839
|
if (warrning) {
|
|
1251
|
-
|
|
1252
|
-
|
|
1840
|
+
Logger({
|
|
1841
|
+
level: "WARN",
|
|
1842
|
+
message: "Parameter Validation warrnings for getSmsProviders",
|
|
1843
|
+
});
|
|
1844
|
+
Logger({ level: "WARN", message: warrning });
|
|
1253
1845
|
}
|
|
1254
1846
|
|
|
1255
1847
|
const query_params = {};
|
|
1256
1848
|
query_params["page_no"] = pageNo;
|
|
1257
1849
|
query_params["page_size"] = pageSize;
|
|
1258
|
-
query_params["
|
|
1850
|
+
query_params["sort"] = sort;
|
|
1259
1851
|
|
|
1260
|
-
|
|
1852
|
+
const response = await PlatformAPIClient.execute(
|
|
1261
1853
|
this.config,
|
|
1262
1854
|
"get",
|
|
1263
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1855
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers`,
|
|
1264
1856
|
query_params,
|
|
1265
1857
|
undefined
|
|
1266
1858
|
);
|
|
1859
|
+
|
|
1860
|
+
const {
|
|
1861
|
+
error: res_error,
|
|
1862
|
+
} = CommunicationModel.SmsProviders().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 getSmsProviders",
|
|
1871
|
+
});
|
|
1872
|
+
Logger({ level: "WARN", message: res_error });
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
return response;
|
|
1267
1876
|
}
|
|
1268
1877
|
|
|
1269
1878
|
/**
|
|
@@ -1271,27 +1880,22 @@ class Communication {
|
|
|
1271
1880
|
* @param {string} arg.companyId - Company id
|
|
1272
1881
|
* @param {string} arg.applicationId - Application id
|
|
1273
1882
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1274
|
-
* @param {
|
|
1275
|
-
* @summary: Get
|
|
1276
|
-
* @description: Get
|
|
1883
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1884
|
+
* @summary: Get sms providers
|
|
1885
|
+
* @description: Get sms providers
|
|
1277
1886
|
*/
|
|
1278
|
-
|
|
1279
|
-
companyId,
|
|
1280
|
-
applicationId,
|
|
1281
|
-
pageSize,
|
|
1282
|
-
populate,
|
|
1283
|
-
} = {}) {
|
|
1887
|
+
getSmsProvidersPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
1284
1888
|
const paginator = new Paginator();
|
|
1285
1889
|
const callback = async () => {
|
|
1286
1890
|
const pageId = paginator.nextId;
|
|
1287
1891
|
const pageNo = paginator.pageNo;
|
|
1288
1892
|
const pageType = "number";
|
|
1289
|
-
const data = await this.
|
|
1893
|
+
const data = await this.getSmsProviders({
|
|
1290
1894
|
companyId: companyId,
|
|
1291
1895
|
applicationId: applicationId,
|
|
1292
1896
|
pageNo: pageNo,
|
|
1293
1897
|
pageSize: pageSize,
|
|
1294
|
-
|
|
1898
|
+
sort: sort,
|
|
1295
1899
|
});
|
|
1296
1900
|
paginator.setPaginator({
|
|
1297
1901
|
hasNext: data.page.has_next ? true : false,
|
|
@@ -1303,16 +1907,80 @@ class Communication {
|
|
|
1303
1907
|
return paginator;
|
|
1304
1908
|
}
|
|
1305
1909
|
|
|
1910
|
+
/**
|
|
1911
|
+
* @param {Object} arg - Arg object.
|
|
1912
|
+
* @param {string} arg.id - Sms template id
|
|
1913
|
+
* @returns {Promise<SmsTemplate>} - Success response
|
|
1914
|
+
* @summary: Get sms template by id
|
|
1915
|
+
* @description: Get sms template by id
|
|
1916
|
+
*/
|
|
1917
|
+
async getSmsTemplateById({ id } = {}) {
|
|
1918
|
+
const { error } = CommunicationValidator.getSmsTemplateById().validate(
|
|
1919
|
+
{
|
|
1920
|
+
id,
|
|
1921
|
+
},
|
|
1922
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1923
|
+
);
|
|
1924
|
+
if (error) {
|
|
1925
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1929
|
+
const {
|
|
1930
|
+
error: warrning,
|
|
1931
|
+
} = CommunicationValidator.getSmsTemplateById().validate(
|
|
1932
|
+
{
|
|
1933
|
+
id,
|
|
1934
|
+
},
|
|
1935
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1936
|
+
);
|
|
1937
|
+
if (warrning) {
|
|
1938
|
+
Logger({
|
|
1939
|
+
level: "WARN",
|
|
1940
|
+
message: "Parameter Validation warrnings for getSmsTemplateById",
|
|
1941
|
+
});
|
|
1942
|
+
Logger({ level: "WARN", message: warrning });
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
const query_params = {};
|
|
1946
|
+
|
|
1947
|
+
const response = await PlatformAPIClient.execute(
|
|
1948
|
+
this.config,
|
|
1949
|
+
"get",
|
|
1950
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
1951
|
+
query_params,
|
|
1952
|
+
undefined
|
|
1953
|
+
);
|
|
1954
|
+
|
|
1955
|
+
const {
|
|
1956
|
+
error: res_error,
|
|
1957
|
+
} = CommunicationModel.SmsTemplate().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 getSmsTemplateById",
|
|
1966
|
+
});
|
|
1967
|
+
Logger({ level: "WARN", message: res_error });
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
return response;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1306
1973
|
/**
|
|
1307
1974
|
* @param {Object} arg - Arg object.
|
|
1308
1975
|
* @param {number} [arg.pageNo] - Current page no
|
|
1309
1976
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1310
1977
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1311
|
-
* @
|
|
1312
|
-
* @
|
|
1978
|
+
* @returns {Promise<SmsTemplates>} - Success response
|
|
1979
|
+
* @summary: Get sms templates
|
|
1980
|
+
* @description: Get sms templates
|
|
1313
1981
|
*/
|
|
1314
|
-
|
|
1315
|
-
const { error } = CommunicationValidator.
|
|
1982
|
+
async getSmsTemplates({ pageNo, pageSize, sort } = {}) {
|
|
1983
|
+
const { error } = CommunicationValidator.getSmsTemplates().validate(
|
|
1316
1984
|
{
|
|
1317
1985
|
pageNo,
|
|
1318
1986
|
pageSize,
|
|
@@ -1325,7 +1993,9 @@ class Communication {
|
|
|
1325
1993
|
}
|
|
1326
1994
|
|
|
1327
1995
|
// Showing warrnings if extra unknown parameters are found
|
|
1328
|
-
const {
|
|
1996
|
+
const {
|
|
1997
|
+
error: warrning,
|
|
1998
|
+
} = CommunicationValidator.getSmsTemplates().validate(
|
|
1329
1999
|
{
|
|
1330
2000
|
pageNo,
|
|
1331
2001
|
pageSize,
|
|
@@ -1334,8 +2004,11 @@ class Communication {
|
|
|
1334
2004
|
{ abortEarly: false, allowUnknown: false }
|
|
1335
2005
|
);
|
|
1336
2006
|
if (warrning) {
|
|
1337
|
-
|
|
1338
|
-
|
|
2007
|
+
Logger({
|
|
2008
|
+
level: "WARN",
|
|
2009
|
+
message: "Parameter Validation warrnings for getSmsTemplates",
|
|
2010
|
+
});
|
|
2011
|
+
Logger({ level: "WARN", message: warrning });
|
|
1339
2012
|
}
|
|
1340
2013
|
|
|
1341
2014
|
const query_params = {};
|
|
@@ -1343,13 +2016,30 @@ class Communication {
|
|
|
1343
2016
|
query_params["page_size"] = pageSize;
|
|
1344
2017
|
query_params["sort"] = sort;
|
|
1345
2018
|
|
|
1346
|
-
|
|
2019
|
+
const response = await PlatformAPIClient.execute(
|
|
1347
2020
|
this.config,
|
|
1348
2021
|
"get",
|
|
1349
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2022
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates`,
|
|
1350
2023
|
query_params,
|
|
1351
2024
|
undefined
|
|
1352
2025
|
);
|
|
2026
|
+
|
|
2027
|
+
const {
|
|
2028
|
+
error: res_error,
|
|
2029
|
+
} = CommunicationModel.SmsTemplates().validate(response, {
|
|
2030
|
+
abortEarly: false,
|
|
2031
|
+
allowUnknown: false,
|
|
2032
|
+
});
|
|
2033
|
+
|
|
2034
|
+
if (res_error) {
|
|
2035
|
+
Logger({
|
|
2036
|
+
level: "WARN",
|
|
2037
|
+
message: "Response Validation Warnnings for getSmsTemplates",
|
|
2038
|
+
});
|
|
2039
|
+
Logger({ level: "WARN", message: res_error });
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
return response;
|
|
1353
2043
|
}
|
|
1354
2044
|
|
|
1355
2045
|
/**
|
|
@@ -1358,16 +2048,16 @@ class Communication {
|
|
|
1358
2048
|
* @param {string} arg.applicationId - Application id
|
|
1359
2049
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1360
2050
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1361
|
-
* @summary: Get
|
|
1362
|
-
* @description: Get
|
|
2051
|
+
* @summary: Get sms templates
|
|
2052
|
+
* @description: Get sms templates
|
|
1363
2053
|
*/
|
|
1364
|
-
|
|
2054
|
+
getSmsTemplatesPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
1365
2055
|
const paginator = new Paginator();
|
|
1366
2056
|
const callback = async () => {
|
|
1367
2057
|
const pageId = paginator.nextId;
|
|
1368
2058
|
const pageNo = paginator.pageNo;
|
|
1369
2059
|
const pageType = "number";
|
|
1370
|
-
const data = await this.
|
|
2060
|
+
const data = await this.getSmsTemplates({
|
|
1371
2061
|
companyId: companyId,
|
|
1372
2062
|
applicationId: applicationId,
|
|
1373
2063
|
pageNo: pageNo,
|
|
@@ -1385,15 +2075,16 @@ class Communication {
|
|
|
1385
2075
|
}
|
|
1386
2076
|
|
|
1387
2077
|
/**
|
|
1388
|
-
* @param {Object} arg - Arg object.
|
|
1389
|
-
* @param {
|
|
1390
|
-
* @
|
|
1391
|
-
* @
|
|
2078
|
+
* @param {Object} arg - Arg object.
|
|
2079
|
+
* @param {string} arg.id - Campaign id
|
|
2080
|
+
* @returns {Promise<GetStats>} - Success response
|
|
2081
|
+
* @summary: Get stats of campaign by id
|
|
2082
|
+
* @description: Get stats of campaign by id
|
|
1392
2083
|
*/
|
|
1393
|
-
|
|
1394
|
-
const { error } = CommunicationValidator.
|
|
2084
|
+
async getStatsOfCampaignById({ id } = {}) {
|
|
2085
|
+
const { error } = CommunicationValidator.getStatsOfCampaignById().validate(
|
|
1395
2086
|
{
|
|
1396
|
-
|
|
2087
|
+
id,
|
|
1397
2088
|
},
|
|
1398
2089
|
{ abortEarly: false, allowUnknown: true }
|
|
1399
2090
|
);
|
|
@@ -1404,26 +2095,46 @@ class Communication {
|
|
|
1404
2095
|
// Showing warrnings if extra unknown parameters are found
|
|
1405
2096
|
const {
|
|
1406
2097
|
error: warrning,
|
|
1407
|
-
} = CommunicationValidator.
|
|
2098
|
+
} = CommunicationValidator.getStatsOfCampaignById().validate(
|
|
1408
2099
|
{
|
|
1409
|
-
|
|
2100
|
+
id,
|
|
1410
2101
|
},
|
|
1411
2102
|
{ abortEarly: false, allowUnknown: false }
|
|
1412
2103
|
);
|
|
1413
2104
|
if (warrning) {
|
|
1414
|
-
|
|
1415
|
-
|
|
2105
|
+
Logger({
|
|
2106
|
+
level: "WARN",
|
|
2107
|
+
message: "Parameter Validation warrnings for getStatsOfCampaignById",
|
|
2108
|
+
});
|
|
2109
|
+
Logger({ level: "WARN", message: warrning });
|
|
1416
2110
|
}
|
|
1417
2111
|
|
|
1418
2112
|
const query_params = {};
|
|
1419
2113
|
|
|
1420
|
-
|
|
2114
|
+
const response = await PlatformAPIClient.execute(
|
|
1421
2115
|
this.config,
|
|
1422
|
-
"
|
|
1423
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2116
|
+
"get",
|
|
2117
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/get-stats/${id}`,
|
|
1424
2118
|
query_params,
|
|
1425
|
-
|
|
2119
|
+
undefined
|
|
1426
2120
|
);
|
|
2121
|
+
|
|
2122
|
+
const {
|
|
2123
|
+
error: res_error,
|
|
2124
|
+
} = CommunicationModel.GetStats().validate(response, {
|
|
2125
|
+
abortEarly: false,
|
|
2126
|
+
allowUnknown: false,
|
|
2127
|
+
});
|
|
2128
|
+
|
|
2129
|
+
if (res_error) {
|
|
2130
|
+
Logger({
|
|
2131
|
+
level: "WARN",
|
|
2132
|
+
message: "Response Validation Warnnings for getStatsOfCampaignById",
|
|
2133
|
+
});
|
|
2134
|
+
Logger({ level: "WARN", message: res_error });
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
return response;
|
|
1427
2138
|
}
|
|
1428
2139
|
|
|
1429
2140
|
/**
|
|
@@ -1431,11 +2142,12 @@ class Communication {
|
|
|
1431
2142
|
* @param {number} [arg.pageNo] - Current page no
|
|
1432
2143
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1433
2144
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1434
|
-
* @
|
|
1435
|
-
* @
|
|
2145
|
+
* @returns {Promise<SystemEmailTemplates>} - Success response
|
|
2146
|
+
* @summary: Get system email templates
|
|
2147
|
+
* @description: Get system email templates
|
|
1436
2148
|
*/
|
|
1437
|
-
|
|
1438
|
-
const { error } = CommunicationValidator.
|
|
2149
|
+
async getSystemEmailTemplates({ pageNo, pageSize, sort } = {}) {
|
|
2150
|
+
const { error } = CommunicationValidator.getSystemEmailTemplates().validate(
|
|
1439
2151
|
{
|
|
1440
2152
|
pageNo,
|
|
1441
2153
|
pageSize,
|
|
@@ -1448,7 +2160,9 @@ class Communication {
|
|
|
1448
2160
|
}
|
|
1449
2161
|
|
|
1450
2162
|
// Showing warrnings if extra unknown parameters are found
|
|
1451
|
-
const {
|
|
2163
|
+
const {
|
|
2164
|
+
error: warrning,
|
|
2165
|
+
} = CommunicationValidator.getSystemEmailTemplates().validate(
|
|
1452
2166
|
{
|
|
1453
2167
|
pageNo,
|
|
1454
2168
|
pageSize,
|
|
@@ -1457,8 +2171,11 @@ class Communication {
|
|
|
1457
2171
|
{ abortEarly: false, allowUnknown: false }
|
|
1458
2172
|
);
|
|
1459
2173
|
if (warrning) {
|
|
1460
|
-
|
|
1461
|
-
|
|
2174
|
+
Logger({
|
|
2175
|
+
level: "WARN",
|
|
2176
|
+
message: "Parameter Validation warrnings for getSystemEmailTemplates",
|
|
2177
|
+
});
|
|
2178
|
+
Logger({ level: "WARN", message: warrning });
|
|
1462
2179
|
}
|
|
1463
2180
|
|
|
1464
2181
|
const query_params = {};
|
|
@@ -1466,13 +2183,30 @@ class Communication {
|
|
|
1466
2183
|
query_params["page_size"] = pageSize;
|
|
1467
2184
|
query_params["sort"] = sort;
|
|
1468
2185
|
|
|
1469
|
-
|
|
2186
|
+
const response = await PlatformAPIClient.execute(
|
|
1470
2187
|
this.config,
|
|
1471
2188
|
"get",
|
|
1472
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2189
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/system-templates`,
|
|
1473
2190
|
query_params,
|
|
1474
2191
|
undefined
|
|
1475
2192
|
);
|
|
2193
|
+
|
|
2194
|
+
const {
|
|
2195
|
+
error: res_error,
|
|
2196
|
+
} = CommunicationModel.SystemEmailTemplates().validate(response, {
|
|
2197
|
+
abortEarly: false,
|
|
2198
|
+
allowUnknown: false,
|
|
2199
|
+
});
|
|
2200
|
+
|
|
2201
|
+
if (res_error) {
|
|
2202
|
+
Logger({
|
|
2203
|
+
level: "WARN",
|
|
2204
|
+
message: "Response Validation Warnnings for getSystemEmailTemplates",
|
|
2205
|
+
});
|
|
2206
|
+
Logger({ level: "WARN", message: res_error });
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
return response;
|
|
1476
2210
|
}
|
|
1477
2211
|
|
|
1478
2212
|
/**
|
|
@@ -1481,16 +2215,21 @@ class Communication {
|
|
|
1481
2215
|
* @param {string} arg.applicationId - Application id
|
|
1482
2216
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1483
2217
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1484
|
-
* @summary: Get
|
|
1485
|
-
* @description: Get
|
|
2218
|
+
* @summary: Get system email templates
|
|
2219
|
+
* @description: Get system email templates
|
|
1486
2220
|
*/
|
|
1487
|
-
|
|
2221
|
+
getSystemEmailTemplatesPaginator({
|
|
2222
|
+
companyId,
|
|
2223
|
+
applicationId,
|
|
2224
|
+
pageSize,
|
|
2225
|
+
sort,
|
|
2226
|
+
} = {}) {
|
|
1488
2227
|
const paginator = new Paginator();
|
|
1489
2228
|
const callback = async () => {
|
|
1490
2229
|
const pageId = paginator.nextId;
|
|
1491
2230
|
const pageNo = paginator.pageNo;
|
|
1492
2231
|
const pageType = "number";
|
|
1493
|
-
const data = await this.
|
|
2232
|
+
const data = await this.getSystemEmailTemplates({
|
|
1494
2233
|
companyId: companyId,
|
|
1495
2234
|
applicationId: applicationId,
|
|
1496
2235
|
pageNo: pageNo,
|
|
@@ -1509,20 +2248,21 @@ class Communication {
|
|
|
1509
2248
|
|
|
1510
2249
|
/**
|
|
1511
2250
|
* @param {Object} arg - Arg object.
|
|
1512
|
-
* @param {
|
|
2251
|
+
* @param {number} [arg.pageNo] - Current page no
|
|
1513
2252
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1514
|
-
* @param {Object} [arg.sort] - To sort based on
|
|
1515
|
-
* @
|
|
1516
|
-
* @summary: Get
|
|
1517
|
-
* @description: Get
|
|
2253
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2254
|
+
* @returns {Promise<SystemSmsTemplates>} - Success response
|
|
2255
|
+
* @summary: Get system sms templates
|
|
2256
|
+
* @description: Get system sms templates
|
|
1518
2257
|
*/
|
|
1519
|
-
|
|
1520
|
-
const {
|
|
2258
|
+
async getSystemSystemTemplates({ pageNo, pageSize, sort } = {}) {
|
|
2259
|
+
const {
|
|
2260
|
+
error,
|
|
2261
|
+
} = CommunicationValidator.getSystemSystemTemplates().validate(
|
|
1521
2262
|
{
|
|
1522
|
-
|
|
2263
|
+
pageNo,
|
|
1523
2264
|
pageSize,
|
|
1524
2265
|
sort,
|
|
1525
|
-
query,
|
|
1526
2266
|
},
|
|
1527
2267
|
{ abortEarly: false, allowUnknown: true }
|
|
1528
2268
|
);
|
|
@@ -1533,33 +2273,51 @@ class Communication {
|
|
|
1533
2273
|
// Showing warrnings if extra unknown parameters are found
|
|
1534
2274
|
const {
|
|
1535
2275
|
error: warrning,
|
|
1536
|
-
} = CommunicationValidator.
|
|
2276
|
+
} = CommunicationValidator.getSystemSystemTemplates().validate(
|
|
1537
2277
|
{
|
|
1538
|
-
|
|
2278
|
+
pageNo,
|
|
1539
2279
|
pageSize,
|
|
1540
2280
|
sort,
|
|
1541
|
-
query,
|
|
1542
2281
|
},
|
|
1543
2282
|
{ abortEarly: false, allowUnknown: false }
|
|
1544
2283
|
);
|
|
1545
2284
|
if (warrning) {
|
|
1546
|
-
|
|
1547
|
-
|
|
2285
|
+
Logger({
|
|
2286
|
+
level: "WARN",
|
|
2287
|
+
message: "Parameter Validation warrnings for getSystemSystemTemplates",
|
|
2288
|
+
});
|
|
2289
|
+
Logger({ level: "WARN", message: warrning });
|
|
1548
2290
|
}
|
|
1549
2291
|
|
|
1550
2292
|
const query_params = {};
|
|
1551
|
-
query_params["
|
|
2293
|
+
query_params["page_no"] = pageNo;
|
|
1552
2294
|
query_params["page_size"] = pageSize;
|
|
1553
2295
|
query_params["sort"] = sort;
|
|
1554
|
-
query_params["query"] = query;
|
|
1555
2296
|
|
|
1556
|
-
|
|
2297
|
+
const response = await PlatformAPIClient.execute(
|
|
1557
2298
|
this.config,
|
|
1558
2299
|
"get",
|
|
1559
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2300
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/system-templates`,
|
|
1560
2301
|
query_params,
|
|
1561
2302
|
undefined
|
|
1562
2303
|
);
|
|
2304
|
+
|
|
2305
|
+
const {
|
|
2306
|
+
error: res_error,
|
|
2307
|
+
} = CommunicationModel.SystemSmsTemplates().validate(response, {
|
|
2308
|
+
abortEarly: false,
|
|
2309
|
+
allowUnknown: false,
|
|
2310
|
+
});
|
|
2311
|
+
|
|
2312
|
+
if (res_error) {
|
|
2313
|
+
Logger({
|
|
2314
|
+
level: "WARN",
|
|
2315
|
+
message: "Response Validation Warnnings for getSystemSystemTemplates",
|
|
2316
|
+
});
|
|
2317
|
+
Logger({ level: "WARN", message: res_error });
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
return response;
|
|
1563
2321
|
}
|
|
1564
2322
|
|
|
1565
2323
|
/**
|
|
@@ -1567,30 +2325,27 @@ class Communication {
|
|
|
1567
2325
|
* @param {string} arg.companyId - Company id
|
|
1568
2326
|
* @param {string} arg.applicationId - Application id
|
|
1569
2327
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1570
|
-
* @param {Object} [arg.sort] - To sort based on
|
|
1571
|
-
* @
|
|
1572
|
-
* @
|
|
1573
|
-
* @description: Get communication logs
|
|
2328
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2329
|
+
* @summary: Get system sms templates
|
|
2330
|
+
* @description: Get system sms templates
|
|
1574
2331
|
*/
|
|
1575
|
-
|
|
2332
|
+
getSystemSystemTemplatesPaginator({
|
|
1576
2333
|
companyId,
|
|
1577
2334
|
applicationId,
|
|
1578
2335
|
pageSize,
|
|
1579
2336
|
sort,
|
|
1580
|
-
query,
|
|
1581
2337
|
} = {}) {
|
|
1582
2338
|
const paginator = new Paginator();
|
|
1583
2339
|
const callback = async () => {
|
|
1584
2340
|
const pageId = paginator.nextId;
|
|
1585
2341
|
const pageNo = paginator.pageNo;
|
|
1586
|
-
const pageType = "
|
|
1587
|
-
const data = await this.
|
|
2342
|
+
const pageType = "number";
|
|
2343
|
+
const data = await this.getSystemSystemTemplates({
|
|
1588
2344
|
companyId: companyId,
|
|
1589
2345
|
applicationId: applicationId,
|
|
1590
|
-
|
|
2346
|
+
pageNo: pageNo,
|
|
1591
2347
|
pageSize: pageSize,
|
|
1592
2348
|
sort: sort,
|
|
1593
|
-
query: query,
|
|
1594
2349
|
});
|
|
1595
2350
|
paginator.setPaginator({
|
|
1596
2351
|
hasNext: data.page.has_next ? true : false,
|
|
@@ -1604,12 +2359,15 @@ class Communication {
|
|
|
1604
2359
|
|
|
1605
2360
|
/**
|
|
1606
2361
|
* @param {Object} arg - Arg object.
|
|
1607
|
-
* @param {
|
|
1608
|
-
* @
|
|
1609
|
-
* @
|
|
2362
|
+
* @param {EngineRequest} arg.body
|
|
2363
|
+
* @returns {Promise<EngineResponse>} - Success response
|
|
2364
|
+
* @summary: Send email or sms asynchronously
|
|
2365
|
+
* @description: Send email or sms asynchronously
|
|
1610
2366
|
*/
|
|
1611
|
-
|
|
1612
|
-
const {
|
|
2367
|
+
async sendCommunicationAsynchronously({ body } = {}) {
|
|
2368
|
+
const {
|
|
2369
|
+
error,
|
|
2370
|
+
} = CommunicationValidator.sendCommunicationAsynchronously().validate(
|
|
1613
2371
|
{
|
|
1614
2372
|
body,
|
|
1615
2373
|
},
|
|
@@ -1620,36 +2378,63 @@ class Communication {
|
|
|
1620
2378
|
}
|
|
1621
2379
|
|
|
1622
2380
|
// Showing warrnings if extra unknown parameters are found
|
|
1623
|
-
const {
|
|
2381
|
+
const {
|
|
2382
|
+
error: warrning,
|
|
2383
|
+
} = CommunicationValidator.sendCommunicationAsynchronously().validate(
|
|
1624
2384
|
{
|
|
1625
2385
|
body,
|
|
1626
2386
|
},
|
|
1627
2387
|
{ abortEarly: false, allowUnknown: false }
|
|
1628
2388
|
);
|
|
1629
2389
|
if (warrning) {
|
|
1630
|
-
|
|
1631
|
-
|
|
2390
|
+
Logger({
|
|
2391
|
+
level: "WARN",
|
|
2392
|
+
message:
|
|
2393
|
+
"Parameter Validation warrnings for sendCommunicationAsynchronously",
|
|
2394
|
+
});
|
|
2395
|
+
Logger({ level: "WARN", message: warrning });
|
|
1632
2396
|
}
|
|
1633
2397
|
|
|
1634
2398
|
const query_params = {};
|
|
1635
2399
|
|
|
1636
|
-
|
|
2400
|
+
const response = await PlatformAPIClient.execute(
|
|
1637
2401
|
this.config,
|
|
1638
2402
|
"post",
|
|
1639
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2403
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/engine/send-async`,
|
|
1640
2404
|
query_params,
|
|
1641
2405
|
body
|
|
1642
2406
|
);
|
|
2407
|
+
|
|
2408
|
+
const {
|
|
2409
|
+
error: res_error,
|
|
2410
|
+
} = CommunicationModel.EngineResponse().validate(response, {
|
|
2411
|
+
abortEarly: false,
|
|
2412
|
+
allowUnknown: false,
|
|
2413
|
+
});
|
|
2414
|
+
|
|
2415
|
+
if (res_error) {
|
|
2416
|
+
Logger({
|
|
2417
|
+
level: "WARN",
|
|
2418
|
+
message:
|
|
2419
|
+
"Response Validation Warnnings for sendCommunicationAsynchronously",
|
|
2420
|
+
});
|
|
2421
|
+
Logger({ level: "WARN", message: res_error });
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
return response;
|
|
1643
2425
|
}
|
|
1644
2426
|
|
|
1645
2427
|
/**
|
|
1646
2428
|
* @param {Object} arg - Arg object.
|
|
1647
|
-
* @param {
|
|
1648
|
-
* @
|
|
1649
|
-
* @
|
|
2429
|
+
* @param {EngineRequest} arg.body
|
|
2430
|
+
* @returns {Promise<EngineResponse>} - Success response
|
|
2431
|
+
* @summary: Send email or sms synchronously
|
|
2432
|
+
* @description: Send email or sms synchronously
|
|
1650
2433
|
*/
|
|
1651
|
-
|
|
1652
|
-
const {
|
|
2434
|
+
async sendCommunicationSynchronously({ body } = {}) {
|
|
2435
|
+
const {
|
|
2436
|
+
error,
|
|
2437
|
+
} = CommunicationValidator.sendCommunicationSynchronously().validate(
|
|
1653
2438
|
{
|
|
1654
2439
|
body,
|
|
1655
2440
|
},
|
|
@@ -1660,119 +2445,61 @@ class Communication {
|
|
|
1660
2445
|
}
|
|
1661
2446
|
|
|
1662
2447
|
// Showing warrnings if extra unknown parameters are found
|
|
1663
|
-
const {
|
|
2448
|
+
const {
|
|
2449
|
+
error: warrning,
|
|
2450
|
+
} = CommunicationValidator.sendCommunicationSynchronously().validate(
|
|
1664
2451
|
{
|
|
1665
2452
|
body,
|
|
1666
2453
|
},
|
|
1667
2454
|
{ abortEarly: false, allowUnknown: false }
|
|
1668
2455
|
);
|
|
1669
2456
|
if (warrning) {
|
|
1670
|
-
|
|
1671
|
-
|
|
2457
|
+
Logger({
|
|
2458
|
+
level: "WARN",
|
|
2459
|
+
message:
|
|
2460
|
+
"Parameter Validation warrnings for sendCommunicationSynchronously",
|
|
2461
|
+
});
|
|
2462
|
+
Logger({ level: "WARN", message: warrning });
|
|
1672
2463
|
}
|
|
1673
2464
|
|
|
1674
2465
|
const query_params = {};
|
|
1675
2466
|
|
|
1676
|
-
|
|
2467
|
+
const response = await PlatformAPIClient.execute(
|
|
1677
2468
|
this.config,
|
|
1678
2469
|
"post",
|
|
1679
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2470
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/engine/send-instant`,
|
|
1680
2471
|
query_params,
|
|
1681
2472
|
body
|
|
1682
2473
|
);
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
/**
|
|
1686
|
-
* @param {Object} arg - Arg object.
|
|
1687
|
-
* @param {number} [arg.pageNo] - Current page no
|
|
1688
|
-
* @param {number} [arg.pageSize] - Current request items count
|
|
1689
|
-
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1690
|
-
* @summary: Get sms providers
|
|
1691
|
-
* @description: Get sms providers
|
|
1692
|
-
*/
|
|
1693
|
-
getSmsProviders({ pageNo, pageSize, sort } = {}) {
|
|
1694
|
-
const { error } = CommunicationValidator.getSmsProviders().validate(
|
|
1695
|
-
{
|
|
1696
|
-
pageNo,
|
|
1697
|
-
pageSize,
|
|
1698
|
-
sort,
|
|
1699
|
-
},
|
|
1700
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1701
|
-
);
|
|
1702
|
-
if (error) {
|
|
1703
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1704
|
-
}
|
|
1705
2474
|
|
|
1706
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1707
2475
|
const {
|
|
1708
|
-
error:
|
|
1709
|
-
} =
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
{
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
2476
|
+
error: res_error,
|
|
2477
|
+
} = CommunicationModel.EngineResponse().validate(response, {
|
|
2478
|
+
abortEarly: false,
|
|
2479
|
+
allowUnknown: false,
|
|
2480
|
+
});
|
|
2481
|
+
|
|
2482
|
+
if (res_error) {
|
|
2483
|
+
Logger({
|
|
2484
|
+
level: "WARN",
|
|
2485
|
+
message:
|
|
2486
|
+
"Response Validation Warnnings for sendCommunicationSynchronously",
|
|
2487
|
+
});
|
|
2488
|
+
Logger({ level: "WARN", message: res_error });
|
|
1720
2489
|
}
|
|
1721
2490
|
|
|
1722
|
-
|
|
1723
|
-
query_params["page_no"] = pageNo;
|
|
1724
|
-
query_params["page_size"] = pageSize;
|
|
1725
|
-
query_params["sort"] = sort;
|
|
1726
|
-
|
|
1727
|
-
return PlatformAPIClient.execute(
|
|
1728
|
-
this.config,
|
|
1729
|
-
"get",
|
|
1730
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers`,
|
|
1731
|
-
query_params,
|
|
1732
|
-
undefined
|
|
1733
|
-
);
|
|
1734
|
-
}
|
|
1735
|
-
|
|
1736
|
-
/**
|
|
1737
|
-
* @param {Object} arg - Arg object.
|
|
1738
|
-
* @param {string} arg.companyId - Company id
|
|
1739
|
-
* @param {string} arg.applicationId - Application id
|
|
1740
|
-
* @param {number} [arg.pageSize] - Current request items count
|
|
1741
|
-
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1742
|
-
* @summary: Get sms providers
|
|
1743
|
-
* @description: Get sms providers
|
|
1744
|
-
*/
|
|
1745
|
-
getSmsProvidersPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
1746
|
-
const paginator = new Paginator();
|
|
1747
|
-
const callback = async () => {
|
|
1748
|
-
const pageId = paginator.nextId;
|
|
1749
|
-
const pageNo = paginator.pageNo;
|
|
1750
|
-
const pageType = "number";
|
|
1751
|
-
const data = await this.getSmsProviders({
|
|
1752
|
-
companyId: companyId,
|
|
1753
|
-
applicationId: applicationId,
|
|
1754
|
-
pageNo: pageNo,
|
|
1755
|
-
pageSize: pageSize,
|
|
1756
|
-
sort: sort,
|
|
1757
|
-
});
|
|
1758
|
-
paginator.setPaginator({
|
|
1759
|
-
hasNext: data.page.has_next ? true : false,
|
|
1760
|
-
nextId: data.page.next_id,
|
|
1761
|
-
});
|
|
1762
|
-
return data;
|
|
1763
|
-
};
|
|
1764
|
-
paginator.setCallback(callback.bind(this));
|
|
1765
|
-
return paginator;
|
|
2491
|
+
return response;
|
|
1766
2492
|
}
|
|
1767
2493
|
|
|
1768
2494
|
/**
|
|
1769
2495
|
* @param {Object} arg - Arg object.
|
|
1770
|
-
* @param {
|
|
1771
|
-
* @
|
|
1772
|
-
* @
|
|
2496
|
+
* @param {SendOtpCommsReq} arg.body
|
|
2497
|
+
* @returns {Promise<SendOtpCommsRes>} - Success response
|
|
2498
|
+
* @summary: Send OTP using email and sms
|
|
2499
|
+
* @description: Send OTP Comms via email and sms
|
|
1773
2500
|
*/
|
|
1774
|
-
|
|
1775
|
-
const { error } = CommunicationValidator.
|
|
2501
|
+
async sendOtp({ body } = {}) {
|
|
2502
|
+
const { error } = CommunicationValidator.sendOtp().validate(
|
|
1776
2503
|
{
|
|
1777
2504
|
body,
|
|
1778
2505
|
},
|
|
@@ -1783,40 +2510,59 @@ class Communication {
|
|
|
1783
2510
|
}
|
|
1784
2511
|
|
|
1785
2512
|
// Showing warrnings if extra unknown parameters are found
|
|
1786
|
-
const {
|
|
1787
|
-
error: warrning,
|
|
1788
|
-
} = CommunicationValidator.createSmsProvider().validate(
|
|
2513
|
+
const { error: warrning } = CommunicationValidator.sendOtp().validate(
|
|
1789
2514
|
{
|
|
1790
2515
|
body,
|
|
1791
2516
|
},
|
|
1792
2517
|
{ abortEarly: false, allowUnknown: false }
|
|
1793
2518
|
);
|
|
1794
2519
|
if (warrning) {
|
|
1795
|
-
|
|
1796
|
-
|
|
2520
|
+
Logger({
|
|
2521
|
+
level: "WARN",
|
|
2522
|
+
message: "Parameter Validation warrnings for sendOtp",
|
|
2523
|
+
});
|
|
2524
|
+
Logger({ level: "WARN", message: warrning });
|
|
1797
2525
|
}
|
|
1798
2526
|
|
|
1799
2527
|
const query_params = {};
|
|
1800
2528
|
|
|
1801
|
-
|
|
2529
|
+
const response = await PlatformAPIClient.execute(
|
|
1802
2530
|
this.config,
|
|
1803
2531
|
"post",
|
|
1804
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2532
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/otp/send-otp-comms`,
|
|
1805
2533
|
query_params,
|
|
1806
2534
|
body
|
|
1807
2535
|
);
|
|
2536
|
+
|
|
2537
|
+
const {
|
|
2538
|
+
error: res_error,
|
|
2539
|
+
} = CommunicationModel.SendOtpCommsRes().validate(response, {
|
|
2540
|
+
abortEarly: false,
|
|
2541
|
+
allowUnknown: false,
|
|
2542
|
+
});
|
|
2543
|
+
|
|
2544
|
+
if (res_error) {
|
|
2545
|
+
Logger({
|
|
2546
|
+
level: "WARN",
|
|
2547
|
+
message: "Response Validation Warnnings for sendOtp",
|
|
2548
|
+
});
|
|
2549
|
+
Logger({ level: "WARN", message: res_error });
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
return response;
|
|
1808
2553
|
}
|
|
1809
2554
|
|
|
1810
2555
|
/**
|
|
1811
2556
|
* @param {Object} arg - Arg object.
|
|
1812
|
-
* @param {
|
|
1813
|
-
* @
|
|
1814
|
-
* @
|
|
2557
|
+
* @param {TriggerJobRequest} arg.body
|
|
2558
|
+
* @returns {Promise<TriggerJobResponse>} - Success response
|
|
2559
|
+
* @summary: Trigger campaign job
|
|
2560
|
+
* @description: Trigger campaign job
|
|
1815
2561
|
*/
|
|
1816
|
-
|
|
1817
|
-
const { error } = CommunicationValidator.
|
|
2562
|
+
async triggerCampaignJob({ body } = {}) {
|
|
2563
|
+
const { error } = CommunicationValidator.triggerCampaignJob().validate(
|
|
1818
2564
|
{
|
|
1819
|
-
|
|
2565
|
+
body,
|
|
1820
2566
|
},
|
|
1821
2567
|
{ abortEarly: false, allowUnknown: true }
|
|
1822
2568
|
);
|
|
@@ -1827,37 +2573,58 @@ class Communication {
|
|
|
1827
2573
|
// Showing warrnings if extra unknown parameters are found
|
|
1828
2574
|
const {
|
|
1829
2575
|
error: warrning,
|
|
1830
|
-
} = CommunicationValidator.
|
|
2576
|
+
} = CommunicationValidator.triggerCampaignJob().validate(
|
|
1831
2577
|
{
|
|
1832
|
-
|
|
2578
|
+
body,
|
|
1833
2579
|
},
|
|
1834
2580
|
{ abortEarly: false, allowUnknown: false }
|
|
1835
2581
|
);
|
|
1836
2582
|
if (warrning) {
|
|
1837
|
-
|
|
1838
|
-
|
|
2583
|
+
Logger({
|
|
2584
|
+
level: "WARN",
|
|
2585
|
+
message: "Parameter Validation warrnings for triggerCampaignJob",
|
|
2586
|
+
});
|
|
2587
|
+
Logger({ level: "WARN", message: warrning });
|
|
1839
2588
|
}
|
|
1840
2589
|
|
|
1841
2590
|
const query_params = {};
|
|
1842
2591
|
|
|
1843
|
-
|
|
2592
|
+
const response = await PlatformAPIClient.execute(
|
|
1844
2593
|
this.config,
|
|
1845
|
-
"
|
|
1846
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2594
|
+
"post",
|
|
2595
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/trigger-job`,
|
|
1847
2596
|
query_params,
|
|
1848
|
-
|
|
2597
|
+
body
|
|
1849
2598
|
);
|
|
2599
|
+
|
|
2600
|
+
const {
|
|
2601
|
+
error: res_error,
|
|
2602
|
+
} = CommunicationModel.TriggerJobResponse().validate(response, {
|
|
2603
|
+
abortEarly: false,
|
|
2604
|
+
allowUnknown: false,
|
|
2605
|
+
});
|
|
2606
|
+
|
|
2607
|
+
if (res_error) {
|
|
2608
|
+
Logger({
|
|
2609
|
+
level: "WARN",
|
|
2610
|
+
message: "Response Validation Warnnings for triggerCampaignJob",
|
|
2611
|
+
});
|
|
2612
|
+
Logger({ level: "WARN", message: res_error });
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
return response;
|
|
1850
2616
|
}
|
|
1851
2617
|
|
|
1852
2618
|
/**
|
|
1853
2619
|
* @param {Object} arg - Arg object.
|
|
1854
|
-
* @param {string} arg.id -
|
|
1855
|
-
* @param {
|
|
1856
|
-
* @
|
|
1857
|
-
* @
|
|
2620
|
+
* @param {string} arg.id - Audience id
|
|
2621
|
+
* @param {AudienceReq} arg.body
|
|
2622
|
+
* @returns {Promise<Audience>} - Success response
|
|
2623
|
+
* @summary: Update audience by id
|
|
2624
|
+
* @description: Update audience by id
|
|
1858
2625
|
*/
|
|
1859
|
-
|
|
1860
|
-
const { error } = CommunicationValidator.
|
|
2626
|
+
async updateAudienceById({ id, body } = {}) {
|
|
2627
|
+
const { error } = CommunicationValidator.updateAudienceById().validate(
|
|
1861
2628
|
{
|
|
1862
2629
|
id,
|
|
1863
2630
|
body,
|
|
@@ -1871,7 +2638,7 @@ class Communication {
|
|
|
1871
2638
|
// Showing warrnings if extra unknown parameters are found
|
|
1872
2639
|
const {
|
|
1873
2640
|
error: warrning,
|
|
1874
|
-
} = CommunicationValidator.
|
|
2641
|
+
} = CommunicationValidator.updateAudienceById().validate(
|
|
1875
2642
|
{
|
|
1876
2643
|
id,
|
|
1877
2644
|
body,
|
|
@@ -1879,35 +2646,54 @@ class Communication {
|
|
|
1879
2646
|
{ abortEarly: false, allowUnknown: false }
|
|
1880
2647
|
);
|
|
1881
2648
|
if (warrning) {
|
|
1882
|
-
|
|
1883
|
-
|
|
2649
|
+
Logger({
|
|
2650
|
+
level: "WARN",
|
|
2651
|
+
message: "Parameter Validation warrnings for updateAudienceById",
|
|
2652
|
+
});
|
|
2653
|
+
Logger({ level: "WARN", message: warrning });
|
|
1884
2654
|
}
|
|
1885
2655
|
|
|
1886
2656
|
const query_params = {};
|
|
1887
2657
|
|
|
1888
|
-
|
|
2658
|
+
const response = await PlatformAPIClient.execute(
|
|
1889
2659
|
this.config,
|
|
1890
2660
|
"put",
|
|
1891
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2661
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
|
|
1892
2662
|
query_params,
|
|
1893
2663
|
body
|
|
1894
2664
|
);
|
|
2665
|
+
|
|
2666
|
+
const {
|
|
2667
|
+
error: res_error,
|
|
2668
|
+
} = CommunicationModel.Audience().validate(response, {
|
|
2669
|
+
abortEarly: false,
|
|
2670
|
+
allowUnknown: false,
|
|
2671
|
+
});
|
|
2672
|
+
|
|
2673
|
+
if (res_error) {
|
|
2674
|
+
Logger({
|
|
2675
|
+
level: "WARN",
|
|
2676
|
+
message: "Response Validation Warnnings for updateAudienceById",
|
|
2677
|
+
});
|
|
2678
|
+
Logger({ level: "WARN", message: res_error });
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
return response;
|
|
1895
2682
|
}
|
|
1896
2683
|
|
|
1897
2684
|
/**
|
|
1898
2685
|
* @param {Object} arg - Arg object.
|
|
1899
|
-
* @param {
|
|
1900
|
-
* @param {
|
|
1901
|
-
* @
|
|
1902
|
-
* @summary:
|
|
1903
|
-
* @description:
|
|
2686
|
+
* @param {string} arg.id - Campaign id
|
|
2687
|
+
* @param {CampaignReq} arg.body
|
|
2688
|
+
* @returns {Promise<Campaign>} - Success response
|
|
2689
|
+
* @summary: Update campaign by id
|
|
2690
|
+
* @description: Update campaign by id
|
|
1904
2691
|
*/
|
|
1905
|
-
|
|
1906
|
-
const { error } = CommunicationValidator.
|
|
2692
|
+
async updateCampaignById({ id, body } = {}) {
|
|
2693
|
+
const { error } = CommunicationValidator.updateCampaignById().validate(
|
|
1907
2694
|
{
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
sort,
|
|
2695
|
+
id,
|
|
2696
|
+
body,
|
|
1911
2697
|
},
|
|
1912
2698
|
{ abortEarly: false, allowUnknown: true }
|
|
1913
2699
|
);
|
|
@@ -1918,74 +2704,61 @@ class Communication {
|
|
|
1918
2704
|
// Showing warrnings if extra unknown parameters are found
|
|
1919
2705
|
const {
|
|
1920
2706
|
error: warrning,
|
|
1921
|
-
} = CommunicationValidator.
|
|
2707
|
+
} = CommunicationValidator.updateCampaignById().validate(
|
|
1922
2708
|
{
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
sort,
|
|
2709
|
+
id,
|
|
2710
|
+
body,
|
|
1926
2711
|
},
|
|
1927
2712
|
{ abortEarly: false, allowUnknown: false }
|
|
1928
2713
|
);
|
|
1929
2714
|
if (warrning) {
|
|
1930
|
-
|
|
1931
|
-
|
|
2715
|
+
Logger({
|
|
2716
|
+
level: "WARN",
|
|
2717
|
+
message: "Parameter Validation warrnings for updateCampaignById",
|
|
2718
|
+
});
|
|
2719
|
+
Logger({ level: "WARN", message: warrning });
|
|
1932
2720
|
}
|
|
1933
2721
|
|
|
1934
2722
|
const query_params = {};
|
|
1935
|
-
query_params["page_no"] = pageNo;
|
|
1936
|
-
query_params["page_size"] = pageSize;
|
|
1937
|
-
query_params["sort"] = sort;
|
|
1938
2723
|
|
|
1939
|
-
|
|
2724
|
+
const response = await PlatformAPIClient.execute(
|
|
1940
2725
|
this.config,
|
|
1941
|
-
"
|
|
1942
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2726
|
+
"put",
|
|
2727
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns/${id}`,
|
|
1943
2728
|
query_params,
|
|
1944
|
-
|
|
2729
|
+
body
|
|
1945
2730
|
);
|
|
1946
|
-
}
|
|
1947
2731
|
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
const callback = async () => {
|
|
1960
|
-
const pageId = paginator.nextId;
|
|
1961
|
-
const pageNo = paginator.pageNo;
|
|
1962
|
-
const pageType = "number";
|
|
1963
|
-
const data = await this.getSmsTemplates({
|
|
1964
|
-
companyId: companyId,
|
|
1965
|
-
applicationId: applicationId,
|
|
1966
|
-
pageNo: pageNo,
|
|
1967
|
-
pageSize: pageSize,
|
|
1968
|
-
sort: sort,
|
|
1969
|
-
});
|
|
1970
|
-
paginator.setPaginator({
|
|
1971
|
-
hasNext: data.page.has_next ? true : false,
|
|
1972
|
-
nextId: data.page.next_id,
|
|
2732
|
+
const {
|
|
2733
|
+
error: res_error,
|
|
2734
|
+
} = CommunicationModel.Campaign().validate(response, {
|
|
2735
|
+
abortEarly: false,
|
|
2736
|
+
allowUnknown: false,
|
|
2737
|
+
});
|
|
2738
|
+
|
|
2739
|
+
if (res_error) {
|
|
2740
|
+
Logger({
|
|
2741
|
+
level: "WARN",
|
|
2742
|
+
message: "Response Validation Warnnings for updateCampaignById",
|
|
1973
2743
|
});
|
|
1974
|
-
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
|
-
return
|
|
2744
|
+
Logger({ level: "WARN", message: res_error });
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
return response;
|
|
1978
2748
|
}
|
|
1979
2749
|
|
|
1980
2750
|
/**
|
|
1981
2751
|
* @param {Object} arg - Arg object.
|
|
1982
|
-
* @param {
|
|
1983
|
-
* @
|
|
1984
|
-
* @
|
|
2752
|
+
* @param {string} arg.id - Email provider id
|
|
2753
|
+
* @param {EmailProviderReq} arg.body
|
|
2754
|
+
* @returns {Promise<EmailProvider>} - Success response
|
|
2755
|
+
* @summary: Update email provider by id
|
|
2756
|
+
* @description: Update email provider by id
|
|
1985
2757
|
*/
|
|
1986
|
-
|
|
1987
|
-
const { error } = CommunicationValidator.
|
|
2758
|
+
async updateEmailProviderById({ id, body } = {}) {
|
|
2759
|
+
const { error } = CommunicationValidator.updateEmailProviderById().validate(
|
|
1988
2760
|
{
|
|
2761
|
+
id,
|
|
1989
2762
|
body,
|
|
1990
2763
|
},
|
|
1991
2764
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1997,38 +2770,62 @@ class Communication {
|
|
|
1997
2770
|
// Showing warrnings if extra unknown parameters are found
|
|
1998
2771
|
const {
|
|
1999
2772
|
error: warrning,
|
|
2000
|
-
} = CommunicationValidator.
|
|
2773
|
+
} = CommunicationValidator.updateEmailProviderById().validate(
|
|
2001
2774
|
{
|
|
2775
|
+
id,
|
|
2002
2776
|
body,
|
|
2003
2777
|
},
|
|
2004
2778
|
{ abortEarly: false, allowUnknown: false }
|
|
2005
2779
|
);
|
|
2006
2780
|
if (warrning) {
|
|
2007
|
-
|
|
2008
|
-
|
|
2781
|
+
Logger({
|
|
2782
|
+
level: "WARN",
|
|
2783
|
+
message: "Parameter Validation warrnings for updateEmailProviderById",
|
|
2784
|
+
});
|
|
2785
|
+
Logger({ level: "WARN", message: warrning });
|
|
2009
2786
|
}
|
|
2010
2787
|
|
|
2011
2788
|
const query_params = {};
|
|
2012
2789
|
|
|
2013
|
-
|
|
2790
|
+
const response = await PlatformAPIClient.execute(
|
|
2014
2791
|
this.config,
|
|
2015
|
-
"
|
|
2016
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2792
|
+
"put",
|
|
2793
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
|
|
2017
2794
|
query_params,
|
|
2018
2795
|
body
|
|
2019
2796
|
);
|
|
2797
|
+
|
|
2798
|
+
const {
|
|
2799
|
+
error: res_error,
|
|
2800
|
+
} = CommunicationModel.EmailProvider().validate(response, {
|
|
2801
|
+
abortEarly: false,
|
|
2802
|
+
allowUnknown: false,
|
|
2803
|
+
});
|
|
2804
|
+
|
|
2805
|
+
if (res_error) {
|
|
2806
|
+
Logger({
|
|
2807
|
+
level: "WARN",
|
|
2808
|
+
message: "Response Validation Warnnings for updateEmailProviderById",
|
|
2809
|
+
});
|
|
2810
|
+
Logger({ level: "WARN", message: res_error });
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
return response;
|
|
2020
2814
|
}
|
|
2021
2815
|
|
|
2022
2816
|
/**
|
|
2023
2817
|
* @param {Object} arg - Arg object.
|
|
2024
|
-
* @param {string} arg.id -
|
|
2025
|
-
* @
|
|
2026
|
-
* @
|
|
2818
|
+
* @param {string} arg.id - Email template id
|
|
2819
|
+
* @param {EmailTemplateReq} arg.body
|
|
2820
|
+
* @returns {Promise<EmailTemplateRes>} - Success response
|
|
2821
|
+
* @summary: Update email template by id
|
|
2822
|
+
* @description: Update email template by id
|
|
2027
2823
|
*/
|
|
2028
|
-
|
|
2029
|
-
const { error } = CommunicationValidator.
|
|
2824
|
+
async updateEmailTemplateById({ id, body } = {}) {
|
|
2825
|
+
const { error } = CommunicationValidator.updateEmailTemplateById().validate(
|
|
2030
2826
|
{
|
|
2031
2827
|
id,
|
|
2828
|
+
body,
|
|
2032
2829
|
},
|
|
2033
2830
|
{ abortEarly: false, allowUnknown: true }
|
|
2034
2831
|
);
|
|
@@ -2039,37 +2836,59 @@ class Communication {
|
|
|
2039
2836
|
// Showing warrnings if extra unknown parameters are found
|
|
2040
2837
|
const {
|
|
2041
2838
|
error: warrning,
|
|
2042
|
-
} = CommunicationValidator.
|
|
2839
|
+
} = CommunicationValidator.updateEmailTemplateById().validate(
|
|
2043
2840
|
{
|
|
2044
2841
|
id,
|
|
2842
|
+
body,
|
|
2045
2843
|
},
|
|
2046
2844
|
{ abortEarly: false, allowUnknown: false }
|
|
2047
2845
|
);
|
|
2048
2846
|
if (warrning) {
|
|
2049
|
-
|
|
2050
|
-
|
|
2847
|
+
Logger({
|
|
2848
|
+
level: "WARN",
|
|
2849
|
+
message: "Parameter Validation warrnings for updateEmailTemplateById",
|
|
2850
|
+
});
|
|
2851
|
+
Logger({ level: "WARN", message: warrning });
|
|
2051
2852
|
}
|
|
2052
2853
|
|
|
2053
2854
|
const query_params = {};
|
|
2054
2855
|
|
|
2055
|
-
|
|
2856
|
+
const response = await PlatformAPIClient.execute(
|
|
2056
2857
|
this.config,
|
|
2057
|
-
"
|
|
2058
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
2858
|
+
"put",
|
|
2859
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
2059
2860
|
query_params,
|
|
2060
|
-
|
|
2861
|
+
body
|
|
2061
2862
|
);
|
|
2863
|
+
|
|
2864
|
+
const {
|
|
2865
|
+
error: res_error,
|
|
2866
|
+
} = CommunicationModel.EmailTemplateRes().validate(response, {
|
|
2867
|
+
abortEarly: false,
|
|
2868
|
+
allowUnknown: false,
|
|
2869
|
+
});
|
|
2870
|
+
|
|
2871
|
+
if (res_error) {
|
|
2872
|
+
Logger({
|
|
2873
|
+
level: "WARN",
|
|
2874
|
+
message: "Response Validation Warnnings for updateEmailTemplateById",
|
|
2875
|
+
});
|
|
2876
|
+
Logger({ level: "WARN", message: res_error });
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
return response;
|
|
2062
2880
|
}
|
|
2063
2881
|
|
|
2064
2882
|
/**
|
|
2065
2883
|
* @param {Object} arg - Arg object.
|
|
2066
|
-
* @param {string} arg.id - Sms
|
|
2067
|
-
* @param {
|
|
2068
|
-
* @
|
|
2069
|
-
* @
|
|
2884
|
+
* @param {string} arg.id - Sms provider id
|
|
2885
|
+
* @param {SmsProviderReq} arg.body
|
|
2886
|
+
* @returns {Promise<SmsProvider>} - Success response
|
|
2887
|
+
* @summary: Update sms provider by id
|
|
2888
|
+
* @description: Update sms provider by id
|
|
2070
2889
|
*/
|
|
2071
|
-
|
|
2072
|
-
const { error } = CommunicationValidator.
|
|
2890
|
+
async updateSmsProviderById({ id, body } = {}) {
|
|
2891
|
+
const { error } = CommunicationValidator.updateSmsProviderById().validate(
|
|
2073
2892
|
{
|
|
2074
2893
|
id,
|
|
2075
2894
|
body,
|
|
@@ -2083,7 +2902,7 @@ class Communication {
|
|
|
2083
2902
|
// Showing warrnings if extra unknown parameters are found
|
|
2084
2903
|
const {
|
|
2085
2904
|
error: warrning,
|
|
2086
|
-
} = CommunicationValidator.
|
|
2905
|
+
} = CommunicationValidator.updateSmsProviderById().validate(
|
|
2087
2906
|
{
|
|
2088
2907
|
id,
|
|
2089
2908
|
body,
|
|
@@ -2091,31 +2910,54 @@ class Communication {
|
|
|
2091
2910
|
{ abortEarly: false, allowUnknown: false }
|
|
2092
2911
|
);
|
|
2093
2912
|
if (warrning) {
|
|
2094
|
-
|
|
2095
|
-
|
|
2913
|
+
Logger({
|
|
2914
|
+
level: "WARN",
|
|
2915
|
+
message: "Parameter Validation warrnings for updateSmsProviderById",
|
|
2916
|
+
});
|
|
2917
|
+
Logger({ level: "WARN", message: warrning });
|
|
2096
2918
|
}
|
|
2097
2919
|
|
|
2098
2920
|
const query_params = {};
|
|
2099
2921
|
|
|
2100
|
-
|
|
2922
|
+
const response = await PlatformAPIClient.execute(
|
|
2101
2923
|
this.config,
|
|
2102
2924
|
"put",
|
|
2103
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/
|
|
2925
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers/${id}`,
|
|
2104
2926
|
query_params,
|
|
2105
2927
|
body
|
|
2106
2928
|
);
|
|
2929
|
+
|
|
2930
|
+
const {
|
|
2931
|
+
error: res_error,
|
|
2932
|
+
} = CommunicationModel.SmsProvider().validate(response, {
|
|
2933
|
+
abortEarly: false,
|
|
2934
|
+
allowUnknown: false,
|
|
2935
|
+
});
|
|
2936
|
+
|
|
2937
|
+
if (res_error) {
|
|
2938
|
+
Logger({
|
|
2939
|
+
level: "WARN",
|
|
2940
|
+
message: "Response Validation Warnnings for updateSmsProviderById",
|
|
2941
|
+
});
|
|
2942
|
+
Logger({ level: "WARN", message: res_error });
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
return response;
|
|
2107
2946
|
}
|
|
2108
2947
|
|
|
2109
2948
|
/**
|
|
2110
2949
|
* @param {Object} arg - Arg object.
|
|
2111
2950
|
* @param {string} arg.id - Sms template id
|
|
2112
|
-
* @
|
|
2113
|
-
* @
|
|
2951
|
+
* @param {SmsTemplateReq} arg.body
|
|
2952
|
+
* @returns {Promise<SmsTemplateRes>} - Success response
|
|
2953
|
+
* @summary: Update sms template by id
|
|
2954
|
+
* @description: Update sms template by id
|
|
2114
2955
|
*/
|
|
2115
|
-
|
|
2116
|
-
const { error } = CommunicationValidator.
|
|
2956
|
+
async updateSmsTemplateById({ id, body } = {}) {
|
|
2957
|
+
const { error } = CommunicationValidator.updateSmsTemplateById().validate(
|
|
2117
2958
|
{
|
|
2118
2959
|
id,
|
|
2960
|
+
body,
|
|
2119
2961
|
},
|
|
2120
2962
|
{ abortEarly: false, allowUnknown: true }
|
|
2121
2963
|
);
|
|
@@ -2126,44 +2968,60 @@ class Communication {
|
|
|
2126
2968
|
// Showing warrnings if extra unknown parameters are found
|
|
2127
2969
|
const {
|
|
2128
2970
|
error: warrning,
|
|
2129
|
-
} = CommunicationValidator.
|
|
2971
|
+
} = CommunicationValidator.updateSmsTemplateById().validate(
|
|
2130
2972
|
{
|
|
2131
2973
|
id,
|
|
2974
|
+
body,
|
|
2132
2975
|
},
|
|
2133
2976
|
{ abortEarly: false, allowUnknown: false }
|
|
2134
2977
|
);
|
|
2135
2978
|
if (warrning) {
|
|
2136
|
-
|
|
2137
|
-
|
|
2979
|
+
Logger({
|
|
2980
|
+
level: "WARN",
|
|
2981
|
+
message: "Parameter Validation warrnings for updateSmsTemplateById",
|
|
2982
|
+
});
|
|
2983
|
+
Logger({ level: "WARN", message: warrning });
|
|
2138
2984
|
}
|
|
2139
2985
|
|
|
2140
2986
|
const query_params = {};
|
|
2141
2987
|
|
|
2142
|
-
|
|
2988
|
+
const response = await PlatformAPIClient.execute(
|
|
2143
2989
|
this.config,
|
|
2144
|
-
"
|
|
2990
|
+
"put",
|
|
2145
2991
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
2146
2992
|
query_params,
|
|
2147
|
-
|
|
2993
|
+
body
|
|
2148
2994
|
);
|
|
2995
|
+
|
|
2996
|
+
const {
|
|
2997
|
+
error: res_error,
|
|
2998
|
+
} = CommunicationModel.SmsTemplateRes().validate(response, {
|
|
2999
|
+
abortEarly: false,
|
|
3000
|
+
allowUnknown: false,
|
|
3001
|
+
});
|
|
3002
|
+
|
|
3003
|
+
if (res_error) {
|
|
3004
|
+
Logger({
|
|
3005
|
+
level: "WARN",
|
|
3006
|
+
message: "Response Validation Warnnings for updateSmsTemplateById",
|
|
3007
|
+
});
|
|
3008
|
+
Logger({ level: "WARN", message: res_error });
|
|
3009
|
+
}
|
|
3010
|
+
|
|
3011
|
+
return response;
|
|
2149
3012
|
}
|
|
2150
3013
|
|
|
2151
3014
|
/**
|
|
2152
3015
|
* @param {Object} arg - Arg object.
|
|
2153
|
-
* @param {
|
|
2154
|
-
* @
|
|
2155
|
-
* @
|
|
2156
|
-
* @
|
|
2157
|
-
* @description: Get system sms templates
|
|
3016
|
+
* @param {VerifyOtpCommsReq} arg.body
|
|
3017
|
+
* @returns {Promise<VerifyOtpCommsSuccessRes>} - Success response
|
|
3018
|
+
* @summary: Verify OTP sent via email and sms
|
|
3019
|
+
* @description: Verify OTP sent via email and sms
|
|
2158
3020
|
*/
|
|
2159
|
-
|
|
2160
|
-
const {
|
|
2161
|
-
error,
|
|
2162
|
-
} = CommunicationValidator.getSystemSystemTemplates().validate(
|
|
3021
|
+
async verfiyOtp({ body } = {}) {
|
|
3022
|
+
const { error } = CommunicationValidator.verfiyOtp().validate(
|
|
2163
3023
|
{
|
|
2164
|
-
|
|
2165
|
-
pageSize,
|
|
2166
|
-
sort,
|
|
3024
|
+
body,
|
|
2167
3025
|
},
|
|
2168
3026
|
{ abortEarly: false, allowUnknown: true }
|
|
2169
3027
|
);
|
|
@@ -2172,72 +3030,46 @@ class Communication {
|
|
|
2172
3030
|
}
|
|
2173
3031
|
|
|
2174
3032
|
// Showing warrnings if extra unknown parameters are found
|
|
2175
|
-
const {
|
|
2176
|
-
error: warrning,
|
|
2177
|
-
} = CommunicationValidator.getSystemSystemTemplates().validate(
|
|
3033
|
+
const { error: warrning } = CommunicationValidator.verfiyOtp().validate(
|
|
2178
3034
|
{
|
|
2179
|
-
|
|
2180
|
-
pageSize,
|
|
2181
|
-
sort,
|
|
3035
|
+
body,
|
|
2182
3036
|
},
|
|
2183
3037
|
{ abortEarly: false, allowUnknown: false }
|
|
2184
3038
|
);
|
|
2185
3039
|
if (warrning) {
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
3040
|
+
Logger({
|
|
3041
|
+
level: "WARN",
|
|
3042
|
+
message: "Parameter Validation warrnings for verfiyOtp",
|
|
3043
|
+
});
|
|
3044
|
+
Logger({ level: "WARN", message: warrning });
|
|
2190
3045
|
}
|
|
2191
3046
|
|
|
2192
3047
|
const query_params = {};
|
|
2193
|
-
query_params["page_no"] = pageNo;
|
|
2194
|
-
query_params["page_size"] = pageSize;
|
|
2195
|
-
query_params["sort"] = sort;
|
|
2196
3048
|
|
|
2197
|
-
|
|
3049
|
+
const response = await PlatformAPIClient.execute(
|
|
2198
3050
|
this.config,
|
|
2199
|
-
"
|
|
2200
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
3051
|
+
"post",
|
|
3052
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/otp/verify-otp-comms`,
|
|
2201
3053
|
query_params,
|
|
2202
|
-
|
|
3054
|
+
body
|
|
2203
3055
|
);
|
|
2204
|
-
}
|
|
2205
3056
|
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
applicationId,
|
|
2218
|
-
pageSize,
|
|
2219
|
-
sort,
|
|
2220
|
-
} = {}) {
|
|
2221
|
-
const paginator = new Paginator();
|
|
2222
|
-
const callback = async () => {
|
|
2223
|
-
const pageId = paginator.nextId;
|
|
2224
|
-
const pageNo = paginator.pageNo;
|
|
2225
|
-
const pageType = "number";
|
|
2226
|
-
const data = await this.getSystemSystemTemplates({
|
|
2227
|
-
companyId: companyId,
|
|
2228
|
-
applicationId: applicationId,
|
|
2229
|
-
pageNo: pageNo,
|
|
2230
|
-
pageSize: pageSize,
|
|
2231
|
-
sort: sort,
|
|
2232
|
-
});
|
|
2233
|
-
paginator.setPaginator({
|
|
2234
|
-
hasNext: data.page.has_next ? true : false,
|
|
2235
|
-
nextId: data.page.next_id,
|
|
3057
|
+
const {
|
|
3058
|
+
error: res_error,
|
|
3059
|
+
} = CommunicationModel.VerifyOtpCommsSuccessRes().validate(response, {
|
|
3060
|
+
abortEarly: false,
|
|
3061
|
+
allowUnknown: false,
|
|
3062
|
+
});
|
|
3063
|
+
|
|
3064
|
+
if (res_error) {
|
|
3065
|
+
Logger({
|
|
3066
|
+
level: "WARN",
|
|
3067
|
+
message: "Response Validation Warnnings for verfiyOtp",
|
|
2236
3068
|
});
|
|
2237
|
-
|
|
2238
|
-
}
|
|
2239
|
-
|
|
2240
|
-
return
|
|
3069
|
+
Logger({ level: "WARN", message: res_error });
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
return response;
|
|
2241
3073
|
}
|
|
2242
3074
|
}
|
|
2243
3075
|
module.exports = Communication;
|