@voucherify/sdk 2.4.0 → 2.6.0

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.
@@ -397,6 +397,14 @@
397
397
  create(exportResource) {
398
398
  return this.client.post('/exports', exportResource);
399
399
  }
400
+ /**
401
+ * @see https://docs.voucherify.io/reference/list-exports
402
+ */
403
+
404
+
405
+ list(query = {}) {
406
+ return this.client.get('/exports', query);
407
+ }
400
408
  /**
401
409
  * @see https://docs.voucherify.io/reference/get-export
402
410
  */
@@ -582,6 +590,22 @@
582
590
  form.append('file', fileStream);
583
591
  return this.client.post('/vouchers/importCSV', form);
584
592
  }
593
+ /**
594
+ * @see https://docs.voucherify.io/reference/list-voucher-transactions
595
+ */
596
+
597
+
598
+ listTransactions(code, params) {
599
+ return this.client.get(`/vouchers/${encode(code)}/transactions`, params);
600
+ }
601
+ /**
602
+ * @see https://docs.voucherify.io/reference/export-voucher-transactions
603
+ */
604
+
605
+
606
+ exportTransactions(code, body) {
607
+ return this.client.post(`/vouchers/${encode(code)}/transactions/export`, body);
608
+ }
585
609
 
586
610
  }
587
611
 
@@ -769,11 +793,13 @@
769
793
  }
770
794
 
771
795
  class Promotions {
772
- constructor(client, tiers) {
796
+ constructor(client, tiers, stack) {
773
797
  this.client = void 0;
774
798
  this.tiers = void 0;
799
+ this.stack = void 0;
775
800
  this.client = client;
776
801
  this.tiers = tiers;
802
+ this.stack = stack;
777
803
  }
778
804
  /**
779
805
  * @see https://docs.voucherify.io/reference/create-promotion-campaign
@@ -1176,6 +1202,14 @@
1176
1202
  delete(rewardId) {
1177
1203
  return this.client.delete(`/rewards/${encode(rewardId)}`);
1178
1204
  }
1205
+ /**
1206
+ * @see https://docs.voucherify.io/reference/get-reward-assignment
1207
+ */
1208
+
1209
+
1210
+ getAssignment(rewardId, assignmentId) {
1211
+ return this.client.get(`/rewards/${encode(rewardId)}/assignments/${encode(assignmentId)}`);
1212
+ }
1179
1213
  /**
1180
1214
  * @see https://docs.voucherify.io/reference/list-reward-assignments
1181
1215
  */
@@ -1284,6 +1318,14 @@
1284
1318
  deleteRewardAssignment(campaignId, assignmentId) {
1285
1319
  return this.client.delete(`/loyalties/${encode(campaignId)}/rewards/${assignmentId}`);
1286
1320
  }
1321
+ /**
1322
+ * @see https://docs.voucherify.io/reference/get-reward-assignment-2
1323
+ */
1324
+
1325
+
1326
+ getRewardAssignment(campaignId, assignmentId) {
1327
+ return this.client.get(`/loyalties/${encode(campaignId)}/rewards/${encode(assignmentId)}`);
1328
+ }
1287
1329
  /**
1288
1330
  * @see https://docs.voucherify.io/reference/list-earning-rules
1289
1331
  */
@@ -1358,28 +1400,63 @@
1358
1400
  }
1359
1401
  /**
1360
1402
  * @see https://docs.voucherify.io/reference/get-member
1403
+ * @see https://docs.voucherify.io/reference/get-member-1
1361
1404
  */
1362
1405
 
1363
1406
 
1364
1407
  getMember(campaignId, memberId) {
1365
- return this.client.get(`/loyalties/${encode(campaignId)}/members/${memberId}`);
1408
+ return this.client.get(campaignId ? `/loyalties/${encode(campaignId)}/members/${memberId}` : `/loyalties/members/${memberId}`);
1366
1409
  }
1367
1410
  /**
1368
1411
  * @see https://docs.voucherify.io/reference/get-member-activities
1412
+ * @see https://docs.voucherify.io/reference/get-member-activities-1
1369
1413
  */
1370
1414
 
1371
1415
 
1372
1416
  getMemberActivities(campaignId, memberId) {
1373
- return this.client.get(`/loyalties/${encode(campaignId)}/members/${memberId}/activities`);
1417
+ return this.client.get(campaignId ? `/loyalties/${encode(campaignId)}/members/${memberId}/activities` : `/loyalties/members/${memberId}/activities`);
1374
1418
  }
1375
1419
  /**
1376
- * @see https://docs.voucherify.io/reference/add-loyalty-card-balance
1420
+ * @see https://docs.voucherify.io/reference/list-member-rewards
1421
+ */
1422
+
1423
+
1424
+ listMemberRewards(memberId, params) {
1425
+ return this.client.get(`/loyalties/members/${encode(memberId)}/rewards`, params);
1426
+ }
1427
+ /**
1428
+ * @see https://docs.voucherify.io/reference/add-remove-loyalty-card-balance
1429
+ * @see https://docs.voucherify.io/reference/add-remove-loyalty-card-balance-1
1430
+ */
1431
+
1432
+
1433
+ addOrRemoveCardBalance(memberId, balance, campaignId) {
1434
+ return this.client.post(campaignId ? `/loyalties/${encode(campaignId)}/members/${memberId}/balance` : `/loyalties/members/${memberId}/balance`, balance);
1435
+ }
1436
+ /**
1437
+ * @see https://docs.voucherify.io/reference/add-remove-loyalty-card-balance-1
1377
1438
  */
1378
1439
 
1379
1440
 
1380
1441
  addPoints(campaignId, memberId, balance) {
1381
1442
  return this.client.post(`/loyalties/${encode(campaignId)}/members/${memberId}/balance`, balance);
1382
1443
  }
1444
+ /**
1445
+ * @see https://docs.voucherify.io/reference/transfer-points
1446
+ */
1447
+
1448
+
1449
+ transferPoints(campaignId, memberId, loyaltiesTransferPoints) {
1450
+ return this.client.post(`/loyalties/${encode(campaignId)}/members/${encode(memberId)}/transfers`, loyaltiesTransferPoints);
1451
+ }
1452
+ /**
1453
+ * @see https://docs.voucherify.io/reference/get-points-expiration
1454
+ */
1455
+
1456
+
1457
+ getPointsExpiration(campaignId, memberId, params) {
1458
+ return this.client.get(`/loyalties/${encode(campaignId)}/members/${memberId}/points-expiration`, params);
1459
+ }
1383
1460
  /**
1384
1461
  * @see https://docs.voucherify.io/reference/redeem-loyalty-card
1385
1462
  */
@@ -1388,6 +1465,80 @@
1388
1465
  redeemReward(campaignId, memberId, params) {
1389
1466
  return this.client.post(`/loyalties/${encode(campaignId)}/members/${encode(memberId)}/redemption`, params);
1390
1467
  }
1468
+ /**
1469
+ * @see https://docs.voucherify.io/reference/list-loyalty-tier-rewards
1470
+ */
1471
+
1472
+
1473
+ listLoyaltyTierRewards(campaignId, tierId) {
1474
+ return this.client.get(`/loyalties/${encode(campaignId)}/tiers/${encode(tierId)}/rewards`);
1475
+ }
1476
+ /**
1477
+ * @see https://docs.voucherify.io/reference/list-loyalty-card-transactions
1478
+ * @see https://docs.voucherify.io/reference/list-loyalty-card-transactions-1
1479
+ */
1480
+
1481
+
1482
+ listCardTransactions(memberId, campaignId, params) {
1483
+ return this.client.get(campaignId ? `/loyalties/${encode(campaignId)}/members/${encode(memberId)}/transactions` : `/loyalties/members/${encode(memberId)}/transactions`, params);
1484
+ }
1485
+ /**
1486
+ * @see https://docs.voucherify.io/reference/export-loyalty-card-transactions
1487
+ * @see https://docs.voucherify.io/reference/export-loyalty-card-transactions-1
1488
+ */
1489
+
1490
+
1491
+ exportCardTransactions(memberId, campaignId, params = {}) {
1492
+ return this.client.post(campaignId ? `/loyalties/${encode(campaignId)}/members/${encode(memberId)}/transactions/export` : `/loyalties/members/${encode(memberId)}/transactions/export`, params);
1493
+ }
1494
+ /**
1495
+ * @see https://docs.voucherify.io/reference/get-reward-details
1496
+ */
1497
+
1498
+
1499
+ getRewardDetails(campaignId, assignmentId) {
1500
+ return this.client.get(`/loyalties/${encode(campaignId)}/reward-assignments/${encode(assignmentId)}/reward`);
1501
+ }
1502
+ /**
1503
+ * @see https://docs.voucherify.io/reference/list-loyalty-tiers
1504
+ */
1505
+
1506
+
1507
+ listTiers(campaignId, params) {
1508
+ return this.client.get(`/loyalties/${encode(campaignId)}/tiers`, params);
1509
+ }
1510
+ /**
1511
+ * @see https://docs.voucherify.io/reference/get-loyalty-tier
1512
+ */
1513
+
1514
+
1515
+ getTier(campaignId, tierId) {
1516
+ return this.client.get(`/loyalties/${encode(campaignId)}/tiers/${encode(tierId)}`);
1517
+ }
1518
+ /**
1519
+ * @see https://docs.voucherify.io/reference/create-loyalty-tiers
1520
+ */
1521
+
1522
+
1523
+ createTiers(campaignId, tiers) {
1524
+ return this.client.post(`/loyalties/${encode(campaignId)}/tiers`, tiers);
1525
+ }
1526
+ /**
1527
+ * @see https://docs.voucherify.io/reference/list-loyalty-tier-earning-rules
1528
+ */
1529
+
1530
+
1531
+ listLoyaltyTierEarningRules(campaignId, tierId, params) {
1532
+ return this.client.get(`/loyalties/${encode(campaignId)}/tiers/${encode(tierId)}/earning-rules`, params);
1533
+ }
1534
+ /**
1535
+ * @see https://docs.voucherify.io/reference/get-member-loyalty-tier
1536
+ */
1537
+
1538
+
1539
+ listMemberLoyaltyTiers(memberId) {
1540
+ return this.client.get(`/loyalties/members/${encode(memberId)}/tiers`);
1541
+ }
1391
1542
 
1392
1543
  }
1393
1544
 
@@ -1456,6 +1607,14 @@
1456
1607
  list(params = {}) {
1457
1608
  return this.client.get('/validation-rules', params);
1458
1609
  }
1610
+ /**
1611
+ * @see https://docs.voucherify.io/reference/list-validation-rules-assignments
1612
+ */
1613
+
1614
+
1615
+ listRulesAssignments(params = {}) {
1616
+ return this.client.get(`/validation-rules-assignments`, params);
1617
+ }
1459
1618
  /**
1460
1619
  * @see https://docs.voucherify.io/reference/list-validation-rule-assignments
1461
1620
  */
@@ -1578,8 +1737,8 @@
1578
1737
  */
1579
1738
 
1580
1739
 
1581
- list() {
1582
- return this.client.get('/categories');
1740
+ list(params = {}) {
1741
+ return this.client.get('/categories', params);
1583
1742
  }
1584
1743
  /**
1585
1744
  * @see https://docs.voucherify.io/reference/create-category
@@ -1616,6 +1775,110 @@
1616
1775
 
1617
1776
  }
1618
1777
 
1778
+ class PromotionsStacks {
1779
+ constructor(client) {
1780
+ this.client = void 0;
1781
+ this.client = client;
1782
+ }
1783
+ /**
1784
+ * @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
1785
+ */
1786
+
1787
+
1788
+ listInCampaign(campaignId) {
1789
+ return this.client.get(`/promotions/${campaignId}/stacks`);
1790
+ }
1791
+ /**
1792
+ * @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
1793
+ */
1794
+
1795
+
1796
+ createInCampaign(campaignId, body) {
1797
+ return this.client.post(`/promotions/${campaignId}/stacks`, body);
1798
+ }
1799
+ /**
1800
+ * @see https://docs.voucherify.io/reference/delete-promotion-stack
1801
+ */
1802
+
1803
+
1804
+ delete(campaignId, stackId) {
1805
+ return this.client.delete(`/promotions/${campaignId}/stacks/${stackId}`);
1806
+ }
1807
+ /**
1808
+ * @see https://docs.voucherify.io/reference/get-promotion-stack
1809
+ */
1810
+
1811
+
1812
+ get(campaignId, stackId) {
1813
+ return this.client.get(`/promotions/${campaignId}/stacks/${stackId}`);
1814
+ }
1815
+ /**
1816
+ * @see https://docs.voucherify.io/reference/update-promotion-stack
1817
+ */
1818
+
1819
+
1820
+ update(campaignId, stackId, body) {
1821
+ return this.client.put(`/promotions/${campaignId}/stacks/${stackId}`, body);
1822
+ }
1823
+ /**
1824
+ * @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
1825
+ */
1826
+
1827
+
1828
+ list(params) {
1829
+ return this.client.get(`/promotions/stacks`, params);
1830
+ }
1831
+
1832
+ }
1833
+
1834
+ class ProductCollections {
1835
+ constructor(client) {
1836
+ this.client = void 0;
1837
+ this.client = client;
1838
+ }
1839
+ /**
1840
+ * @see https://docs.voucherify.io/reference/create-product-collection
1841
+ */
1842
+
1843
+
1844
+ create(productCollection) {
1845
+ return this.client.post(`/product-collections`, productCollection);
1846
+ }
1847
+ /**
1848
+ * @see https://docs.voucherify.io/reference/list-product-collections
1849
+ */
1850
+
1851
+
1852
+ list(params) {
1853
+ return this.client.get(`/product-collections`, params);
1854
+ }
1855
+ /**
1856
+ * @see https://docs.voucherify.io/reference/delete-product-collection
1857
+ */
1858
+
1859
+
1860
+ delete(productCollectionId) {
1861
+ return this.client.delete(`/product-collections/${encode(productCollectionId)}`);
1862
+ }
1863
+ /**
1864
+ * @see https://docs.voucherify.io/reference/get-product-collection
1865
+ */
1866
+
1867
+
1868
+ get(productCollectionId) {
1869
+ return this.client.get(`/product-collections/${encode(productCollectionId)}`);
1870
+ }
1871
+ /**
1872
+ * @see https://docs.voucherify.io/reference/list-products-in-collection
1873
+ */
1874
+
1875
+
1876
+ listProducts(productCollectionId, params) {
1877
+ return this.client.get(`/product-collections/${encode(productCollectionId)}/products`, params);
1878
+ }
1879
+
1880
+ }
1881
+
1619
1882
  // apiLimitsHandler: ApiLimitsHandler
1620
1883
  // campaigns: Campaigns
1621
1884
  // consents: Consents
@@ -1646,7 +1909,7 @@
1646
1909
  let headers = {
1647
1910
  'X-App-Id': options.applicationId,
1648
1911
  'X-App-Token': options.secretKey,
1649
- 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.4.0"}`,
1912
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.6.0"}`,
1650
1913
  'Content-Type': 'application/json'
1651
1914
  };
1652
1915
 
@@ -1684,13 +1947,15 @@
1684
1947
  const events = new Events(client);
1685
1948
  const distributions = new Distributions(client, exportsNamespace);
1686
1949
  const promotionTiers = new PromotionTiers(client);
1687
- const promotions = new Promotions(client, promotionTiers);
1950
+ const promotionStack = new PromotionsStacks(client);
1951
+ const promotions = new Promotions(client, promotionTiers, promotionStack);
1688
1952
  const validations = new Validations(client, promotions);
1689
1953
  const redemptions = new Redemptions(client);
1690
1954
  const customers = new Customers(client);
1691
1955
  const consents = new Consents(client);
1692
1956
  const orders = new Orders(client);
1693
1957
  const products = new Products(client);
1958
+ const productCollections = new ProductCollections(client);
1694
1959
  const rewards = new Rewards(client);
1695
1960
  const loyalties = new Loyalties(client);
1696
1961
  const segments = new Segments(client);
@@ -1709,6 +1974,7 @@
1709
1974
  consents,
1710
1975
  orders,
1711
1976
  products,
1977
+ productCollections,
1712
1978
  rewards,
1713
1979
  loyalties,
1714
1980
  segments,
@@ -1899,7 +2165,7 @@
1899
2165
  let headers = {
1900
2166
  'X-Client-Application-Id': options.clientApplicationId,
1901
2167
  'X-Client-Token': options.clientSecretKey,
1902
- 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.4.0"}`
2168
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.6.0"}`
1903
2169
  };
1904
2170
 
1905
2171
  if (environment().startsWith('Node')) {