@gofynd/fdk-client-javascript 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/documentation/application/CART.md +5934 -4502
  2. package/documentation/application/CATALOG.md +6338 -7245
  3. package/documentation/application/COMMON.md +95 -222
  4. package/documentation/application/COMMUNICATION.md +106 -186
  5. package/documentation/application/CONFIGURATION.md +903 -1597
  6. package/documentation/application/CONTENT.md +562 -1270
  7. package/documentation/application/FILESTORAGE.md +84 -220
  8. package/documentation/application/LEAD.md +314 -660
  9. package/documentation/application/LOGISTIC.md +229 -305
  10. package/documentation/application/ORDER.md +642 -1137
  11. package/documentation/application/PAYMENT.md +2285 -3031
  12. package/documentation/application/POSCART.md +6079 -4642
  13. package/documentation/application/REWARDS.md +94 -248
  14. package/documentation/application/SHARE.md +152 -250
  15. package/documentation/application/THEME.md +952 -1235
  16. package/documentation/application/USER.md +1228 -1765
  17. package/documentation/platform/ANALYTICS.md +207 -349
  18. package/documentation/platform/AUDITTRAIL.md +121 -204
  19. package/documentation/platform/BILLING.md +865 -1376
  20. package/documentation/platform/CART.md +2814 -3662
  21. package/documentation/platform/CATALOG.md +15266 -17619
  22. package/documentation/platform/COMMON.md +95 -222
  23. package/documentation/platform/COMMUNICATION.md +1632 -2380
  24. package/documentation/platform/COMPANYPROFILE.md +572 -957
  25. package/documentation/platform/CONFIGURATION.md +3050 -4073
  26. package/documentation/platform/CONTENT.md +3509 -4121
  27. package/documentation/platform/DISCOUNT.md +140 -236
  28. package/documentation/platform/FILESTORAGE.md +187 -323
  29. package/documentation/platform/INVENTORY.md +268 -911
  30. package/documentation/platform/LEAD.md +2195 -2541
  31. package/documentation/platform/ORDER.md +3750 -5636
  32. package/documentation/platform/PARTNER.md +9 -36
  33. package/documentation/platform/PAYMENT.md +903 -1213
  34. package/documentation/platform/REWARDS.md +183 -347
  35. package/documentation/platform/SHARE.md +120 -213
  36. package/documentation/platform/THEME.md +12956 -13239
  37. package/documentation/platform/USER.md +975 -1120
  38. package/documentation/platform/WEBHOOK.md +78 -184
  39. package/documentation/public/CONFIGURATION.md +95 -222
  40. package/documentation/public/INVENTORY.md +100 -282
  41. package/documentation/public/WEBHOOK.md +27 -133
  42. package/package.json +1 -1
  43. package/sdk/application/ApplicationConfig.js +1 -1
  44. package/sdk/application/Cart/CartApplicationClient.d.ts +243 -243
  45. package/sdk/application/Cart/CartApplicationClient.js +1058 -547
  46. package/sdk/application/Cart/CartApplicationModel.d.ts +64 -63
  47. package/sdk/application/Cart/CartApplicationModel.js +489 -886
  48. package/sdk/application/Cart/CartApplicationValidator.d.ts +17 -17
  49. package/sdk/application/Cart/CartApplicationValidator.js +98 -98
  50. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +358 -358
  51. package/sdk/application/Catalog/CatalogApplicationClient.js +1545 -949
  52. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +90 -90
  53. package/sdk/application/Catalog/CatalogApplicationModel.js +692 -1258
  54. package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +19 -19
  55. package/sdk/application/Catalog/CatalogApplicationValidator.js +110 -110
  56. package/sdk/application/Common/CommonApplicationClient.d.ts +13 -13
  57. package/sdk/application/Common/CommonApplicationClient.js +76 -36
  58. package/sdk/application/Common/CommonApplicationModel.d.ts +12 -12
  59. package/sdk/application/Common/CommonApplicationModel.js +83 -160
  60. package/sdk/application/Common/CommonApplicationValidator.d.ts +1 -1
  61. package/sdk/application/Common/CommonApplicationValidator.js +6 -6
  62. package/sdk/application/Communication/CommunicationApplicationClient.d.ts +11 -11
  63. package/sdk/application/Communication/CommunicationApplicationClient.js +92 -31
  64. package/sdk/application/Communication/CommunicationApplicationModel.d.ts +6 -6
  65. package/sdk/application/Communication/CommunicationApplicationModel.js +38 -83
  66. package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +1 -1
  67. package/sdk/application/Communication/CommunicationApplicationValidator.js +4 -4
  68. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +116 -116
  69. package/sdk/application/Configuration/ConfigurationApplicationClient.js +638 -312
  70. package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +85 -85
  71. package/sdk/application/Configuration/ConfigurationApplicationModel.js +480 -851
  72. package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +8 -8
  73. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +33 -33
  74. package/sdk/application/Content/ContentApplicationClient.d.ts +67 -67
  75. package/sdk/application/Content/ContentApplicationClient.js +581 -213
  76. package/sdk/application/Content/ContentApplicationModel.d.ts +76 -75
  77. package/sdk/application/Content/ContentApplicationModel.js +468 -875
  78. package/sdk/application/Content/ContentApplicationValidator.d.ts +5 -5
  79. package/sdk/application/Content/ContentApplicationValidator.js +24 -24
  80. package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +25 -25
  81. package/sdk/application/FileStorage/FileStorageApplicationClient.js +121 -59
  82. package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +13 -13
  83. package/sdk/application/FileStorage/FileStorageApplicationModel.js +86 -169
  84. package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +1 -1
  85. package/sdk/application/FileStorage/FileStorageApplicationValidator.js +7 -7
  86. package/sdk/application/Lead/LeadApplicationClient.d.ts +24 -24
  87. package/sdk/application/Lead/LeadApplicationClient.js +230 -96
  88. package/sdk/application/Lead/LeadApplicationModel.d.ts +35 -35
  89. package/sdk/application/Lead/LeadApplicationModel.js +267 -474
  90. package/sdk/application/Lead/LeadApplicationValidator.d.ts +2 -2
  91. package/sdk/application/Lead/LeadApplicationValidator.js +11 -11
  92. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +30 -19
  93. package/sdk/application/Logistic/LogisticApplicationClient.js +196 -47
  94. package/sdk/application/Logistic/LogisticApplicationModel.d.ts +17 -14
  95. package/sdk/application/Logistic/LogisticApplicationModel.js +133 -201
  96. package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +3 -2
  97. package/sdk/application/Logistic/LogisticApplicationValidator.js +14 -8
  98. package/sdk/application/Order/OrderApplicationClient.d.ts +86 -86
  99. package/sdk/application/Order/OrderApplicationClient.js +448 -215
  100. package/sdk/application/Order/OrderApplicationModel.d.ts +50 -50
  101. package/sdk/application/Order/OrderApplicationModel.js +357 -661
  102. package/sdk/application/Order/OrderApplicationValidator.d.ts +7 -7
  103. package/sdk/application/Order/OrderApplicationValidator.js +28 -28
  104. package/sdk/application/Payment/PaymentApplicationClient.d.ts +318 -318
  105. package/sdk/application/Payment/PaymentApplicationClient.js +1525 -750
  106. package/sdk/application/Payment/PaymentApplicationModel.d.ts +72 -72
  107. package/sdk/application/Payment/PaymentApplicationModel.js +565 -1033
  108. package/sdk/application/Payment/PaymentApplicationValidator.d.ts +28 -28
  109. package/sdk/application/Payment/PaymentApplicationValidator.js +107 -107
  110. package/sdk/application/PosCart/PosCartApplicationClient.d.ts +254 -254
  111. package/sdk/application/PosCart/PosCartApplicationClient.js +1137 -606
  112. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +61 -60
  113. package/sdk/application/PosCart/PosCartApplicationModel.js +477 -873
  114. package/sdk/application/PosCart/PosCartApplicationValidator.d.ts +18 -18
  115. package/sdk/application/PosCart/PosCartApplicationValidator.js +103 -103
  116. package/sdk/application/Rewards/RewardsApplicationClient.d.ts +27 -27
  117. package/sdk/application/Rewards/RewardsApplicationClient.js +253 -113
  118. package/sdk/application/Rewards/RewardsApplicationModel.d.ts +14 -14
  119. package/sdk/application/Rewards/RewardsApplicationModel.js +96 -191
  120. package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +3 -3
  121. package/sdk/application/Rewards/RewardsApplicationValidator.js +12 -12
  122. package/sdk/application/Share/ShareApplicationClient.d.ts +37 -37
  123. package/sdk/application/Share/ShareApplicationClient.js +221 -96
  124. package/sdk/application/Share/ShareApplicationModel.d.ts +8 -8
  125. package/sdk/application/Share/ShareApplicationModel.js +63 -123
  126. package/sdk/application/Share/ShareApplicationValidator.d.ts +4 -4
  127. package/sdk/application/Share/ShareApplicationValidator.js +12 -12
  128. package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -8
  129. package/sdk/application/Theme/ThemeApplicationClient.js +115 -37
  130. package/sdk/application/Theme/ThemeApplicationModel.d.ts +34 -34
  131. package/sdk/application/Theme/ThemeApplicationModel.js +190 -336
  132. package/sdk/application/Theme/ThemeApplicationValidator.d.ts +1 -1
  133. package/sdk/application/Theme/ThemeApplicationValidator.js +4 -4
  134. package/sdk/application/User/UserApplicationClient.d.ts +280 -280
  135. package/sdk/application/User/UserApplicationClient.js +1201 -543
  136. package/sdk/application/User/UserApplicationModel.d.ts +79 -72
  137. package/sdk/application/User/UserApplicationModel.js +440 -689
  138. package/sdk/application/User/UserApplicationValidator.d.ts +24 -24
  139. package/sdk/application/User/UserApplicationValidator.js +89 -89
  140. package/sdk/common/AxiosHelper.js +1 -1
  141. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +55 -47
  142. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +308 -151
  143. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +6 -6
  144. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +20 -20
  145. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  146. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
  147. package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +11 -11
  148. package/sdk/platform/Analytics/AnalyticsPlatformModel.js +95 -178
  149. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +16 -12
  150. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +131 -44
  151. package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +10 -10
  152. package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +50 -89
  153. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.d.ts +1 -1
  154. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +6 -6
  155. package/sdk/platform/Billing/BillingPlatformClient.d.ts +68 -56
  156. package/sdk/platform/Billing/BillingPlatformClient.js +416 -171
  157. package/sdk/platform/Billing/BillingPlatformModel.d.ts +40 -40
  158. package/sdk/platform/Billing/BillingPlatformModel.js +342 -668
  159. package/sdk/platform/Billing/BillingPlatformValidator.d.ts +8 -8
  160. package/sdk/platform/Billing/BillingPlatformValidator.js +25 -25
  161. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +176 -159
  162. package/sdk/platform/Cart/CartPlatformApplicationClient.js +837 -500
  163. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +11 -11
  164. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +63 -63
  165. package/sdk/platform/Cart/CartPlatformModel.d.ts +86 -85
  166. package/sdk/platform/Cart/CartPlatformModel.js +677 -1211
  167. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +582 -529
  168. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2642 -1533
  169. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +40 -40
  170. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +175 -175
  171. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +708 -590
  172. package/sdk/platform/Catalog/CatalogPlatformClient.js +3103 -1362
  173. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +293 -284
  174. package/sdk/platform/Catalog/CatalogPlatformModel.js +2149 -3660
  175. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +66 -64
  176. package/sdk/platform/Catalog/CatalogPlatformValidator.js +235 -216
  177. package/sdk/platform/Common/CommonPlatformClient.d.ts +14 -12
  178. package/sdk/platform/Common/CommonPlatformClient.js +80 -37
  179. package/sdk/platform/Common/CommonPlatformModel.d.ts +12 -12
  180. package/sdk/platform/Common/CommonPlatformModel.js +83 -160
  181. package/sdk/platform/Common/CommonPlatformValidator.d.ts +1 -1
  182. package/sdk/platform/Common/CommonPlatformValidator.js +6 -6
  183. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +333 -293
  184. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1687 -855
  185. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +30 -30
  186. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +87 -87
  187. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  188. package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
  189. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +67 -67
  190. package/sdk/platform/Communication/CommunicationPlatformModel.js +522 -974
  191. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +70 -57
  192. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +463 -182
  193. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +28 -28
  194. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +294 -557
  195. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +7 -7
  196. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +24 -24
  197. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +175 -137
  198. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1168 -521
  199. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +22 -21
  200. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +69 -63
  201. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +137 -119
  202. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +691 -316
  203. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +148 -146
  204. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +854 -1508
  205. package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +9 -9
  206. package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +38 -38
  207. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +542 -461
  208. package/sdk/platform/Content/ContentPlatformApplicationClient.js +2600 -1160
  209. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +50 -49
  210. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +159 -152
  211. package/sdk/platform/Content/ContentPlatformModel.d.ts +79 -75
  212. package/sdk/platform/Content/ContentPlatformModel.js +486 -867
  213. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +72 -61
  214. package/sdk/platform/Discount/DiscountPlatformClient.js +424 -198
  215. package/sdk/platform/Discount/DiscountPlatformModel.d.ts +7 -7
  216. package/sdk/platform/Discount/DiscountPlatformModel.js +60 -121
  217. package/sdk/platform/Discount/DiscountPlatformValidator.d.ts +6 -6
  218. package/sdk/platform/Discount/DiscountPlatformValidator.js +29 -29
  219. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +26 -22
  220. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +145 -59
  221. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +1 -1
  222. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +8 -8
  223. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +58 -52
  224. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +240 -114
  225. package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +13 -13
  226. package/sdk/platform/FileStorage/FileStoragePlatformModel.js +86 -169
  227. package/sdk/platform/FileStorage/FileStoragePlatformValidator.d.ts +3 -3
  228. package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +11 -11
  229. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +76 -63
  230. package/sdk/platform/Inventory/InventoryPlatformClient.js +461 -197
  231. package/sdk/platform/Inventory/InventoryPlatformModel.d.ts +30 -30
  232. package/sdk/platform/Inventory/InventoryPlatformModel.js +497 -964
  233. package/sdk/platform/Inventory/InventoryPlatformValidator.d.ts +7 -7
  234. package/sdk/platform/Inventory/InventoryPlatformValidator.js +28 -28
  235. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +84 -71
  236. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +441 -182
  237. package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +7 -7
  238. package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +28 -28
  239. package/sdk/platform/Lead/LeadPlatformClient.d.ts +86 -75
  240. package/sdk/platform/Lead/LeadPlatformClient.js +434 -212
  241. package/sdk/platform/Lead/LeadPlatformModel.d.ts +35 -35
  242. package/sdk/platform/Lead/LeadPlatformModel.js +267 -474
  243. package/sdk/platform/Lead/LeadPlatformValidator.d.ts +6 -6
  244. package/sdk/platform/Lead/LeadPlatformValidator.js +24 -24
  245. package/sdk/platform/OAuthClient.js +8 -8
  246. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +14 -11
  247. package/sdk/platform/Order/OrderPlatformApplicationClient.js +113 -49
  248. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -1
  249. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +6 -6
  250. package/sdk/platform/Order/OrderPlatformClient.d.ts +367 -315
  251. package/sdk/platform/Order/OrderPlatformClient.js +1775 -893
  252. package/sdk/platform/Order/OrderPlatformModel.d.ts +198 -192
  253. package/sdk/platform/Order/OrderPlatformModel.js +1591 -2822
  254. package/sdk/platform/Order/OrderPlatformValidator.d.ts +32 -32
  255. package/sdk/platform/Order/OrderPlatformValidator.js +160 -155
  256. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  257. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
  258. package/sdk/platform/Partner/PartnerPlatformModel.js +6 -22
  259. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +65 -54
  260. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +395 -164
  261. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +6 -6
  262. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +23 -23
  263. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +55 -45
  264. package/sdk/platform/Payment/PaymentPlatformClient.js +362 -147
  265. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +27 -27
  266. package/sdk/platform/Payment/PaymentPlatformModel.js +220 -408
  267. package/sdk/platform/Payment/PaymentPlatformValidator.d.ts +4 -4
  268. package/sdk/platform/Payment/PaymentPlatformValidator.js +21 -21
  269. package/sdk/platform/PlatformApplicationClient.d.ts +1496 -10153
  270. package/sdk/platform/PlatformApplicationClient.js +1584 -13691
  271. package/sdk/platform/PlatformClient.d.ts +7918 -7666
  272. package/sdk/platform/PlatformClient.js +8701 -9926
  273. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +91 -78
  274. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +507 -253
  275. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +8 -8
  276. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +34 -34
  277. package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +15 -15
  278. package/sdk/platform/Rewards/RewardsPlatformModel.js +92 -194
  279. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +16 -12
  280. package/sdk/platform/Share/SharePlatformApplicationClient.js +130 -52
  281. package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +1 -1
  282. package/sdk/platform/Share/SharePlatformApplicationValidator.js +6 -6
  283. package/sdk/platform/Share/SharePlatformModel.d.ts +8 -8
  284. package/sdk/platform/Share/SharePlatformModel.js +60 -118
  285. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +148 -124
  286. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +770 -295
  287. package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +15 -15
  288. package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +44 -44
  289. package/sdk/platform/Theme/ThemePlatformModel.d.ts +34 -34
  290. package/sdk/platform/Theme/ThemePlatformModel.js +190 -336
  291. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +146 -67
  292. package/sdk/platform/User/UserPlatformApplicationClient.js +742 -155
  293. package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +12 -7
  294. package/sdk/platform/User/UserPlatformApplicationValidator.js +61 -23
  295. package/sdk/platform/User/UserPlatformModel.d.ts +79 -72
  296. package/sdk/platform/User/UserPlatformModel.js +440 -689
  297. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +35 -29
  298. package/sdk/platform/Webhook/WebhookPlatformClient.js +218 -91
  299. package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +7 -7
  300. package/sdk/platform/Webhook/WebhookPlatformModel.js +68 -136
  301. package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +3 -3
  302. package/sdk/platform/Webhook/WebhookPlatformValidator.js +14 -14
  303. package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +13 -13
  304. package/sdk/public/Configuration/ConfigurationPublicClient.js +81 -38
  305. package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +12 -12
  306. package/sdk/public/Configuration/ConfigurationPublicModel.js +85 -162
  307. package/sdk/public/Configuration/ConfigurationPublicValidator.d.ts +1 -1
  308. package/sdk/public/Configuration/ConfigurationPublicValidator.js +6 -6
  309. package/sdk/public/Inventory/InventoryPublicClient.d.ts +34 -34
  310. package/sdk/public/Inventory/InventoryPublicClient.js +228 -105
  311. package/sdk/public/Inventory/InventoryPublicModel.d.ts +10 -10
  312. package/sdk/public/Inventory/InventoryPublicModel.js +119 -245
  313. package/sdk/public/Inventory/InventoryPublicValidator.d.ts +3 -3
  314. package/sdk/public/Inventory/InventoryPublicValidator.js +15 -15
  315. package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
  316. package/sdk/public/Webhook/WebhookPublicModel.d.ts +7 -7
  317. package/sdk/public/Webhook/WebhookPublicModel.js +68 -136
  318. package/tests/application/catalog.spec.js +7 -0
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
2
2
  const PlatformAPIClient = require("../PlatformAPIClient");
3
3
  const { FDKClientValidationError } = require("../../common/FDKError");
4
4
  const RewardsValidator = require("./RewardsPlatformApplicationValidator");
5
+ const RewardsModel = require("./RewardsPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
5
7
 
6
8
  class Rewards {
7
9
  constructor(config, applicationId) {
@@ -11,16 +13,15 @@ class Rewards {
11
13
 
12
14
  /**
13
15
  * @param {Object} arg - Arg object.
14
- * @param {string} arg.pageId - Pagination page id
15
- * @param {number} arg.pageSize - Pagination page size
16
- * @summary: List of giveaways of the current application.
17
- * @description: List of giveaways of the current application.
16
+ * @param {string} arg.audienceId - Audience id
17
+ * @returns {Promise<GiveawayAudience>} - Success response
18
+ * @summary: Get the Giveaway audience status
19
+ * @description: Get giveaway audience status
18
20
  */
19
- showGiveaways({ pageId, pageSize } = {}) {
20
- const { error } = RewardsValidator.showGiveaways().validate(
21
+ async getGiveawayAudienceStatus({ audienceId } = {}) {
22
+ const { error } = RewardsValidator.getGiveawayAudienceStatus().validate(
21
23
  {
22
- pageId,
23
- pageSize,
24
+ audienceId,
24
25
  },
25
26
  { abortEarly: false, allowUnknown: true }
26
27
  );
@@ -29,41 +30,61 @@ class Rewards {
29
30
  }
30
31
 
31
32
  // Showing warrnings if extra unknown parameters are found
32
- const { error: warrning } = RewardsValidator.showGiveaways().validate(
33
+ const {
34
+ error: warrning,
35
+ } = RewardsValidator.getGiveawayAudienceStatus().validate(
33
36
  {
34
- pageId,
35
- pageSize,
37
+ audienceId,
36
38
  },
37
39
  { abortEarly: false, allowUnknown: false }
38
40
  );
39
41
  if (warrning) {
40
- console.log("Parameter Validation warrnings for showGiveaways");
41
- console.log(warrning);
42
+ Logger({
43
+ level: "WARN",
44
+ message: "Parameter Validation warrnings for getGiveawayAudienceStatus",
45
+ });
46
+ Logger({ level: "WARN", message: warrning });
42
47
  }
43
48
 
44
49
  const query_params = {};
45
- query_params["page_id"] = pageId;
46
- query_params["page_size"] = pageSize;
47
50
 
48
- return PlatformAPIClient.execute(
51
+ const response = await PlatformAPIClient.execute(
49
52
  this.config,
50
53
  "get",
51
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways`,
54
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/audience/${audienceId}/status`,
52
55
  query_params,
53
56
  undefined
54
57
  );
58
+
59
+ const {
60
+ error: res_error,
61
+ } = RewardsModel.GiveawayAudience().validate(response, {
62
+ abortEarly: false,
63
+ allowUnknown: false,
64
+ });
65
+
66
+ if (res_error) {
67
+ Logger({
68
+ level: "WARN",
69
+ message: "Response Validation Warnnings for getGiveawayAudienceStatus",
70
+ });
71
+ Logger({ level: "WARN", message: res_error });
72
+ }
73
+
74
+ return response;
55
75
  }
56
76
 
57
77
  /**
58
78
  * @param {Object} arg - Arg object.
59
- * @param {Giveaway} arg.body
60
- * @summary: List of giveaways of the current application.
61
- * @description: Adds a new giveaway.
79
+ * @param {string} arg.id - Giveaway ID
80
+ * @returns {Promise<Giveaway>} - Success response
81
+ * @summary: Get giveaway by ID.
82
+ * @description: Get giveaway by ID.
62
83
  */
63
- saveGiveAway({ body } = {}) {
64
- const { error } = RewardsValidator.saveGiveAway().validate(
84
+ async getGiveawayById({ id } = {}) {
85
+ const { error } = RewardsValidator.getGiveawayById().validate(
65
86
  {
66
- body,
87
+ id,
67
88
  },
68
89
  { abortEarly: false, allowUnknown: true }
69
90
  );
@@ -72,38 +93,61 @@ class Rewards {
72
93
  }
73
94
 
74
95
  // Showing warrnings if extra unknown parameters are found
75
- const { error: warrning } = RewardsValidator.saveGiveAway().validate(
96
+ const { error: warrning } = RewardsValidator.getGiveawayById().validate(
76
97
  {
77
- body,
98
+ id,
78
99
  },
79
100
  { abortEarly: false, allowUnknown: false }
80
101
  );
81
102
  if (warrning) {
82
- console.log("Parameter Validation warrnings for saveGiveAway");
83
- console.log(warrning);
103
+ Logger({
104
+ level: "WARN",
105
+ message: "Parameter Validation warrnings for getGiveawayById",
106
+ });
107
+ Logger({ level: "WARN", message: warrning });
84
108
  }
85
109
 
86
110
  const query_params = {};
87
111
 
88
- return PlatformAPIClient.execute(
112
+ const response = await PlatformAPIClient.execute(
89
113
  this.config,
90
- "post",
91
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways`,
114
+ "get",
115
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/${id}`,
92
116
  query_params,
93
- body
117
+ undefined
94
118
  );
119
+
120
+ const { error: res_error } = RewardsModel.Giveaway().validate(response, {
121
+ abortEarly: false,
122
+ allowUnknown: false,
123
+ });
124
+
125
+ if (res_error) {
126
+ Logger({
127
+ level: "WARN",
128
+ message: "Response Validation Warnnings for getGiveawayById",
129
+ });
130
+ Logger({ level: "WARN", message: res_error });
131
+ }
132
+
133
+ return response;
95
134
  }
96
135
 
97
136
  /**
98
137
  * @param {Object} arg - Arg object.
99
- * @param {string} arg.id - Giveaway ID
100
- * @summary: Get giveaway by ID.
101
- * @description: Get giveaway by ID.
138
+ * @param {string} arg.name - The name given to the offer.
139
+ * @param {string} arg.cookie - User's session cookie. This cookie is set in
140
+ * browser cookie when logged-in to fynd's authentication system i.e.
141
+ * `Grimlock` or by using grimlock-backend SDK for backend implementation.
142
+ * @returns {Promise<Offer>} - Success response
143
+ * @summary: Get offer by name
144
+ * @description: Use this API to get the offer details and configuration by entering the name of the offer.
102
145
  */
103
- getGiveawayById({ id } = {}) {
104
- const { error } = RewardsValidator.getGiveawayById().validate(
146
+ async getOfferByName({ name, cookie } = {}) {
147
+ const { error } = RewardsValidator.getOfferByName().validate(
105
148
  {
106
- id,
149
+ name,
150
+ cookie,
107
151
  },
108
152
  { abortEarly: false, allowUnknown: true }
109
153
  );
@@ -112,41 +156,56 @@ class Rewards {
112
156
  }
113
157
 
114
158
  // Showing warrnings if extra unknown parameters are found
115
- const { error: warrning } = RewardsValidator.getGiveawayById().validate(
159
+ const { error: warrning } = RewardsValidator.getOfferByName().validate(
116
160
  {
117
- id,
161
+ name,
162
+ cookie,
118
163
  },
119
164
  { abortEarly: false, allowUnknown: false }
120
165
  );
121
166
  if (warrning) {
122
- console.log("Parameter Validation warrnings for getGiveawayById");
123
- console.log(warrning);
167
+ Logger({
168
+ level: "WARN",
169
+ message: "Parameter Validation warrnings for getOfferByName",
170
+ });
171
+ Logger({ level: "WARN", message: warrning });
124
172
  }
125
173
 
126
174
  const query_params = {};
127
175
 
128
- return PlatformAPIClient.execute(
176
+ const response = await PlatformAPIClient.execute(
129
177
  this.config,
130
178
  "get",
131
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/${id}`,
179
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/${name}/`,
132
180
  query_params,
133
181
  undefined
134
182
  );
183
+
184
+ const { error: res_error } = RewardsModel.Offer().validate(response, {
185
+ abortEarly: false,
186
+ allowUnknown: false,
187
+ });
188
+
189
+ if (res_error) {
190
+ Logger({
191
+ level: "WARN",
192
+ message: "Response Validation Warnnings for getOfferByName",
193
+ });
194
+ Logger({ level: "WARN", message: res_error });
195
+ }
196
+
197
+ return response;
135
198
  }
136
199
 
137
200
  /**
138
201
  * @param {Object} arg - Arg object.
139
- * @param {string} arg.id - Giveaway ID
140
- * @param {Giveaway} arg.body
141
- * @summary: Updates the giveaway by it's ID.
142
- * @description: Updates the giveaway by it's ID.
202
+ * @returns {Promise<ConfigurationRes>} - Success response
203
+ * @summary: Get all valid android paths
204
+ * @description: Use this API to get a list of valid android paths required by the Rewards INIT API to validate a fradualent device.
143
205
  */
144
- updateGiveAway({ id, body } = {}) {
145
- const { error } = RewardsValidator.updateGiveAway().validate(
146
- {
147
- id,
148
- body,
149
- },
206
+ async getRewardsConfiguration({} = {}) {
207
+ const { error } = RewardsValidator.getRewardsConfiguration().validate(
208
+ {},
150
209
  { abortEarly: false, allowUnknown: true }
151
210
  );
152
211
  if (error) {
@@ -154,39 +213,64 @@ class Rewards {
154
213
  }
155
214
 
156
215
  // Showing warrnings if extra unknown parameters are found
157
- const { error: warrning } = RewardsValidator.updateGiveAway().validate(
158
- {
159
- id,
160
- body,
161
- },
216
+ const {
217
+ error: warrning,
218
+ } = RewardsValidator.getRewardsConfiguration().validate(
219
+ {},
162
220
  { abortEarly: false, allowUnknown: false }
163
221
  );
164
222
  if (warrning) {
165
- console.log("Parameter Validation warrnings for updateGiveAway");
166
- console.log(warrning);
223
+ Logger({
224
+ level: "WARN",
225
+ message: "Parameter Validation warrnings for getRewardsConfiguration",
226
+ });
227
+ Logger({ level: "WARN", message: warrning });
167
228
  }
168
229
 
169
230
  const query_params = {};
170
231
 
171
- return PlatformAPIClient.execute(
232
+ const response = await PlatformAPIClient.execute(
172
233
  this.config,
173
- "put",
174
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/${id}`,
234
+ "get",
235
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/configuration/`,
175
236
  query_params,
176
- body
237
+ undefined
177
238
  );
239
+
240
+ const {
241
+ error: res_error,
242
+ } = RewardsModel.ConfigurationRes().validate(response, {
243
+ abortEarly: false,
244
+ allowUnknown: false,
245
+ });
246
+
247
+ if (res_error) {
248
+ Logger({
249
+ level: "WARN",
250
+ message: "Response Validation Warnnings for getRewardsConfiguration",
251
+ });
252
+ Logger({ level: "WARN", message: res_error });
253
+ }
254
+
255
+ return response;
178
256
  }
179
257
 
180
258
  /**
181
259
  * @param {Object} arg - Arg object.
182
- * @param {string} arg.audienceId - Audience id
183
- * @summary: Get the Giveaway audience status
184
- * @description: Get giveaway audience status
260
+ * @param {string} arg.userId - User id
261
+ * @param {string} [arg.pageId] - PageID is the ID of the requested page.
262
+ * For first request it should be kept empty.
263
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
264
+ * @returns {Promise<HistoryRes>} - Success response
265
+ * @summary: Get all transactions of reward points
266
+ * @description: Use this API to get a list of points transactions.
185
267
  */
186
- getGiveawayAudienceStatus({ audienceId } = {}) {
187
- const { error } = RewardsValidator.getGiveawayAudienceStatus().validate(
268
+ async getUserPointsHistory({ userId, pageId, pageSize } = {}) {
269
+ const { error } = RewardsValidator.getUserPointsHistory().validate(
188
270
  {
189
- audienceId,
271
+ userId,
272
+ pageId,
273
+ pageSize,
190
274
  },
191
275
  { abortEarly: false, allowUnknown: true }
192
276
  );
@@ -197,38 +281,99 @@ class Rewards {
197
281
  // Showing warrnings if extra unknown parameters are found
198
282
  const {
199
283
  error: warrning,
200
- } = RewardsValidator.getGiveawayAudienceStatus().validate(
284
+ } = RewardsValidator.getUserPointsHistory().validate(
201
285
  {
202
- audienceId,
286
+ userId,
287
+ pageId,
288
+ pageSize,
203
289
  },
204
290
  { abortEarly: false, allowUnknown: false }
205
291
  );
206
292
  if (warrning) {
207
- console.log(
208
- "Parameter Validation warrnings for getGiveawayAudienceStatus"
209
- );
210
- console.log(warrning);
293
+ Logger({
294
+ level: "WARN",
295
+ message: "Parameter Validation warrnings for getUserPointsHistory",
296
+ });
297
+ Logger({ level: "WARN", message: warrning });
211
298
  }
212
299
 
213
300
  const query_params = {};
301
+ query_params["page_id"] = pageId;
302
+ query_params["page_size"] = pageSize;
214
303
 
215
- return PlatformAPIClient.execute(
304
+ const response = await PlatformAPIClient.execute(
216
305
  this.config,
217
306
  "get",
218
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/audience/${audienceId}/status`,
307
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/points/history/`,
219
308
  query_params,
220
309
  undefined
221
310
  );
311
+
312
+ const { error: res_error } = RewardsModel.HistoryRes().validate(response, {
313
+ abortEarly: false,
314
+ allowUnknown: false,
315
+ });
316
+
317
+ if (res_error) {
318
+ Logger({
319
+ level: "WARN",
320
+ message: "Response Validation Warnnings for getUserPointsHistory",
321
+ });
322
+ Logger({ level: "WARN", message: res_error });
323
+ }
324
+
325
+ return response;
222
326
  }
223
327
 
224
328
  /**
225
329
  * @param {Object} arg - Arg object.
226
- * @summary: List of offers of the current application.
227
- * @description: List of offers of the current application.
330
+ * @param {string} arg.userId - User id
331
+ * @param {string} arg.companyId - Company id
332
+ * @param {string} arg.applicationId - Application id
333
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
334
+ * @summary: Get all transactions of reward points
335
+ * @description: Use this API to get a list of points transactions.
228
336
  */
229
- showOffers({} = {}) {
230
- const { error } = RewardsValidator.showOffers().validate(
231
- {},
337
+ getUserPointsHistoryPaginator({
338
+ userId,
339
+ companyId,
340
+ applicationId,
341
+ pageSize,
342
+ } = {}) {
343
+ const paginator = new Paginator();
344
+ const callback = async () => {
345
+ const pageId = paginator.nextId;
346
+ const pageNo = paginator.pageNo;
347
+ const pageType = "cursor";
348
+ const data = await this.getUserPointsHistory({
349
+ userId: userId,
350
+ companyId: companyId,
351
+ applicationId: applicationId,
352
+ pageId: pageId,
353
+ pageSize: pageSize,
354
+ });
355
+ paginator.setPaginator({
356
+ hasNext: data.page.has_next ? true : false,
357
+ nextId: data.page.next_id,
358
+ });
359
+ return data;
360
+ };
361
+ paginator.setCallback(callback.bind(this));
362
+ return paginator;
363
+ }
364
+
365
+ /**
366
+ * @param {Object} arg - Arg object.
367
+ * @param {Giveaway} arg.body
368
+ * @returns {Promise<Giveaway>} - Success response
369
+ * @summary: List of giveaways of the current application.
370
+ * @description: Adds a new giveaway.
371
+ */
372
+ async saveGiveAway({ body } = {}) {
373
+ const { error } = RewardsValidator.saveGiveAway().validate(
374
+ {
375
+ body,
376
+ },
232
377
  { abortEarly: false, allowUnknown: true }
233
378
  );
234
379
  if (error) {
@@ -236,40 +381,57 @@ class Rewards {
236
381
  }
237
382
 
238
383
  // Showing warrnings if extra unknown parameters are found
239
- const { error: warrning } = RewardsValidator.showOffers().validate(
240
- {},
384
+ const { error: warrning } = RewardsValidator.saveGiveAway().validate(
385
+ {
386
+ body,
387
+ },
241
388
  { abortEarly: false, allowUnknown: false }
242
389
  );
243
390
  if (warrning) {
244
- console.log("Parameter Validation warrnings for showOffers");
245
- console.log(warrning);
391
+ Logger({
392
+ level: "WARN",
393
+ message: "Parameter Validation warrnings for saveGiveAway",
394
+ });
395
+ Logger({ level: "WARN", message: warrning });
246
396
  }
247
397
 
248
398
  const query_params = {};
249
399
 
250
- return PlatformAPIClient.execute(
400
+ const response = await PlatformAPIClient.execute(
251
401
  this.config,
252
- "get",
253
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/`,
402
+ "post",
403
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways`,
254
404
  query_params,
255
- undefined
405
+ body
256
406
  );
407
+
408
+ const { error: res_error } = RewardsModel.Giveaway().validate(response, {
409
+ abortEarly: false,
410
+ allowUnknown: false,
411
+ });
412
+
413
+ if (res_error) {
414
+ Logger({
415
+ level: "WARN",
416
+ message: "Response Validation Warnnings for saveGiveAway",
417
+ });
418
+ Logger({ level: "WARN", message: res_error });
419
+ }
420
+
421
+ return response;
257
422
  }
258
423
 
259
424
  /**
260
425
  * @param {Object} arg - Arg object.
261
- * @param {string} arg.name - The name given to the offer.
262
- * @param {string} arg.cookie - User's session cookie. This cookie is set in
263
- * browser cookie when logged-in to fynd's authentication system i.e.
264
- * `Grimlock` or by using grimlock-backend SDK for backend implementation.
265
- * @summary: Get offer by name
266
- * @description: Use this API to get the offer details and configuration by entering the name of the offer.
426
+ * @param {ConfigurationRequest} arg.body
427
+ * @returns {Promise<SetConfigurationRes>} - Success response
428
+ * @summary: Updates the collection with given android paths.
429
+ * @description: Updates the configuration or inserts new records.
267
430
  */
268
- getOfferByName({ name, cookie } = {}) {
269
- const { error } = RewardsValidator.getOfferByName().validate(
431
+ async setRewardsConfiguration({ body } = {}) {
432
+ const { error } = RewardsValidator.setRewardsConfiguration().validate(
270
433
  {
271
- name,
272
- cookie,
434
+ body,
273
435
  },
274
436
  { abortEarly: false, allowUnknown: true }
275
437
  );
@@ -278,41 +440,63 @@ class Rewards {
278
440
  }
279
441
 
280
442
  // Showing warrnings if extra unknown parameters are found
281
- const { error: warrning } = RewardsValidator.getOfferByName().validate(
443
+ const {
444
+ error: warrning,
445
+ } = RewardsValidator.setRewardsConfiguration().validate(
282
446
  {
283
- name,
284
- cookie,
447
+ body,
285
448
  },
286
449
  { abortEarly: false, allowUnknown: false }
287
450
  );
288
451
  if (warrning) {
289
- console.log("Parameter Validation warrnings for getOfferByName");
290
- console.log(warrning);
452
+ Logger({
453
+ level: "WARN",
454
+ message: "Parameter Validation warrnings for setRewardsConfiguration",
455
+ });
456
+ Logger({ level: "WARN", message: warrning });
291
457
  }
292
458
 
293
459
  const query_params = {};
294
460
 
295
- return PlatformAPIClient.execute(
461
+ const response = await PlatformAPIClient.execute(
296
462
  this.config,
297
- "get",
298
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/${name}/`,
463
+ "post",
464
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/configuration/`,
299
465
  query_params,
300
- undefined
466
+ body
301
467
  );
468
+
469
+ const {
470
+ error: res_error,
471
+ } = RewardsModel.SetConfigurationRes().validate(response, {
472
+ abortEarly: false,
473
+ allowUnknown: false,
474
+ });
475
+
476
+ if (res_error) {
477
+ Logger({
478
+ level: "WARN",
479
+ message: "Response Validation Warnnings for setRewardsConfiguration",
480
+ });
481
+ Logger({ level: "WARN", message: res_error });
482
+ }
483
+
484
+ return response;
302
485
  }
303
486
 
304
487
  /**
305
488
  * @param {Object} arg - Arg object.
306
- * @param {string} arg.name - The name given to the offer.
307
- * @param {Offer} arg.body
308
- * @summary: Update offer by name
309
- * @description: Use this API to update the offer details
489
+ * @param {string} arg.pageId - Pagination page id
490
+ * @param {number} arg.pageSize - Pagination page size
491
+ * @returns {Promise<GiveawayResponse>} - Success response
492
+ * @summary: List of giveaways of the current application.
493
+ * @description: List of giveaways of the current application.
310
494
  */
311
- updateOfferByName({ name, body } = {}) {
312
- const { error } = RewardsValidator.updateOfferByName().validate(
495
+ async showGiveaways({ pageId, pageSize } = {}) {
496
+ const { error } = RewardsValidator.showGiveaways().validate(
313
497
  {
314
- name,
315
- body,
498
+ pageId,
499
+ pageSize,
316
500
  },
317
501
  { abortEarly: false, allowUnknown: true }
318
502
  );
@@ -321,42 +505,60 @@ class Rewards {
321
505
  }
322
506
 
323
507
  // Showing warrnings if extra unknown parameters are found
324
- const { error: warrning } = RewardsValidator.updateOfferByName().validate(
508
+ const { error: warrning } = RewardsValidator.showGiveaways().validate(
325
509
  {
326
- name,
327
- body,
510
+ pageId,
511
+ pageSize,
328
512
  },
329
513
  { abortEarly: false, allowUnknown: false }
330
514
  );
331
515
  if (warrning) {
332
- console.log("Parameter Validation warrnings for updateOfferByName");
333
- console.log(warrning);
516
+ Logger({
517
+ level: "WARN",
518
+ message: "Parameter Validation warrnings for showGiveaways",
519
+ });
520
+ Logger({ level: "WARN", message: warrning });
334
521
  }
335
522
 
336
523
  const query_params = {};
524
+ query_params["page_id"] = pageId;
525
+ query_params["page_size"] = pageSize;
337
526
 
338
- return PlatformAPIClient.execute(
527
+ const response = await PlatformAPIClient.execute(
339
528
  this.config,
340
- "put",
341
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/${name}/`,
529
+ "get",
530
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways`,
342
531
  query_params,
343
- body
532
+ undefined
344
533
  );
534
+
535
+ const {
536
+ error: res_error,
537
+ } = RewardsModel.GiveawayResponse().validate(response, {
538
+ abortEarly: false,
539
+ allowUnknown: false,
540
+ });
541
+
542
+ if (res_error) {
543
+ Logger({
544
+ level: "WARN",
545
+ message: "Response Validation Warnnings for showGiveaways",
546
+ });
547
+ Logger({ level: "WARN", message: res_error });
548
+ }
549
+
550
+ return response;
345
551
  }
346
552
 
347
553
  /**
348
554
  * @param {Object} arg - Arg object.
349
- * @param {string} arg.userId - User id
350
- * @param {AppUser} arg.body
351
- * @summary: Update user status
352
- * @description: Use this API to update the user status active/archive
555
+ * @returns {Promise<Offer[]>} - Success response
556
+ * @summary: List of offers of the current application.
557
+ * @description: List of offers of the current application.
353
558
  */
354
- updateUserStatus({ userId, body } = {}) {
355
- const { error } = RewardsValidator.updateUserStatus().validate(
356
- {
357
- userId,
358
- body,
359
- },
559
+ async showOffers({} = {}) {
560
+ const { error } = RewardsValidator.showOffers().validate(
561
+ {},
360
562
  { abortEarly: false, allowUnknown: true }
361
563
  );
362
564
  if (error) {
@@ -364,39 +566,56 @@ class Rewards {
364
566
  }
365
567
 
366
568
  // Showing warrnings if extra unknown parameters are found
367
- const { error: warrning } = RewardsValidator.updateUserStatus().validate(
368
- {
369
- userId,
370
- body,
371
- },
569
+ const { error: warrning } = RewardsValidator.showOffers().validate(
570
+ {},
372
571
  { abortEarly: false, allowUnknown: false }
373
572
  );
374
573
  if (warrning) {
375
- console.log("Parameter Validation warrnings for updateUserStatus");
376
- console.log(warrning);
574
+ Logger({
575
+ level: "WARN",
576
+ message: "Parameter Validation warrnings for showOffers",
577
+ });
578
+ Logger({ level: "WARN", message: warrning });
377
579
  }
378
580
 
379
581
  const query_params = {};
380
582
 
381
- return PlatformAPIClient.execute(
583
+ const response = await PlatformAPIClient.execute(
382
584
  this.config,
383
- "patch",
384
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/`,
585
+ "get",
586
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/`,
385
587
  query_params,
386
- body
588
+ undefined
387
589
  );
590
+
591
+ const { error: res_error } = Joi.array()
592
+ .items(RewardsModel.Offer())
593
+ .validate(response, { abortEarly: false, allowUnknown: false });
594
+
595
+ if (res_error) {
596
+ Logger({
597
+ level: "WARN",
598
+ message: "Response Validation Warnnings for showOffers",
599
+ });
600
+ Logger({ level: "WARN", message: res_error });
601
+ }
602
+
603
+ return response;
388
604
  }
389
605
 
390
606
  /**
391
607
  * @param {Object} arg - Arg object.
392
- * @param {string} arg.userId - User id
393
- * @summary: Get user reward details
394
- * @description: Use this API to get the user reward details
608
+ * @param {string} arg.id - Giveaway ID
609
+ * @param {Giveaway} arg.body
610
+ * @returns {Promise<Giveaway>} - Success response
611
+ * @summary: Updates the giveaway by it's ID.
612
+ * @description: Updates the giveaway by it's ID.
395
613
  */
396
- user({ userId } = {}) {
397
- const { error } = RewardsValidator.user().validate(
614
+ async updateGiveAway({ id, body } = {}) {
615
+ const { error } = RewardsValidator.updateGiveAway().validate(
398
616
  {
399
- userId,
617
+ id,
618
+ body,
400
619
  },
401
620
  { abortEarly: false, allowUnknown: true }
402
621
  );
@@ -405,43 +624,60 @@ class Rewards {
405
624
  }
406
625
 
407
626
  // Showing warrnings if extra unknown parameters are found
408
- const { error: warrning } = RewardsValidator.user().validate(
627
+ const { error: warrning } = RewardsValidator.updateGiveAway().validate(
409
628
  {
410
- userId,
629
+ id,
630
+ body,
411
631
  },
412
632
  { abortEarly: false, allowUnknown: false }
413
633
  );
414
634
  if (warrning) {
415
- console.log("Parameter Validation warrnings for user");
416
- console.log(warrning);
635
+ Logger({
636
+ level: "WARN",
637
+ message: "Parameter Validation warrnings for updateGiveAway",
638
+ });
639
+ Logger({ level: "WARN", message: warrning });
417
640
  }
418
641
 
419
642
  const query_params = {};
420
643
 
421
- return PlatformAPIClient.execute(
644
+ const response = await PlatformAPIClient.execute(
422
645
  this.config,
423
- "get",
424
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/`,
646
+ "put",
647
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/${id}`,
425
648
  query_params,
426
- undefined
649
+ body
427
650
  );
651
+
652
+ const { error: res_error } = RewardsModel.Giveaway().validate(response, {
653
+ abortEarly: false,
654
+ allowUnknown: false,
655
+ });
656
+
657
+ if (res_error) {
658
+ Logger({
659
+ level: "WARN",
660
+ message: "Response Validation Warnnings for updateGiveAway",
661
+ });
662
+ Logger({ level: "WARN", message: res_error });
663
+ }
664
+
665
+ return response;
428
666
  }
429
667
 
430
668
  /**
431
669
  * @param {Object} arg - Arg object.
432
- * @param {string} arg.userId - User id
433
- * @param {string} [arg.pageId] - PageID is the ID of the requested page.
434
- * For first request it should be kept empty.
435
- * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
436
- * @summary: Get all transactions of reward points
437
- * @description: Use this API to get a list of points transactions.
670
+ * @param {string} arg.name - The name given to the offer.
671
+ * @param {Offer} arg.body
672
+ * @returns {Promise<Offer>} - Success response
673
+ * @summary: Update offer by name
674
+ * @description: Use this API to update the offer details
438
675
  */
439
- getUserPointsHistory({ userId, pageId, pageSize } = {}) {
440
- const { error } = RewardsValidator.getUserPointsHistory().validate(
676
+ async updateOfferByName({ name, body } = {}) {
677
+ const { error } = RewardsValidator.updateOfferByName().validate(
441
678
  {
442
- userId,
443
- pageId,
444
- pageSize,
679
+ name,
680
+ body,
445
681
  },
446
682
  { abortEarly: false, allowUnknown: true }
447
683
  );
@@ -450,79 +686,61 @@ class Rewards {
450
686
  }
451
687
 
452
688
  // Showing warrnings if extra unknown parameters are found
453
- const {
454
- error: warrning,
455
- } = RewardsValidator.getUserPointsHistory().validate(
689
+ const { error: warrning } = RewardsValidator.updateOfferByName().validate(
456
690
  {
457
- userId,
458
- pageId,
459
- pageSize,
691
+ name,
692
+ body,
460
693
  },
461
694
  { abortEarly: false, allowUnknown: false }
462
695
  );
463
696
  if (warrning) {
464
- console.log("Parameter Validation warrnings for getUserPointsHistory");
465
- console.log(warrning);
697
+ Logger({
698
+ level: "WARN",
699
+ message: "Parameter Validation warrnings for updateOfferByName",
700
+ });
701
+ Logger({ level: "WARN", message: warrning });
466
702
  }
467
703
 
468
704
  const query_params = {};
469
- query_params["page_id"] = pageId;
470
- query_params["page_size"] = pageSize;
471
705
 
472
- return PlatformAPIClient.execute(
706
+ const response = await PlatformAPIClient.execute(
473
707
  this.config,
474
- "get",
475
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/points/history/`,
708
+ "put",
709
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/${name}/`,
476
710
  query_params,
477
- undefined
711
+ body
478
712
  );
479
- }
480
713
 
481
- /**
482
- * @param {Object} arg - Arg object.
483
- * @param {string} arg.userId - User id
484
- * @param {string} arg.companyId - Company id
485
- * @param {string} arg.applicationId - Application id
486
- * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
487
- * @summary: Get all transactions of reward points
488
- * @description: Use this API to get a list of points transactions.
489
- */
490
- getUserPointsHistoryPaginator({
491
- userId,
492
- companyId,
493
- applicationId,
494
- pageSize,
495
- } = {}) {
496
- const paginator = new Paginator();
497
- const callback = async () => {
498
- const pageId = paginator.nextId;
499
- const pageNo = paginator.pageNo;
500
- const pageType = "cursor";
501
- const data = await this.getUserPointsHistory({
502
- userId: userId,
503
- companyId: companyId,
504
- applicationId: applicationId,
505
- pageId: pageId,
506
- pageSize: pageSize,
507
- });
508
- paginator.setPaginator({
509
- hasNext: data.page.has_next ? true : false,
510
- nextId: data.page.next_id,
714
+ const { error: res_error } = RewardsModel.Offer().validate(response, {
715
+ abortEarly: false,
716
+ allowUnknown: false,
717
+ });
718
+
719
+ if (res_error) {
720
+ Logger({
721
+ level: "WARN",
722
+ message: "Response Validation Warnnings for updateOfferByName",
511
723
  });
512
- return data;
513
- };
514
- paginator.setCallback(callback.bind(this));
515
- return paginator;
724
+ Logger({ level: "WARN", message: res_error });
725
+ }
726
+
727
+ return response;
516
728
  }
517
729
 
518
730
  /**
519
731
  * @param {Object} arg - Arg object.
520
- * @summary: Get all valid android paths
521
- * @description: Use this API to get a list of valid android paths required by the Rewards INIT API to validate a fradualent device.
732
+ * @param {string} arg.userId - User id
733
+ * @param {AppUser} arg.body
734
+ * @returns {Promise<AppUser>} - Success response
735
+ * @summary: Update user status
736
+ * @description: Use this API to update the user status active/archive
522
737
  */
523
- getRewardsConfiguration({} = {}) {
524
- const { error } = RewardsValidator.getRewardsConfiguration().validate(
525
- {},
738
+ async updateUserStatus({ userId, body } = {}) {
739
+ const { error } = RewardsValidator.updateUserStatus().validate(
740
+ {
741
+ userId,
742
+ body,
743
+ },
526
744
  { abortEarly: false, allowUnknown: true }
527
745
  );
528
746
  if (error) {
@@ -530,38 +748,58 @@ class Rewards {
530
748
  }
531
749
 
532
750
  // Showing warrnings if extra unknown parameters are found
533
- const {
534
- error: warrning,
535
- } = RewardsValidator.getRewardsConfiguration().validate(
536
- {},
751
+ const { error: warrning } = RewardsValidator.updateUserStatus().validate(
752
+ {
753
+ userId,
754
+ body,
755
+ },
537
756
  { abortEarly: false, allowUnknown: false }
538
757
  );
539
758
  if (warrning) {
540
- console.log("Parameter Validation warrnings for getRewardsConfiguration");
541
- console.log(warrning);
759
+ Logger({
760
+ level: "WARN",
761
+ message: "Parameter Validation warrnings for updateUserStatus",
762
+ });
763
+ Logger({ level: "WARN", message: warrning });
542
764
  }
543
765
 
544
766
  const query_params = {};
545
767
 
546
- return PlatformAPIClient.execute(
768
+ const response = await PlatformAPIClient.execute(
547
769
  this.config,
548
- "get",
549
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/configuration/`,
770
+ "patch",
771
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/`,
550
772
  query_params,
551
- undefined
773
+ body
552
774
  );
775
+
776
+ const { error: res_error } = RewardsModel.AppUser().validate(response, {
777
+ abortEarly: false,
778
+ allowUnknown: false,
779
+ });
780
+
781
+ if (res_error) {
782
+ Logger({
783
+ level: "WARN",
784
+ message: "Response Validation Warnnings for updateUserStatus",
785
+ });
786
+ Logger({ level: "WARN", message: res_error });
787
+ }
788
+
789
+ return response;
553
790
  }
554
791
 
555
792
  /**
556
793
  * @param {Object} arg - Arg object.
557
- * @param {ConfigurationRequest} arg.body
558
- * @summary: Updates the collection with given android paths.
559
- * @description: Updates the configuration or inserts new records.
794
+ * @param {string} arg.userId - User id
795
+ * @returns {Promise<UserRes>} - Success response
796
+ * @summary: Get user reward details
797
+ * @description: Use this API to get the user reward details
560
798
  */
561
- setRewardsConfiguration({ body } = {}) {
562
- const { error } = RewardsValidator.setRewardsConfiguration().validate(
799
+ async user({ userId } = {}) {
800
+ const { error } = RewardsValidator.user().validate(
563
801
  {
564
- body,
802
+ userId,
565
803
  },
566
804
  { abortEarly: false, allowUnknown: true }
567
805
  );
@@ -570,28 +808,44 @@ class Rewards {
570
808
  }
571
809
 
572
810
  // Showing warrnings if extra unknown parameters are found
573
- const {
574
- error: warrning,
575
- } = RewardsValidator.setRewardsConfiguration().validate(
811
+ const { error: warrning } = RewardsValidator.user().validate(
576
812
  {
577
- body,
813
+ userId,
578
814
  },
579
815
  { abortEarly: false, allowUnknown: false }
580
816
  );
581
817
  if (warrning) {
582
- console.log("Parameter Validation warrnings for setRewardsConfiguration");
583
- console.log(warrning);
818
+ Logger({
819
+ level: "WARN",
820
+ message: "Parameter Validation warrnings for user",
821
+ });
822
+ Logger({ level: "WARN", message: warrning });
584
823
  }
585
824
 
586
825
  const query_params = {};
587
826
 
588
- return PlatformAPIClient.execute(
827
+ const response = await PlatformAPIClient.execute(
589
828
  this.config,
590
- "post",
591
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/configuration/`,
829
+ "get",
830
+ `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/`,
592
831
  query_params,
593
- body
832
+ undefined
594
833
  );
834
+
835
+ const { error: res_error } = RewardsModel.UserRes().validate(response, {
836
+ abortEarly: false,
837
+ allowUnknown: false,
838
+ });
839
+
840
+ if (res_error) {
841
+ Logger({
842
+ level: "WARN",
843
+ message: "Response Validation Warnnings for user",
844
+ });
845
+ Logger({ level: "WARN", message: res_error });
846
+ }
847
+
848
+ return response;
595
849
  }
596
850
  }
597
851
  module.exports = Rewards;