@paddle/paddle-node-sdk 3.0.0 → 3.2.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.
Files changed (145) hide show
  1. package/dist/cjs/entities/client-token/client-token-collection.js +11 -0
  2. package/dist/cjs/entities/client-token/client-token.js +24 -0
  3. package/dist/cjs/entities/client-token/index.js +18 -0
  4. package/dist/cjs/entities/discount/discount.js +4 -0
  5. package/dist/cjs/entities/shared/transaction-payout-totals-adjusted.js +2 -0
  6. package/dist/cjs/entities/shared/transaction-payout-totals.js +4 -0
  7. package/dist/cjs/enums/client-tokens/client-token-status.js +2 -0
  8. package/dist/cjs/enums/client-tokens/index.js +17 -0
  9. package/dist/cjs/enums/index.js +1 -0
  10. package/dist/cjs/notifications/entities/client-token/client-token-notification.js +24 -0
  11. package/dist/cjs/notifications/entities/client-token/index.js +17 -0
  12. package/dist/cjs/notifications/entities/discount/discount-notification.js +2 -0
  13. package/dist/cjs/notifications/entities/index.js +1 -0
  14. package/dist/cjs/notifications/entities/shared/transaction-payout-totals-adjusted-notification.js +2 -0
  15. package/dist/cjs/notifications/events/client-token/client-token-created-event.js +15 -0
  16. package/dist/cjs/notifications/events/client-token/client-token-revoked-event.js +15 -0
  17. package/dist/cjs/notifications/events/client-token/client-token-updated-event.js +15 -0
  18. package/dist/cjs/notifications/events/client-token/index.js +19 -0
  19. package/dist/cjs/notifications/events/discount-group/discount-group-updated-event.js +15 -0
  20. package/dist/cjs/notifications/events/discount-group/index.js +1 -0
  21. package/dist/cjs/notifications/events/index.js +1 -0
  22. package/dist/cjs/notifications/helpers/types.js +4 -0
  23. package/dist/cjs/notifications/helpers/webhooks.js +8 -0
  24. package/dist/cjs/notifications/types/client-token/client-token-notification-response.js +2 -0
  25. package/dist/cjs/notifications/types/client-token/index.js +17 -0
  26. package/dist/cjs/notifications/types/index.js +1 -0
  27. package/dist/cjs/paddle.js +2 -0
  28. package/dist/cjs/resources/client-tokens/index.js +57 -0
  29. package/dist/cjs/resources/client-tokens/operations/create-client-token-request-body.js +2 -0
  30. package/dist/cjs/resources/client-tokens/operations/index.js +19 -0
  31. package/dist/cjs/resources/client-tokens/operations/list-client-token-query-parameters.js +2 -0
  32. package/dist/cjs/resources/client-tokens/operations/update-client-token-request-body.js +2 -0
  33. package/dist/cjs/resources/discount-groups/index.js +21 -0
  34. package/dist/cjs/resources/discount-groups/operations/index.js +1 -0
  35. package/dist/cjs/resources/discount-groups/operations/update-discount-group-request-body.js +2 -0
  36. package/dist/cjs/resources/discounts/index.js +3 -2
  37. package/dist/cjs/resources/discounts/operations/get-discount-query-parameters.js +2 -0
  38. package/dist/cjs/resources/discounts/operations/index.js +1 -0
  39. package/dist/cjs/resources/index.js +1 -0
  40. package/dist/cjs/types/client-token/client-token-response.js +2 -0
  41. package/dist/cjs/types/client-token/index.js +17 -0
  42. package/dist/cjs/types/index.js +1 -0
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/esm/entities/client-token/client-token-collection.js +7 -0
  45. package/dist/esm/entities/client-token/client-token.js +20 -0
  46. package/dist/esm/entities/client-token/index.js +2 -0
  47. package/dist/esm/entities/discount/discount.js +5 -1
  48. package/dist/esm/entities/shared/transaction-payout-totals-adjusted.js +2 -0
  49. package/dist/esm/entities/shared/transaction-payout-totals.js +4 -0
  50. package/dist/esm/enums/client-tokens/client-token-status.js +1 -0
  51. package/dist/esm/enums/client-tokens/index.js +1 -0
  52. package/dist/esm/enums/index.js +1 -0
  53. package/dist/esm/notifications/entities/client-token/client-token-notification.js +20 -0
  54. package/dist/esm/notifications/entities/client-token/index.js +1 -0
  55. package/dist/esm/notifications/entities/discount/discount-notification.js +2 -0
  56. package/dist/esm/notifications/entities/index.js +1 -0
  57. package/dist/esm/notifications/entities/shared/transaction-payout-totals-adjusted-notification.js +2 -0
  58. package/dist/esm/notifications/events/client-token/client-token-created-event.js +11 -0
  59. package/dist/esm/notifications/events/client-token/client-token-revoked-event.js +11 -0
  60. package/dist/esm/notifications/events/client-token/client-token-updated-event.js +11 -0
  61. package/dist/esm/notifications/events/client-token/index.js +3 -0
  62. package/dist/esm/notifications/events/discount-group/discount-group-updated-event.js +11 -0
  63. package/dist/esm/notifications/events/discount-group/index.js +1 -0
  64. package/dist/esm/notifications/events/index.js +1 -0
  65. package/dist/esm/notifications/helpers/types.js +4 -0
  66. package/dist/esm/notifications/helpers/webhooks.js +9 -1
  67. package/dist/esm/notifications/types/client-token/client-token-notification-response.js +1 -0
  68. package/dist/esm/notifications/types/client-token/index.js +1 -0
  69. package/dist/esm/notifications/types/index.js +1 -0
  70. package/dist/esm/paddle.js +3 -1
  71. package/dist/esm/resources/client-tokens/index.js +39 -0
  72. package/dist/esm/resources/client-tokens/operations/create-client-token-request-body.js +1 -0
  73. package/dist/esm/resources/client-tokens/operations/index.js +3 -0
  74. package/dist/esm/resources/client-tokens/operations/list-client-token-query-parameters.js +1 -0
  75. package/dist/esm/resources/client-tokens/operations/update-client-token-request-body.js +1 -0
  76. package/dist/esm/resources/discount-groups/index.js +22 -1
  77. package/dist/esm/resources/discount-groups/operations/index.js +1 -0
  78. package/dist/esm/resources/discount-groups/operations/update-discount-group-request-body.js +1 -0
  79. package/dist/esm/resources/discounts/index.js +3 -2
  80. package/dist/esm/resources/discounts/operations/get-discount-query-parameters.js +1 -0
  81. package/dist/esm/resources/discounts/operations/index.js +1 -0
  82. package/dist/esm/resources/index.js +1 -0
  83. package/dist/esm/types/client-token/client-token-response.js +1 -0
  84. package/dist/esm/types/client-token/index.js +1 -0
  85. package/dist/esm/types/index.js +1 -0
  86. package/dist/esm/version.js +1 -1
  87. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  88. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  89. package/dist/tsconfig.types.tsbuildinfo +1 -1
  90. package/dist/types/entities/client-token/client-token-collection.d.ts +6 -0
  91. package/dist/types/entities/client-token/client-token.d.ts +13 -0
  92. package/dist/types/entities/client-token/index.d.ts +2 -0
  93. package/dist/types/entities/discount/discount.d.ts +3 -1
  94. package/dist/types/entities/shared/transaction-payout-totals-adjusted.d.ts +1 -0
  95. package/dist/types/entities/shared/transaction-payout-totals.d.ts +2 -0
  96. package/dist/types/enums/api-key/api-key-permission.d.ts +1 -1
  97. package/dist/types/enums/client-tokens/client-token-status.d.ts +1 -0
  98. package/dist/types/enums/client-tokens/index.d.ts +1 -0
  99. package/dist/types/enums/index.d.ts +1 -0
  100. package/dist/types/notifications/entities/client-token/client-token-notification.d.ts +13 -0
  101. package/dist/types/notifications/entities/client-token/index.d.ts +1 -0
  102. package/dist/types/notifications/entities/discount/discount-notification.d.ts +1 -0
  103. package/dist/types/notifications/entities/index.d.ts +1 -0
  104. package/dist/types/notifications/entities/shared/transaction-payout-totals-adjusted-notification.d.ts +1 -0
  105. package/dist/types/notifications/events/client-token/client-token-created-event.d.ts +10 -0
  106. package/dist/types/notifications/events/client-token/client-token-revoked-event.d.ts +10 -0
  107. package/dist/types/notifications/events/client-token/client-token-updated-event.d.ts +10 -0
  108. package/dist/types/notifications/events/client-token/index.d.ts +3 -0
  109. package/dist/types/notifications/events/discount-group/discount-group-updated-event.d.ts +10 -0
  110. package/dist/types/notifications/events/discount-group/index.d.ts +1 -0
  111. package/dist/types/notifications/events/index.d.ts +1 -0
  112. package/dist/types/notifications/helpers/types.d.ts +7 -3
  113. package/dist/types/notifications/types/client-token/client-token-notification-response.d.ts +11 -0
  114. package/dist/types/notifications/types/client-token/index.d.ts +1 -0
  115. package/dist/types/notifications/types/discount/discount-notification-response.d.ts +1 -0
  116. package/dist/types/notifications/types/index.d.ts +1 -0
  117. package/dist/types/notifications/types/shared/payment-method-details.d.ts +1 -1
  118. package/dist/types/notifications/types/shared/transaction-payout-totals-adjusted-notification-response.d.ts +1 -0
  119. package/dist/types/paddle.d.ts +2 -1
  120. package/dist/types/resources/client-tokens/index.d.ts +11 -0
  121. package/dist/types/resources/client-tokens/operations/create-client-token-request-body.d.ts +4 -0
  122. package/dist/types/resources/client-tokens/operations/index.d.ts +3 -0
  123. package/dist/types/resources/client-tokens/operations/list-client-token-query-parameters.d.ts +7 -0
  124. package/dist/types/resources/client-tokens/operations/update-client-token-request-body.d.ts +4 -0
  125. package/dist/types/resources/discount-groups/index.d.ts +4 -1
  126. package/dist/types/resources/discount-groups/operations/index.d.ts +1 -0
  127. package/dist/types/resources/discount-groups/operations/update-discount-group-request-body.d.ts +5 -0
  128. package/dist/types/resources/discounts/index.d.ts +2 -2
  129. package/dist/types/resources/discounts/operations/create-discount-request-body.d.ts +1 -0
  130. package/dist/types/resources/discounts/operations/get-discount-query-parameters.d.ts +3 -0
  131. package/dist/types/resources/discounts/operations/index.d.ts +1 -0
  132. package/dist/types/resources/discounts/operations/list-discount-query-parameters.d.ts +2 -0
  133. package/dist/types/resources/discounts/operations/update-discount-request-body.d.ts +1 -0
  134. package/dist/types/resources/events/operations/list-events-query-parameters.d.ts +2 -0
  135. package/dist/types/resources/index.d.ts +1 -0
  136. package/dist/types/types/client-token/client-token-response.d.ts +11 -0
  137. package/dist/types/types/client-token/index.d.ts +1 -0
  138. package/dist/types/types/discount/discount-response.d.ts +4 -1
  139. package/dist/types/types/events/events-response.d.ts +14 -2
  140. package/dist/types/types/index.d.ts +1 -0
  141. package/dist/types/types/shared/payment-method-details.d.ts +1 -1
  142. package/dist/types/types/shared/transaction-payout-totals-adjusted-response.d.ts +1 -0
  143. package/dist/types/types/shared/transaction-payout-totals-response.d.ts +2 -0
  144. package/dist/types/version.d.ts +1 -1
  145. package/package.json +2 -1
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientTokenCollection = void 0;
4
+ const index_js_1 = require("../../internal/base/index.js");
5
+ const client_token_js_1 = require("./client-token.js");
6
+ class ClientTokenCollection extends index_js_1.Collection {
7
+ fromJson(data) {
8
+ return new client_token_js_1.ClientToken(data);
9
+ }
10
+ }
11
+ exports.ClientTokenCollection = ClientTokenCollection;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientToken = void 0;
4
+ class ClientToken {
5
+ id;
6
+ token;
7
+ name;
8
+ description;
9
+ status;
10
+ createdAt;
11
+ updatedAt;
12
+ revokedAt;
13
+ constructor(clientToken) {
14
+ this.id = clientToken.id;
15
+ this.token = clientToken.token;
16
+ this.name = clientToken.name;
17
+ this.description = clientToken.description ?? null;
18
+ this.status = clientToken.status;
19
+ this.createdAt = clientToken.created_at;
20
+ this.updatedAt = clientToken.updated_at;
21
+ this.revokedAt = clientToken.revoked_at ?? null;
22
+ }
23
+ }
24
+ exports.ClientToken = ClientToken;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client-token-collection.js"), exports);
18
+ __exportStar(require("./client-token.js"), exports);
@@ -22,6 +22,8 @@ class Discount {
22
22
  createdAt;
23
23
  updatedAt;
24
24
  importMeta;
25
+ discountGroupId;
26
+ discountGroup;
25
27
  constructor(discount) {
26
28
  this.id = discount.id;
27
29
  this.status = discount.status;
@@ -42,6 +44,8 @@ class Discount {
42
44
  this.createdAt = discount.created_at;
43
45
  this.updatedAt = discount.updated_at;
44
46
  this.importMeta = discount.import_meta ? new index_js_1.ImportMeta(discount.import_meta) : null;
47
+ this.discountGroupId = discount.discount_group_id ? discount.discount_group_id : null;
48
+ this.discountGroup = discount.discount_group ? new index_js_1.DiscountGroup(discount.discount_group) : null;
45
49
  }
46
50
  }
47
51
  exports.Discount = Discount;
@@ -10,6 +10,7 @@ class TransactionPayoutTotalsAdjusted {
10
10
  chargebackFee;
11
11
  earnings;
12
12
  currencyCode;
13
+ exchangeRate;
13
14
  constructor(transactionPayoutTotalsAdjusted) {
14
15
  this.subtotal = transactionPayoutTotalsAdjusted.subtotal;
15
16
  this.tax = transactionPayoutTotalsAdjusted.tax;
@@ -20,6 +21,7 @@ class TransactionPayoutTotalsAdjusted {
20
21
  : null;
21
22
  this.earnings = transactionPayoutTotalsAdjusted.earnings;
22
23
  this.currencyCode = transactionPayoutTotalsAdjusted.currency_code;
24
+ this.exchangeRate = transactionPayoutTotalsAdjusted.exchange_rate;
23
25
  }
24
26
  }
25
27
  exports.TransactionPayoutTotalsAdjusted = TransactionPayoutTotalsAdjusted;
@@ -13,6 +13,8 @@ class TransactionPayoutTotals {
13
13
  fee;
14
14
  earnings;
15
15
  currencyCode;
16
+ exchangeRate;
17
+ feeRate;
16
18
  constructor(transactionPayoutTotals) {
17
19
  this.subtotal = transactionPayoutTotals.subtotal;
18
20
  this.discount = transactionPayoutTotals.discount;
@@ -25,6 +27,8 @@ class TransactionPayoutTotals {
25
27
  this.fee = transactionPayoutTotals.fee;
26
28
  this.earnings = transactionPayoutTotals.earnings;
27
29
  this.currencyCode = transactionPayoutTotals.currency_code;
30
+ this.exchangeRate = transactionPayoutTotals.exchange_rate;
31
+ this.feeRate = transactionPayoutTotals.fee_rate;
28
32
  }
29
33
  }
30
34
  exports.TransactionPayoutTotals = TransactionPayoutTotals;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client-token-status.js"), exports);
@@ -29,3 +29,4 @@ __exportStar(require("./simulation/index.js"), exports);
29
29
  __exportStar(require("./simulation-run/index.js"), exports);
30
30
  __exportStar(require("./simulation-run-event/index.js"), exports);
31
31
  __exportStar(require("./api-key/index.js"), exports);
32
+ __exportStar(require("./client-tokens/index.js"), exports);
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientTokenNotification = void 0;
4
+ class ClientTokenNotification {
5
+ id;
6
+ token;
7
+ name;
8
+ description;
9
+ status;
10
+ createdAt;
11
+ updatedAt;
12
+ revokedAt;
13
+ constructor(clientToken) {
14
+ this.id = clientToken.id;
15
+ this.token = clientToken.token;
16
+ this.name = clientToken.name;
17
+ this.description = clientToken.description ?? null;
18
+ this.status = clientToken.status;
19
+ this.createdAt = clientToken.created_at;
20
+ this.updatedAt = clientToken.updated_at;
21
+ this.revokedAt = clientToken.revoked_at ?? null;
22
+ }
23
+ }
24
+ exports.ClientTokenNotification = ClientTokenNotification;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client-token-notification.js"), exports);
@@ -22,6 +22,7 @@ class DiscountNotification {
22
22
  createdAt;
23
23
  updatedAt;
24
24
  importMeta;
25
+ discountGroupId;
25
26
  constructor(discount) {
26
27
  this.id = discount.id;
27
28
  this.status = discount.status;
@@ -42,6 +43,7 @@ class DiscountNotification {
42
43
  this.createdAt = discount.created_at;
43
44
  this.updatedAt = discount.updated_at;
44
45
  this.importMeta = discount.import_meta ? new index_js_1.ImportMetaNotification(discount.import_meta) : null;
46
+ this.discountGroupId = discount.discount_group_id ? discount.discount_group_id : null;
45
47
  }
46
48
  }
47
49
  exports.DiscountNotification = DiscountNotification;
@@ -29,3 +29,4 @@ __exportStar(require("./payout/index.js"), exports);
29
29
  __exportStar(require("./report/index.js"), exports);
30
30
  __exportStar(require("./shared/index.js"), exports);
31
31
  __exportStar(require("./api-key/index.js"), exports);
32
+ __exportStar(require("./client-token/index.js"), exports);
@@ -10,6 +10,7 @@ class TransactionPayoutTotalsAdjustedNotification {
10
10
  chargebackFee;
11
11
  earnings;
12
12
  currencyCode;
13
+ exchangeRate;
13
14
  constructor(transactionPayoutTotalsAdjusted) {
14
15
  this.subtotal = transactionPayoutTotalsAdjusted.subtotal;
15
16
  this.tax = transactionPayoutTotalsAdjusted.tax;
@@ -20,6 +21,7 @@ class TransactionPayoutTotalsAdjustedNotification {
20
21
  : null;
21
22
  this.earnings = transactionPayoutTotalsAdjusted.earnings;
22
23
  this.currencyCode = transactionPayoutTotalsAdjusted.currency_code;
24
+ this.exchangeRate = transactionPayoutTotalsAdjusted.exchange_rate;
23
25
  }
24
26
  }
25
27
  exports.TransactionPayoutTotalsAdjustedNotification = TransactionPayoutTotalsAdjustedNotification;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientTokenCreatedEvent = void 0;
4
+ const event_js_1 = require("../../../entities/events/event.js");
5
+ const index_js_1 = require("../../helpers/index.js");
6
+ const index_js_2 = require("../../entities/index.js");
7
+ class ClientTokenCreatedEvent extends event_js_1.Event {
8
+ eventType = index_js_1.EventName.ClientTokenCreated;
9
+ data;
10
+ constructor(response) {
11
+ super(response);
12
+ this.data = new index_js_2.ClientTokenNotification(response.data);
13
+ }
14
+ }
15
+ exports.ClientTokenCreatedEvent = ClientTokenCreatedEvent;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientTokenRevokedEvent = void 0;
4
+ const event_js_1 = require("../../../entities/events/event.js");
5
+ const index_js_1 = require("../../helpers/index.js");
6
+ const index_js_2 = require("../../entities/index.js");
7
+ class ClientTokenRevokedEvent extends event_js_1.Event {
8
+ eventType = index_js_1.EventName.ClientTokenRevoked;
9
+ data;
10
+ constructor(response) {
11
+ super(response);
12
+ this.data = new index_js_2.ClientTokenNotification(response.data);
13
+ }
14
+ }
15
+ exports.ClientTokenRevokedEvent = ClientTokenRevokedEvent;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientTokenUpdatedEvent = void 0;
4
+ const event_js_1 = require("../../../entities/events/event.js");
5
+ const index_js_1 = require("../../helpers/index.js");
6
+ const index_js_2 = require("../../entities/index.js");
7
+ class ClientTokenUpdatedEvent extends event_js_1.Event {
8
+ eventType = index_js_1.EventName.ClientTokenUpdated;
9
+ data;
10
+ constructor(response) {
11
+ super(response);
12
+ this.data = new index_js_2.ClientTokenNotification(response.data);
13
+ }
14
+ }
15
+ exports.ClientTokenUpdatedEvent = ClientTokenUpdatedEvent;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client-token-created-event.js"), exports);
18
+ __exportStar(require("./client-token-updated-event.js"), exports);
19
+ __exportStar(require("./client-token-revoked-event.js"), exports);
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscountGroupUpdatedEvent = void 0;
4
+ const event_js_1 = require("../../../entities/events/event.js");
5
+ const index_js_1 = require("../../helpers/index.js");
6
+ const index_js_2 = require("../../entities/index.js");
7
+ class DiscountGroupUpdatedEvent extends event_js_1.Event {
8
+ eventType = index_js_1.EventName.DiscountGroupUpdated;
9
+ data;
10
+ constructor(response) {
11
+ super(response);
12
+ this.data = new index_js_2.DiscountGroupNotification(response.data);
13
+ }
14
+ }
15
+ exports.DiscountGroupUpdatedEvent = DiscountGroupUpdatedEvent;
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./discount-group-created-event.js"), exports);
18
+ __exportStar(require("./discount-group-updated-event.js"), exports);
@@ -29,3 +29,4 @@ __exportStar(require("./subscription/index.js"), exports);
29
29
  __exportStar(require("./transaction/index.js"), exports);
30
30
  __exportStar(require("./report/index.js"), exports);
31
31
  __exportStar(require("./api-key/index.js"), exports);
32
+ __exportStar(require("./client-token/index.js"), exports);
@@ -16,6 +16,9 @@ var EventName;
16
16
  EventName["BusinessCreated"] = "business.created";
17
17
  EventName["BusinessImported"] = "business.imported";
18
18
  EventName["BusinessUpdated"] = "business.updated";
19
+ EventName["ClientTokenCreated"] = "client_token.created";
20
+ EventName["ClientTokenUpdated"] = "client_token.updated";
21
+ EventName["ClientTokenRevoked"] = "client_token.revoked";
19
22
  EventName["CustomerCreated"] = "customer.created";
20
23
  EventName["CustomerUpdated"] = "customer.updated";
21
24
  EventName["CustomerImported"] = "customer.imported";
@@ -23,6 +26,7 @@ var EventName;
23
26
  EventName["DiscountUpdated"] = "discount.updated";
24
27
  EventName["DiscountImported"] = "discount.imported";
25
28
  EventName["DiscountGroupCreated"] = "discount_group.created";
29
+ EventName["DiscountGroupUpdated"] = "discount_group.updated";
26
30
  EventName["PaymentMethodDeleted"] = "payment_method.deleted";
27
31
  EventName["PaymentMethodSaved"] = "payment_method.saved";
28
32
  EventName["PayoutCreated"] = "payout.created";
@@ -47,6 +47,12 @@ class Webhooks {
47
47
  return new index_js_1.BusinessUpdatedEvent(data);
48
48
  case types_js_1.EventName.BusinessImported:
49
49
  return new index_js_1.BusinessImportedEvent(data);
50
+ case types_js_1.EventName.ClientTokenCreated:
51
+ return new index_js_1.ClientTokenCreatedEvent(data);
52
+ case types_js_1.EventName.ClientTokenUpdated:
53
+ return new index_js_1.ClientTokenUpdatedEvent(data);
54
+ case types_js_1.EventName.ClientTokenRevoked:
55
+ return new index_js_1.ClientTokenRevokedEvent(data);
50
56
  case types_js_1.EventName.CustomerCreated:
51
57
  return new index_js_1.CustomerCreatedEvent(data);
52
58
  case types_js_1.EventName.CustomerUpdated:
@@ -61,6 +67,8 @@ class Webhooks {
61
67
  return new index_js_1.DiscountUpdatedEvent(data);
62
68
  case types_js_1.EventName.DiscountGroupCreated:
63
69
  return new index_js_1.DiscountGroupCreatedEvent(data);
70
+ case types_js_1.EventName.DiscountGroupUpdated:
71
+ return new index_js_1.DiscountGroupUpdatedEvent(data);
64
72
  case types_js_1.EventName.PaymentMethodDeleted:
65
73
  return new index_js_1.PaymentMethodDeletedEvent(data);
66
74
  case types_js_1.EventName.PaymentMethodSaved:
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client-token-notification-response.js"), exports);
@@ -29,3 +29,4 @@ __exportStar(require("./payout/index.js"), exports);
29
29
  __exportStar(require("./report/index.js"), exports);
30
30
  __exportStar(require("./shared/index.js"), exports);
31
31
  __exportStar(require("./api-key/index.js"), exports);
32
+ __exportStar(require("./client-token/index.js"), exports);
@@ -35,6 +35,7 @@ class Paddle {
35
35
  simulations;
36
36
  simulationRuns;
37
37
  simulationRunEvents;
38
+ clientTokens;
38
39
  constructor(apiKey, options) {
39
40
  this.client = new client_js_1.Client(apiKey, options ? { ...this.defaultPaddleOptions, ...options } : { ...this.defaultPaddleOptions });
40
41
  this.products = new index_js_2.ProductsResource(this.client);
@@ -60,6 +61,7 @@ class Paddle {
60
61
  this.simulations = new index_js_2.SimulationsResource(this.client);
61
62
  this.simulationRuns = new index_js_2.SimulationRunsResource(this.client);
62
63
  this.simulationRunEvents = new index_js_2.SimulationRunEventsResource(this.client);
64
+ this.clientTokens = new index_js_2.ClientTokensResource(this.client);
63
65
  }
64
66
  }
65
67
  exports.Paddle = Paddle;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ClientTokensResource = void 0;
18
+ const index_js_1 = require("../../internal/base/index.js");
19
+ const index_js_2 = require("../../entities/client-token/index.js");
20
+ const ClientTokenPaths = {
21
+ list: '/client-tokens',
22
+ create: '/client-tokens',
23
+ get: '/client-tokens/{client_token_id}',
24
+ update: '/client-tokens/{client_token_id}',
25
+ };
26
+ __exportStar(require("./operations/index.js"), exports);
27
+ class ClientTokensResource extends index_js_1.BaseResource {
28
+ list(queryParams) {
29
+ const queryParameters = new index_js_1.QueryParameters(queryParams);
30
+ return new index_js_2.ClientTokenCollection(this.client, ClientTokenPaths.list + queryParameters.toQueryString());
31
+ }
32
+ async create(createClientTokenRequestBody) {
33
+ const response = await this.client.post(ClientTokenPaths.create, createClientTokenRequestBody);
34
+ const data = this.handleResponse(response);
35
+ return new index_js_2.ClientToken(data);
36
+ }
37
+ async get(clientTokenId) {
38
+ const urlWithPathParams = new index_js_1.PathParameters(ClientTokenPaths.get, {
39
+ client_token_id: clientTokenId,
40
+ }).deriveUrl();
41
+ const response = await this.client.get(urlWithPathParams);
42
+ const data = this.handleResponse(response);
43
+ return new index_js_2.ClientToken(data);
44
+ }
45
+ async update(clientTokenId, updateClientToken) {
46
+ const urlWithPathParams = new index_js_1.PathParameters(ClientTokenPaths.update, {
47
+ client_token_id: clientTokenId,
48
+ }).deriveUrl();
49
+ const response = await this.client.patch(urlWithPathParams, updateClientToken);
50
+ const data = this.handleResponse(response);
51
+ return new index_js_2.ClientToken(data);
52
+ }
53
+ async revoke(clientTokenId) {
54
+ return await this.update(clientTokenId, { status: 'revoked' });
55
+ }
56
+ }
57
+ exports.ClientTokensResource = ClientTokensResource;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./create-client-token-request-body.js"), exports);
18
+ __exportStar(require("./list-client-token-query-parameters.js"), exports);
19
+ __exportStar(require("./update-client-token-request-body.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -20,6 +20,8 @@ const index_js_2 = require("../../internal/base/index.js");
20
20
  const DiscountGroupPaths = {
21
21
  list: '/discount-groups',
22
22
  create: '/discount-groups',
23
+ get: '/discount-groups/{discount_group_id}',
24
+ update: '/discount-groups/{discount_group_id}',
23
25
  };
24
26
  __exportStar(require("./operations/index.js"), exports);
25
27
  class DiscountGroupsResource extends index_js_2.BaseResource {
@@ -32,5 +34,24 @@ class DiscountGroupsResource extends index_js_2.BaseResource {
32
34
  const data = this.handleResponse(response);
33
35
  return new index_js_1.DiscountGroup(data);
34
36
  }
37
+ async get(discountGroupId) {
38
+ const urlWithPathParams = new index_js_2.PathParameters(DiscountGroupPaths.get, {
39
+ discount_group_id: discountGroupId,
40
+ }).deriveUrl();
41
+ const response = await this.client.get(urlWithPathParams);
42
+ const data = this.handleResponse(response);
43
+ return new index_js_1.DiscountGroup(data);
44
+ }
45
+ async update(discountGroupId, updateDiscountGroup) {
46
+ const urlWithPathParams = new index_js_2.PathParameters(DiscountGroupPaths.update, {
47
+ discount_group_id: discountGroupId,
48
+ }).deriveUrl();
49
+ const response = await this.client.patch(urlWithPathParams, updateDiscountGroup);
50
+ const data = this.handleResponse(response);
51
+ return new index_js_1.DiscountGroup(data);
52
+ }
53
+ async archive(discountGroupId) {
54
+ return await this.update(discountGroupId, { status: 'archived' });
55
+ }
35
56
  }
36
57
  exports.DiscountGroupsResource = DiscountGroupsResource;
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./list-discount-group-query-parameters.js"), exports);
18
18
  __exportStar(require("./create-discount-group-request-body.js"), exports);
19
+ __exportStar(require("./update-discount-group-request-body.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -34,11 +34,12 @@ class DiscountsResource extends index_js_1.BaseResource {
34
34
  const data = this.handleResponse(response);
35
35
  return new index_js_2.Discount(data);
36
36
  }
37
- async get(discountId) {
37
+ async get(discountId, queryParams) {
38
+ const queryParameters = new index_js_1.QueryParameters(queryParams);
38
39
  const urlWithPathParams = new index_js_1.PathParameters(DiscountPaths.get, {
39
40
  discount_id: discountId,
40
41
  }).deriveUrl();
41
- const response = await this.client.get(urlWithPathParams);
42
+ const response = await this.client.get(urlWithPathParams + queryParameters.toQueryString());
42
43
  const data = this.handleResponse(response);
43
44
  return new index_js_2.Discount(data);
44
45
  }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./list-discount-query-parameters.js"), exports);
18
18
  __exportStar(require("./create-discount-request-body.js"), exports);
19
19
  __exportStar(require("./update-discount-request-body.js"), exports);
20
+ __exportStar(require("./get-discount-query-parameters.js"), exports);
@@ -35,3 +35,4 @@ __exportStar(require("./simulation-types/index.js"), exports);
35
35
  __exportStar(require("./simulations/index.js"), exports);
36
36
  __exportStar(require("./simulation-runs/index.js"), exports);
37
37
  __exportStar(require("./simulation-run-events/index.js"), exports);
38
+ __exportStar(require("./client-tokens/index.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client-token-response.js"), exports);
@@ -38,3 +38,4 @@ __exportStar(require("./simulation-type/index.js"), exports);
38
38
  __exportStar(require("./simulation/index.js"), exports);
39
39
  __exportStar(require("./simulation-run/index.js"), exports);
40
40
  __exportStar(require("./simulation-run-event/index.js"), exports);
41
+ __exportStar(require("./client-token/index.js"), exports);
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = '3.0.0';
4
+ exports.SDK_VERSION = '3.2.0';
@@ -0,0 +1,7 @@
1
+ import { Collection } from '../../internal/base/index.js';
2
+ import { ClientToken } from './client-token.js';
3
+ export class ClientTokenCollection extends Collection {
4
+ fromJson(data) {
5
+ return new ClientToken(data);
6
+ }
7
+ }