@paddle/paddle-node-sdk 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +14 -14
  3. package/dist/entities/address/address.d.ts +2 -1
  4. package/dist/entities/address/address.js +2 -0
  5. package/dist/entities/business/business.d.ts +2 -1
  6. package/dist/entities/business/business.js +1 -0
  7. package/dist/entities/customer/customer.d.ts +2 -1
  8. package/dist/entities/customer/customer.js +2 -0
  9. package/dist/entities/discount/discount.d.ts +2 -1
  10. package/dist/entities/discount/discount.js +2 -0
  11. package/dist/entities/event-types/event-type.d.ts +9 -0
  12. package/dist/entities/event-types/event-type.js +12 -0
  13. package/dist/entities/event-types/index.d.ts +1 -0
  14. package/dist/entities/event-types/index.js +17 -0
  15. package/dist/entities/events/event-collection.d.ts +2 -2
  16. package/dist/entities/index.d.ts +3 -0
  17. package/dist/entities/index.js +3 -0
  18. package/dist/entities/notification-settings/index.d.ts +1 -0
  19. package/dist/entities/notification-settings/index.js +17 -0
  20. package/dist/entities/notification-settings/notification-settings.d.ts +15 -0
  21. package/dist/entities/notification-settings/notification-settings.js +18 -0
  22. package/dist/entities/notifications/index.d.ts +5 -0
  23. package/dist/entities/notifications/index.js +21 -0
  24. package/dist/entities/notifications/notification-collection.d.ts +6 -0
  25. package/dist/entities/notifications/notification-collection.js +11 -0
  26. package/dist/entities/notifications/notification-log-collection.d.ts +6 -0
  27. package/dist/entities/notifications/notification-log-collection.js +11 -0
  28. package/dist/entities/notifications/notification-log.d.ts +8 -0
  29. package/dist/entities/notifications/notification-log.js +14 -0
  30. package/dist/entities/notifications/notification.d.ts +18 -0
  31. package/dist/entities/notifications/notification.js +22 -0
  32. package/dist/entities/notifications/replay-notification.d.ts +5 -0
  33. package/dist/entities/notifications/replay-notification.js +9 -0
  34. package/dist/entities/shared/transaction-payout-totals.d.ts +1 -0
  35. package/dist/entities/shared/transaction-payout-totals.js +1 -0
  36. package/dist/entities/shared/transaction-totals.d.ts +1 -0
  37. package/dist/entities/shared/transaction-totals.js +1 -0
  38. package/dist/entities/subscription/subscription-includes.d.ts +2 -1
  39. package/dist/entities/subscription/subscription-includes.js +1 -0
  40. package/dist/entities/subscription/subscription-preview.d.ts +2 -1
  41. package/dist/entities/subscription/subscription-preview.js +1 -0
  42. package/dist/entities/subscription/subscription-scheduled-change.d.ts +2 -2
  43. package/dist/entities/subscription/subscription.d.ts +2 -1
  44. package/dist/entities/subscription/subscription.js +1 -0
  45. package/dist/enums/index.d.ts +2 -0
  46. package/dist/enums/index.js +2 -0
  47. package/dist/enums/notification/index.d.ts +2 -0
  48. package/dist/enums/notification/index.js +18 -0
  49. package/dist/enums/notification/notification-status.d.ts +1 -0
  50. package/dist/enums/notification/notification-status.js +2 -0
  51. package/dist/enums/notification/origin.d.ts +1 -0
  52. package/dist/enums/notification/origin.js +2 -0
  53. package/dist/enums/notification-settings/index.d.ts +1 -0
  54. package/dist/enums/notification-settings/index.js +17 -0
  55. package/dist/enums/notification-settings/notification-settings-type.d.ts +1 -0
  56. package/dist/enums/notification-settings/notification-settings-type.js +2 -0
  57. package/dist/internal/api/client.d.ts +2 -0
  58. package/dist/internal/api/client.js +14 -0
  59. package/dist/notifications/helpers/webhooks.d.ts +2 -2
  60. package/dist/notifications/helpers/webhooks.js +3 -1
  61. package/dist/paddle.d.ts +4 -1
  62. package/dist/paddle.js +3 -0
  63. package/dist/resources/event-types/index.d.ts +5 -0
  64. package/dist/resources/event-types/index.js +27 -0
  65. package/dist/resources/index.d.ts +3 -0
  66. package/dist/resources/index.js +3 -0
  67. package/dist/resources/notification-settings/index.d.ts +11 -0
  68. package/dist/resources/notification-settings/index.js +84 -0
  69. package/dist/resources/notification-settings/operations/create-notification-settings-request-body.d.ts +10 -0
  70. package/dist/resources/notification-settings/operations/create-notification-settings-request-body.js +2 -0
  71. package/dist/resources/notification-settings/operations/index.d.ts +2 -0
  72. package/dist/resources/notification-settings/operations/index.js +18 -0
  73. package/dist/resources/notification-settings/operations/update-notification-settings-request-body.d.ts +9 -0
  74. package/dist/resources/notification-settings/operations/update-notification-settings-request-body.js +2 -0
  75. package/dist/resources/notifications/index.d.ts +10 -0
  76. package/dist/resources/notifications/index.js +69 -0
  77. package/dist/resources/notifications/operations/index.d.ts +2 -0
  78. package/dist/resources/notifications/operations/index.js +18 -0
  79. package/dist/resources/notifications/operations/list-notification-log-query-parameters.d.ts +4 -0
  80. package/dist/resources/notifications/operations/list-notification-log-query-parameters.js +2 -0
  81. package/dist/resources/notifications/operations/list-notification-query-parameters.d.ts +12 -0
  82. package/dist/resources/notifications/operations/list-notification-query-parameters.js +2 -0
  83. package/dist/resources/transactions/operations/list-transaction-query-parameters.d.ts +2 -1
  84. package/dist/types/address/address-response.d.ts +2 -1
  85. package/dist/types/business/business-response.d.ts +2 -1
  86. package/dist/types/customer/customer-response.d.ts +2 -1
  87. package/dist/types/discount/discount-response.d.ts +2 -1
  88. package/dist/types/event-types/event-type-response.d.ts +7 -0
  89. package/dist/types/event-types/event-type-response.js +2 -0
  90. package/dist/types/event-types/index.d.ts +1 -0
  91. package/dist/types/event-types/index.js +17 -0
  92. package/dist/types/index.d.ts +3 -0
  93. package/dist/types/index.js +3 -0
  94. package/dist/types/notification-settings/index.d.ts +1 -0
  95. package/dist/types/notification-settings/index.js +17 -0
  96. package/dist/types/notification-settings/notification-settings-response.d.ts +13 -0
  97. package/dist/types/notification-settings/notification-settings-response.js +2 -0
  98. package/dist/types/notifications/index.d.ts +3 -0
  99. package/dist/types/notifications/index.js +19 -0
  100. package/dist/types/notifications/notification-log.d.ts +7 -0
  101. package/dist/types/notifications/notification-log.js +2 -0
  102. package/dist/types/notifications/notification.d.ts +17 -0
  103. package/dist/types/notifications/notification.js +2 -0
  104. package/dist/types/notifications/replay-notification.d.ts +3 -0
  105. package/dist/types/notifications/replay-notification.js +2 -0
  106. package/dist/types/shared/transaction-payout-totals-response.d.ts +1 -0
  107. package/dist/types/shared/transaction-totals-response.d.ts +1 -0
  108. package/dist/types/subscription/subscription-preview-response.d.ts +2 -1
  109. package/dist/types/subscription/subscription-response.d.ts +2 -1
  110. package/dist/types/subscription/subscription-scheduled-change-response.d.ts +2 -2
  111. package/dist/version.d.ts +1 -1
  112. package/dist/version.js +1 -1
  113. package/package.json +1 -1
@@ -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("./notification-status"), exports);
18
+ __exportStar(require("./origin"), exports);
@@ -0,0 +1 @@
1
+ export type NotificationStatus = 'not_attempted' | 'needs_retry' | 'delivered' | 'failed';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type Origin = 'event' | 'replay';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './notification-settings-type';
@@ -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("./notification-settings-type"), exports);
@@ -0,0 +1 @@
1
+ export type NotificationSettingsType = 'email' | 'url';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  import { type QueryParameters } from '../base';
2
2
  import { type PaddleOptions } from '../types/config';
3
+ import { type ErrorResponse } from '../types/response';
3
4
  export declare class Client {
4
5
  private readonly apiKey;
5
6
  private readonly options;
@@ -10,4 +11,5 @@ export declare class Client {
10
11
  get<Q, R>(url: string, queryParams?: QueryParameters<Q>): Promise<R>;
11
12
  post<B, R>(url: string, requestBody: B): Promise<R>;
12
13
  patch<B, R>(url: string, requestBody: B): Promise<R>;
14
+ delete(url: string): Promise<ErrorResponse | undefined>;
13
15
  }
@@ -34,6 +34,7 @@ class Client {
34
34
  const uuid = (0, crypto_1.randomUUID)();
35
35
  return {
36
36
  Authorization: `bearer ${this.apiKey}`,
37
+ 'Content-Type': 'application/json',
37
38
  'user-agent': `PaddleSDK/node ${version_1.SDK_VERSION}`,
38
39
  'X-Transaction-ID': uuid,
39
40
  };
@@ -82,5 +83,18 @@ class Client {
82
83
  return rawResponse.json();
83
84
  });
84
85
  }
86
+ delete(url) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const logUrl = url.split('?')[0];
89
+ const headers = this.getHeaders();
90
+ logger_1.Logger.logRequest('DELETE', logUrl, headers);
91
+ const rawResponse = yield (0, node_fetch_1.default)(`${this.baseUrl}${url}`, {
92
+ method: 'DELETE',
93
+ headers,
94
+ });
95
+ logger_1.Logger.logResponse('DELETE', logUrl, headers, rawResponse);
96
+ return rawResponse;
97
+ });
98
+ }
85
99
  }
86
100
  exports.Client = Client;
@@ -1,7 +1,7 @@
1
1
  import { type IEvents } from '../../types';
2
2
  import { type EventEntity } from './types';
3
3
  export declare class Webhooks {
4
- unmarshal(requestBody: string, secretKey: string, signature: string): EventEntity;
4
+ unmarshal(requestBody: string, secretKey: string, signature: string): EventEntity | null;
5
5
  isSignatureValid(requestBody: string, secretKey: string, signature: string): boolean;
6
- static fromJson(data: IEvents): EventEntity;
6
+ static fromJson(data: IEvents): EventEntity | null;
7
7
  }
@@ -4,6 +4,7 @@ exports.Webhooks = void 0;
4
4
  const events_1 = require("../events");
5
5
  const types_1 = require("./types");
6
6
  const webhooks_validator_1 = require("./webhooks-validator");
7
+ const logger_1 = require("../../internal/base/logger");
7
8
  class Webhooks {
8
9
  unmarshal(requestBody, secretKey, signature) {
9
10
  const isSignatureValid = new webhooks_validator_1.WebhooksValidator().isValidSignature(requestBody, secretKey, signature);
@@ -91,7 +92,8 @@ class Webhooks {
91
92
  case types_1.EventName.TransactionUpdated:
92
93
  return new events_1.TransactionUpdatedEvent(data);
93
94
  default:
94
- throw new Error('[Paddle] Unknown event_type');
95
+ logger_1.Logger.log('Unknown event_type');
96
+ return null;
95
97
  }
96
98
  }
97
99
  }
package/dist/paddle.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, PricesResource, PricingPreviewResource, ProductsResource, SubscriptionsResource, TransactionsResource } from './resources';
1
+ import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PricesResource, PricingPreviewResource, ProductsResource, SubscriptionsResource, TransactionsResource } from './resources';
2
2
  import { type PaddleOptions } from './internal';
3
3
  import { EventsResource } from './resources/events';
4
4
  import { Webhooks } from './notifications';
@@ -17,5 +17,8 @@ export declare class Paddle {
17
17
  pricingPreview: PricingPreviewResource;
18
18
  events: EventsResource;
19
19
  webhooks: Webhooks;
20
+ eventTypes: EventTypesResource;
21
+ notificationSettings: NotificationSettingsResource;
22
+ notifications: NotificationsResource;
20
23
  constructor(apiKey: string, options?: PaddleOptions);
21
24
  }
package/dist/paddle.js CHANGED
@@ -24,6 +24,9 @@ class Paddle {
24
24
  this.pricingPreview = new resources_1.PricingPreviewResource(this.client);
25
25
  this.events = new events_1.EventsResource(this.client);
26
26
  this.webhooks = new notifications_1.Webhooks();
27
+ this.eventTypes = new resources_1.EventTypesResource(this.client);
28
+ this.notificationSettings = new resources_1.NotificationSettingsResource(this.client);
29
+ this.notifications = new resources_1.NotificationsResource(this.client);
27
30
  }
28
31
  }
29
32
  exports.Paddle = Paddle;
@@ -0,0 +1,5 @@
1
+ import { BaseResource } from '../../internal/base';
2
+ import { EventType } from '../../entities';
3
+ export declare class EventTypesResource extends BaseResource {
4
+ list(): Promise<EventType[]>;
5
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EventTypesResource = void 0;
13
+ const base_1 = require("../../internal/base");
14
+ const entities_1 = require("../../entities");
15
+ const EventTypesPaths = {
16
+ list: '/event-types',
17
+ };
18
+ class EventTypesResource extends base_1.BaseResource {
19
+ list() {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const response = yield this.client.get(EventTypesPaths.list);
22
+ const data = this.handleResponse(response);
23
+ return data.map((eventType) => new entities_1.EventType(eventType));
24
+ });
25
+ }
26
+ }
27
+ exports.EventTypesResource = EventTypesResource;
@@ -8,3 +8,6 @@ export * from './products';
8
8
  export * from './subscriptions';
9
9
  export * from './transactions';
10
10
  export * from './pricing-preview';
11
+ export * from './event-types';
12
+ export * from './notification-settings';
13
+ export * from './notifications';
@@ -24,3 +24,6 @@ __exportStar(require("./products"), exports);
24
24
  __exportStar(require("./subscriptions"), exports);
25
25
  __exportStar(require("./transactions"), exports);
26
26
  __exportStar(require("./pricing-preview"), exports);
27
+ __exportStar(require("./event-types"), exports);
28
+ __exportStar(require("./notification-settings"), exports);
29
+ __exportStar(require("./notifications"), exports);
@@ -0,0 +1,11 @@
1
+ import { BaseResource } from '../../internal/base';
2
+ import { NotificationSettings } from '../../entities';
3
+ import { type CreateNotificationSettingsRequestBody, type UpdateNotificationSettingsRequestBody } from './operations';
4
+ export * from './operations';
5
+ export declare class NotificationSettingsResource extends BaseResource {
6
+ list(): Promise<NotificationSettings[]>;
7
+ create(createNotificationSettings: CreateNotificationSettingsRequestBody): Promise<NotificationSettings>;
8
+ get(notificationId: string): Promise<NotificationSettings>;
9
+ update(notificationId: string, updateNotificationSettings: UpdateNotificationSettingsRequestBody): Promise<NotificationSettings>;
10
+ delete(notificationId: string): Promise<undefined>;
11
+ }
@@ -0,0 +1,84 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.NotificationSettingsResource = void 0;
27
+ const base_1 = require("../../internal/base");
28
+ const entities_1 = require("../../entities");
29
+ const NotificationSettingsPaths = {
30
+ list: '/notification-settings',
31
+ create: '/notification-settings',
32
+ get: '/notification-settings/{notification_setting_id}',
33
+ update: '/notification-settings/{notification_setting_id}',
34
+ delete: '/notification-settings/{notification_setting_id}',
35
+ };
36
+ __exportStar(require("./operations"), exports);
37
+ class NotificationSettingsResource extends base_1.BaseResource {
38
+ list() {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const response = yield this.client.get(NotificationSettingsPaths.list);
41
+ const data = this.handleResponse(response);
42
+ return data.map((notificationSetting) => new entities_1.NotificationSettings(notificationSetting));
43
+ });
44
+ }
45
+ create(createNotificationSettings) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const response = yield this.client.post(NotificationSettingsPaths.create, createNotificationSettings);
48
+ const data = this.handleResponse(response);
49
+ return new entities_1.NotificationSettings(data);
50
+ });
51
+ }
52
+ get(notificationId) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const urlWithPathParams = new base_1.PathParameters(NotificationSettingsPaths.get, {
55
+ notification_setting_id: notificationId,
56
+ }).deriveUrl();
57
+ const response = yield this.client.get(urlWithPathParams);
58
+ const data = this.handleResponse(response);
59
+ return new entities_1.NotificationSettings(data);
60
+ });
61
+ }
62
+ update(notificationId, updateNotificationSettings) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ const urlWithPathParams = new base_1.PathParameters(NotificationSettingsPaths.update, {
65
+ notification_setting_id: notificationId,
66
+ }).deriveUrl();
67
+ const response = yield this.client.patch(urlWithPathParams, updateNotificationSettings);
68
+ const data = this.handleResponse(response);
69
+ return new entities_1.NotificationSettings(data);
70
+ });
71
+ }
72
+ delete(notificationId) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ const urlWithPathParams = new base_1.PathParameters(NotificationSettingsPaths.update, {
75
+ notification_setting_id: notificationId,
76
+ }).deriveUrl();
77
+ const response = yield this.client.delete(urlWithPathParams);
78
+ if (response) {
79
+ this.handleResponse(response);
80
+ }
81
+ });
82
+ }
83
+ }
84
+ exports.NotificationSettingsResource = NotificationSettingsResource;
@@ -0,0 +1,10 @@
1
+ import { type NotificationSettingsType } from '../../../enums';
2
+ import { type IEventName } from '../../../notifications';
3
+ export interface CreateNotificationSettingsRequestBody {
4
+ description: string;
5
+ destination: string;
6
+ subscribedEvents: IEventName[];
7
+ type: NotificationSettingsType;
8
+ apiVersion?: number | null;
9
+ includeSensitiveFields?: boolean | null;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from './create-notification-settings-request-body';
2
+ export * from './update-notification-settings-request-body';
@@ -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("./create-notification-settings-request-body"), exports);
18
+ __exportStar(require("./update-notification-settings-request-body"), exports);
@@ -0,0 +1,9 @@
1
+ import { type IEventName } from '../../../notifications';
2
+ export interface UpdateNotificationSettingsRequestBody {
3
+ description?: string;
4
+ destination?: string;
5
+ active?: boolean;
6
+ apiVersion?: number;
7
+ includeSensitiveFields?: boolean;
8
+ subscribedEvents?: IEventName[];
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { BaseResource } from '../../internal/base';
2
+ import { Notification, NotificationCollection, NotificationLogCollection, ReplayNotification } from '../../entities';
3
+ import { type ListNotificationLogQueryParameters, type ListNotificationQueryParameters } from './operations';
4
+ export * from './operations';
5
+ export declare class NotificationsResource extends BaseResource {
6
+ list(queryParams?: ListNotificationQueryParameters): NotificationCollection;
7
+ get(notificationId: string): Promise<Notification>;
8
+ replay(notificationId: string): Promise<ReplayNotification>;
9
+ getLogs(notificationId: string, queryParams?: ListNotificationLogQueryParameters): NotificationLogCollection;
10
+ }
@@ -0,0 +1,69 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.NotificationsResource = void 0;
27
+ const base_1 = require("../../internal/base");
28
+ const entities_1 = require("../../entities");
29
+ const NotificationPaths = {
30
+ list: '/notifications',
31
+ get: '/notifications/{notification_id}',
32
+ getLogs: '/notifications/{notification_id}/logs',
33
+ replay: '/notifications/{notification_id}/replay',
34
+ };
35
+ __exportStar(require("./operations"), exports);
36
+ class NotificationsResource extends base_1.BaseResource {
37
+ list(queryParams) {
38
+ const queryParameters = new base_1.QueryParameters(queryParams);
39
+ return new entities_1.NotificationCollection(this.client, NotificationPaths.list + '?' + queryParameters.toQueryString());
40
+ }
41
+ get(notificationId) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const urlWithPathParams = new base_1.PathParameters(NotificationPaths.get, {
44
+ notification_id: notificationId,
45
+ }).deriveUrl();
46
+ const response = yield this.client.get(urlWithPathParams);
47
+ const data = this.handleResponse(response);
48
+ return new entities_1.Notification(data);
49
+ });
50
+ }
51
+ replay(notificationId) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ const urlWithPathParams = new base_1.PathParameters(NotificationPaths.replay, {
54
+ notification_id: notificationId,
55
+ }).deriveUrl();
56
+ const response = yield this.client.post(urlWithPathParams, undefined);
57
+ const data = this.handleResponse(response);
58
+ return new entities_1.ReplayNotification(data);
59
+ });
60
+ }
61
+ getLogs(notificationId, queryParams) {
62
+ const queryParameters = new base_1.QueryParameters(queryParams);
63
+ const urlWithPathParams = new base_1.PathParameters(NotificationPaths.getLogs, {
64
+ notification_id: notificationId,
65
+ }).deriveUrl();
66
+ return new entities_1.NotificationLogCollection(this.client, urlWithPathParams + '?' + queryParameters.toQueryString());
67
+ }
68
+ }
69
+ exports.NotificationsResource = NotificationsResource;
@@ -0,0 +1,2 @@
1
+ export * from './list-notification-query-parameters';
2
+ export * from './list-notification-log-query-parameters';
@@ -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("./list-notification-query-parameters"), exports);
18
+ __exportStar(require("./list-notification-log-query-parameters"), exports);
@@ -0,0 +1,4 @@
1
+ export interface ListNotificationLogQueryParameters {
2
+ after: string;
3
+ perPage: number;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { type NotificationStatus } from '../../../enums';
2
+ export interface ListNotificationQueryParameters {
3
+ after: string;
4
+ notificationSettingId: string[];
5
+ orderBy: string;
6
+ perPage: number;
7
+ search: string;
8
+ status: NotificationStatus[];
9
+ filter: string;
10
+ to: string;
11
+ from: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { type CollectionMode, type TransactionStatus } from '../../../enums';
1
+ import { type CollectionMode, type TransactionStatus, type TransactionOrigin } from '../../../enums';
2
2
  export interface ListTransactionQueryParameters {
3
3
  after?: string;
4
4
  billedAt?: string;
@@ -25,4 +25,5 @@ export interface ListTransactionQueryParameters {
25
25
  'updatedAt[GT]'?: string;
26
26
  'updatedAt[LTE]'?: string;
27
27
  'updatedAt[GTE]'?: string;
28
+ origin?: TransactionOrigin[];
28
29
  }
@@ -1,4 +1,4 @@
1
- import { type ICustomData } from '../index';
1
+ import { type ICustomData, type IImportMetaResponse } from '../index';
2
2
  import { type CountryCode, type Status } from '../../enums';
3
3
  export interface IAddressResponse {
4
4
  id: string;
@@ -13,4 +13,5 @@ export interface IAddressResponse {
13
13
  status: Status;
14
14
  created_at: string;
15
15
  updated_at: string;
16
+ import_meta?: IImportMetaResponse | null;
16
17
  }
@@ -1,4 +1,4 @@
1
- import { type IBusinessContacts, type ICustomData } from '../index';
1
+ import { type IBusinessContacts, type ICustomData, type IImportMetaResponse } from '../index';
2
2
  import { type Status } from '../../enums';
3
3
  export interface IBusinessResponse {
4
4
  id: string;
@@ -10,4 +10,5 @@ export interface IBusinessResponse {
10
10
  created_at: string;
11
11
  updated_at: string;
12
12
  custom_data?: ICustomData | null;
13
+ import_meta?: IImportMetaResponse | null;
13
14
  }
@@ -1,4 +1,4 @@
1
- import { type ICustomData } from '../index';
1
+ import { type ICustomData, type IImportMetaResponse } from '../index';
2
2
  import { type Status } from '../../enums';
3
3
  export interface ICustomerResponse {
4
4
  id: string;
@@ -10,4 +10,5 @@ export interface ICustomerResponse {
10
10
  locale: string;
11
11
  created_at: string;
12
12
  updated_at: string;
13
+ import_meta?: IImportMetaResponse | null;
13
14
  }
@@ -1,5 +1,5 @@
1
1
  import { type CurrencyCode, type DiscountStatus, type DiscountType } from '../../enums';
2
- import { type ICustomData } from '../shared';
2
+ import { type ICustomData, type IImportMetaResponse } from '../shared';
3
3
  export interface IDiscountResponse {
4
4
  id: string;
5
5
  status: DiscountStatus;
@@ -18,4 +18,5 @@ export interface IDiscountResponse {
18
18
  times_used: number;
19
19
  created_at: string;
20
20
  updated_at: string;
21
+ import_meta?: IImportMetaResponse | null;
21
22
  }
@@ -0,0 +1,7 @@
1
+ import { type IEventName } from '../../notifications';
2
+ export interface IEventTypeResponse {
3
+ name: IEventName;
4
+ description: string;
5
+ group: string;
6
+ available_versions: number[];
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from './event-type-response';
@@ -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("./event-type-response"), exports);
@@ -11,3 +11,6 @@ export * from './discount';
11
11
  export * from './pricing-preview';
12
12
  export * from './events';
13
13
  export * from './payout';
14
+ export * from './event-types';
15
+ export * from './notification-settings';
16
+ export * from './notifications';
@@ -27,3 +27,6 @@ __exportStar(require("./discount"), exports);
27
27
  __exportStar(require("./pricing-preview"), exports);
28
28
  __exportStar(require("./events"), exports);
29
29
  __exportStar(require("./payout"), exports);
30
+ __exportStar(require("./event-types"), exports);
31
+ __exportStar(require("./notification-settings"), exports);
32
+ __exportStar(require("./notifications"), exports);
@@ -0,0 +1 @@
1
+ export * from './notification-settings-response';