@gofynd/fdk-client-javascript 1.0.2 → 1.0.4

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