@gofynd/fdk-client-javascript 1.4.15-beta.13 → 1.4.15-beta.15

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 (278) hide show
  1. package/README.md +23 -26
  2. package/package.json +5 -1
  3. package/sdk/application/ApplicationClient.d.ts +5 -6
  4. package/sdk/application/ApplicationClient.js +24 -20
  5. package/sdk/application/Cart/CartApplicationClient.d.ts +133 -83
  6. package/sdk/application/Cart/CartApplicationClient.js +444 -76
  7. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +132 -114
  8. package/sdk/application/Catalog/CatalogApplicationClient.js +209 -126
  9. package/sdk/application/Common/CommonApplicationClient.d.ts +4 -4
  10. package/sdk/application/Common/CommonApplicationClient.js +4 -4
  11. package/sdk/application/Communication/CommunicationApplicationClient.d.ts +3 -3
  12. package/sdk/application/Communication/CommunicationApplicationClient.js +3 -3
  13. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +58 -36
  14. package/sdk/application/Configuration/ConfigurationApplicationClient.js +73 -29
  15. package/sdk/application/Content/ContentApplicationClient.d.ts +95 -66
  16. package/sdk/application/Content/ContentApplicationClient.js +274 -111
  17. package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +11 -11
  18. package/sdk/application/FileStorage/FileStorageApplicationClient.js +10 -10
  19. package/sdk/application/Finance/FinanceApplicationClient.d.ts +29 -0
  20. package/sdk/application/Finance/FinanceApplicationClient.js +111 -0
  21. package/sdk/application/Lead/LeadApplicationClient.d.ts +7 -7
  22. package/sdk/application/Lead/LeadApplicationClient.js +6 -6
  23. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +37 -57
  24. package/sdk/application/Logistic/LogisticApplicationClient.js +117 -180
  25. package/sdk/application/Order/OrderApplicationClient.d.ts +63 -21
  26. package/sdk/application/Order/OrderApplicationClient.js +217 -17
  27. package/sdk/application/Payment/PaymentApplicationClient.d.ts +179 -149
  28. package/sdk/application/Payment/PaymentApplicationClient.js +301 -167
  29. package/sdk/application/Share/ShareApplicationClient.d.ts +7 -7
  30. package/sdk/application/Share/ShareApplicationClient.js +7 -7
  31. package/sdk/application/Theme/ThemeApplicationClient.d.ts +7 -7
  32. package/sdk/application/Theme/ThemeApplicationClient.js +10 -6
  33. package/sdk/application/User/UserApplicationClient.d.ts +103 -53
  34. package/sdk/application/User/UserApplicationClient.js +308 -49
  35. package/sdk/common/AxiosHelper.js +11 -4
  36. package/sdk/common/Constant.d.ts +27 -4
  37. package/sdk/common/Constant.js +33 -6
  38. package/sdk/common/utils.d.ts +10 -0
  39. package/sdk/common/utils.js +24 -3
  40. package/sdk/partner/FileStorage/FileStoragePartnerClient.d.ts +46 -16
  41. package/sdk/partner/FileStorage/FileStoragePartnerClient.js +266 -40
  42. package/sdk/partner/FileStorage/FileStoragePartnerModel.d.ts +163 -19
  43. package/sdk/partner/FileStorage/FileStoragePartnerModel.js +158 -14
  44. package/sdk/partner/FileStorage/FileStoragePartnerValidator.d.ts +5 -2
  45. package/sdk/partner/FileStorage/FileStoragePartnerValidator.js +23 -7
  46. package/sdk/partner/Lead/LeadPartnerClient.d.ts +9 -9
  47. package/sdk/partner/Lead/LeadPartnerClient.js +9 -9
  48. package/sdk/partner/Lead/LeadPartnerModel.d.ts +14 -9
  49. package/sdk/partner/Lead/LeadPartnerModel.js +19 -17
  50. package/sdk/partner/Logistics/LogisticsPartnerClient.d.ts +264 -49
  51. package/sdk/partner/Logistics/LogisticsPartnerClient.js +2116 -252
  52. package/sdk/partner/Logistics/LogisticsPartnerModel.d.ts +2256 -258
  53. package/sdk/partner/Logistics/LogisticsPartnerModel.js +1187 -230
  54. package/sdk/partner/Logistics/LogisticsPartnerValidator.d.ts +21 -1
  55. package/sdk/partner/Logistics/LogisticsPartnerValidator.js +218 -13
  56. package/sdk/partner/PartnerClient.d.ts +5 -2
  57. package/sdk/partner/PartnerClient.js +21 -7
  58. package/sdk/partner/Theme/ThemePartnerClient.d.ts +32 -34
  59. package/sdk/partner/Theme/ThemePartnerClient.js +42 -44
  60. package/sdk/partner/Theme/ThemePartnerModel.d.ts +142 -43
  61. package/sdk/partner/Theme/ThemePartnerModel.js +129 -44
  62. package/sdk/partner/Theme/ThemePartnerValidator.js +4 -4
  63. package/sdk/partner/Webhook/WebhookPartnerClient.d.ts +83 -27
  64. package/sdk/partner/Webhook/WebhookPartnerClient.js +446 -27
  65. package/sdk/partner/Webhook/WebhookPartnerModel.d.ts +920 -185
  66. package/sdk/partner/Webhook/WebhookPartnerModel.js +462 -154
  67. package/sdk/partner/Webhook/WebhookPartnerValidator.d.ts +5 -0
  68. package/sdk/partner/Webhook/WebhookPartnerValidator.js +41 -3
  69. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +8 -7
  70. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +17 -11
  71. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +4 -1
  72. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +1 -1
  73. package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +68 -13
  74. package/sdk/platform/Analytics/AnalyticsPlatformModel.js +44 -6
  75. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +3 -33
  76. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +4 -244
  77. package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +49 -145
  78. package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +20 -171
  79. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.d.ts +1 -39
  80. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +0 -35
  81. package/sdk/platform/Billing/BillingPlatformClient.d.ts +15 -15
  82. package/sdk/platform/Billing/BillingPlatformClient.js +18 -18
  83. package/sdk/platform/Billing/BillingPlatformModel.d.ts +443 -388
  84. package/sdk/platform/Billing/BillingPlatformModel.js +280 -263
  85. package/sdk/platform/Billing/BillingPlatformValidator.d.ts +16 -18
  86. package/sdk/platform/Billing/BillingPlatformValidator.js +8 -9
  87. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +266 -203
  88. package/sdk/platform/Cart/CartPlatformApplicationClient.js +1446 -500
  89. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +729 -100
  90. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +446 -82
  91. package/sdk/platform/Cart/CartPlatformModel.d.ts +6927 -1396
  92. package/sdk/platform/Cart/CartPlatformModel.js +3065 -1316
  93. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +433 -248
  94. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1662 -559
  95. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +464 -159
  96. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +304 -87
  97. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +383 -234
  98. package/sdk/platform/Catalog/CatalogPlatformClient.js +2475 -1557
  99. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +9571 -2674
  100. package/sdk/platform/Catalog/CatalogPlatformModel.js +5081 -2019
  101. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +364 -117
  102. package/sdk/platform/Catalog/CatalogPlatformValidator.js +281 -104
  103. package/sdk/platform/Common/CommonPlatformClient.d.ts +5 -4
  104. package/sdk/platform/Common/CommonPlatformClient.js +6 -5
  105. package/sdk/platform/Common/CommonPlatformModel.d.ts +36 -25
  106. package/sdk/platform/Common/CommonPlatformModel.js +25 -14
  107. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -153
  108. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +102 -541
  109. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +36 -49
  110. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +20 -60
  111. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +1 -1
  112. package/sdk/platform/Communication/CommunicationPlatformClient.js +1 -1
  113. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +189 -43
  114. package/sdk/platform/Communication/CommunicationPlatformModel.js +165 -42
  115. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +58 -81
  116. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +68 -116
  117. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +291 -249
  118. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +243 -234
  119. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +12 -12
  120. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +12 -12
  121. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +78 -65
  122. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +101 -88
  123. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +20 -20
  124. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +19 -19
  125. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +68 -34
  126. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +174 -41
  127. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +667 -244
  128. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +474 -155
  129. package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +37 -9
  130. package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +27 -8
  131. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +366 -280
  132. package/sdk/platform/Content/ContentPlatformApplicationClient.js +1435 -753
  133. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +323 -223
  134. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +335 -205
  135. package/sdk/platform/Content/ContentPlatformClient.d.ts +304 -106
  136. package/sdk/platform/Content/ContentPlatformClient.js +1842 -450
  137. package/sdk/platform/Content/ContentPlatformModel.d.ts +2582 -566
  138. package/sdk/platform/Content/ContentPlatformModel.js +1426 -558
  139. package/sdk/platform/Content/ContentPlatformValidator.d.ts +293 -114
  140. package/sdk/platform/Content/ContentPlatformValidator.js +328 -101
  141. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +59 -23
  142. package/sdk/platform/Discount/DiscountPlatformClient.js +84 -23
  143. package/sdk/platform/Discount/DiscountPlatformModel.d.ts +403 -110
  144. package/sdk/platform/Discount/DiscountPlatformModel.js +121 -107
  145. package/sdk/platform/Discount/DiscountPlatformValidator.d.ts +56 -36
  146. package/sdk/platform/Discount/DiscountPlatformValidator.js +29 -19
  147. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +12 -110
  148. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +14 -684
  149. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +5 -94
  150. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +4 -115
  151. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +20 -20
  152. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +22 -22
  153. package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +90 -920
  154. package/sdk/platform/FileStorage/FileStoragePlatformModel.js +53 -949
  155. package/sdk/platform/FileStorage/FileStoragePlatformValidator.d.ts +6 -6
  156. package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +6 -6
  157. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +10 -10
  158. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +10 -10
  159. package/sdk/platform/Lead/LeadPlatformClient.d.ts +11 -11
  160. package/sdk/platform/Lead/LeadPlatformClient.js +11 -11
  161. package/sdk/platform/Lead/LeadPlatformModel.d.ts +14 -9
  162. package/sdk/platform/Lead/LeadPlatformModel.js +20 -18
  163. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +56 -9
  164. package/sdk/platform/Order/OrderPlatformApplicationClient.js +340 -10
  165. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +128 -24
  166. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +81 -19
  167. package/sdk/platform/Order/OrderPlatformClient.d.ts +517 -160
  168. package/sdk/platform/Order/OrderPlatformClient.js +1623 -384
  169. package/sdk/platform/Order/OrderPlatformModel.d.ts +10372 -1587
  170. package/sdk/platform/Order/OrderPlatformModel.js +5726 -1512
  171. package/sdk/platform/Order/OrderPlatformValidator.d.ts +539 -123
  172. package/sdk/platform/Order/OrderPlatformValidator.js +323 -92
  173. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +8 -6
  174. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +11 -9
  175. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.d.ts +6 -4
  176. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +3 -2
  177. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +77 -25
  178. package/sdk/platform/Partner/PartnerPlatformModel.js +32 -21
  179. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +144 -219
  180. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +307 -796
  181. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +86 -121
  182. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +80 -138
  183. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +30 -30
  184. package/sdk/platform/Payment/PaymentPlatformClient.js +30 -30
  185. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +901 -761
  186. package/sdk/platform/Payment/PaymentPlatformModel.js +663 -583
  187. package/sdk/platform/Payment/PaymentPlatformValidator.d.ts +8 -8
  188. package/sdk/platform/Payment/PaymentPlatformValidator.js +8 -8
  189. package/sdk/platform/PlatformApplicationClient.d.ts +0 -2
  190. package/sdk/platform/PlatformApplicationClient.js +0 -4
  191. package/sdk/platform/PlatformClient.d.ts +5 -4
  192. package/sdk/platform/PlatformClient.js +32 -22
  193. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +526 -69
  194. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +3337 -337
  195. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +603 -38
  196. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +529 -32
  197. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +184 -133
  198. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +780 -491
  199. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +9408 -1666
  200. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +5720 -1765
  201. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +257 -180
  202. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +185 -127
  203. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +7 -7
  204. package/sdk/platform/Share/SharePlatformApplicationClient.js +7 -7
  205. package/sdk/platform/Share/SharePlatformModel.d.ts +45 -9
  206. package/sdk/platform/Share/SharePlatformModel.js +31 -6
  207. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +26 -26
  208. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +38 -29
  209. package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +18 -3
  210. package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +10 -2
  211. package/sdk/platform/Theme/ThemePlatformClient.d.ts +4 -4
  212. package/sdk/platform/Theme/ThemePlatformClient.js +4 -4
  213. package/sdk/platform/Theme/ThemePlatformModel.d.ts +103 -17
  214. package/sdk/platform/Theme/ThemePlatformModel.js +92 -23
  215. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +167 -45
  216. package/sdk/platform/User/UserPlatformApplicationClient.js +950 -67
  217. package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +189 -3
  218. package/sdk/platform/User/UserPlatformApplicationValidator.js +157 -3
  219. package/sdk/platform/User/UserPlatformModel.d.ts +880 -47
  220. package/sdk/platform/User/UserPlatformModel.js +607 -46
  221. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +33 -86
  222. package/sdk/platform/Webhook/WebhookPlatformClient.js +79 -474
  223. package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +861 -422
  224. package/sdk/platform/Webhook/WebhookPlatformModel.js +469 -391
  225. package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +10 -55
  226. package/sdk/platform/Webhook/WebhookPlatformValidator.js +12 -72
  227. package/sdk/platform/index.d.ts +0 -2
  228. package/sdk/platform/index.js +0 -4
  229. package/sdk/public/Catalog/CatalogPublicClient.d.ts +22 -0
  230. package/sdk/public/Catalog/CatalogPublicClient.js +133 -0
  231. package/sdk/public/Catalog/CatalogPublicModel.d.ts +158 -0
  232. package/sdk/public/Catalog/CatalogPublicModel.js +116 -0
  233. package/sdk/public/Catalog/CatalogPublicValidator.d.ts +55 -0
  234. package/sdk/public/Catalog/CatalogPublicValidator.js +35 -0
  235. package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +5 -4
  236. package/sdk/public/Configuration/ConfigurationPublicClient.js +9 -8
  237. package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +41 -21
  238. package/sdk/public/Configuration/ConfigurationPublicModel.js +28 -12
  239. package/sdk/public/Content/ContentPublicClient.d.ts +145 -2
  240. package/sdk/public/Content/ContentPublicClient.js +1067 -17
  241. package/sdk/public/Content/ContentPublicModel.d.ts +704 -3
  242. package/sdk/public/Content/ContentPublicModel.js +751 -3
  243. package/sdk/public/Content/ContentPublicValidator.d.ts +94 -3
  244. package/sdk/public/Content/ContentPublicValidator.js +119 -2
  245. package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
  246. package/sdk/public/Partner/PartnerPublicClient.js +1 -1
  247. package/sdk/public/Partner/PartnerPublicModel.d.ts +248 -72
  248. package/sdk/public/Partner/PartnerPublicModel.js +81 -71
  249. package/sdk/public/Partner/PartnerPublicValidator.d.ts +2 -2
  250. package/sdk/public/Partner/PartnerPublicValidator.js +1 -1
  251. package/sdk/public/PublicClient.d.ts +5 -2
  252. package/sdk/public/PublicClient.js +16 -6
  253. package/sdk/public/Webhook/WebhookPublicClient.d.ts +13 -13
  254. package/sdk/public/Webhook/WebhookPublicClient.js +13 -13
  255. package/sdk/public/Webhook/WebhookPublicModel.d.ts +249 -67
  256. package/sdk/public/Webhook/WebhookPublicModel.js +81 -61
  257. package/sdk/public/Webhook/WebhookPublicValidator.d.ts +4 -4
  258. package/sdk/public/Webhook/WebhookPublicValidator.js +4 -4
  259. package/sdk/public/index.d.ts +1 -0
  260. package/sdk/public/index.js +2 -0
  261. package/utility.d.ts +3 -0
  262. package/utility.js +7 -0
  263. package/sdk/application/Rewards/RewardsApplicationClient.d.ts +0 -79
  264. package/sdk/application/Rewards/RewardsApplicationClient.js +0 -315
  265. package/sdk/application/Webhook/WebhookApplicationClient.d.ts +0 -19
  266. package/sdk/application/Webhook/WebhookApplicationClient.js +0 -72
  267. package/sdk/platform/Finance/FinancePlatformClient.d.ts +0 -320
  268. package/sdk/platform/Finance/FinancePlatformClient.js +0 -2333
  269. package/sdk/platform/Finance/FinancePlatformModel.d.ts +0 -2890
  270. package/sdk/platform/Finance/FinancePlatformModel.js +0 -2148
  271. package/sdk/platform/Finance/FinancePlatformValidator.d.ts +0 -284
  272. package/sdk/platform/Finance/FinancePlatformValidator.js +0 -354
  273. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +0 -136
  274. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +0 -976
  275. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +0 -152
  276. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +0 -157
  277. package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +0 -382
  278. package/sdk/platform/Rewards/RewardsPlatformModel.js +0 -408
@@ -1,976 +0,0 @@
1
- const PlatformAPIClient = require("../PlatformAPIClient");
2
- const {
3
- FDKClientValidationError,
4
- FDKResponseValidationError,
5
- } = require("../../common/FDKError");
6
- const Paginator = require("../../common/Paginator");
7
- const RewardsPlatformApplicationValidator = require("./RewardsPlatformApplicationValidator");
8
- const RewardsPlatformModel = require("./RewardsPlatformModel");
9
- const { Logger } = require("./../../common/Logger");
10
- const Joi = require("joi");
11
-
12
- class Rewards {
13
- constructor(config, applicationId) {
14
- this.config = config;
15
- this.applicationId = applicationId;
16
- }
17
-
18
- /**
19
- * @param {RewardsPlatformApplicationValidator.GetGiveawayByIdParam} arg - Arg object
20
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
21
- * @param {import("../PlatformAPIClient").Options} - Options
22
- * @returns {Promise<RewardsPlatformModel.Giveaway>} - Success response
23
- * @name getGiveawayById
24
- * @summary: Get a giveaway
25
- * @description: Retrieve specific giveaway details by its unique identifier. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/getGiveawayById/).
26
- */
27
- async getGiveawayById(
28
- { id, requestHeaders } = { requestHeaders: {} },
29
- { responseHeaders } = { responseHeaders: false }
30
- ) {
31
- const {
32
- error,
33
- } = RewardsPlatformApplicationValidator.getGiveawayById().validate(
34
- {
35
- id,
36
- },
37
- { abortEarly: false, allowUnknown: true }
38
- );
39
- if (error) {
40
- return Promise.reject(new FDKClientValidationError(error));
41
- }
42
-
43
- // Showing warrnings if extra unknown parameters are found
44
- const {
45
- error: warrning,
46
- } = RewardsPlatformApplicationValidator.getGiveawayById().validate(
47
- {
48
- id,
49
- },
50
- { abortEarly: false, allowUnknown: false }
51
- );
52
- if (warrning) {
53
- Logger({
54
- level: "WARN",
55
- message: `Parameter Validation warrnings for platform > Rewards > getGiveawayById \n ${warrning}`,
56
- });
57
- }
58
-
59
- const query_params = {};
60
-
61
- const response = await PlatformAPIClient.execute(
62
- this.config,
63
- "get",
64
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/${id}`,
65
- query_params,
66
- undefined,
67
- requestHeaders,
68
- { responseHeaders }
69
- );
70
-
71
- let responseData = response;
72
- if (responseHeaders) {
73
- responseData = response[0];
74
- }
75
-
76
- const {
77
- error: res_error,
78
- } = RewardsPlatformModel.Giveaway().validate(responseData, {
79
- abortEarly: false,
80
- allowUnknown: true,
81
- });
82
-
83
- if (res_error) {
84
- if (this.config.options.strictResponseCheck === true) {
85
- return Promise.reject(new FDKResponseValidationError(res_error));
86
- } else {
87
- Logger({
88
- level: "WARN",
89
- message: `Response Validation Warnings for platform > Rewards > getGiveawayById \n ${res_error}`,
90
- });
91
- }
92
- }
93
-
94
- return response;
95
- }
96
-
97
- /**
98
- * @param {RewardsPlatformApplicationValidator.GetOfferByNameParam} arg - Arg object
99
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
100
- * @param {import("../PlatformAPIClient").Options} - Options
101
- * @returns {Promise<RewardsPlatformModel.Offer>} - Success response
102
- * @name getOfferByName
103
- * @summary: Get offer by name
104
- * @description: Retrieve an offer by its name. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/getOfferByName/).
105
- */
106
- async getOfferByName(
107
- { name, requestHeaders } = { requestHeaders: {} },
108
- { responseHeaders } = { responseHeaders: false }
109
- ) {
110
- const {
111
- error,
112
- } = RewardsPlatformApplicationValidator.getOfferByName().validate(
113
- { name },
114
- { abortEarly: false, allowUnknown: true }
115
- );
116
- if (error) {
117
- return Promise.reject(new FDKClientValidationError(error));
118
- }
119
-
120
- // Showing warrnings if extra unknown parameters are found
121
- const {
122
- error: warrning,
123
- } = RewardsPlatformApplicationValidator.getOfferByName().validate(
124
- { name },
125
- { abortEarly: false, allowUnknown: false }
126
- );
127
- if (warrning) {
128
- Logger({
129
- level: "WARN",
130
- message: `Parameter Validation warrnings for platform > Rewards > getOfferByName \n ${warrning}`,
131
- });
132
- }
133
-
134
- const query_params = {};
135
-
136
- const response = await PlatformAPIClient.execute(
137
- this.config,
138
- "get",
139
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/${name}/`,
140
- query_params,
141
- undefined,
142
- requestHeaders,
143
- { responseHeaders }
144
- );
145
-
146
- let responseData = response;
147
- if (responseHeaders) {
148
- responseData = response[0];
149
- }
150
-
151
- const {
152
- error: res_error,
153
- } = RewardsPlatformModel.Offer().validate(responseData, {
154
- abortEarly: false,
155
- allowUnknown: true,
156
- });
157
-
158
- if (res_error) {
159
- if (this.config.options.strictResponseCheck === true) {
160
- return Promise.reject(new FDKResponseValidationError(res_error));
161
- } else {
162
- Logger({
163
- level: "WARN",
164
- message: `Response Validation Warnings for platform > Rewards > getOfferByName \n ${res_error}`,
165
- });
166
- }
167
- }
168
-
169
- return response;
170
- }
171
-
172
- /**
173
- * @param {RewardsPlatformApplicationValidator.GetRewardsConfigurationParam} arg
174
- * - Arg object
175
- *
176
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
177
- * @param {import("../PlatformAPIClient").Options} - Options
178
- * @returns {Promise<RewardsPlatformModel.ConfigurationRes>} - Success response
179
- * @name getRewardsConfiguration
180
- * @summary: Get rewards configuration
181
- * @description: Retrieve the configuration settings for the rewards program. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/getRewardsConfiguration/).
182
- */
183
- async getRewardsConfiguration(
184
- { requestHeaders } = { requestHeaders: {} },
185
- { responseHeaders } = { responseHeaders: false }
186
- ) {
187
- const {
188
- error,
189
- } = RewardsPlatformApplicationValidator.getRewardsConfiguration().validate(
190
- {},
191
- { abortEarly: false, allowUnknown: true }
192
- );
193
- if (error) {
194
- return Promise.reject(new FDKClientValidationError(error));
195
- }
196
-
197
- // Showing warrnings if extra unknown parameters are found
198
- const {
199
- error: warrning,
200
- } = RewardsPlatformApplicationValidator.getRewardsConfiguration().validate(
201
- {},
202
- { abortEarly: false, allowUnknown: false }
203
- );
204
- if (warrning) {
205
- Logger({
206
- level: "WARN",
207
- message: `Parameter Validation warrnings for platform > Rewards > getRewardsConfiguration \n ${warrning}`,
208
- });
209
- }
210
-
211
- const query_params = {};
212
-
213
- const response = await PlatformAPIClient.execute(
214
- this.config,
215
- "get",
216
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/configuration/`,
217
- query_params,
218
- undefined,
219
- requestHeaders,
220
- { responseHeaders }
221
- );
222
-
223
- let responseData = response;
224
- if (responseHeaders) {
225
- responseData = response[0];
226
- }
227
-
228
- const {
229
- error: res_error,
230
- } = RewardsPlatformModel.ConfigurationRes().validate(responseData, {
231
- abortEarly: false,
232
- allowUnknown: true,
233
- });
234
-
235
- if (res_error) {
236
- if (this.config.options.strictResponseCheck === true) {
237
- return Promise.reject(new FDKResponseValidationError(res_error));
238
- } else {
239
- Logger({
240
- level: "WARN",
241
- message: `Response Validation Warnings for platform > Rewards > getRewardsConfiguration \n ${res_error}`,
242
- });
243
- }
244
- }
245
-
246
- return response;
247
- }
248
-
249
- /**
250
- * @param {RewardsPlatformApplicationValidator.GetUserDetailsParam} arg - Arg object
251
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
252
- * @param {import("../PlatformAPIClient").Options} - Options
253
- * @returns {Promise<RewardsPlatformModel.UserRes>} - Success response
254
- * @name getUserDetails
255
- * @summary: Get a user
256
- * @description: Retrieve comprehensive details about a user in the rewards program. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/getUserDetails/).
257
- */
258
- async getUserDetails(
259
- { userId, requestHeaders } = { requestHeaders: {} },
260
- { responseHeaders } = { responseHeaders: false }
261
- ) {
262
- const {
263
- error,
264
- } = RewardsPlatformApplicationValidator.getUserDetails().validate(
265
- { userId },
266
- { abortEarly: false, allowUnknown: true }
267
- );
268
- if (error) {
269
- return Promise.reject(new FDKClientValidationError(error));
270
- }
271
-
272
- // Showing warrnings if extra unknown parameters are found
273
- const {
274
- error: warrning,
275
- } = RewardsPlatformApplicationValidator.getUserDetails().validate(
276
- { userId },
277
- { abortEarly: false, allowUnknown: false }
278
- );
279
- if (warrning) {
280
- Logger({
281
- level: "WARN",
282
- message: `Parameter Validation warrnings for platform > Rewards > getUserDetails \n ${warrning}`,
283
- });
284
- }
285
-
286
- const query_params = {};
287
-
288
- const response = await PlatformAPIClient.execute(
289
- this.config,
290
- "get",
291
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/`,
292
- query_params,
293
- undefined,
294
- requestHeaders,
295
- { responseHeaders }
296
- );
297
-
298
- let responseData = response;
299
- if (responseHeaders) {
300
- responseData = response[0];
301
- }
302
-
303
- const {
304
- error: res_error,
305
- } = RewardsPlatformModel.UserRes().validate(responseData, {
306
- abortEarly: false,
307
- allowUnknown: true,
308
- });
309
-
310
- if (res_error) {
311
- if (this.config.options.strictResponseCheck === true) {
312
- return Promise.reject(new FDKResponseValidationError(res_error));
313
- } else {
314
- Logger({
315
- level: "WARN",
316
- message: `Response Validation Warnings for platform > Rewards > getUserDetails \n ${res_error}`,
317
- });
318
- }
319
- }
320
-
321
- return response;
322
- }
323
-
324
- /**
325
- * @param {RewardsPlatformApplicationValidator.GetUserPointsHistoryParam} arg
326
- * - Arg object
327
- *
328
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
329
- * @param {import("../PlatformAPIClient").Options} - Options
330
- * @returns {Promise<RewardsPlatformModel.HistoryRes>} - Success response
331
- * @name getUserPointsHistory
332
- * @summary: Get reward user points history
333
- * @description: Retrieve the history of points earned and redeemed by a user. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/getUserPointsHistory/).
334
- */
335
- async getUserPointsHistory(
336
- { userId, pageId, pageSize, requestHeaders } = { requestHeaders: {} },
337
- { responseHeaders } = { responseHeaders: false }
338
- ) {
339
- const {
340
- error,
341
- } = RewardsPlatformApplicationValidator.getUserPointsHistory().validate(
342
- {
343
- userId,
344
-
345
- pageId,
346
- pageSize,
347
- },
348
- { abortEarly: false, allowUnknown: true }
349
- );
350
- if (error) {
351
- return Promise.reject(new FDKClientValidationError(error));
352
- }
353
-
354
- // Showing warrnings if extra unknown parameters are found
355
- const {
356
- error: warrning,
357
- } = RewardsPlatformApplicationValidator.getUserPointsHistory().validate(
358
- {
359
- userId,
360
-
361
- pageId,
362
- pageSize,
363
- },
364
- { abortEarly: false, allowUnknown: false }
365
- );
366
- if (warrning) {
367
- Logger({
368
- level: "WARN",
369
- message: `Parameter Validation warrnings for platform > Rewards > getUserPointsHistory \n ${warrning}`,
370
- });
371
- }
372
-
373
- const query_params = {};
374
- query_params["page_id"] = pageId;
375
- query_params["page_size"] = pageSize;
376
-
377
- const response = await PlatformAPIClient.execute(
378
- this.config,
379
- "get",
380
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/points/history/`,
381
- query_params,
382
- undefined,
383
- requestHeaders,
384
- { responseHeaders }
385
- );
386
-
387
- let responseData = response;
388
- if (responseHeaders) {
389
- responseData = response[0];
390
- }
391
-
392
- const {
393
- error: res_error,
394
- } = RewardsPlatformModel.HistoryRes().validate(responseData, {
395
- abortEarly: false,
396
- allowUnknown: true,
397
- });
398
-
399
- if (res_error) {
400
- if (this.config.options.strictResponseCheck === true) {
401
- return Promise.reject(new FDKResponseValidationError(res_error));
402
- } else {
403
- Logger({
404
- level: "WARN",
405
- message: `Response Validation Warnings for platform > Rewards > getUserPointsHistory \n ${res_error}`,
406
- });
407
- }
408
- }
409
-
410
- return response;
411
- }
412
-
413
- /**
414
- * @param {RewardsPlatformApplicationValidator.SaveGiveAwayParam} arg - Arg object
415
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
416
- * @param {import("../PlatformAPIClient").Options} - Options
417
- * @returns {Promise<RewardsPlatformModel.Giveaway>} - Success response
418
- * @name saveGiveAway
419
- * @summary: Create a giveaway
420
- * @description: Store and manage details of a giveaway. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/saveGiveAway/).
421
- */
422
- async saveGiveAway(
423
- { body, requestHeaders } = { requestHeaders: {} },
424
- { responseHeaders } = { responseHeaders: false }
425
- ) {
426
- const {
427
- error,
428
- } = RewardsPlatformApplicationValidator.saveGiveAway().validate(
429
- {
430
- body,
431
- },
432
- { abortEarly: false, allowUnknown: true }
433
- );
434
- if (error) {
435
- return Promise.reject(new FDKClientValidationError(error));
436
- }
437
-
438
- // Showing warrnings if extra unknown parameters are found
439
- const {
440
- error: warrning,
441
- } = RewardsPlatformApplicationValidator.saveGiveAway().validate(
442
- {
443
- body,
444
- },
445
- { abortEarly: false, allowUnknown: false }
446
- );
447
- if (warrning) {
448
- Logger({
449
- level: "WARN",
450
- message: `Parameter Validation warrnings for platform > Rewards > saveGiveAway \n ${warrning}`,
451
- });
452
- }
453
-
454
- const query_params = {};
455
-
456
- const response = await PlatformAPIClient.execute(
457
- this.config,
458
- "post",
459
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways`,
460
- query_params,
461
- body,
462
- requestHeaders,
463
- { responseHeaders }
464
- );
465
-
466
- let responseData = response;
467
- if (responseHeaders) {
468
- responseData = response[0];
469
- }
470
-
471
- const {
472
- error: res_error,
473
- } = RewardsPlatformModel.Giveaway().validate(responseData, {
474
- abortEarly: false,
475
- allowUnknown: true,
476
- });
477
-
478
- if (res_error) {
479
- if (this.config.options.strictResponseCheck === true) {
480
- return Promise.reject(new FDKResponseValidationError(res_error));
481
- } else {
482
- Logger({
483
- level: "WARN",
484
- message: `Response Validation Warnings for platform > Rewards > saveGiveAway \n ${res_error}`,
485
- });
486
- }
487
- }
488
-
489
- return response;
490
- }
491
-
492
- /**
493
- * @param {RewardsPlatformApplicationValidator.SetRewardsConfigurationParam} arg
494
- * - Arg object
495
- *
496
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
497
- * @param {import("../PlatformAPIClient").Options} - Options
498
- * @returns {Promise<RewardsPlatformModel.SetConfigurationRes>} - Success response
499
- * @name setRewardsConfiguration
500
- * @summary: Set rewards configuration
501
- * @description: Configure and modify the settings for the rewards program. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/setRewardsConfiguration/).
502
- */
503
- async setRewardsConfiguration(
504
- { body, requestHeaders } = { requestHeaders: {} },
505
- { responseHeaders } = { responseHeaders: false }
506
- ) {
507
- const {
508
- error,
509
- } = RewardsPlatformApplicationValidator.setRewardsConfiguration().validate(
510
- {
511
- body,
512
- },
513
- { abortEarly: false, allowUnknown: true }
514
- );
515
- if (error) {
516
- return Promise.reject(new FDKClientValidationError(error));
517
- }
518
-
519
- // Showing warrnings if extra unknown parameters are found
520
- const {
521
- error: warrning,
522
- } = RewardsPlatformApplicationValidator.setRewardsConfiguration().validate(
523
- {
524
- body,
525
- },
526
- { abortEarly: false, allowUnknown: false }
527
- );
528
- if (warrning) {
529
- Logger({
530
- level: "WARN",
531
- message: `Parameter Validation warrnings for platform > Rewards > setRewardsConfiguration \n ${warrning}`,
532
- });
533
- }
534
-
535
- const query_params = {};
536
-
537
- const response = await PlatformAPIClient.execute(
538
- this.config,
539
- "post",
540
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/configuration/`,
541
- query_params,
542
- body,
543
- requestHeaders,
544
- { responseHeaders }
545
- );
546
-
547
- let responseData = response;
548
- if (responseHeaders) {
549
- responseData = response[0];
550
- }
551
-
552
- const {
553
- error: res_error,
554
- } = RewardsPlatformModel.SetConfigurationRes().validate(responseData, {
555
- abortEarly: false,
556
- allowUnknown: true,
557
- });
558
-
559
- if (res_error) {
560
- if (this.config.options.strictResponseCheck === true) {
561
- return Promise.reject(new FDKResponseValidationError(res_error));
562
- } else {
563
- Logger({
564
- level: "WARN",
565
- message: `Response Validation Warnings for platform > Rewards > setRewardsConfiguration \n ${res_error}`,
566
- });
567
- }
568
- }
569
-
570
- return response;
571
- }
572
-
573
- /**
574
- * @param {RewardsPlatformApplicationValidator.ShowGiveawaysParam} arg - Arg object
575
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
576
- * @param {import("../PlatformAPIClient").Options} - Options
577
- * @returns {Promise<RewardsPlatformModel.GiveawayResponse>} - Success response
578
- * @name showGiveaways
579
- * @summary: List giveaways
580
- * @description: Retrieve and display available giveaways. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/showGiveaways/).
581
- */
582
- async showGiveaways(
583
- { pageId, pageSize, requestHeaders } = { requestHeaders: {} },
584
- { responseHeaders } = { responseHeaders: false }
585
- ) {
586
- const {
587
- error,
588
- } = RewardsPlatformApplicationValidator.showGiveaways().validate(
589
- {
590
- pageId,
591
- pageSize,
592
- },
593
- { abortEarly: false, allowUnknown: true }
594
- );
595
- if (error) {
596
- return Promise.reject(new FDKClientValidationError(error));
597
- }
598
-
599
- // Showing warrnings if extra unknown parameters are found
600
- const {
601
- error: warrning,
602
- } = RewardsPlatformApplicationValidator.showGiveaways().validate(
603
- {
604
- pageId,
605
- pageSize,
606
- },
607
- { abortEarly: false, allowUnknown: false }
608
- );
609
- if (warrning) {
610
- Logger({
611
- level: "WARN",
612
- message: `Parameter Validation warrnings for platform > Rewards > showGiveaways \n ${warrning}`,
613
- });
614
- }
615
-
616
- const query_params = {};
617
- query_params["page_id"] = pageId;
618
- query_params["page_size"] = pageSize;
619
-
620
- const response = await PlatformAPIClient.execute(
621
- this.config,
622
- "get",
623
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways`,
624
- query_params,
625
- undefined,
626
- requestHeaders,
627
- { responseHeaders }
628
- );
629
-
630
- let responseData = response;
631
- if (responseHeaders) {
632
- responseData = response[0];
633
- }
634
-
635
- const {
636
- error: res_error,
637
- } = RewardsPlatformModel.GiveawayResponse().validate(responseData, {
638
- abortEarly: false,
639
- allowUnknown: true,
640
- });
641
-
642
- if (res_error) {
643
- if (this.config.options.strictResponseCheck === true) {
644
- return Promise.reject(new FDKResponseValidationError(res_error));
645
- } else {
646
- Logger({
647
- level: "WARN",
648
- message: `Response Validation Warnings for platform > Rewards > showGiveaways \n ${res_error}`,
649
- });
650
- }
651
- }
652
-
653
- return response;
654
- }
655
-
656
- /**
657
- * @param {RewardsPlatformApplicationValidator.ShowOffersParam} arg - Arg object
658
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
659
- * @param {import("../PlatformAPIClient").Options} - Options
660
- * @returns {Promise<RewardsPlatformModel.Offer[]>} - Success response
661
- * @name showOffers
662
- * @summary: List offers
663
- * @description: Display available offers for users. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/showOffers/).
664
- */
665
- async showOffers(
666
- { requestHeaders } = { requestHeaders: {} },
667
- { responseHeaders } = { responseHeaders: false }
668
- ) {
669
- const { error } = RewardsPlatformApplicationValidator.showOffers().validate(
670
- {},
671
- { abortEarly: false, allowUnknown: true }
672
- );
673
- if (error) {
674
- return Promise.reject(new FDKClientValidationError(error));
675
- }
676
-
677
- // Showing warrnings if extra unknown parameters are found
678
- const {
679
- error: warrning,
680
- } = RewardsPlatformApplicationValidator.showOffers().validate(
681
- {},
682
- { abortEarly: false, allowUnknown: false }
683
- );
684
- if (warrning) {
685
- Logger({
686
- level: "WARN",
687
- message: `Parameter Validation warrnings for platform > Rewards > showOffers \n ${warrning}`,
688
- });
689
- }
690
-
691
- const query_params = {};
692
-
693
- const response = await PlatformAPIClient.execute(
694
- this.config,
695
- "get",
696
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/`,
697
- query_params,
698
- undefined,
699
- requestHeaders,
700
- { responseHeaders }
701
- );
702
-
703
- let responseData = response;
704
- if (responseHeaders) {
705
- responseData = response[0];
706
- }
707
-
708
- const { error: res_error } = Joi.array()
709
- .items(RewardsPlatformModel.Offer())
710
- .validate(responseData, { abortEarly: false, allowUnknown: true });
711
-
712
- if (res_error) {
713
- if (this.config.options.strictResponseCheck === true) {
714
- return Promise.reject(new FDKResponseValidationError(res_error));
715
- } else {
716
- Logger({
717
- level: "WARN",
718
- message: `Response Validation Warnings for platform > Rewards > showOffers \n ${res_error}`,
719
- });
720
- }
721
- }
722
-
723
- return response;
724
- }
725
-
726
- /**
727
- * @param {RewardsPlatformApplicationValidator.UpdateGiveAwayParam} arg - Arg object
728
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
729
- * @param {import("../PlatformAPIClient").Options} - Options
730
- * @returns {Promise<RewardsPlatformModel.Giveaway>} - Success response
731
- * @name updateGiveAway
732
- * @summary: Update a giveaway
733
- * @description: Modify and update information about a giveaway. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/updateGiveAway/).
734
- */
735
- async updateGiveAway(
736
- { id, body, requestHeaders } = { requestHeaders: {} },
737
- { responseHeaders } = { responseHeaders: false }
738
- ) {
739
- const {
740
- error,
741
- } = RewardsPlatformApplicationValidator.updateGiveAway().validate(
742
- {
743
- id,
744
- body,
745
- },
746
- { abortEarly: false, allowUnknown: true }
747
- );
748
- if (error) {
749
- return Promise.reject(new FDKClientValidationError(error));
750
- }
751
-
752
- // Showing warrnings if extra unknown parameters are found
753
- const {
754
- error: warrning,
755
- } = RewardsPlatformApplicationValidator.updateGiveAway().validate(
756
- {
757
- id,
758
- body,
759
- },
760
- { abortEarly: false, allowUnknown: false }
761
- );
762
- if (warrning) {
763
- Logger({
764
- level: "WARN",
765
- message: `Parameter Validation warrnings for platform > Rewards > updateGiveAway \n ${warrning}`,
766
- });
767
- }
768
-
769
- const query_params = {};
770
-
771
- const response = await PlatformAPIClient.execute(
772
- this.config,
773
- "put",
774
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/${id}`,
775
- query_params,
776
- body,
777
- requestHeaders,
778
- { responseHeaders }
779
- );
780
-
781
- let responseData = response;
782
- if (responseHeaders) {
783
- responseData = response[0];
784
- }
785
-
786
- const {
787
- error: res_error,
788
- } = RewardsPlatformModel.Giveaway().validate(responseData, {
789
- abortEarly: false,
790
- allowUnknown: true,
791
- });
792
-
793
- if (res_error) {
794
- if (this.config.options.strictResponseCheck === true) {
795
- return Promise.reject(new FDKResponseValidationError(res_error));
796
- } else {
797
- Logger({
798
- level: "WARN",
799
- message: `Response Validation Warnings for platform > Rewards > updateGiveAway \n ${res_error}`,
800
- });
801
- }
802
- }
803
-
804
- return response;
805
- }
806
-
807
- /**
808
- * @param {RewardsPlatformApplicationValidator.UpdateOfferByNameParam} arg
809
- * - Arg object
810
- *
811
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
812
- * @param {import("../PlatformAPIClient").Options} - Options
813
- * @returns {Promise<RewardsPlatformModel.Offer>} - Success response
814
- * @name updateOfferByName
815
- * @summary: Update offer by name
816
- * @description: Modify and manage an offer using its name. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/updateOfferByName/).
817
- */
818
- async updateOfferByName(
819
- { name, body, requestHeaders } = { requestHeaders: {} },
820
- { responseHeaders } = { responseHeaders: false }
821
- ) {
822
- const {
823
- error,
824
- } = RewardsPlatformApplicationValidator.updateOfferByName().validate(
825
- {
826
- name,
827
-
828
- body,
829
- },
830
- { abortEarly: false, allowUnknown: true }
831
- );
832
- if (error) {
833
- return Promise.reject(new FDKClientValidationError(error));
834
- }
835
-
836
- // Showing warrnings if extra unknown parameters are found
837
- const {
838
- error: warrning,
839
- } = RewardsPlatformApplicationValidator.updateOfferByName().validate(
840
- {
841
- name,
842
-
843
- body,
844
- },
845
- { abortEarly: false, allowUnknown: false }
846
- );
847
- if (warrning) {
848
- Logger({
849
- level: "WARN",
850
- message: `Parameter Validation warrnings for platform > Rewards > updateOfferByName \n ${warrning}`,
851
- });
852
- }
853
-
854
- const query_params = {};
855
-
856
- const response = await PlatformAPIClient.execute(
857
- this.config,
858
- "put",
859
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/offers/${name}/`,
860
- query_params,
861
- body,
862
- requestHeaders,
863
- { responseHeaders }
864
- );
865
-
866
- let responseData = response;
867
- if (responseHeaders) {
868
- responseData = response[0];
869
- }
870
-
871
- const {
872
- error: res_error,
873
- } = RewardsPlatformModel.Offer().validate(responseData, {
874
- abortEarly: false,
875
- allowUnknown: true,
876
- });
877
-
878
- if (res_error) {
879
- if (this.config.options.strictResponseCheck === true) {
880
- return Promise.reject(new FDKResponseValidationError(res_error));
881
- } else {
882
- Logger({
883
- level: "WARN",
884
- message: `Response Validation Warnings for platform > Rewards > updateOfferByName \n ${res_error}`,
885
- });
886
- }
887
- }
888
-
889
- return response;
890
- }
891
-
892
- /**
893
- * @param {RewardsPlatformApplicationValidator.UpdateUserStatusParam} arg - Arg object
894
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
895
- * @param {import("../PlatformAPIClient").Options} - Options
896
- * @returns {Promise<RewardsPlatformModel.AppUser>} - Success response
897
- * @name updateUserStatus
898
- * @summary: Update user status
899
- * @description: Change and update the status of a user in the rewards system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/rewards/updateUserStatus/).
900
- */
901
- async updateUserStatus(
902
- { userId, body, requestHeaders } = { requestHeaders: {} },
903
- { responseHeaders } = { responseHeaders: false }
904
- ) {
905
- const {
906
- error,
907
- } = RewardsPlatformApplicationValidator.updateUserStatus().validate(
908
- {
909
- userId,
910
-
911
- body,
912
- },
913
- { abortEarly: false, allowUnknown: true }
914
- );
915
- if (error) {
916
- return Promise.reject(new FDKClientValidationError(error));
917
- }
918
-
919
- // Showing warrnings if extra unknown parameters are found
920
- const {
921
- error: warrning,
922
- } = RewardsPlatformApplicationValidator.updateUserStatus().validate(
923
- {
924
- userId,
925
-
926
- body,
927
- },
928
- { abortEarly: false, allowUnknown: false }
929
- );
930
- if (warrning) {
931
- Logger({
932
- level: "WARN",
933
- message: `Parameter Validation warrnings for platform > Rewards > updateUserStatus \n ${warrning}`,
934
- });
935
- }
936
-
937
- const query_params = {};
938
-
939
- const response = await PlatformAPIClient.execute(
940
- this.config,
941
- "patch",
942
- `/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/`,
943
- query_params,
944
- body,
945
- requestHeaders,
946
- { responseHeaders }
947
- );
948
-
949
- let responseData = response;
950
- if (responseHeaders) {
951
- responseData = response[0];
952
- }
953
-
954
- const {
955
- error: res_error,
956
- } = RewardsPlatformModel.AppUser().validate(responseData, {
957
- abortEarly: false,
958
- allowUnknown: true,
959
- });
960
-
961
- if (res_error) {
962
- if (this.config.options.strictResponseCheck === true) {
963
- return Promise.reject(new FDKResponseValidationError(res_error));
964
- } else {
965
- Logger({
966
- level: "WARN",
967
- message: `Response Validation Warnings for platform > Rewards > updateUserStatus \n ${res_error}`,
968
- });
969
- }
970
- }
971
-
972
- return response;
973
- }
974
- }
975
-
976
- module.exports = Rewards;