@gofynd/fdk-client-javascript 1.0.2 → 1.0.3

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