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