@gofynd/fdk-client-javascript 0.1.37 → 1.0.1

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 (353) hide show
  1. package/README.md +24 -0
  2. package/application.d.ts +2 -1
  3. package/application.js +2 -1
  4. package/documentation/application/CART.md +315 -289
  5. package/documentation/application/CATALOG.md +438 -415
  6. package/documentation/application/FILESTORAGE.md +2 -0
  7. package/documentation/application/LEAD.md +18 -18
  8. package/documentation/application/LOGISTIC.md +45 -45
  9. package/documentation/application/ORDER.md +277 -277
  10. package/documentation/application/PAYMENT.md +251 -251
  11. package/documentation/application/POSCART.md +318 -292
  12. package/documentation/application/REWARDS.md +1 -0
  13. package/documentation/application/USER.md +19 -14
  14. package/documentation/platform/CART.md +465 -462
  15. package/documentation/platform/CATALOG.md +2792 -2711
  16. package/documentation/platform/COMPANYPROFILE.md +200 -362
  17. package/documentation/platform/DISCOUNT.md +86 -0
  18. package/documentation/platform/FILESTORAGE.md +2 -0
  19. package/documentation/platform/LEAD.md +60 -60
  20. package/documentation/platform/ORDER.md +1451 -1654
  21. package/documentation/platform/PAYMENT.md +94 -94
  22. package/documentation/platform/REWARDS.md +145 -0
  23. package/documentation/platform/USER.md +24 -14
  24. package/index.d.ts +4 -1
  25. package/index.js +13 -4
  26. package/package.json +9 -9
  27. package/platform.d.ts +2 -1
  28. package/platform.js +3 -2
  29. package/public.d.ts +1 -0
  30. package/public.js +3 -2
  31. package/sdk/application/ApplicationAPIClient.js +3 -1
  32. package/sdk/application/ApplicationClient.d.ts +16 -16
  33. package/sdk/application/ApplicationClient.js +32 -16
  34. package/sdk/application/ApplicationConfig.js +3 -2
  35. package/sdk/application/ApplicationModels.d.ts +0 -832
  36. package/sdk/application/ApplicationModels.js +3 -10574
  37. package/sdk/application/{client → Cart}/CartApplicationClient.d.ts +9 -3
  38. package/sdk/application/{client → Cart}/CartApplicationClient.js +316 -8
  39. package/sdk/application/Cart/CartApplicationModel.d.ts +81 -0
  40. package/sdk/application/Cart/CartApplicationModel.js +1136 -0
  41. package/sdk/application/{models/CartValidator.js → Cart/CartApplicationValidator.js} +17 -12
  42. package/sdk/application/{client → Catalog}/CatalogApplicationClient.d.ts +8 -5
  43. package/sdk/application/{client → Catalog}/CatalogApplicationClient.js +389 -8
  44. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +117 -0
  45. package/sdk/application/Catalog/CatalogApplicationModel.js +1606 -0
  46. package/sdk/application/{models/CatalogValidator.js → Catalog/CatalogApplicationValidator.js} +4 -1
  47. package/sdk/application/{client → Common}/CommonApplicationClient.js +24 -2
  48. package/sdk/application/Common/CommonApplicationModel.d.ts +20 -0
  49. package/sdk/application/Common/CommonApplicationModel.js +228 -0
  50. package/sdk/{platform/models/CommonValidator.js → application/Common/CommonApplicationValidator.js} +3 -1
  51. package/sdk/application/{client → Communication}/CommunicationApplicationClient.js +43 -2
  52. package/sdk/application/Communication/CommunicationApplicationModel.d.ts +15 -0
  53. package/sdk/application/Communication/CommunicationApplicationModel.js +144 -0
  54. package/sdk/application/{models/CommunicationValidator.js → Communication/CommunicationApplicationValidator.js} +5 -3
  55. package/sdk/application/{client → Configuration}/ConfigurationApplicationClient.js +202 -2
  56. package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +111 -0
  57. package/sdk/application/Configuration/ConfigurationApplicationModel.js +1182 -0
  58. package/sdk/application/{models/ConfigurationValidator.js → Configuration/ConfigurationApplicationValidator.js} +4 -2
  59. package/sdk/application/{client → Content}/ContentApplicationClient.js +217 -2
  60. package/sdk/application/Content/ContentApplicationModel.d.ts +105 -0
  61. package/sdk/application/Content/ContentApplicationModel.js +1349 -0
  62. package/sdk/application/{models/ContentValidator.js → Content/ContentApplicationValidator.js} +3 -1
  63. package/sdk/application/{client → FileStorage}/FileStorageApplicationClient.js +35 -2
  64. package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +21 -0
  65. package/sdk/application/FileStorage/FileStorageApplicationModel.js +244 -0
  66. package/sdk/application/{models/FileStorageValidator.js → FileStorage/FileStorageApplicationValidator.js} +6 -4
  67. package/sdk/application/{client → Lead}/LeadApplicationClient.js +83 -2
  68. package/sdk/application/Lead/LeadApplicationModel.d.ts +55 -0
  69. package/sdk/application/Lead/LeadApplicationModel.js +690 -0
  70. package/sdk/application/{models/LeadValidator.js → Lead/LeadApplicationValidator.js} +6 -4
  71. package/sdk/application/{client → Logistic}/LogisticApplicationClient.js +46 -2
  72. package/sdk/application/Logistic/LogisticApplicationModel.d.ts +26 -0
  73. package/sdk/application/Logistic/LogisticApplicationModel.js +286 -0
  74. package/sdk/application/{models/LogisticValidator.js → Logistic/LogisticApplicationValidator.js} +5 -3
  75. package/sdk/application/{client → Order}/OrderApplicationClient.js +148 -2
  76. package/sdk/application/Order/OrderApplicationModel.d.ts +67 -0
  77. package/sdk/application/Order/OrderApplicationModel.js +872 -0
  78. package/sdk/application/{models/OrderValidator.js → Order/OrderApplicationValidator.js} +5 -3
  79. package/sdk/application/{client → Payment}/PaymentApplicationClient.js +530 -2
  80. package/sdk/application/Payment/PaymentApplicationModel.d.ts +96 -0
  81. package/sdk/application/Payment/PaymentApplicationModel.js +1318 -0
  82. package/sdk/application/{models/PaymentValidator.js → Payment/PaymentApplicationValidator.js} +25 -23
  83. package/sdk/application/{client → PosCart}/PosCartApplicationClient.d.ts +9 -3
  84. package/sdk/application/{client → PosCart}/PosCartApplicationClient.js +343 -8
  85. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +79 -0
  86. package/sdk/application/PosCart/PosCartApplicationModel.js +1132 -0
  87. package/sdk/application/{models/PosCartValidator.js → PosCart/PosCartApplicationValidator.js} +18 -13
  88. package/sdk/application/{client → Rewards}/RewardsApplicationClient.js +83 -2
  89. package/sdk/application/Rewards/RewardsApplicationModel.d.ts +23 -0
  90. package/sdk/application/Rewards/RewardsApplicationModel.js +276 -0
  91. package/sdk/application/{models/RewardsValidator.js → Rewards/RewardsApplicationValidator.js} +6 -4
  92. package/sdk/application/{client → Share}/ShareApplicationClient.js +89 -2
  93. package/sdk/application/Share/ShareApplicationModel.d.ts +16 -0
  94. package/sdk/application/Share/ShareApplicationModel.js +178 -0
  95. package/sdk/application/{models/ShareValidator.js → Share/ShareApplicationValidator.js} +4 -2
  96. package/sdk/application/{client → Theme}/ThemeApplicationClient.js +46 -2
  97. package/sdk/application/Theme/ThemeApplicationModel.d.ts +49 -0
  98. package/sdk/application/Theme/ThemeApplicationModel.js +486 -0
  99. package/sdk/application/{models/ThemeValidator.js → Theme/ThemeApplicationValidator.js} +3 -1
  100. package/sdk/application/{client → User}/UserApplicationClient.js +407 -2
  101. package/sdk/application/User/UserApplicationModel.d.ts +95 -0
  102. package/sdk/application/User/UserApplicationModel.js +998 -0
  103. package/sdk/application/{models/UserValidator.js → User/UserApplicationValidator.js} +31 -29
  104. package/sdk/application/index.d.ts +18 -0
  105. package/sdk/application/index.js +33 -0
  106. package/sdk/common/AxiosHelper.js +23 -10
  107. package/sdk/common/Logger.d.ts +2 -0
  108. package/sdk/common/Logger.js +6 -0
  109. package/sdk/common/curlHelper.d.ts +2 -0
  110. package/sdk/common/curlHelper.js +95 -0
  111. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +101 -0
  112. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +399 -0
  113. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +11 -0
  114. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +56 -0
  115. package/sdk/platform/{client → Analytics}/AnalyticsPlatformClient.js +60 -2
  116. package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +23 -0
  117. package/sdk/platform/Analytics/AnalyticsPlatformModel.js +252 -0
  118. package/sdk/platform/{models/AnalyticsValidator.js → Analytics/AnalyticsPlatformValidator.js} +5 -4
  119. package/sdk/platform/{client → AuditTrail}/AuditTrailPlatformClient.js +48 -2
  120. package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +18 -0
  121. package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +144 -0
  122. package/sdk/platform/{models/AuditTrailValidator.js → AuditTrail/AuditTrailPlatformValidator.js} +3 -2
  123. package/sdk/platform/{client → Billing}/BillingPlatformClient.js +162 -2
  124. package/sdk/platform/Billing/BillingPlatformModel.d.ts +65 -0
  125. package/sdk/platform/Billing/BillingPlatformModel.js +906 -0
  126. package/sdk/platform/{models/BillingValidator.js → Billing/BillingPlatformValidator.js} +6 -5
  127. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +293 -0
  128. package/sdk/platform/Cart/CartPlatformApplicationClient.js +1001 -0
  129. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +20 -0
  130. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +138 -0
  131. package/sdk/platform/Cart/CartPlatformModel.d.ts +104 -0
  132. package/sdk/platform/Cart/CartPlatformModel.js +1516 -0
  133. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +856 -0
  134. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2927 -0
  135. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +56 -0
  136. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +389 -0
  137. package/sdk/platform/{client → Catalog}/CatalogPlatformClient.js +1402 -349
  138. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +317 -0
  139. package/sdk/platform/Catalog/CatalogPlatformModel.js +4702 -0
  140. package/sdk/platform/{models/CatalogValidator.js → Catalog/CatalogPlatformValidator.js} +92 -91
  141. package/sdk/platform/{client → Common}/CommonPlatformClient.js +28 -2
  142. package/sdk/platform/Common/CommonPlatformModel.d.ts +20 -0
  143. package/sdk/platform/Common/CommonPlatformModel.js +228 -0
  144. package/sdk/{application/models/CommonValidator.js → platform/Common/CommonPlatformValidator.js} +2 -1
  145. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +611 -0
  146. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +2243 -0
  147. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +43 -0
  148. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +277 -0
  149. package/sdk/platform/{client → Communication}/CommunicationPlatformClient.js +17 -2
  150. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +102 -0
  151. package/sdk/platform/Communication/CommunicationPlatformModel.js +1312 -0
  152. package/sdk/platform/{models/CommunicationValidator.js → Communication/CommunicationPlatformValidator.js} +2 -1
  153. package/sdk/platform/{client → CompanyProfile}/CompanyProfilePlatformClient.d.ts +0 -9
  154. package/sdk/platform/{client → CompanyProfile}/CompanyProfilePlatformClient.js +176 -28
  155. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +44 -0
  156. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +706 -0
  157. package/sdk/platform/{models/CompanyProfileValidator.d.ts → CompanyProfile/CompanyProfilePlatformValidator.d.ts} +0 -1
  158. package/sdk/platform/{models/CompanyProfileValidator.js → CompanyProfile/CompanyProfilePlatformValidator.js} +9 -14
  159. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +309 -0
  160. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1322 -0
  161. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +31 -0
  162. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +164 -0
  163. package/sdk/platform/{client → Configuration}/ConfigurationPlatformClient.js +284 -2
  164. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +185 -0
  165. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +2072 -0
  166. package/sdk/platform/{models/ConfigurationValidator.js → Configuration/ConfigurationPlatformValidator.js} +9 -8
  167. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +781 -0
  168. package/sdk/platform/Content/ContentPlatformApplicationClient.js +3074 -0
  169. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +71 -0
  170. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +422 -0
  171. package/sdk/platform/Content/ContentPlatformModel.d.ts +105 -0
  172. package/sdk/platform/Content/ContentPlatformModel.js +1349 -0
  173. package/sdk/platform/{client → Discount}/DiscountPlatformClient.d.ts +11 -0
  174. package/sdk/platform/{client → Discount}/DiscountPlatformClient.js +187 -2
  175. package/sdk/platform/Discount/DiscountPlatformModel.d.ts +15 -0
  176. package/sdk/platform/Discount/DiscountPlatformModel.js +176 -0
  177. package/sdk/platform/{models/DiscountValidator.d.ts → Discount/DiscountPlatformValidator.d.ts} +1 -0
  178. package/sdk/platform/{models/DiscountValidator.js → Discount/DiscountPlatformValidator.js} +13 -5
  179. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +114 -0
  180. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +301 -0
  181. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +7 -0
  182. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +38 -0
  183. package/sdk/platform/{client → FileStorage}/FileStoragePlatformClient.js +78 -2
  184. package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +21 -0
  185. package/sdk/platform/FileStorage/FileStoragePlatformModel.js +244 -0
  186. package/sdk/platform/{models/FileStorageValidator.js → FileStorage/FileStoragePlatformValidator.js} +6 -5
  187. package/sdk/platform/{client → Inventory}/InventoryPlatformClient.js +163 -2
  188. package/sdk/platform/Inventory/InventoryPlatformModel.d.ts +62 -0
  189. package/sdk/platform/Inventory/InventoryPlatformModel.js +1178 -0
  190. package/sdk/platform/{models/InventoryValidator.js → Inventory/InventoryPlatformValidator.js} +5 -4
  191. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +138 -0
  192. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +559 -0
  193. package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +16 -0
  194. package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +90 -0
  195. package/sdk/platform/{client → Lead}/LeadPlatformClient.js +142 -2
  196. package/sdk/platform/Lead/LeadPlatformModel.d.ts +55 -0
  197. package/sdk/platform/Lead/LeadPlatformModel.js +690 -0
  198. package/sdk/platform/{models/LeadValidator.js → Lead/LeadPlatformValidator.js} +7 -6
  199. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +59 -0
  200. package/sdk/platform/Order/OrderPlatformApplicationClient.js +207 -0
  201. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +6 -0
  202. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +37 -0
  203. package/sdk/platform/{client → Order}/OrderPlatformClient.d.ts +24 -55
  204. package/sdk/platform/{client → Order}/OrderPlatformClient.js +693 -146
  205. package/sdk/platform/Order/OrderPlatformModel.d.ts +222 -0
  206. package/sdk/platform/Order/OrderPlatformModel.js +3466 -0
  207. package/sdk/platform/{models/OrderValidator.d.ts → Order/OrderPlatformValidator.d.ts} +2 -3
  208. package/sdk/platform/{models/OrderValidator.js → Order/OrderPlatformValidator.js} +32 -48
  209. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +30 -0
  210. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +100 -0
  211. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.d.ts +5 -0
  212. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +20 -0
  213. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +7 -0
  214. package/sdk/platform/Partner/PartnerPlatformModel.js +54 -0
  215. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +108 -0
  216. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +498 -0
  217. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +14 -0
  218. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +73 -0
  219. package/sdk/platform/{client → Payment}/PaymentPlatformClient.js +141 -2
  220. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +44 -0
  221. package/sdk/platform/Payment/PaymentPlatformModel.js +552 -0
  222. package/sdk/platform/{models/PaymentValidator.js → Payment/PaymentPlatformValidator.js} +6 -5
  223. package/sdk/platform/PlatformAPIClient.js +2 -1
  224. package/sdk/platform/PlatformApplicationClient.d.ts +2824 -18486
  225. package/sdk/platform/PlatformApplicationClient.js +3772 -13928
  226. package/sdk/platform/PlatformClient.d.ts +2824 -2881
  227. package/sdk/platform/PlatformClient.js +3710 -3145
  228. package/sdk/platform/PlatformConfig.js +2 -1
  229. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +150 -0
  230. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +597 -0
  231. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +16 -0
  232. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +91 -0
  233. package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +24 -0
  234. package/sdk/platform/Rewards/RewardsPlatformModel.js +294 -0
  235. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +72 -0
  236. package/sdk/platform/Share/SharePlatformApplicationClient.js +235 -0
  237. package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +7 -0
  238. package/sdk/platform/Share/SharePlatformApplicationValidator.js +35 -0
  239. package/sdk/platform/Share/SharePlatformModel.d.ts +15 -0
  240. package/sdk/platform/Share/SharePlatformModel.js +170 -0
  241. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +238 -0
  242. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +997 -0
  243. package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +27 -0
  244. package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +155 -0
  245. package/sdk/platform/Theme/ThemePlatformModel.d.ts +49 -0
  246. package/sdk/platform/Theme/ThemePlatformModel.js +486 -0
  247. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +121 -0
  248. package/sdk/platform/User/UserPlatformApplicationClient.js +506 -0
  249. package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +15 -0
  250. package/sdk/platform/User/UserPlatformApplicationValidator.js +79 -0
  251. package/sdk/platform/User/UserPlatformModel.d.ts +95 -0
  252. package/sdk/platform/User/UserPlatformModel.js +998 -0
  253. package/sdk/platform/{client → Webhook}/WebhookPlatformClient.js +92 -2
  254. package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +17 -0
  255. package/sdk/platform/Webhook/WebhookPlatformModel.js +208 -0
  256. package/sdk/platform/{models/WebhookValidator.js → Webhook/WebhookPlatformValidator.js} +4 -3
  257. package/sdk/platform/index.d.ts +24 -0
  258. package/sdk/platform/index.js +45 -0
  259. package/sdk/public/{client → Configuration}/ConfigurationPublicClient.js +26 -1
  260. package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +20 -0
  261. package/sdk/public/Configuration/ConfigurationPublicModel.js +230 -0
  262. package/sdk/public/{models/ConfigurationValidator.js → Configuration/ConfigurationPublicValidator.js} +3 -1
  263. package/sdk/public/{client → Inventory}/InventoryPublicClient.js +76 -1
  264. package/sdk/public/Inventory/InventoryPublicModel.d.ts +22 -0
  265. package/sdk/public/Inventory/InventoryPublicModel.js +334 -0
  266. package/sdk/public/{models/InventoryValidator.js → Inventory/InventoryPublicValidator.js} +4 -2
  267. package/sdk/public/PublicClient.d.ts +3 -3
  268. package/sdk/public/PublicClient.js +8 -3
  269. package/sdk/public/{client → Webhook}/WebhookPublicClient.js +30 -1
  270. package/sdk/public/Webhook/WebhookPublicModel.d.ts +17 -0
  271. package/sdk/public/Webhook/WebhookPublicModel.js +208 -0
  272. package/sdk/public/{models/WebhookValidator.js → Webhook/WebhookPublicValidator.js} +4 -2
  273. package/sdk/public/index.d.ts +5 -0
  274. package/sdk/public/index.js +7 -0
  275. package/sdk/platform/PlatformApplicationModels.d.ts +0 -328
  276. package/sdk/platform/PlatformApplicationModels.js +0 -22658
  277. package/sdk/platform/PlatformModels.d.ts +0 -1477
  278. package/sdk/platform/PlatformModels.js +0 -20646
  279. package/sdk/platform/models/CartValidator.d.ts +0 -0
  280. package/sdk/platform/models/CartValidator.js +0 -0
  281. package/sdk/platform/models/ContentValidator.d.ts +0 -0
  282. package/sdk/platform/models/ContentValidator.js +0 -0
  283. package/sdk/platform/models/PartnerValidator.d.ts +0 -0
  284. package/sdk/platform/models/PartnerValidator.js +0 -0
  285. package/sdk/platform/models/RewardsValidator.d.ts +0 -0
  286. package/sdk/platform/models/RewardsValidator.js +0 -0
  287. package/sdk/platform/models/ShareValidator.d.ts +0 -0
  288. package/sdk/platform/models/ShareValidator.js +0 -0
  289. package/sdk/platform/models/ThemeValidator.d.ts +0 -0
  290. package/sdk/platform/models/ThemeValidator.js +0 -0
  291. package/sdk/platform/models/UserValidator.d.ts +0 -0
  292. package/sdk/platform/models/UserValidator.js +0 -0
  293. package/sdk/public/PublicModels.d.ts +0 -50
  294. package/sdk/public/PublicModels.js +0 -712
  295. package/sdk/application/{models/CartValidator.d.ts → Cart/CartApplicationValidator.d.ts} +0 -0
  296. package/sdk/application/{models/CatalogValidator.d.ts → Catalog/CatalogApplicationValidator.d.ts} +0 -0
  297. package/sdk/application/{client → Common}/CommonApplicationClient.d.ts +0 -0
  298. package/sdk/application/{models/CommonValidator.d.ts → Common/CommonApplicationValidator.d.ts} +0 -0
  299. package/sdk/application/{client → Communication}/CommunicationApplicationClient.d.ts +0 -0
  300. package/sdk/application/{models/CommunicationValidator.d.ts → Communication/CommunicationApplicationValidator.d.ts} +0 -0
  301. package/sdk/application/{client → Configuration}/ConfigurationApplicationClient.d.ts +0 -0
  302. package/sdk/application/{models/ConfigurationValidator.d.ts → Configuration/ConfigurationApplicationValidator.d.ts} +0 -0
  303. package/sdk/application/{client → Content}/ContentApplicationClient.d.ts +0 -0
  304. package/sdk/application/{models/ContentValidator.d.ts → Content/ContentApplicationValidator.d.ts} +0 -0
  305. package/sdk/application/{client → FileStorage}/FileStorageApplicationClient.d.ts +0 -0
  306. package/sdk/application/{models/FileStorageValidator.d.ts → FileStorage/FileStorageApplicationValidator.d.ts} +0 -0
  307. package/sdk/application/{client → Lead}/LeadApplicationClient.d.ts +0 -0
  308. package/sdk/application/{models/LeadValidator.d.ts → Lead/LeadApplicationValidator.d.ts} +0 -0
  309. package/sdk/application/{client → Logistic}/LogisticApplicationClient.d.ts +0 -0
  310. package/sdk/application/{models/LogisticValidator.d.ts → Logistic/LogisticApplicationValidator.d.ts} +0 -0
  311. package/sdk/application/{client → Order}/OrderApplicationClient.d.ts +0 -0
  312. package/sdk/application/{models/OrderValidator.d.ts → Order/OrderApplicationValidator.d.ts} +0 -0
  313. package/sdk/application/{client → Payment}/PaymentApplicationClient.d.ts +0 -0
  314. package/sdk/application/{models/PaymentValidator.d.ts → Payment/PaymentApplicationValidator.d.ts} +0 -0
  315. package/sdk/application/{models/PosCartValidator.d.ts → PosCart/PosCartApplicationValidator.d.ts} +0 -0
  316. package/sdk/application/{client → Rewards}/RewardsApplicationClient.d.ts +0 -0
  317. package/sdk/application/{models/RewardsValidator.d.ts → Rewards/RewardsApplicationValidator.d.ts} +0 -0
  318. package/sdk/application/{client → Share}/ShareApplicationClient.d.ts +0 -0
  319. package/sdk/application/{models/ShareValidator.d.ts → Share/ShareApplicationValidator.d.ts} +0 -0
  320. package/sdk/application/{client → Theme}/ThemeApplicationClient.d.ts +0 -0
  321. package/sdk/application/{models/ThemeValidator.d.ts → Theme/ThemeApplicationValidator.d.ts} +0 -0
  322. package/sdk/application/{client → User}/UserApplicationClient.d.ts +0 -0
  323. package/sdk/application/{models/UserValidator.d.ts → User/UserApplicationValidator.d.ts} +0 -0
  324. package/sdk/platform/{client → Analytics}/AnalyticsPlatformClient.d.ts +0 -0
  325. package/sdk/platform/{models/AnalyticsValidator.d.ts → Analytics/AnalyticsPlatformValidator.d.ts} +0 -0
  326. package/sdk/platform/{client → AuditTrail}/AuditTrailPlatformClient.d.ts +0 -0
  327. package/sdk/platform/{models/AuditTrailValidator.d.ts → AuditTrail/AuditTrailPlatformValidator.d.ts} +0 -0
  328. package/sdk/platform/{client → Billing}/BillingPlatformClient.d.ts +0 -0
  329. package/sdk/platform/{models/BillingValidator.d.ts → Billing/BillingPlatformValidator.d.ts} +0 -0
  330. package/sdk/platform/{client → Catalog}/CatalogPlatformClient.d.ts +149 -149
  331. package/sdk/platform/{models/CatalogValidator.d.ts → Catalog/CatalogPlatformValidator.d.ts} +21 -21
  332. /package/sdk/platform/{client → Common}/CommonPlatformClient.d.ts +0 -0
  333. /package/sdk/platform/{models/CommonValidator.d.ts → Common/CommonPlatformValidator.d.ts} +0 -0
  334. /package/sdk/platform/{client → Communication}/CommunicationPlatformClient.d.ts +0 -0
  335. /package/sdk/platform/{models/CommunicationValidator.d.ts → Communication/CommunicationPlatformValidator.d.ts} +0 -0
  336. /package/sdk/platform/{client → Configuration}/ConfigurationPlatformClient.d.ts +0 -0
  337. /package/sdk/platform/{models/ConfigurationValidator.d.ts → Configuration/ConfigurationPlatformValidator.d.ts} +0 -0
  338. /package/sdk/platform/{client → FileStorage}/FileStoragePlatformClient.d.ts +0 -0
  339. /package/sdk/platform/{models/FileStorageValidator.d.ts → FileStorage/FileStoragePlatformValidator.d.ts} +0 -0
  340. /package/sdk/platform/{client → Inventory}/InventoryPlatformClient.d.ts +0 -0
  341. /package/sdk/platform/{models/InventoryValidator.d.ts → Inventory/InventoryPlatformValidator.d.ts} +0 -0
  342. /package/sdk/platform/{client → Lead}/LeadPlatformClient.d.ts +0 -0
  343. /package/sdk/platform/{models/LeadValidator.d.ts → Lead/LeadPlatformValidator.d.ts} +0 -0
  344. /package/sdk/platform/{client → Payment}/PaymentPlatformClient.d.ts +0 -0
  345. /package/sdk/platform/{models/PaymentValidator.d.ts → Payment/PaymentPlatformValidator.d.ts} +0 -0
  346. /package/sdk/platform/{client → Webhook}/WebhookPlatformClient.d.ts +0 -0
  347. /package/sdk/platform/{models/WebhookValidator.d.ts → Webhook/WebhookPlatformValidator.d.ts} +0 -0
  348. /package/sdk/public/{client → Configuration}/ConfigurationPublicClient.d.ts +0 -0
  349. /package/sdk/public/{models/ConfigurationValidator.d.ts → Configuration/ConfigurationPublicValidator.d.ts} +0 -0
  350. /package/sdk/public/{client → Inventory}/InventoryPublicClient.d.ts +0 -0
  351. /package/sdk/public/{models/InventoryValidator.d.ts → Inventory/InventoryPublicValidator.d.ts} +0 -0
  352. /package/sdk/public/{client → Webhook}/WebhookPublicClient.d.ts +0 -0
  353. /package/sdk/public/{models/WebhookValidator.d.ts → Webhook/WebhookPublicValidator.d.ts} +0 -0
@@ -0,0 +1,2243 @@
1
+ const Paginator = require("../../common/Paginator");
2
+ const PlatformAPIClient = require("../PlatformAPIClient");
3
+ const { FDKClientValidationError } = require("../../common/FDKError");
4
+ const CommunicationValidator = require("./CommunicationPlatformApplicationValidator");
5
+
6
+ class Communication {
7
+ constructor(config, applicationId) {
8
+ this.config = config;
9
+ this.applicationId = applicationId;
10
+ }
11
+
12
+ /**
13
+ * @param {Object} arg - Arg object.
14
+ * @param {number} [arg.pageNo] - Current page no
15
+ * @param {number} [arg.pageSize] - Current request items count
16
+ * @param {Object} [arg.sort] - To sort based on created_at
17
+ * @summary: Get campaigns
18
+ * @description: Get campaigns
19
+ */
20
+ getCampaigns({ pageNo, pageSize, sort } = {}) {
21
+ const { error } = CommunicationValidator.getCampaigns().validate(
22
+ {
23
+ pageNo,
24
+ pageSize,
25
+ sort,
26
+ },
27
+ { abortEarly: false, allowUnknown: true }
28
+ );
29
+ if (error) {
30
+ return Promise.reject(new FDKClientValidationError(error));
31
+ }
32
+
33
+ // Showing warrnings if extra unknown parameters are found
34
+ const { error: warrning } = CommunicationValidator.getCampaigns().validate(
35
+ {
36
+ pageNo,
37
+ pageSize,
38
+ sort,
39
+ },
40
+ { abortEarly: false, allowUnknown: false }
41
+ );
42
+ if (warrning) {
43
+ console.log("Parameter Validation warrnings for getCampaigns");
44
+ console.log(warrning);
45
+ }
46
+
47
+ const query_params = {};
48
+ query_params["page_no"] = pageNo;
49
+ query_params["page_size"] = pageSize;
50
+ query_params["sort"] = sort;
51
+
52
+ return PlatformAPIClient.execute(
53
+ this.config,
54
+ "get",
55
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns`,
56
+ query_params,
57
+ undefined
58
+ );
59
+ }
60
+
61
+ /**
62
+ * @param {Object} arg - Arg object.
63
+ * @param {string} arg.companyId - Company id
64
+ * @param {string} arg.applicationId - Application id
65
+ * @param {number} [arg.pageSize] - Current request items count
66
+ * @param {Object} [arg.sort] - To sort based on created_at
67
+ * @summary: Get campaigns
68
+ * @description: Get campaigns
69
+ */
70
+ getCampaignsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
71
+ const paginator = new Paginator();
72
+ const callback = async () => {
73
+ const pageId = paginator.nextId;
74
+ const pageNo = paginator.pageNo;
75
+ const pageType = "number";
76
+ const data = await this.getCampaigns({
77
+ companyId: companyId,
78
+ applicationId: applicationId,
79
+ pageNo: pageNo,
80
+ pageSize: pageSize,
81
+ sort: sort,
82
+ });
83
+ paginator.setPaginator({
84
+ hasNext: data.page.has_next ? true : false,
85
+ nextId: data.page.next_id,
86
+ });
87
+ return data;
88
+ };
89
+ paginator.setCallback(callback.bind(this));
90
+ return paginator;
91
+ }
92
+
93
+ /**
94
+ * @param {Object} arg - Arg object.
95
+ * @param {CampaignReq} arg.body
96
+ * @summary: Create campaign
97
+ * @description: Create campaign
98
+ */
99
+ createCampaign({ body } = {}) {
100
+ const { error } = CommunicationValidator.createCampaign().validate(
101
+ {
102
+ body,
103
+ },
104
+ { abortEarly: false, allowUnknown: true }
105
+ );
106
+ if (error) {
107
+ return Promise.reject(new FDKClientValidationError(error));
108
+ }
109
+
110
+ // Showing warrnings if extra unknown parameters are found
111
+ const {
112
+ error: warrning,
113
+ } = CommunicationValidator.createCampaign().validate(
114
+ {
115
+ body,
116
+ },
117
+ { abortEarly: false, allowUnknown: false }
118
+ );
119
+ if (warrning) {
120
+ console.log("Parameter Validation warrnings for createCampaign");
121
+ console.log(warrning);
122
+ }
123
+
124
+ const query_params = {};
125
+
126
+ return PlatformAPIClient.execute(
127
+ this.config,
128
+ "post",
129
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns`,
130
+ query_params,
131
+ body
132
+ );
133
+ }
134
+
135
+ /**
136
+ * @param {Object} arg - Arg object.
137
+ * @param {string} arg.id - Campaign id
138
+ * @summary: Get campaign by id
139
+ * @description: Get campaign by id
140
+ */
141
+ getCampaignById({ id } = {}) {
142
+ const { error } = CommunicationValidator.getCampaignById().validate(
143
+ {
144
+ id,
145
+ },
146
+ { abortEarly: false, allowUnknown: true }
147
+ );
148
+ if (error) {
149
+ return Promise.reject(new FDKClientValidationError(error));
150
+ }
151
+
152
+ // Showing warrnings if extra unknown parameters are found
153
+ const {
154
+ error: warrning,
155
+ } = CommunicationValidator.getCampaignById().validate(
156
+ {
157
+ id,
158
+ },
159
+ { abortEarly: false, allowUnknown: false }
160
+ );
161
+ if (warrning) {
162
+ console.log("Parameter Validation warrnings for getCampaignById");
163
+ console.log(warrning);
164
+ }
165
+
166
+ const query_params = {};
167
+
168
+ return PlatformAPIClient.execute(
169
+ this.config,
170
+ "get",
171
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns/${id}`,
172
+ query_params,
173
+ undefined
174
+ );
175
+ }
176
+
177
+ /**
178
+ * @param {Object} arg - Arg object.
179
+ * @param {string} arg.id - Campaign id
180
+ * @param {CampaignReq} arg.body
181
+ * @summary: Update campaign by id
182
+ * @description: Update campaign by id
183
+ */
184
+ updateCampaignById({ id, body } = {}) {
185
+ const { error } = CommunicationValidator.updateCampaignById().validate(
186
+ {
187
+ id,
188
+ body,
189
+ },
190
+ { abortEarly: false, allowUnknown: true }
191
+ );
192
+ if (error) {
193
+ return Promise.reject(new FDKClientValidationError(error));
194
+ }
195
+
196
+ // Showing warrnings if extra unknown parameters are found
197
+ const {
198
+ error: warrning,
199
+ } = CommunicationValidator.updateCampaignById().validate(
200
+ {
201
+ id,
202
+ body,
203
+ },
204
+ { abortEarly: false, allowUnknown: false }
205
+ );
206
+ if (warrning) {
207
+ console.log("Parameter Validation warrnings for updateCampaignById");
208
+ console.log(warrning);
209
+ }
210
+
211
+ const query_params = {};
212
+
213
+ return PlatformAPIClient.execute(
214
+ this.config,
215
+ "put",
216
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns/${id}`,
217
+ query_params,
218
+ body
219
+ );
220
+ }
221
+
222
+ /**
223
+ * @param {Object} arg - Arg object.
224
+ * @param {string} arg.id - Campaign id
225
+ * @summary: Get stats of campaign by id
226
+ * @description: Get stats of campaign by id
227
+ */
228
+ getStatsOfCampaignById({ id } = {}) {
229
+ const { error } = CommunicationValidator.getStatsOfCampaignById().validate(
230
+ {
231
+ id,
232
+ },
233
+ { abortEarly: false, allowUnknown: true }
234
+ );
235
+ if (error) {
236
+ return Promise.reject(new FDKClientValidationError(error));
237
+ }
238
+
239
+ // Showing warrnings if extra unknown parameters are found
240
+ const {
241
+ error: warrning,
242
+ } = CommunicationValidator.getStatsOfCampaignById().validate(
243
+ {
244
+ id,
245
+ },
246
+ { abortEarly: false, allowUnknown: false }
247
+ );
248
+ if (warrning) {
249
+ console.log("Parameter Validation warrnings for getStatsOfCampaignById");
250
+ console.log(warrning);
251
+ }
252
+
253
+ const query_params = {};
254
+
255
+ return PlatformAPIClient.execute(
256
+ this.config,
257
+ "get",
258
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/get-stats/${id}`,
259
+ query_params,
260
+ undefined
261
+ );
262
+ }
263
+
264
+ /**
265
+ * @param {Object} arg - Arg object.
266
+ * @param {number} [arg.pageNo] - Current page no
267
+ * @param {number} [arg.pageSize] - Current request items count
268
+ * @param {Object} [arg.sort] - To sort based on created_at
269
+ * @summary: Get audiences
270
+ * @description: Get audiences
271
+ */
272
+ getAudiences({ pageNo, pageSize, sort } = {}) {
273
+ const { error } = CommunicationValidator.getAudiences().validate(
274
+ {
275
+ pageNo,
276
+ pageSize,
277
+ sort,
278
+ },
279
+ { abortEarly: false, allowUnknown: true }
280
+ );
281
+ if (error) {
282
+ return Promise.reject(new FDKClientValidationError(error));
283
+ }
284
+
285
+ // Showing warrnings if extra unknown parameters are found
286
+ const { error: warrning } = CommunicationValidator.getAudiences().validate(
287
+ {
288
+ pageNo,
289
+ pageSize,
290
+ sort,
291
+ },
292
+ { abortEarly: false, allowUnknown: false }
293
+ );
294
+ if (warrning) {
295
+ console.log("Parameter Validation warrnings for getAudiences");
296
+ console.log(warrning);
297
+ }
298
+
299
+ const query_params = {};
300
+ query_params["page_no"] = pageNo;
301
+ query_params["page_size"] = pageSize;
302
+ query_params["sort"] = sort;
303
+
304
+ return PlatformAPIClient.execute(
305
+ this.config,
306
+ "get",
307
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources`,
308
+ query_params,
309
+ undefined
310
+ );
311
+ }
312
+
313
+ /**
314
+ * @param {Object} arg - Arg object.
315
+ * @param {string} arg.companyId - Company id
316
+ * @param {string} arg.applicationId - Application id
317
+ * @param {number} [arg.pageSize] - Current request items count
318
+ * @param {Object} [arg.sort] - To sort based on created_at
319
+ * @summary: Get audiences
320
+ * @description: Get audiences
321
+ */
322
+ getAudiencesPaginator({ companyId, applicationId, pageSize, sort } = {}) {
323
+ const paginator = new Paginator();
324
+ const callback = async () => {
325
+ const pageId = paginator.nextId;
326
+ const pageNo = paginator.pageNo;
327
+ const pageType = "number";
328
+ const data = await this.getAudiences({
329
+ companyId: companyId,
330
+ applicationId: applicationId,
331
+ pageNo: pageNo,
332
+ pageSize: pageSize,
333
+ sort: sort,
334
+ });
335
+ paginator.setPaginator({
336
+ hasNext: data.page.has_next ? true : false,
337
+ nextId: data.page.next_id,
338
+ });
339
+ return data;
340
+ };
341
+ paginator.setCallback(callback.bind(this));
342
+ return paginator;
343
+ }
344
+
345
+ /**
346
+ * @param {Object} arg - Arg object.
347
+ * @param {AudienceReq} arg.body
348
+ * @summary: Create audience
349
+ * @description: Create audience
350
+ */
351
+ createAudience({ body } = {}) {
352
+ const { error } = CommunicationValidator.createAudience().validate(
353
+ {
354
+ body,
355
+ },
356
+ { abortEarly: false, allowUnknown: true }
357
+ );
358
+ if (error) {
359
+ return Promise.reject(new FDKClientValidationError(error));
360
+ }
361
+
362
+ // Showing warrnings if extra unknown parameters are found
363
+ const {
364
+ error: warrning,
365
+ } = CommunicationValidator.createAudience().validate(
366
+ {
367
+ body,
368
+ },
369
+ { abortEarly: false, allowUnknown: false }
370
+ );
371
+ if (warrning) {
372
+ console.log("Parameter Validation warrnings for createAudience");
373
+ console.log(warrning);
374
+ }
375
+
376
+ const query_params = {};
377
+
378
+ return PlatformAPIClient.execute(
379
+ this.config,
380
+ "post",
381
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources`,
382
+ query_params,
383
+ body
384
+ );
385
+ }
386
+
387
+ /**
388
+ * @param {Object} arg - Arg object.
389
+ * @param {BigqueryHeadersReq} arg.body
390
+ * @summary: Get bigquery headers
391
+ * @description: Get bigquery headers
392
+ */
393
+ getBigqueryHeaders({ body } = {}) {
394
+ const { error } = CommunicationValidator.getBigqueryHeaders().validate(
395
+ {
396
+ body,
397
+ },
398
+ { abortEarly: false, allowUnknown: true }
399
+ );
400
+ if (error) {
401
+ return Promise.reject(new FDKClientValidationError(error));
402
+ }
403
+
404
+ // Showing warrnings if extra unknown parameters are found
405
+ const {
406
+ error: warrning,
407
+ } = CommunicationValidator.getBigqueryHeaders().validate(
408
+ {
409
+ body,
410
+ },
411
+ { abortEarly: false, allowUnknown: false }
412
+ );
413
+ if (warrning) {
414
+ console.log("Parameter Validation warrnings for getBigqueryHeaders");
415
+ console.log(warrning);
416
+ }
417
+
418
+ const query_params = {};
419
+
420
+ return PlatformAPIClient.execute(
421
+ this.config,
422
+ "post",
423
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/bigquery-headers`,
424
+ query_params,
425
+ body
426
+ );
427
+ }
428
+
429
+ /**
430
+ * @param {Object} arg - Arg object.
431
+ * @param {string} arg.id - Audience id
432
+ * @summary: Get audience by id
433
+ * @description: Get audience by id
434
+ */
435
+ getAudienceById({ id } = {}) {
436
+ const { error } = CommunicationValidator.getAudienceById().validate(
437
+ {
438
+ id,
439
+ },
440
+ { abortEarly: false, allowUnknown: true }
441
+ );
442
+ if (error) {
443
+ return Promise.reject(new FDKClientValidationError(error));
444
+ }
445
+
446
+ // Showing warrnings if extra unknown parameters are found
447
+ const {
448
+ error: warrning,
449
+ } = CommunicationValidator.getAudienceById().validate(
450
+ {
451
+ id,
452
+ },
453
+ { abortEarly: false, allowUnknown: false }
454
+ );
455
+ if (warrning) {
456
+ console.log("Parameter Validation warrnings for getAudienceById");
457
+ console.log(warrning);
458
+ }
459
+
460
+ const query_params = {};
461
+
462
+ return PlatformAPIClient.execute(
463
+ this.config,
464
+ "get",
465
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
466
+ query_params,
467
+ undefined
468
+ );
469
+ }
470
+
471
+ /**
472
+ * @param {Object} arg - Arg object.
473
+ * @param {string} arg.id - Audience id
474
+ * @param {AudienceReq} arg.body
475
+ * @summary: Update audience by id
476
+ * @description: Update audience by id
477
+ */
478
+ updateAudienceById({ id, body } = {}) {
479
+ const { error } = CommunicationValidator.updateAudienceById().validate(
480
+ {
481
+ id,
482
+ body,
483
+ },
484
+ { abortEarly: false, allowUnknown: true }
485
+ );
486
+ if (error) {
487
+ return Promise.reject(new FDKClientValidationError(error));
488
+ }
489
+
490
+ // Showing warrnings if extra unknown parameters are found
491
+ const {
492
+ error: warrning,
493
+ } = CommunicationValidator.updateAudienceById().validate(
494
+ {
495
+ id,
496
+ body,
497
+ },
498
+ { abortEarly: false, allowUnknown: false }
499
+ );
500
+ if (warrning) {
501
+ console.log("Parameter Validation warrnings for updateAudienceById");
502
+ console.log(warrning);
503
+ }
504
+
505
+ const query_params = {};
506
+
507
+ return PlatformAPIClient.execute(
508
+ this.config,
509
+ "put",
510
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
511
+ query_params,
512
+ body
513
+ );
514
+ }
515
+
516
+ /**
517
+ * @param {Object} arg - Arg object.
518
+ * @param {GetNRecordsCsvReq} arg.body
519
+ * @summary: Get n sample records from csv
520
+ * @description: Get n sample records from csv
521
+ */
522
+ getNSampleRecordsFromCsv({ body } = {}) {
523
+ const {
524
+ error,
525
+ } = CommunicationValidator.getNSampleRecordsFromCsv().validate(
526
+ {
527
+ body,
528
+ },
529
+ { abortEarly: false, allowUnknown: true }
530
+ );
531
+ if (error) {
532
+ return Promise.reject(new FDKClientValidationError(error));
533
+ }
534
+
535
+ // Showing warrnings if extra unknown parameters are found
536
+ const {
537
+ error: warrning,
538
+ } = CommunicationValidator.getNSampleRecordsFromCsv().validate(
539
+ {
540
+ body,
541
+ },
542
+ { abortEarly: false, allowUnknown: false }
543
+ );
544
+ if (warrning) {
545
+ console.log(
546
+ "Parameter Validation warrnings for getNSampleRecordsFromCsv"
547
+ );
548
+ console.log(warrning);
549
+ }
550
+
551
+ const query_params = {};
552
+
553
+ return PlatformAPIClient.execute(
554
+ this.config,
555
+ "post",
556
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/get-n-records`,
557
+ query_params,
558
+ body
559
+ );
560
+ }
561
+
562
+ /**
563
+ * @param {Object} arg - Arg object.
564
+ * @param {number} [arg.pageNo] - Current page no
565
+ * @param {number} [arg.pageSize] - Current request items count
566
+ * @param {Object} [arg.sort] - To sort based on created_at
567
+ * @summary: Get email providers
568
+ * @description: Get email providers
569
+ */
570
+ getEmailProviders({ pageNo, pageSize, sort } = {}) {
571
+ const { error } = CommunicationValidator.getEmailProviders().validate(
572
+ {
573
+ pageNo,
574
+ pageSize,
575
+ sort,
576
+ },
577
+ { abortEarly: false, allowUnknown: true }
578
+ );
579
+ if (error) {
580
+ return Promise.reject(new FDKClientValidationError(error));
581
+ }
582
+
583
+ // Showing warrnings if extra unknown parameters are found
584
+ const {
585
+ error: warrning,
586
+ } = CommunicationValidator.getEmailProviders().validate(
587
+ {
588
+ pageNo,
589
+ pageSize,
590
+ sort,
591
+ },
592
+ { abortEarly: false, allowUnknown: false }
593
+ );
594
+ if (warrning) {
595
+ console.log("Parameter Validation warrnings for getEmailProviders");
596
+ console.log(warrning);
597
+ }
598
+
599
+ const query_params = {};
600
+ query_params["page_no"] = pageNo;
601
+ query_params["page_size"] = pageSize;
602
+ query_params["sort"] = sort;
603
+
604
+ return PlatformAPIClient.execute(
605
+ this.config,
606
+ "get",
607
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers`,
608
+ query_params,
609
+ undefined
610
+ );
611
+ }
612
+
613
+ /**
614
+ * @param {Object} arg - Arg object.
615
+ * @param {string} arg.companyId - Company id
616
+ * @param {string} arg.applicationId - Application id
617
+ * @param {number} [arg.pageSize] - Current request items count
618
+ * @param {Object} [arg.sort] - To sort based on created_at
619
+ * @summary: Get email providers
620
+ * @description: Get email providers
621
+ */
622
+ getEmailProvidersPaginator({
623
+ companyId,
624
+ applicationId,
625
+ pageSize,
626
+ sort,
627
+ } = {}) {
628
+ const paginator = new Paginator();
629
+ const callback = async () => {
630
+ const pageId = paginator.nextId;
631
+ const pageNo = paginator.pageNo;
632
+ const pageType = "number";
633
+ const data = await this.getEmailProviders({
634
+ companyId: companyId,
635
+ applicationId: applicationId,
636
+ pageNo: pageNo,
637
+ pageSize: pageSize,
638
+ sort: sort,
639
+ });
640
+ paginator.setPaginator({
641
+ hasNext: data.page.has_next ? true : false,
642
+ nextId: data.page.next_id,
643
+ });
644
+ return data;
645
+ };
646
+ paginator.setCallback(callback.bind(this));
647
+ return paginator;
648
+ }
649
+
650
+ /**
651
+ * @param {Object} arg - Arg object.
652
+ * @param {EmailProviderReq} arg.body
653
+ * @summary: Create email provider
654
+ * @description: Create email provider
655
+ */
656
+ createEmailProvider({ body } = {}) {
657
+ const { error } = CommunicationValidator.createEmailProvider().validate(
658
+ {
659
+ body,
660
+ },
661
+ { abortEarly: false, allowUnknown: true }
662
+ );
663
+ if (error) {
664
+ return Promise.reject(new FDKClientValidationError(error));
665
+ }
666
+
667
+ // Showing warrnings if extra unknown parameters are found
668
+ const {
669
+ error: warrning,
670
+ } = CommunicationValidator.createEmailProvider().validate(
671
+ {
672
+ body,
673
+ },
674
+ { abortEarly: false, allowUnknown: false }
675
+ );
676
+ if (warrning) {
677
+ console.log("Parameter Validation warrnings for createEmailProvider");
678
+ console.log(warrning);
679
+ }
680
+
681
+ const query_params = {};
682
+
683
+ return PlatformAPIClient.execute(
684
+ this.config,
685
+ "post",
686
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers`,
687
+ query_params,
688
+ body
689
+ );
690
+ }
691
+
692
+ /**
693
+ * @param {Object} arg - Arg object.
694
+ * @param {string} arg.id - Email provider id
695
+ * @summary: Get email provider by id
696
+ * @description: Get email provider by id
697
+ */
698
+ getEmailProviderById({ id } = {}) {
699
+ const { error } = CommunicationValidator.getEmailProviderById().validate(
700
+ {
701
+ id,
702
+ },
703
+ { abortEarly: false, allowUnknown: true }
704
+ );
705
+ if (error) {
706
+ return Promise.reject(new FDKClientValidationError(error));
707
+ }
708
+
709
+ // Showing warrnings if extra unknown parameters are found
710
+ const {
711
+ error: warrning,
712
+ } = CommunicationValidator.getEmailProviderById().validate(
713
+ {
714
+ id,
715
+ },
716
+ { abortEarly: false, allowUnknown: false }
717
+ );
718
+ if (warrning) {
719
+ console.log("Parameter Validation warrnings for getEmailProviderById");
720
+ console.log(warrning);
721
+ }
722
+
723
+ const query_params = {};
724
+
725
+ return PlatformAPIClient.execute(
726
+ this.config,
727
+ "get",
728
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
729
+ query_params,
730
+ undefined
731
+ );
732
+ }
733
+
734
+ /**
735
+ * @param {Object} arg - Arg object.
736
+ * @param {string} arg.id - Email provider id
737
+ * @param {EmailProviderReq} arg.body
738
+ * @summary: Update email provider by id
739
+ * @description: Update email provider by id
740
+ */
741
+ updateEmailProviderById({ id, body } = {}) {
742
+ const { error } = CommunicationValidator.updateEmailProviderById().validate(
743
+ {
744
+ id,
745
+ body,
746
+ },
747
+ { abortEarly: false, allowUnknown: true }
748
+ );
749
+ if (error) {
750
+ return Promise.reject(new FDKClientValidationError(error));
751
+ }
752
+
753
+ // Showing warrnings if extra unknown parameters are found
754
+ const {
755
+ error: warrning,
756
+ } = CommunicationValidator.updateEmailProviderById().validate(
757
+ {
758
+ id,
759
+ body,
760
+ },
761
+ { abortEarly: false, allowUnknown: false }
762
+ );
763
+ if (warrning) {
764
+ console.log("Parameter Validation warrnings for updateEmailProviderById");
765
+ console.log(warrning);
766
+ }
767
+
768
+ const query_params = {};
769
+
770
+ return PlatformAPIClient.execute(
771
+ this.config,
772
+ "put",
773
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
774
+ query_params,
775
+ body
776
+ );
777
+ }
778
+
779
+ /**
780
+ * @param {Object} arg - Arg object.
781
+ * @param {number} [arg.pageNo] - Current page no
782
+ * @param {number} [arg.pageSize] - Current request items count
783
+ * @param {Object} [arg.sort] - To sort based on created_at
784
+ * @summary: Get email templates
785
+ * @description: Get email templates
786
+ */
787
+ getEmailTemplates({ pageNo, pageSize, sort } = {}) {
788
+ const { error } = CommunicationValidator.getEmailTemplates().validate(
789
+ {
790
+ pageNo,
791
+ pageSize,
792
+ sort,
793
+ },
794
+ { abortEarly: false, allowUnknown: true }
795
+ );
796
+ if (error) {
797
+ return Promise.reject(new FDKClientValidationError(error));
798
+ }
799
+
800
+ // Showing warrnings if extra unknown parameters are found
801
+ const {
802
+ error: warrning,
803
+ } = CommunicationValidator.getEmailTemplates().validate(
804
+ {
805
+ pageNo,
806
+ pageSize,
807
+ sort,
808
+ },
809
+ { abortEarly: false, allowUnknown: false }
810
+ );
811
+ if (warrning) {
812
+ console.log("Parameter Validation warrnings for getEmailTemplates");
813
+ console.log(warrning);
814
+ }
815
+
816
+ const query_params = {};
817
+ query_params["page_no"] = pageNo;
818
+ query_params["page_size"] = pageSize;
819
+ query_params["sort"] = sort;
820
+
821
+ return PlatformAPIClient.execute(
822
+ this.config,
823
+ "get",
824
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates`,
825
+ query_params,
826
+ undefined
827
+ );
828
+ }
829
+
830
+ /**
831
+ * @param {Object} arg - Arg object.
832
+ * @param {string} arg.companyId - Company id
833
+ * @param {string} arg.applicationId - Application id
834
+ * @param {number} [arg.pageSize] - Current request items count
835
+ * @param {Object} [arg.sort] - To sort based on created_at
836
+ * @summary: Get email templates
837
+ * @description: Get email templates
838
+ */
839
+ getEmailTemplatesPaginator({
840
+ companyId,
841
+ applicationId,
842
+ pageSize,
843
+ sort,
844
+ } = {}) {
845
+ const paginator = new Paginator();
846
+ const callback = async () => {
847
+ const pageId = paginator.nextId;
848
+ const pageNo = paginator.pageNo;
849
+ const pageType = "number";
850
+ const data = await this.getEmailTemplates({
851
+ companyId: companyId,
852
+ applicationId: applicationId,
853
+ pageNo: pageNo,
854
+ pageSize: pageSize,
855
+ sort: sort,
856
+ });
857
+ paginator.setPaginator({
858
+ hasNext: data.page.has_next ? true : false,
859
+ nextId: data.page.next_id,
860
+ });
861
+ return data;
862
+ };
863
+ paginator.setCallback(callback.bind(this));
864
+ return paginator;
865
+ }
866
+
867
+ /**
868
+ * @param {Object} arg - Arg object.
869
+ * @param {EmailTemplateReq} arg.body
870
+ * @summary: Create email template
871
+ * @description: Create email template
872
+ */
873
+ createEmailTemplate({ body } = {}) {
874
+ const { error } = CommunicationValidator.createEmailTemplate().validate(
875
+ {
876
+ body,
877
+ },
878
+ { abortEarly: false, allowUnknown: true }
879
+ );
880
+ if (error) {
881
+ return Promise.reject(new FDKClientValidationError(error));
882
+ }
883
+
884
+ // Showing warrnings if extra unknown parameters are found
885
+ const {
886
+ error: warrning,
887
+ } = CommunicationValidator.createEmailTemplate().validate(
888
+ {
889
+ body,
890
+ },
891
+ { abortEarly: false, allowUnknown: false }
892
+ );
893
+ if (warrning) {
894
+ console.log("Parameter Validation warrnings for createEmailTemplate");
895
+ console.log(warrning);
896
+ }
897
+
898
+ const query_params = {};
899
+
900
+ return PlatformAPIClient.execute(
901
+ this.config,
902
+ "post",
903
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates`,
904
+ query_params,
905
+ body
906
+ );
907
+ }
908
+
909
+ /**
910
+ * @param {Object} arg - Arg object.
911
+ * @param {number} [arg.pageNo] - Current page no
912
+ * @param {number} [arg.pageSize] - Current request items count
913
+ * @param {Object} [arg.sort] - To sort based on created_at
914
+ * @summary: Get system email templates
915
+ * @description: Get system email templates
916
+ */
917
+ getSystemEmailTemplates({ pageNo, pageSize, sort } = {}) {
918
+ const { error } = CommunicationValidator.getSystemEmailTemplates().validate(
919
+ {
920
+ pageNo,
921
+ pageSize,
922
+ sort,
923
+ },
924
+ { abortEarly: false, allowUnknown: true }
925
+ );
926
+ if (error) {
927
+ return Promise.reject(new FDKClientValidationError(error));
928
+ }
929
+
930
+ // Showing warrnings if extra unknown parameters are found
931
+ const {
932
+ error: warrning,
933
+ } = CommunicationValidator.getSystemEmailTemplates().validate(
934
+ {
935
+ pageNo,
936
+ pageSize,
937
+ sort,
938
+ },
939
+ { abortEarly: false, allowUnknown: false }
940
+ );
941
+ if (warrning) {
942
+ console.log("Parameter Validation warrnings for getSystemEmailTemplates");
943
+ console.log(warrning);
944
+ }
945
+
946
+ const query_params = {};
947
+ query_params["page_no"] = pageNo;
948
+ query_params["page_size"] = pageSize;
949
+ query_params["sort"] = sort;
950
+
951
+ return PlatformAPIClient.execute(
952
+ this.config,
953
+ "get",
954
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/system-templates`,
955
+ query_params,
956
+ undefined
957
+ );
958
+ }
959
+
960
+ /**
961
+ * @param {Object} arg - Arg object.
962
+ * @param {string} arg.companyId - Company id
963
+ * @param {string} arg.applicationId - Application id
964
+ * @param {number} [arg.pageSize] - Current request items count
965
+ * @param {Object} [arg.sort] - To sort based on created_at
966
+ * @summary: Get system email templates
967
+ * @description: Get system email templates
968
+ */
969
+ getSystemEmailTemplatesPaginator({
970
+ companyId,
971
+ applicationId,
972
+ pageSize,
973
+ sort,
974
+ } = {}) {
975
+ const paginator = new Paginator();
976
+ const callback = async () => {
977
+ const pageId = paginator.nextId;
978
+ const pageNo = paginator.pageNo;
979
+ const pageType = "number";
980
+ const data = await this.getSystemEmailTemplates({
981
+ companyId: companyId,
982
+ applicationId: applicationId,
983
+ pageNo: pageNo,
984
+ pageSize: pageSize,
985
+ sort: sort,
986
+ });
987
+ paginator.setPaginator({
988
+ hasNext: data.page.has_next ? true : false,
989
+ nextId: data.page.next_id,
990
+ });
991
+ return data;
992
+ };
993
+ paginator.setCallback(callback.bind(this));
994
+ return paginator;
995
+ }
996
+
997
+ /**
998
+ * @param {Object} arg - Arg object.
999
+ * @param {string} arg.id - Email template id
1000
+ * @summary: Get email template by id
1001
+ * @description: Get email template by id
1002
+ */
1003
+ getEmailTemplateById({ id } = {}) {
1004
+ const { error } = CommunicationValidator.getEmailTemplateById().validate(
1005
+ {
1006
+ id,
1007
+ },
1008
+ { abortEarly: false, allowUnknown: true }
1009
+ );
1010
+ if (error) {
1011
+ return Promise.reject(new FDKClientValidationError(error));
1012
+ }
1013
+
1014
+ // Showing warrnings if extra unknown parameters are found
1015
+ const {
1016
+ error: warrning,
1017
+ } = CommunicationValidator.getEmailTemplateById().validate(
1018
+ {
1019
+ id,
1020
+ },
1021
+ { abortEarly: false, allowUnknown: false }
1022
+ );
1023
+ if (warrning) {
1024
+ console.log("Parameter Validation warrnings for getEmailTemplateById");
1025
+ console.log(warrning);
1026
+ }
1027
+
1028
+ const query_params = {};
1029
+
1030
+ return PlatformAPIClient.execute(
1031
+ this.config,
1032
+ "get",
1033
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
1034
+ query_params,
1035
+ undefined
1036
+ );
1037
+ }
1038
+
1039
+ /**
1040
+ * @param {Object} arg - Arg object.
1041
+ * @param {string} arg.id - Email template id
1042
+ * @param {EmailTemplateReq} arg.body
1043
+ * @summary: Update email template by id
1044
+ * @description: Update email template by id
1045
+ */
1046
+ updateEmailTemplateById({ id, body } = {}) {
1047
+ const { error } = CommunicationValidator.updateEmailTemplateById().validate(
1048
+ {
1049
+ id,
1050
+ body,
1051
+ },
1052
+ { abortEarly: false, allowUnknown: true }
1053
+ );
1054
+ if (error) {
1055
+ return Promise.reject(new FDKClientValidationError(error));
1056
+ }
1057
+
1058
+ // Showing warrnings if extra unknown parameters are found
1059
+ const {
1060
+ error: warrning,
1061
+ } = CommunicationValidator.updateEmailTemplateById().validate(
1062
+ {
1063
+ id,
1064
+ body,
1065
+ },
1066
+ { abortEarly: false, allowUnknown: false }
1067
+ );
1068
+ if (warrning) {
1069
+ console.log("Parameter Validation warrnings for updateEmailTemplateById");
1070
+ console.log(warrning);
1071
+ }
1072
+
1073
+ const query_params = {};
1074
+
1075
+ return PlatformAPIClient.execute(
1076
+ this.config,
1077
+ "put",
1078
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
1079
+ query_params,
1080
+ body
1081
+ );
1082
+ }
1083
+
1084
+ /**
1085
+ * @param {Object} arg - Arg object.
1086
+ * @param {string} arg.id - Email template id
1087
+ * @summary: Delete email template by id
1088
+ * @description: Delete email template by id
1089
+ */
1090
+ deleteEmailTemplateById({ id } = {}) {
1091
+ const { error } = CommunicationValidator.deleteEmailTemplateById().validate(
1092
+ {
1093
+ id,
1094
+ },
1095
+ { abortEarly: false, allowUnknown: true }
1096
+ );
1097
+ if (error) {
1098
+ return Promise.reject(new FDKClientValidationError(error));
1099
+ }
1100
+
1101
+ // Showing warrnings if extra unknown parameters are found
1102
+ const {
1103
+ error: warrning,
1104
+ } = CommunicationValidator.deleteEmailTemplateById().validate(
1105
+ {
1106
+ id,
1107
+ },
1108
+ { abortEarly: false, allowUnknown: false }
1109
+ );
1110
+ if (warrning) {
1111
+ console.log("Parameter Validation warrnings for deleteEmailTemplateById");
1112
+ console.log(warrning);
1113
+ }
1114
+
1115
+ const query_params = {};
1116
+
1117
+ return PlatformAPIClient.execute(
1118
+ this.config,
1119
+ "delete",
1120
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
1121
+ query_params,
1122
+ undefined
1123
+ );
1124
+ }
1125
+
1126
+ /**
1127
+ * @param {Object} arg - Arg object.
1128
+ * @param {EngineRequest} arg.body
1129
+ * @summary: Send email or sms synchronously
1130
+ * @description: Send email or sms synchronously
1131
+ */
1132
+ sendCommunicationSynchronously({ body } = {}) {
1133
+ const {
1134
+ error,
1135
+ } = CommunicationValidator.sendCommunicationSynchronously().validate(
1136
+ {
1137
+ body,
1138
+ },
1139
+ { abortEarly: false, allowUnknown: true }
1140
+ );
1141
+ if (error) {
1142
+ return Promise.reject(new FDKClientValidationError(error));
1143
+ }
1144
+
1145
+ // Showing warrnings if extra unknown parameters are found
1146
+ const {
1147
+ error: warrning,
1148
+ } = CommunicationValidator.sendCommunicationSynchronously().validate(
1149
+ {
1150
+ body,
1151
+ },
1152
+ { abortEarly: false, allowUnknown: false }
1153
+ );
1154
+ if (warrning) {
1155
+ console.log(
1156
+ "Parameter Validation warrnings for sendCommunicationSynchronously"
1157
+ );
1158
+ console.log(warrning);
1159
+ }
1160
+
1161
+ const query_params = {};
1162
+
1163
+ return PlatformAPIClient.execute(
1164
+ this.config,
1165
+ "post",
1166
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/engine/send-instant`,
1167
+ query_params,
1168
+ body
1169
+ );
1170
+ }
1171
+
1172
+ /**
1173
+ * @param {Object} arg - Arg object.
1174
+ * @param {EngineRequest} arg.body
1175
+ * @summary: Send email or sms asynchronously
1176
+ * @description: Send email or sms asynchronously
1177
+ */
1178
+ sendCommunicationAsynchronously({ body } = {}) {
1179
+ const {
1180
+ error,
1181
+ } = CommunicationValidator.sendCommunicationAsynchronously().validate(
1182
+ {
1183
+ body,
1184
+ },
1185
+ { abortEarly: false, allowUnknown: true }
1186
+ );
1187
+ if (error) {
1188
+ return Promise.reject(new FDKClientValidationError(error));
1189
+ }
1190
+
1191
+ // Showing warrnings if extra unknown parameters are found
1192
+ const {
1193
+ error: warrning,
1194
+ } = CommunicationValidator.sendCommunicationAsynchronously().validate(
1195
+ {
1196
+ body,
1197
+ },
1198
+ { abortEarly: false, allowUnknown: false }
1199
+ );
1200
+ if (warrning) {
1201
+ console.log(
1202
+ "Parameter Validation warrnings for sendCommunicationAsynchronously"
1203
+ );
1204
+ console.log(warrning);
1205
+ }
1206
+
1207
+ const query_params = {};
1208
+
1209
+ return PlatformAPIClient.execute(
1210
+ this.config,
1211
+ "post",
1212
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/engine/send-async`,
1213
+ query_params,
1214
+ body
1215
+ );
1216
+ }
1217
+
1218
+ /**
1219
+ * @param {Object} arg - Arg object.
1220
+ * @param {number} [arg.pageNo] - Current page no
1221
+ * @param {number} [arg.pageSize] - Current request items count
1222
+ * @param {string} [arg.populate] - Populate fields
1223
+ * @summary: Get event subscriptions
1224
+ * @description: Get event subscriptions
1225
+ */
1226
+ getEventSubscriptions({ pageNo, pageSize, populate } = {}) {
1227
+ const { error } = CommunicationValidator.getEventSubscriptions().validate(
1228
+ {
1229
+ pageNo,
1230
+ pageSize,
1231
+ populate,
1232
+ },
1233
+ { abortEarly: false, allowUnknown: true }
1234
+ );
1235
+ if (error) {
1236
+ return Promise.reject(new FDKClientValidationError(error));
1237
+ }
1238
+
1239
+ // Showing warrnings if extra unknown parameters are found
1240
+ const {
1241
+ error: warrning,
1242
+ } = CommunicationValidator.getEventSubscriptions().validate(
1243
+ {
1244
+ pageNo,
1245
+ pageSize,
1246
+ populate,
1247
+ },
1248
+ { abortEarly: false, allowUnknown: false }
1249
+ );
1250
+ if (warrning) {
1251
+ console.log("Parameter Validation warrnings for getEventSubscriptions");
1252
+ console.log(warrning);
1253
+ }
1254
+
1255
+ const query_params = {};
1256
+ query_params["page_no"] = pageNo;
1257
+ query_params["page_size"] = pageSize;
1258
+ query_params["populate"] = populate;
1259
+
1260
+ return PlatformAPIClient.execute(
1261
+ this.config,
1262
+ "get",
1263
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/event/event-subscriptions`,
1264
+ query_params,
1265
+ undefined
1266
+ );
1267
+ }
1268
+
1269
+ /**
1270
+ * @param {Object} arg - Arg object.
1271
+ * @param {string} arg.companyId - Company id
1272
+ * @param {string} arg.applicationId - Application id
1273
+ * @param {number} [arg.pageSize] - Current request items count
1274
+ * @param {string} [arg.populate] - Populate fields
1275
+ * @summary: Get event subscriptions
1276
+ * @description: Get event subscriptions
1277
+ */
1278
+ getEventSubscriptionsPaginator({
1279
+ companyId,
1280
+ applicationId,
1281
+ pageSize,
1282
+ populate,
1283
+ } = {}) {
1284
+ const paginator = new Paginator();
1285
+ const callback = async () => {
1286
+ const pageId = paginator.nextId;
1287
+ const pageNo = paginator.pageNo;
1288
+ const pageType = "number";
1289
+ const data = await this.getEventSubscriptions({
1290
+ companyId: companyId,
1291
+ applicationId: applicationId,
1292
+ pageNo: pageNo,
1293
+ pageSize: pageSize,
1294
+ populate: populate,
1295
+ });
1296
+ paginator.setPaginator({
1297
+ hasNext: data.page.has_next ? true : false,
1298
+ nextId: data.page.next_id,
1299
+ });
1300
+ return data;
1301
+ };
1302
+ paginator.setCallback(callback.bind(this));
1303
+ return paginator;
1304
+ }
1305
+
1306
+ /**
1307
+ * @param {Object} arg - Arg object.
1308
+ * @param {number} [arg.pageNo] - Current page no
1309
+ * @param {number} [arg.pageSize] - Current request items count
1310
+ * @param {Object} [arg.sort] - To sort based on created_at
1311
+ * @summary: Get jobs
1312
+ * @description: Get jobs
1313
+ */
1314
+ getJobs({ pageNo, pageSize, sort } = {}) {
1315
+ const { error } = CommunicationValidator.getJobs().validate(
1316
+ {
1317
+ pageNo,
1318
+ pageSize,
1319
+ sort,
1320
+ },
1321
+ { abortEarly: false, allowUnknown: true }
1322
+ );
1323
+ if (error) {
1324
+ return Promise.reject(new FDKClientValidationError(error));
1325
+ }
1326
+
1327
+ // Showing warrnings if extra unknown parameters are found
1328
+ const { error: warrning } = CommunicationValidator.getJobs().validate(
1329
+ {
1330
+ pageNo,
1331
+ pageSize,
1332
+ sort,
1333
+ },
1334
+ { abortEarly: false, allowUnknown: false }
1335
+ );
1336
+ if (warrning) {
1337
+ console.log("Parameter Validation warrnings for getJobs");
1338
+ console.log(warrning);
1339
+ }
1340
+
1341
+ const query_params = {};
1342
+ query_params["page_no"] = pageNo;
1343
+ query_params["page_size"] = pageSize;
1344
+ query_params["sort"] = sort;
1345
+
1346
+ return PlatformAPIClient.execute(
1347
+ this.config,
1348
+ "get",
1349
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/jobs`,
1350
+ query_params,
1351
+ undefined
1352
+ );
1353
+ }
1354
+
1355
+ /**
1356
+ * @param {Object} arg - Arg object.
1357
+ * @param {string} arg.companyId - Company id
1358
+ * @param {string} arg.applicationId - Application id
1359
+ * @param {number} [arg.pageSize] - Current request items count
1360
+ * @param {Object} [arg.sort] - To sort based on created_at
1361
+ * @summary: Get jobs
1362
+ * @description: Get jobs
1363
+ */
1364
+ getJobsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
1365
+ const paginator = new Paginator();
1366
+ const callback = async () => {
1367
+ const pageId = paginator.nextId;
1368
+ const pageNo = paginator.pageNo;
1369
+ const pageType = "number";
1370
+ const data = await this.getJobs({
1371
+ companyId: companyId,
1372
+ applicationId: applicationId,
1373
+ pageNo: pageNo,
1374
+ pageSize: pageSize,
1375
+ sort: sort,
1376
+ });
1377
+ paginator.setPaginator({
1378
+ hasNext: data.page.has_next ? true : false,
1379
+ nextId: data.page.next_id,
1380
+ });
1381
+ return data;
1382
+ };
1383
+ paginator.setCallback(callback.bind(this));
1384
+ return paginator;
1385
+ }
1386
+
1387
+ /**
1388
+ * @param {Object} arg - Arg object.
1389
+ * @param {TriggerJobRequest} arg.body
1390
+ * @summary: Trigger campaign job
1391
+ * @description: Trigger campaign job
1392
+ */
1393
+ triggerCampaignJob({ body } = {}) {
1394
+ const { error } = CommunicationValidator.triggerCampaignJob().validate(
1395
+ {
1396
+ body,
1397
+ },
1398
+ { abortEarly: false, allowUnknown: true }
1399
+ );
1400
+ if (error) {
1401
+ return Promise.reject(new FDKClientValidationError(error));
1402
+ }
1403
+
1404
+ // Showing warrnings if extra unknown parameters are found
1405
+ const {
1406
+ error: warrning,
1407
+ } = CommunicationValidator.triggerCampaignJob().validate(
1408
+ {
1409
+ body,
1410
+ },
1411
+ { abortEarly: false, allowUnknown: false }
1412
+ );
1413
+ if (warrning) {
1414
+ console.log("Parameter Validation warrnings for triggerCampaignJob");
1415
+ console.log(warrning);
1416
+ }
1417
+
1418
+ const query_params = {};
1419
+
1420
+ return PlatformAPIClient.execute(
1421
+ this.config,
1422
+ "post",
1423
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/trigger-job`,
1424
+ query_params,
1425
+ body
1426
+ );
1427
+ }
1428
+
1429
+ /**
1430
+ * @param {Object} arg - Arg object.
1431
+ * @param {number} [arg.pageNo] - Current page no
1432
+ * @param {number} [arg.pageSize] - Current request items count
1433
+ * @param {Object} [arg.sort] - To sort based on created_at
1434
+ * @summary: Get job logs
1435
+ * @description: Get job logs
1436
+ */
1437
+ getJobLogs({ pageNo, pageSize, sort } = {}) {
1438
+ const { error } = CommunicationValidator.getJobLogs().validate(
1439
+ {
1440
+ pageNo,
1441
+ pageSize,
1442
+ sort,
1443
+ },
1444
+ { abortEarly: false, allowUnknown: true }
1445
+ );
1446
+ if (error) {
1447
+ return Promise.reject(new FDKClientValidationError(error));
1448
+ }
1449
+
1450
+ // Showing warrnings if extra unknown parameters are found
1451
+ const { error: warrning } = CommunicationValidator.getJobLogs().validate(
1452
+ {
1453
+ pageNo,
1454
+ pageSize,
1455
+ sort,
1456
+ },
1457
+ { abortEarly: false, allowUnknown: false }
1458
+ );
1459
+ if (warrning) {
1460
+ console.log("Parameter Validation warrnings for getJobLogs");
1461
+ console.log(warrning);
1462
+ }
1463
+
1464
+ const query_params = {};
1465
+ query_params["page_no"] = pageNo;
1466
+ query_params["page_size"] = pageSize;
1467
+ query_params["sort"] = sort;
1468
+
1469
+ return PlatformAPIClient.execute(
1470
+ this.config,
1471
+ "get",
1472
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/logs`,
1473
+ query_params,
1474
+ undefined
1475
+ );
1476
+ }
1477
+
1478
+ /**
1479
+ * @param {Object} arg - Arg object.
1480
+ * @param {string} arg.companyId - Company id
1481
+ * @param {string} arg.applicationId - Application id
1482
+ * @param {number} [arg.pageSize] - Current request items count
1483
+ * @param {Object} [arg.sort] - To sort based on created_at
1484
+ * @summary: Get job logs
1485
+ * @description: Get job logs
1486
+ */
1487
+ getJobLogsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
1488
+ const paginator = new Paginator();
1489
+ const callback = async () => {
1490
+ const pageId = paginator.nextId;
1491
+ const pageNo = paginator.pageNo;
1492
+ const pageType = "number";
1493
+ const data = await this.getJobLogs({
1494
+ companyId: companyId,
1495
+ applicationId: applicationId,
1496
+ pageNo: pageNo,
1497
+ pageSize: pageSize,
1498
+ sort: sort,
1499
+ });
1500
+ paginator.setPaginator({
1501
+ hasNext: data.page.has_next ? true : false,
1502
+ nextId: data.page.next_id,
1503
+ });
1504
+ return data;
1505
+ };
1506
+ paginator.setCallback(callback.bind(this));
1507
+ return paginator;
1508
+ }
1509
+
1510
+ /**
1511
+ * @param {Object} arg - Arg object.
1512
+ * @param {string} [arg.pageId] - Current page no
1513
+ * @param {number} [arg.pageSize] - Current request items count
1514
+ * @param {Object} [arg.sort] - To sort based on _id
1515
+ * @param {Object} [arg.query] -
1516
+ * @summary: Get communication logs
1517
+ * @description: Get communication logs
1518
+ */
1519
+ getCommunicationLogs({ pageId, pageSize, sort, query } = {}) {
1520
+ const { error } = CommunicationValidator.getCommunicationLogs().validate(
1521
+ {
1522
+ pageId,
1523
+ pageSize,
1524
+ sort,
1525
+ query,
1526
+ },
1527
+ { abortEarly: false, allowUnknown: true }
1528
+ );
1529
+ if (error) {
1530
+ return Promise.reject(new FDKClientValidationError(error));
1531
+ }
1532
+
1533
+ // Showing warrnings if extra unknown parameters are found
1534
+ const {
1535
+ error: warrning,
1536
+ } = CommunicationValidator.getCommunicationLogs().validate(
1537
+ {
1538
+ pageId,
1539
+ pageSize,
1540
+ sort,
1541
+ query,
1542
+ },
1543
+ { abortEarly: false, allowUnknown: false }
1544
+ );
1545
+ if (warrning) {
1546
+ console.log("Parameter Validation warrnings for getCommunicationLogs");
1547
+ console.log(warrning);
1548
+ }
1549
+
1550
+ const query_params = {};
1551
+ query_params["page_id"] = pageId;
1552
+ query_params["page_size"] = pageSize;
1553
+ query_params["sort"] = sort;
1554
+ query_params["query"] = query;
1555
+
1556
+ return PlatformAPIClient.execute(
1557
+ this.config,
1558
+ "get",
1559
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/log`,
1560
+ query_params,
1561
+ undefined
1562
+ );
1563
+ }
1564
+
1565
+ /**
1566
+ * @param {Object} arg - Arg object.
1567
+ * @param {string} arg.companyId - Company id
1568
+ * @param {string} arg.applicationId - Application id
1569
+ * @param {number} [arg.pageSize] - Current request items count
1570
+ * @param {Object} [arg.sort] - To sort based on _id
1571
+ * @param {Object} [arg.query] -
1572
+ * @summary: Get communication logs
1573
+ * @description: Get communication logs
1574
+ */
1575
+ getCommunicationLogsPaginator({
1576
+ companyId,
1577
+ applicationId,
1578
+ pageSize,
1579
+ sort,
1580
+ query,
1581
+ } = {}) {
1582
+ const paginator = new Paginator();
1583
+ const callback = async () => {
1584
+ const pageId = paginator.nextId;
1585
+ const pageNo = paginator.pageNo;
1586
+ const pageType = "cursor";
1587
+ const data = await this.getCommunicationLogs({
1588
+ companyId: companyId,
1589
+ applicationId: applicationId,
1590
+ pageId: pageId,
1591
+ pageSize: pageSize,
1592
+ sort: sort,
1593
+ query: query,
1594
+ });
1595
+ paginator.setPaginator({
1596
+ hasNext: data.page.has_next ? true : false,
1597
+ nextId: data.page.next_id,
1598
+ });
1599
+ return data;
1600
+ };
1601
+ paginator.setCallback(callback.bind(this));
1602
+ return paginator;
1603
+ }
1604
+
1605
+ /**
1606
+ * @param {Object} arg - Arg object.
1607
+ * @param {SendOtpCommsReq} arg.body
1608
+ * @summary: Send OTP using email and sms
1609
+ * @description: Send OTP Comms via email and sms
1610
+ */
1611
+ sendOtp({ body } = {}) {
1612
+ const { error } = CommunicationValidator.sendOtp().validate(
1613
+ {
1614
+ body,
1615
+ },
1616
+ { abortEarly: false, allowUnknown: true }
1617
+ );
1618
+ if (error) {
1619
+ return Promise.reject(new FDKClientValidationError(error));
1620
+ }
1621
+
1622
+ // Showing warrnings if extra unknown parameters are found
1623
+ const { error: warrning } = CommunicationValidator.sendOtp().validate(
1624
+ {
1625
+ body,
1626
+ },
1627
+ { abortEarly: false, allowUnknown: false }
1628
+ );
1629
+ if (warrning) {
1630
+ console.log("Parameter Validation warrnings for sendOtp");
1631
+ console.log(warrning);
1632
+ }
1633
+
1634
+ const query_params = {};
1635
+
1636
+ return PlatformAPIClient.execute(
1637
+ this.config,
1638
+ "post",
1639
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/otp/send-otp-comms`,
1640
+ query_params,
1641
+ body
1642
+ );
1643
+ }
1644
+
1645
+ /**
1646
+ * @param {Object} arg - Arg object.
1647
+ * @param {VerifyOtpCommsReq} arg.body
1648
+ * @summary: Verify OTP sent via email and sms
1649
+ * @description: Verify OTP sent via email and sms
1650
+ */
1651
+ verfiyOtp({ body } = {}) {
1652
+ const { error } = CommunicationValidator.verfiyOtp().validate(
1653
+ {
1654
+ body,
1655
+ },
1656
+ { abortEarly: false, allowUnknown: true }
1657
+ );
1658
+ if (error) {
1659
+ return Promise.reject(new FDKClientValidationError(error));
1660
+ }
1661
+
1662
+ // Showing warrnings if extra unknown parameters are found
1663
+ const { error: warrning } = CommunicationValidator.verfiyOtp().validate(
1664
+ {
1665
+ body,
1666
+ },
1667
+ { abortEarly: false, allowUnknown: false }
1668
+ );
1669
+ if (warrning) {
1670
+ console.log("Parameter Validation warrnings for verfiyOtp");
1671
+ console.log(warrning);
1672
+ }
1673
+
1674
+ const query_params = {};
1675
+
1676
+ return PlatformAPIClient.execute(
1677
+ this.config,
1678
+ "post",
1679
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/otp/verify-otp-comms`,
1680
+ query_params,
1681
+ body
1682
+ );
1683
+ }
1684
+
1685
+ /**
1686
+ * @param {Object} arg - Arg object.
1687
+ * @param {number} [arg.pageNo] - Current page no
1688
+ * @param {number} [arg.pageSize] - Current request items count
1689
+ * @param {Object} [arg.sort] - To sort based on created_at
1690
+ * @summary: Get sms providers
1691
+ * @description: Get sms providers
1692
+ */
1693
+ getSmsProviders({ pageNo, pageSize, sort } = {}) {
1694
+ const { error } = CommunicationValidator.getSmsProviders().validate(
1695
+ {
1696
+ pageNo,
1697
+ pageSize,
1698
+ sort,
1699
+ },
1700
+ { abortEarly: false, allowUnknown: true }
1701
+ );
1702
+ if (error) {
1703
+ return Promise.reject(new FDKClientValidationError(error));
1704
+ }
1705
+
1706
+ // Showing warrnings if extra unknown parameters are found
1707
+ const {
1708
+ error: warrning,
1709
+ } = CommunicationValidator.getSmsProviders().validate(
1710
+ {
1711
+ pageNo,
1712
+ pageSize,
1713
+ sort,
1714
+ },
1715
+ { abortEarly: false, allowUnknown: false }
1716
+ );
1717
+ if (warrning) {
1718
+ console.log("Parameter Validation warrnings for getSmsProviders");
1719
+ console.log(warrning);
1720
+ }
1721
+
1722
+ const query_params = {};
1723
+ query_params["page_no"] = pageNo;
1724
+ query_params["page_size"] = pageSize;
1725
+ query_params["sort"] = sort;
1726
+
1727
+ return PlatformAPIClient.execute(
1728
+ this.config,
1729
+ "get",
1730
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers`,
1731
+ query_params,
1732
+ undefined
1733
+ );
1734
+ }
1735
+
1736
+ /**
1737
+ * @param {Object} arg - Arg object.
1738
+ * @param {string} arg.companyId - Company id
1739
+ * @param {string} arg.applicationId - Application id
1740
+ * @param {number} [arg.pageSize] - Current request items count
1741
+ * @param {Object} [arg.sort] - To sort based on created_at
1742
+ * @summary: Get sms providers
1743
+ * @description: Get sms providers
1744
+ */
1745
+ getSmsProvidersPaginator({ companyId, applicationId, pageSize, sort } = {}) {
1746
+ const paginator = new Paginator();
1747
+ const callback = async () => {
1748
+ const pageId = paginator.nextId;
1749
+ const pageNo = paginator.pageNo;
1750
+ const pageType = "number";
1751
+ const data = await this.getSmsProviders({
1752
+ companyId: companyId,
1753
+ applicationId: applicationId,
1754
+ pageNo: pageNo,
1755
+ pageSize: pageSize,
1756
+ sort: sort,
1757
+ });
1758
+ paginator.setPaginator({
1759
+ hasNext: data.page.has_next ? true : false,
1760
+ nextId: data.page.next_id,
1761
+ });
1762
+ return data;
1763
+ };
1764
+ paginator.setCallback(callback.bind(this));
1765
+ return paginator;
1766
+ }
1767
+
1768
+ /**
1769
+ * @param {Object} arg - Arg object.
1770
+ * @param {SmsProviderReq} arg.body
1771
+ * @summary: Create sms provider
1772
+ * @description: Create sms provider
1773
+ */
1774
+ createSmsProvider({ body } = {}) {
1775
+ const { error } = CommunicationValidator.createSmsProvider().validate(
1776
+ {
1777
+ body,
1778
+ },
1779
+ { abortEarly: false, allowUnknown: true }
1780
+ );
1781
+ if (error) {
1782
+ return Promise.reject(new FDKClientValidationError(error));
1783
+ }
1784
+
1785
+ // Showing warrnings if extra unknown parameters are found
1786
+ const {
1787
+ error: warrning,
1788
+ } = CommunicationValidator.createSmsProvider().validate(
1789
+ {
1790
+ body,
1791
+ },
1792
+ { abortEarly: false, allowUnknown: false }
1793
+ );
1794
+ if (warrning) {
1795
+ console.log("Parameter Validation warrnings for createSmsProvider");
1796
+ console.log(warrning);
1797
+ }
1798
+
1799
+ const query_params = {};
1800
+
1801
+ return PlatformAPIClient.execute(
1802
+ this.config,
1803
+ "post",
1804
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers`,
1805
+ query_params,
1806
+ body
1807
+ );
1808
+ }
1809
+
1810
+ /**
1811
+ * @param {Object} arg - Arg object.
1812
+ * @param {string} arg.id - Sms provider id
1813
+ * @summary: Get sms provider by id
1814
+ * @description: Get sms provider by id
1815
+ */
1816
+ getSmsProviderById({ id } = {}) {
1817
+ const { error } = CommunicationValidator.getSmsProviderById().validate(
1818
+ {
1819
+ id,
1820
+ },
1821
+ { abortEarly: false, allowUnknown: true }
1822
+ );
1823
+ if (error) {
1824
+ return Promise.reject(new FDKClientValidationError(error));
1825
+ }
1826
+
1827
+ // Showing warrnings if extra unknown parameters are found
1828
+ const {
1829
+ error: warrning,
1830
+ } = CommunicationValidator.getSmsProviderById().validate(
1831
+ {
1832
+ id,
1833
+ },
1834
+ { abortEarly: false, allowUnknown: false }
1835
+ );
1836
+ if (warrning) {
1837
+ console.log("Parameter Validation warrnings for getSmsProviderById");
1838
+ console.log(warrning);
1839
+ }
1840
+
1841
+ const query_params = {};
1842
+
1843
+ return PlatformAPIClient.execute(
1844
+ this.config,
1845
+ "get",
1846
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers/${id}`,
1847
+ query_params,
1848
+ undefined
1849
+ );
1850
+ }
1851
+
1852
+ /**
1853
+ * @param {Object} arg - Arg object.
1854
+ * @param {string} arg.id - Sms provider id
1855
+ * @param {SmsProviderReq} arg.body
1856
+ * @summary: Update sms provider by id
1857
+ * @description: Update sms provider by id
1858
+ */
1859
+ updateSmsProviderById({ id, body } = {}) {
1860
+ const { error } = CommunicationValidator.updateSmsProviderById().validate(
1861
+ {
1862
+ id,
1863
+ body,
1864
+ },
1865
+ { abortEarly: false, allowUnknown: true }
1866
+ );
1867
+ if (error) {
1868
+ return Promise.reject(new FDKClientValidationError(error));
1869
+ }
1870
+
1871
+ // Showing warrnings if extra unknown parameters are found
1872
+ const {
1873
+ error: warrning,
1874
+ } = CommunicationValidator.updateSmsProviderById().validate(
1875
+ {
1876
+ id,
1877
+ body,
1878
+ },
1879
+ { abortEarly: false, allowUnknown: false }
1880
+ );
1881
+ if (warrning) {
1882
+ console.log("Parameter Validation warrnings for updateSmsProviderById");
1883
+ console.log(warrning);
1884
+ }
1885
+
1886
+ const query_params = {};
1887
+
1888
+ return PlatformAPIClient.execute(
1889
+ this.config,
1890
+ "put",
1891
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers/${id}`,
1892
+ query_params,
1893
+ body
1894
+ );
1895
+ }
1896
+
1897
+ /**
1898
+ * @param {Object} arg - Arg object.
1899
+ * @param {number} [arg.pageNo] - Current page no
1900
+ * @param {number} [arg.pageSize] - Current request items count
1901
+ * @param {Object} [arg.sort] - To sort based on created_at
1902
+ * @summary: Get sms templates
1903
+ * @description: Get sms templates
1904
+ */
1905
+ getSmsTemplates({ pageNo, pageSize, sort } = {}) {
1906
+ const { error } = CommunicationValidator.getSmsTemplates().validate(
1907
+ {
1908
+ pageNo,
1909
+ pageSize,
1910
+ sort,
1911
+ },
1912
+ { abortEarly: false, allowUnknown: true }
1913
+ );
1914
+ if (error) {
1915
+ return Promise.reject(new FDKClientValidationError(error));
1916
+ }
1917
+
1918
+ // Showing warrnings if extra unknown parameters are found
1919
+ const {
1920
+ error: warrning,
1921
+ } = CommunicationValidator.getSmsTemplates().validate(
1922
+ {
1923
+ pageNo,
1924
+ pageSize,
1925
+ sort,
1926
+ },
1927
+ { abortEarly: false, allowUnknown: false }
1928
+ );
1929
+ if (warrning) {
1930
+ console.log("Parameter Validation warrnings for getSmsTemplates");
1931
+ console.log(warrning);
1932
+ }
1933
+
1934
+ const query_params = {};
1935
+ query_params["page_no"] = pageNo;
1936
+ query_params["page_size"] = pageSize;
1937
+ query_params["sort"] = sort;
1938
+
1939
+ return PlatformAPIClient.execute(
1940
+ this.config,
1941
+ "get",
1942
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates`,
1943
+ query_params,
1944
+ undefined
1945
+ );
1946
+ }
1947
+
1948
+ /**
1949
+ * @param {Object} arg - Arg object.
1950
+ * @param {string} arg.companyId - Company id
1951
+ * @param {string} arg.applicationId - Application id
1952
+ * @param {number} [arg.pageSize] - Current request items count
1953
+ * @param {Object} [arg.sort] - To sort based on created_at
1954
+ * @summary: Get sms templates
1955
+ * @description: Get sms templates
1956
+ */
1957
+ getSmsTemplatesPaginator({ companyId, applicationId, pageSize, sort } = {}) {
1958
+ const paginator = new Paginator();
1959
+ const callback = async () => {
1960
+ const pageId = paginator.nextId;
1961
+ const pageNo = paginator.pageNo;
1962
+ const pageType = "number";
1963
+ const data = await this.getSmsTemplates({
1964
+ companyId: companyId,
1965
+ applicationId: applicationId,
1966
+ pageNo: pageNo,
1967
+ pageSize: pageSize,
1968
+ sort: sort,
1969
+ });
1970
+ paginator.setPaginator({
1971
+ hasNext: data.page.has_next ? true : false,
1972
+ nextId: data.page.next_id,
1973
+ });
1974
+ return data;
1975
+ };
1976
+ paginator.setCallback(callback.bind(this));
1977
+ return paginator;
1978
+ }
1979
+
1980
+ /**
1981
+ * @param {Object} arg - Arg object.
1982
+ * @param {SmsTemplateReq} arg.body
1983
+ * @summary: Create sms template
1984
+ * @description: Create sms template
1985
+ */
1986
+ createSmsTemplate({ body } = {}) {
1987
+ const { error } = CommunicationValidator.createSmsTemplate().validate(
1988
+ {
1989
+ body,
1990
+ },
1991
+ { abortEarly: false, allowUnknown: true }
1992
+ );
1993
+ if (error) {
1994
+ return Promise.reject(new FDKClientValidationError(error));
1995
+ }
1996
+
1997
+ // Showing warrnings if extra unknown parameters are found
1998
+ const {
1999
+ error: warrning,
2000
+ } = CommunicationValidator.createSmsTemplate().validate(
2001
+ {
2002
+ body,
2003
+ },
2004
+ { abortEarly: false, allowUnknown: false }
2005
+ );
2006
+ if (warrning) {
2007
+ console.log("Parameter Validation warrnings for createSmsTemplate");
2008
+ console.log(warrning);
2009
+ }
2010
+
2011
+ const query_params = {};
2012
+
2013
+ return PlatformAPIClient.execute(
2014
+ this.config,
2015
+ "post",
2016
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates`,
2017
+ query_params,
2018
+ body
2019
+ );
2020
+ }
2021
+
2022
+ /**
2023
+ * @param {Object} arg - Arg object.
2024
+ * @param {string} arg.id - Sms template id
2025
+ * @summary: Get sms template by id
2026
+ * @description: Get sms template by id
2027
+ */
2028
+ getSmsTemplateById({ id } = {}) {
2029
+ const { error } = CommunicationValidator.getSmsTemplateById().validate(
2030
+ {
2031
+ id,
2032
+ },
2033
+ { abortEarly: false, allowUnknown: true }
2034
+ );
2035
+ if (error) {
2036
+ return Promise.reject(new FDKClientValidationError(error));
2037
+ }
2038
+
2039
+ // Showing warrnings if extra unknown parameters are found
2040
+ const {
2041
+ error: warrning,
2042
+ } = CommunicationValidator.getSmsTemplateById().validate(
2043
+ {
2044
+ id,
2045
+ },
2046
+ { abortEarly: false, allowUnknown: false }
2047
+ );
2048
+ if (warrning) {
2049
+ console.log("Parameter Validation warrnings for getSmsTemplateById");
2050
+ console.log(warrning);
2051
+ }
2052
+
2053
+ const query_params = {};
2054
+
2055
+ return PlatformAPIClient.execute(
2056
+ this.config,
2057
+ "get",
2058
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
2059
+ query_params,
2060
+ undefined
2061
+ );
2062
+ }
2063
+
2064
+ /**
2065
+ * @param {Object} arg - Arg object.
2066
+ * @param {string} arg.id - Sms template id
2067
+ * @param {SmsTemplateReq} arg.body
2068
+ * @summary: Update sms template by id
2069
+ * @description: Update sms template by id
2070
+ */
2071
+ updateSmsTemplateById({ id, body } = {}) {
2072
+ const { error } = CommunicationValidator.updateSmsTemplateById().validate(
2073
+ {
2074
+ id,
2075
+ body,
2076
+ },
2077
+ { abortEarly: false, allowUnknown: true }
2078
+ );
2079
+ if (error) {
2080
+ return Promise.reject(new FDKClientValidationError(error));
2081
+ }
2082
+
2083
+ // Showing warrnings if extra unknown parameters are found
2084
+ const {
2085
+ error: warrning,
2086
+ } = CommunicationValidator.updateSmsTemplateById().validate(
2087
+ {
2088
+ id,
2089
+ body,
2090
+ },
2091
+ { abortEarly: false, allowUnknown: false }
2092
+ );
2093
+ if (warrning) {
2094
+ console.log("Parameter Validation warrnings for updateSmsTemplateById");
2095
+ console.log(warrning);
2096
+ }
2097
+
2098
+ const query_params = {};
2099
+
2100
+ return PlatformAPIClient.execute(
2101
+ this.config,
2102
+ "put",
2103
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
2104
+ query_params,
2105
+ body
2106
+ );
2107
+ }
2108
+
2109
+ /**
2110
+ * @param {Object} arg - Arg object.
2111
+ * @param {string} arg.id - Sms template id
2112
+ * @summary: Delete sms template by id
2113
+ * @description: Delete sms template by id
2114
+ */
2115
+ deleteSmsTemplateById({ id } = {}) {
2116
+ const { error } = CommunicationValidator.deleteSmsTemplateById().validate(
2117
+ {
2118
+ id,
2119
+ },
2120
+ { abortEarly: false, allowUnknown: true }
2121
+ );
2122
+ if (error) {
2123
+ return Promise.reject(new FDKClientValidationError(error));
2124
+ }
2125
+
2126
+ // Showing warrnings if extra unknown parameters are found
2127
+ const {
2128
+ error: warrning,
2129
+ } = CommunicationValidator.deleteSmsTemplateById().validate(
2130
+ {
2131
+ id,
2132
+ },
2133
+ { abortEarly: false, allowUnknown: false }
2134
+ );
2135
+ if (warrning) {
2136
+ console.log("Parameter Validation warrnings for deleteSmsTemplateById");
2137
+ console.log(warrning);
2138
+ }
2139
+
2140
+ const query_params = {};
2141
+
2142
+ return PlatformAPIClient.execute(
2143
+ this.config,
2144
+ "delete",
2145
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
2146
+ query_params,
2147
+ undefined
2148
+ );
2149
+ }
2150
+
2151
+ /**
2152
+ * @param {Object} arg - Arg object.
2153
+ * @param {number} [arg.pageNo] - Current page no
2154
+ * @param {number} [arg.pageSize] - Current request items count
2155
+ * @param {Object} [arg.sort] - To sort based on created_at
2156
+ * @summary: Get system sms templates
2157
+ * @description: Get system sms templates
2158
+ */
2159
+ getSystemSystemTemplates({ pageNo, pageSize, sort } = {}) {
2160
+ const {
2161
+ error,
2162
+ } = CommunicationValidator.getSystemSystemTemplates().validate(
2163
+ {
2164
+ pageNo,
2165
+ pageSize,
2166
+ sort,
2167
+ },
2168
+ { abortEarly: false, allowUnknown: true }
2169
+ );
2170
+ if (error) {
2171
+ return Promise.reject(new FDKClientValidationError(error));
2172
+ }
2173
+
2174
+ // Showing warrnings if extra unknown parameters are found
2175
+ const {
2176
+ error: warrning,
2177
+ } = CommunicationValidator.getSystemSystemTemplates().validate(
2178
+ {
2179
+ pageNo,
2180
+ pageSize,
2181
+ sort,
2182
+ },
2183
+ { abortEarly: false, allowUnknown: false }
2184
+ );
2185
+ if (warrning) {
2186
+ console.log(
2187
+ "Parameter Validation warrnings for getSystemSystemTemplates"
2188
+ );
2189
+ console.log(warrning);
2190
+ }
2191
+
2192
+ const query_params = {};
2193
+ query_params["page_no"] = pageNo;
2194
+ query_params["page_size"] = pageSize;
2195
+ query_params["sort"] = sort;
2196
+
2197
+ return PlatformAPIClient.execute(
2198
+ this.config,
2199
+ "get",
2200
+ `/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/system-templates`,
2201
+ query_params,
2202
+ undefined
2203
+ );
2204
+ }
2205
+
2206
+ /**
2207
+ * @param {Object} arg - Arg object.
2208
+ * @param {string} arg.companyId - Company id
2209
+ * @param {string} arg.applicationId - Application id
2210
+ * @param {number} [arg.pageSize] - Current request items count
2211
+ * @param {Object} [arg.sort] - To sort based on created_at
2212
+ * @summary: Get system sms templates
2213
+ * @description: Get system sms templates
2214
+ */
2215
+ getSystemSystemTemplatesPaginator({
2216
+ companyId,
2217
+ applicationId,
2218
+ pageSize,
2219
+ sort,
2220
+ } = {}) {
2221
+ const paginator = new Paginator();
2222
+ const callback = async () => {
2223
+ const pageId = paginator.nextId;
2224
+ const pageNo = paginator.pageNo;
2225
+ const pageType = "number";
2226
+ const data = await this.getSystemSystemTemplates({
2227
+ companyId: companyId,
2228
+ applicationId: applicationId,
2229
+ pageNo: pageNo,
2230
+ pageSize: pageSize,
2231
+ sort: sort,
2232
+ });
2233
+ paginator.setPaginator({
2234
+ hasNext: data.page.has_next ? true : false,
2235
+ nextId: data.page.next_id,
2236
+ });
2237
+ return data;
2238
+ };
2239
+ paginator.setCallback(callback.bind(this));
2240
+ return paginator;
2241
+ }
2242
+ }
2243
+ module.exports = Communication;