@paddle/paddle-node-sdk 0.2.4 → 0.2.5
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.
- package/CHANGELOG.md +11 -1
- package/README.md +6 -3
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/index.js +1 -0
- package/dist/entities/report/index.d.ts +4 -0
- package/dist/entities/report/index.js +20 -0
- package/dist/entities/report/report-collection.d.ts +6 -0
- package/dist/entities/report/report-collection.js +11 -0
- package/dist/entities/report/report-csv.d.ts +5 -0
- package/dist/entities/report/report-csv.js +9 -0
- package/dist/entities/report/report-filters.d.ts +8 -0
- package/dist/entities/report/report-filters.js +12 -0
- package/dist/entities/report/report.d.ts +13 -0
- package/dist/entities/report/report.js +17 -0
- package/dist/enums/index.d.ts +1 -0
- package/dist/enums/index.js +1 -0
- package/dist/enums/report/index.d.ts +4 -0
- package/dist/enums/report/index.js +20 -0
- package/dist/enums/report/report-filter-name.d.ts +1 -0
- package/dist/enums/report/report-filter-name.js +2 -0
- package/dist/enums/report/report-filter-operator.d.ts +1 -0
- package/dist/enums/report/report-filter-operator.js +2 -0
- package/dist/enums/report/report-status.d.ts +1 -0
- package/dist/enums/report/report-status.js +2 -0
- package/dist/enums/report/report-type.d.ts +1 -0
- package/dist/enums/report/report-type.js +2 -0
- package/dist/notifications/events/index.d.ts +1 -0
- package/dist/notifications/events/index.js +1 -0
- package/dist/notifications/events/report/index.d.ts +2 -0
- package/dist/notifications/events/report/index.js +18 -0
- package/dist/notifications/events/report/report-created-event.d.ts +9 -0
- package/dist/notifications/events/report/report-created-event.js +14 -0
- package/dist/notifications/events/report/report-updated-event.d.ts +9 -0
- package/dist/notifications/events/report/report-updated-event.js +14 -0
- package/dist/notifications/helpers/types.d.ts +6 -4
- package/dist/notifications/helpers/types.js +2 -0
- package/dist/notifications/helpers/webhooks.js +4 -0
- package/dist/paddle.d.ts +2 -1
- package/dist/paddle.js +1 -0
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.js +1 -0
- package/dist/resources/reports/index.d.ts +10 -0
- package/dist/resources/reports/index.js +69 -0
- package/dist/resources/reports/operations/create-report-request-object.d.ts +6 -0
- package/dist/resources/reports/operations/create-report-request-object.js +2 -0
- package/dist/resources/reports/operations/index.d.ts +2 -0
- package/dist/resources/reports/operations/index.js +18 -0
- package/dist/resources/reports/operations/list-report-query-parameters.d.ts +7 -0
- package/dist/resources/reports/operations/list-report-query-parameters.js +2 -0
- package/dist/types/events/events-response.d.ts +8 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/report/index.d.ts +3 -0
- package/dist/types/report/index.js +19 -0
- package/dist/types/report/report-filters.d.ts +6 -0
- package/dist/types/report/report-filters.js +2 -0
- package/dist/types/report/report.d.ts +11 -0
- package/dist/types/report/report.js +2 -0
- package/dist/types/report/reports-csv.d.ts +3 -0
- package/dist/types/report/reports-csv.js +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
8
8
|
|
|
9
9
|
Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx&utm_medium=paddle-node-sdk) for information about changes to the Paddle Billing platform, the Paddle API, and other developer tools.
|
|
10
10
|
|
|
11
|
+
## 0.2.5 - 2023-12-15
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Added `reports.list()` to [list reports](https://developer.paddle.com/api-reference/reports/list-reports?utm_source=dx&utm_medium=paddle-node-sdk)
|
|
16
|
+
- Added `reports.create()` to [create a new report](https://developer.paddle.com/api-reference/reports/create-report?utm_source=dx&utm_medium=paddle-node-sdk)
|
|
17
|
+
- Added `reports.get()` to [get a report](https://developer.paddle.com/api-reference/reports/get-report?utm_source=dx&utm_medium=paddle-node-sdk)
|
|
18
|
+
- Added `reports.getReportCsv()` to [get a CSV file for a report](https://developer.paddle.com/api-reference/reports/get-report-csv?utm_source=dx&utm_medium=paddle-node-sdk)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
11
22
|
## 0.2.4 - 2023-12-14
|
|
12
23
|
|
|
13
24
|
### Changed
|
|
@@ -33,7 +44,6 @@ Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx
|
|
|
33
44
|
- Added `notifications.replay()` to [replay a notification](https://developer.paddle.com/api-reference/notifications/replay-notification?utm_source=dx&utm_medium=paddle-node-sdk)
|
|
34
45
|
- Added `notifications.getLogs()` to [get all logs for a notification](https://developer.paddle.com/api-reference/notification-logs/list-notification-logs?utm_source=dx&utm_medium=paddle-node-sdk)
|
|
35
46
|
|
|
36
|
-
|
|
37
47
|
### Fixed
|
|
38
48
|
|
|
39
49
|
- Fixed incorrect type of `action` in `subscriptions.scheduled_change`
|
package/README.md
CHANGED
|
@@ -269,9 +269,7 @@ app.listen(3000)
|
|
|
269
269
|
|
|
270
270
|
## Feature parity
|
|
271
271
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
This table shows which operations are available as of the latest release.
|
|
272
|
+
The Node.js SDK has complete feature parity with the Paddle API. All operations in the Paddle API are supported.
|
|
275
273
|
|
|
276
274
|
| Paddle API operation | Support |
|
|
277
275
|
|----------------------------------------------|:--------:|
|
|
@@ -330,6 +328,11 @@ This table shows which operations are available as of the latest release.
|
|
|
330
328
|
| Create an adjustment | ✅ |
|
|
331
329
|
| **Pricing preview** | **Full** |
|
|
332
330
|
| Preview prices | ✅ |
|
|
331
|
+
| **Reports** | **Full** |
|
|
332
|
+
| List reports | ✅ |
|
|
333
|
+
| Create a report | ✅ |
|
|
334
|
+
| Get a report | ✅ |
|
|
335
|
+
| Get a CSV file for a report | ✅ |
|
|
333
336
|
| **Event types** | **Full** |
|
|
334
337
|
| List event types | ✅ |
|
|
335
338
|
| **Events** | **Full** |
|
package/dist/entities/index.d.ts
CHANGED
package/dist/entities/index.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
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("./report-filters"), exports);
|
|
18
|
+
__exportStar(require("./report"), exports);
|
|
19
|
+
__exportStar(require("./report-csv"), exports);
|
|
20
|
+
__exportStar(require("./report-collection"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Report } from '../../entities';
|
|
2
|
+
import { type IReportResponse } from '../../types';
|
|
3
|
+
import { Collection } from '../../internal/base';
|
|
4
|
+
export declare class ReportCollection extends Collection<IReportResponse, Report> {
|
|
5
|
+
fromJson(data: IReportResponse): Report;
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportCollection = void 0;
|
|
4
|
+
const entities_1 = require("../../entities");
|
|
5
|
+
const base_1 = require("../../internal/base");
|
|
6
|
+
class ReportCollection extends base_1.Collection {
|
|
7
|
+
fromJson(data) {
|
|
8
|
+
return new entities_1.Report(data);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.ReportCollection = ReportCollection;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IReportFilters } from '../../types';
|
|
2
|
+
import { type ReportFilterName, type ReportFilterOperator } from '../../enums';
|
|
3
|
+
export declare class ReportFilters {
|
|
4
|
+
readonly name: ReportFilterName;
|
|
5
|
+
readonly operator: null | ReportFilterOperator;
|
|
6
|
+
readonly value: string[] | string;
|
|
7
|
+
constructor(reportFiltersResponse: IReportFilters);
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportFilters = void 0;
|
|
4
|
+
class ReportFilters {
|
|
5
|
+
constructor(reportFiltersResponse) {
|
|
6
|
+
var _a;
|
|
7
|
+
this.name = reportFiltersResponse.name;
|
|
8
|
+
this.operator = (_a = reportFiltersResponse.operator) !== null && _a !== void 0 ? _a : null;
|
|
9
|
+
this.value = reportFiltersResponse.value;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.ReportFilters = ReportFilters;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type IReportResponse } from '../../types';
|
|
2
|
+
import { ReportFilters } from '../index';
|
|
3
|
+
import { type ReportStatus, type ReportType } from '../../enums';
|
|
4
|
+
export declare class Report {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly status: ReportStatus;
|
|
7
|
+
readonly rows: number | null;
|
|
8
|
+
readonly type: ReportType;
|
|
9
|
+
readonly filters: ReportFilters[];
|
|
10
|
+
readonly expiresAt: string | null;
|
|
11
|
+
readonly createdAt: string;
|
|
12
|
+
constructor(reportResponse: IReportResponse);
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Report = void 0;
|
|
4
|
+
const index_1 = require("../index");
|
|
5
|
+
class Report {
|
|
6
|
+
constructor(reportResponse) {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
this.id = reportResponse.id;
|
|
9
|
+
this.status = reportResponse.status;
|
|
10
|
+
this.rows = (_a = reportResponse.rows) !== null && _a !== void 0 ? _a : null;
|
|
11
|
+
this.type = reportResponse.type;
|
|
12
|
+
this.filters = (_b = reportResponse.filters) === null || _b === void 0 ? void 0 : _b.map((filter) => new index_1.ReportFilters(filter));
|
|
13
|
+
this.expiresAt = (_c = reportResponse.expires_at) !== null && _c !== void 0 ? _c : null;
|
|
14
|
+
this.createdAt = reportResponse.created_at;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.Report = Report;
|
package/dist/enums/index.d.ts
CHANGED
package/dist/enums/index.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
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("./report-status"), exports);
|
|
18
|
+
__exportStar(require("./report-type"), exports);
|
|
19
|
+
__exportStar(require("./report-filter-name"), exports);
|
|
20
|
+
__exportStar(require("./report-filter-operator"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ReportFilterName = 'action' | 'collection_mode' | 'currency_code' | 'origin' | 'status' | 'updated_at';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ReportFilterOperator = 'lt' | 'gte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ReportStatus = 'pending' | 'ready' | 'failed' | 'expired';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ReportType = 'adjustments' | 'adjustment_line_items' | 'transactions' | 'transaction_line_items';
|
|
@@ -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("./report-created-event"), exports);
|
|
18
|
+
__exportStar(require("./report-updated-event"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Report } from '../../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse, type IReportResponse } from '../../../types';
|
|
5
|
+
export declare class ReportCreatedEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.ReportCreated;
|
|
7
|
+
readonly data: Report;
|
|
8
|
+
constructor(response: IEventsResponse<IReportResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportCreatedEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class ReportCreatedEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.ReportCreated;
|
|
11
|
+
this.data = new entities_1.Report(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ReportCreatedEvent = ReportCreatedEvent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Event } from '../../../entities/events/event';
|
|
2
|
+
import { Report } from '../../../entities';
|
|
3
|
+
import { EventName } from '../../helpers';
|
|
4
|
+
import { type IEventsResponse, type IReportResponse } from '../../../types';
|
|
5
|
+
export declare class ReportUpdatedEvent extends Event {
|
|
6
|
+
readonly eventType = EventName.ReportUpdated;
|
|
7
|
+
readonly data: Report;
|
|
8
|
+
constructor(response: IEventsResponse<IReportResponse>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportUpdatedEvent = void 0;
|
|
4
|
+
const event_1 = require("../../../entities/events/event");
|
|
5
|
+
const entities_1 = require("../../../entities");
|
|
6
|
+
const helpers_1 = require("../../helpers");
|
|
7
|
+
class ReportUpdatedEvent extends event_1.Event {
|
|
8
|
+
constructor(response) {
|
|
9
|
+
super(response);
|
|
10
|
+
this.eventType = helpers_1.EventName.ReportUpdated;
|
|
11
|
+
this.data = new entities_1.Report(response.data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ReportUpdatedEvent = ReportUpdatedEvent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AddressCreatedEvent, type AddressUpdatedEvent, type BusinessCreatedEvent, type AdjustmentCreatedEvent, type AdjustmentUpdatedEvent, type BusinessUpdatedEvent, type CustomerCreatedEvent, type CustomerUpdatedEvent, type DiscountCreatedEvent, type DiscountImportedEvent, type DiscountUpdatedEvent, type PayoutCreatedEvent, type PayoutPaidEvent, type PriceCreatedEvent, type PriceUpdatedEvent, type ProductCreatedEvent, type ProductUpdatedEvent, type SubscriptionCreatedEvent, type SubscriptionActivatedEvent, type SubscriptionCanceledEvent, type SubscriptionImportedEvent, type SubscriptionPausedEvent, type SubscriptionResumedEvent, type SubscriptionTrialingEvent, type SubscriptionUpdatedEvent, type TransactionCanceledEvent, type TransactionBilledEvent, type TransactionCompletedEvent, type TransactionCreatedEvent, type TransactionPaidEvent, type SubscriptionPastDueEvent, type TransactionPastDueEvent, type TransactionPaymentFailedEvent, type TransactionReadyEvent, type TransactionUpdatedEvent } from '../events';
|
|
2
|
-
export type EventEntity = AddressCreatedEvent | AddressUpdatedEvent | AdjustmentUpdatedEvent | AdjustmentCreatedEvent | BusinessCreatedEvent | BusinessUpdatedEvent | CustomerCreatedEvent | CustomerUpdatedEvent | DiscountCreatedEvent | DiscountUpdatedEvent | DiscountImportedEvent | PayoutCreatedEvent | PayoutPaidEvent | PriceCreatedEvent | PriceUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | SubscriptionActivatedEvent | SubscriptionCanceledEvent | SubscriptionCreatedEvent | SubscriptionImportedEvent | SubscriptionPastDueEvent | SubscriptionPausedEvent | SubscriptionResumedEvent | SubscriptionTrialingEvent | SubscriptionUpdatedEvent | TransactionBilledEvent | TransactionCanceledEvent | TransactionCompletedEvent | TransactionCreatedEvent | TransactionPaidEvent | TransactionPastDueEvent | TransactionPaymentFailedEvent | TransactionReadyEvent | TransactionUpdatedEvent;
|
|
1
|
+
import { type AddressCreatedEvent, type AddressUpdatedEvent, type BusinessCreatedEvent, type AdjustmentCreatedEvent, type AdjustmentUpdatedEvent, type BusinessUpdatedEvent, type CustomerCreatedEvent, type CustomerUpdatedEvent, type DiscountCreatedEvent, type DiscountImportedEvent, type DiscountUpdatedEvent, type PayoutCreatedEvent, type PayoutPaidEvent, type PriceCreatedEvent, type PriceUpdatedEvent, type ProductCreatedEvent, type ProductUpdatedEvent, type SubscriptionCreatedEvent, type SubscriptionActivatedEvent, type SubscriptionCanceledEvent, type SubscriptionImportedEvent, type SubscriptionPausedEvent, type SubscriptionResumedEvent, type SubscriptionTrialingEvent, type SubscriptionUpdatedEvent, type TransactionCanceledEvent, type TransactionBilledEvent, type TransactionCompletedEvent, type TransactionCreatedEvent, type TransactionPaidEvent, type SubscriptionPastDueEvent, type TransactionPastDueEvent, type TransactionPaymentFailedEvent, type TransactionReadyEvent, type TransactionUpdatedEvent, type ReportUpdatedEvent, type ReportCreatedEvent } from '../events';
|
|
2
|
+
export type EventEntity = AddressCreatedEvent | AddressUpdatedEvent | AdjustmentUpdatedEvent | AdjustmentCreatedEvent | BusinessCreatedEvent | BusinessUpdatedEvent | CustomerCreatedEvent | CustomerUpdatedEvent | DiscountCreatedEvent | DiscountUpdatedEvent | DiscountImportedEvent | PayoutCreatedEvent | PayoutPaidEvent | PriceCreatedEvent | PriceUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | SubscriptionActivatedEvent | SubscriptionCanceledEvent | SubscriptionCreatedEvent | SubscriptionImportedEvent | SubscriptionPastDueEvent | SubscriptionPausedEvent | SubscriptionResumedEvent | SubscriptionTrialingEvent | SubscriptionUpdatedEvent | TransactionBilledEvent | TransactionCanceledEvent | TransactionCompletedEvent | TransactionCreatedEvent | TransactionPaidEvent | TransactionPastDueEvent | TransactionPaymentFailedEvent | TransactionReadyEvent | TransactionUpdatedEvent | ReportUpdatedEvent | ReportCreatedEvent;
|
|
3
3
|
export declare enum EventName {
|
|
4
4
|
AddressCreated = "address.created",
|
|
5
5
|
AddressUpdated = "address.updated",
|
|
@@ -35,6 +35,8 @@ export declare enum EventName {
|
|
|
35
35
|
TransactionPastDue = "transaction.past_due",
|
|
36
36
|
TransactionPaymentFailed = "transaction.payment_failed",
|
|
37
37
|
TransactionReady = "transaction.ready",
|
|
38
|
-
TransactionUpdated = "transaction.updated"
|
|
38
|
+
TransactionUpdated = "transaction.updated",
|
|
39
|
+
ReportCreated = "report.created",
|
|
40
|
+
ReportUpdated = "report.updated"
|
|
39
41
|
}
|
|
40
|
-
export type IEventName = 'address.created' | 'address.updated' | 'adjustment.created' | 'adjustment.updated' | 'business.created' | 'business.updated' | 'customer.created' | 'customer.updated' | 'discount.created' | 'discount.updated' | 'discount.imported' | 'payout.updated' | 'payout.paid' | 'price.updated' | 'price.created' | 'product.updated' | 'product.created' | 'subscription.activated' | 'subscription.canceled' | 'subscription.imported' | 'subscription.created' | 'subscription.past_due' | 'subscription.paused' | 'subscription.resumed' | 'subscription.trialing' | 'subscription.updated' | 'transaction.billed' | 'transaction.canceled' | 'transaction.completed' | 'transaction.paid' | 'transaction.created' | 'transaction.past_due' | 'transaction.payment_failed' | 'transaction.ready' | 'transaction.updated';
|
|
42
|
+
export type IEventName = 'address.created' | 'address.updated' | 'adjustment.created' | 'adjustment.updated' | 'business.created' | 'business.updated' | 'customer.created' | 'customer.updated' | 'discount.created' | 'discount.updated' | 'discount.imported' | 'payout.updated' | 'payout.paid' | 'price.updated' | 'price.created' | 'product.updated' | 'product.created' | 'subscription.activated' | 'subscription.canceled' | 'subscription.imported' | 'subscription.created' | 'subscription.past_due' | 'subscription.paused' | 'subscription.resumed' | 'subscription.trialing' | 'subscription.updated' | 'transaction.billed' | 'transaction.canceled' | 'transaction.completed' | 'transaction.paid' | 'transaction.created' | 'transaction.past_due' | 'transaction.payment_failed' | 'transaction.ready' | 'transaction.updated' | 'report.created' | 'report.updated';
|
|
@@ -38,4 +38,6 @@ var EventName;
|
|
|
38
38
|
EventName["TransactionPaymentFailed"] = "transaction.payment_failed";
|
|
39
39
|
EventName["TransactionReady"] = "transaction.ready";
|
|
40
40
|
EventName["TransactionUpdated"] = "transaction.updated";
|
|
41
|
+
EventName["ReportCreated"] = "report.created";
|
|
42
|
+
EventName["ReportUpdated"] = "report.updated";
|
|
41
43
|
})(EventName || (exports.EventName = EventName = {}));
|
|
@@ -91,6 +91,10 @@ class Webhooks {
|
|
|
91
91
|
return new events_1.TransactionReadyEvent(data);
|
|
92
92
|
case types_1.EventName.TransactionUpdated:
|
|
93
93
|
return new events_1.TransactionUpdatedEvent(data);
|
|
94
|
+
case types_1.EventName.ReportCreated:
|
|
95
|
+
return new events_1.ReportCreatedEvent(data);
|
|
96
|
+
case types_1.EventName.ReportUpdated:
|
|
97
|
+
return new events_1.ReportUpdatedEvent(data);
|
|
94
98
|
default:
|
|
95
99
|
logger_1.Logger.log('Unknown event_type');
|
|
96
100
|
return null;
|
package/dist/paddle.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PricesResource, PricingPreviewResource, ProductsResource, SubscriptionsResource, TransactionsResource } from './resources';
|
|
1
|
+
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SubscriptionsResource, TransactionsResource } from './resources';
|
|
2
2
|
import { type PaddleOptions } from './internal';
|
|
3
3
|
import { EventsResource } from './resources/events';
|
|
4
4
|
import { Webhooks } from './notifications';
|
|
@@ -20,5 +20,6 @@ export declare class Paddle {
|
|
|
20
20
|
eventTypes: EventTypesResource;
|
|
21
21
|
notificationSettings: NotificationSettingsResource;
|
|
22
22
|
notifications: NotificationsResource;
|
|
23
|
+
reports: ReportsResource;
|
|
23
24
|
constructor(apiKey: string, options?: PaddleOptions);
|
|
24
25
|
}
|
package/dist/paddle.js
CHANGED
|
@@ -27,6 +27,7 @@ class Paddle {
|
|
|
27
27
|
this.eventTypes = new resources_1.EventTypesResource(this.client);
|
|
28
28
|
this.notificationSettings = new resources_1.NotificationSettingsResource(this.client);
|
|
29
29
|
this.notifications = new resources_1.NotificationsResource(this.client);
|
|
30
|
+
this.reports = new resources_1.ReportsResource(this.client);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
exports.Paddle = Paddle;
|
package/dist/resources/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Report, ReportCollection, ReportCsv } from '../../entities';
|
|
2
|
+
import { BaseResource } from '../../internal/base';
|
|
3
|
+
import { type CreateReportRequestBody, type ListReportQueryParameters } from './operations';
|
|
4
|
+
export * from './operations';
|
|
5
|
+
export declare class ReportsResource extends BaseResource {
|
|
6
|
+
list(queryParams?: ListReportQueryParameters): ReportCollection;
|
|
7
|
+
create(createReportParameters: CreateReportRequestBody): Promise<Report>;
|
|
8
|
+
get(reportId: string): Promise<Report>;
|
|
9
|
+
getReportCsv(reportId: string): Promise<ReportCsv>;
|
|
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.ReportsResource = void 0;
|
|
27
|
+
const entities_1 = require("../../entities");
|
|
28
|
+
const base_1 = require("../../internal/base");
|
|
29
|
+
const ReportPaths = {
|
|
30
|
+
list: '/reports',
|
|
31
|
+
create: '/reports',
|
|
32
|
+
get: '/reports/{report_id}',
|
|
33
|
+
getReportCsv: '/reports/{report_id}/download-url',
|
|
34
|
+
};
|
|
35
|
+
__exportStar(require("./operations"), exports);
|
|
36
|
+
class ReportsResource extends base_1.BaseResource {
|
|
37
|
+
list(queryParams) {
|
|
38
|
+
const queryParameters = new base_1.QueryParameters(queryParams);
|
|
39
|
+
return new entities_1.ReportCollection(this.client, ReportPaths.list + '?' + queryParameters.toQueryString());
|
|
40
|
+
}
|
|
41
|
+
create(createReportParameters) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const response = yield this.client.post(ReportPaths.create, createReportParameters);
|
|
44
|
+
const data = this.handleResponse(response);
|
|
45
|
+
return new entities_1.Report(data);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
get(reportId) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const urlWithPathParams = new base_1.PathParameters(ReportPaths.get, {
|
|
51
|
+
report_id: reportId,
|
|
52
|
+
}).deriveUrl();
|
|
53
|
+
const response = yield this.client.get(urlWithPathParams);
|
|
54
|
+
const data = this.handleResponse(response);
|
|
55
|
+
return new entities_1.Report(data);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
getReportCsv(reportId) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const urlWithPathParams = new base_1.PathParameters(ReportPaths.getReportCsv, {
|
|
61
|
+
report_id: reportId,
|
|
62
|
+
}).deriveUrl();
|
|
63
|
+
const response = yield this.client.get(urlWithPathParams);
|
|
64
|
+
const data = this.handleResponse(response);
|
|
65
|
+
return new entities_1.ReportCsv(data);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.ReportsResource = ReportsResource;
|
|
@@ -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-report-query-parameters"), exports);
|
|
18
|
+
__exportStar(require("./create-report-request-object"), exports);
|
|
@@ -9,6 +9,7 @@ import { type IProductResponse } from '../product';
|
|
|
9
9
|
import { type ISubscriptionNotificationResponse } from '../subscription';
|
|
10
10
|
import { type ITransactionResponse } from '../transaction';
|
|
11
11
|
import { type IPayoutResponse } from '../payout';
|
|
12
|
+
import { type IReportResponse } from '../report';
|
|
12
13
|
export interface IEventsResponse<T = object> {
|
|
13
14
|
event_id: string;
|
|
14
15
|
notification_id: string;
|
|
@@ -121,5 +122,11 @@ interface ITransactionReady extends IEventsResponse<ITransactionResponse> {
|
|
|
121
122
|
interface ITransactionUpdated extends IEventsResponse<ITransactionResponse> {
|
|
122
123
|
event_type: EventName.TransactionUpdated;
|
|
123
124
|
}
|
|
124
|
-
|
|
125
|
+
interface IReportCreated extends IEventsResponse<IReportResponse> {
|
|
126
|
+
event_type: EventName.ReportCreated;
|
|
127
|
+
}
|
|
128
|
+
interface IReportUpdated extends IEventsResponse<IReportResponse> {
|
|
129
|
+
event_type: EventName.ReportUpdated;
|
|
130
|
+
}
|
|
131
|
+
export type IEvents = IAddressCreated | IAddressUpdated | IAdjustmentCreated | IAdjustmentUpdated | IBusinessCreated | IBusinessUpdated | ICustomerCreated | ICustomerUpdated | IDiscountCreated | IDiscountUpdated | IDiscountImported | IPayoutCreated | IPayoutPaid | IPriceCreated | IPriceUpdated | IProductCreated | IProductUpdated | ISubscriptionActivated | ISubscriptionCanceled | ISubscriptionCreated | ISubscriptionImported | ISubscriptionPastDue | ISubscriptionPaused | ISubscriptionResumed | ISubscriptionTrialing | ISubscriptionUpdated | ITransactionBilled | ITransactionCanceled | ITransactionCompleted | ITransactionCreated | ITransactionPaid | ITransactionPastDue | ITransactionPaymentFailed | ITransactionReady | ITransactionUpdated | IReportCreated | IReportUpdated;
|
|
125
132
|
export {};
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -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("./report-filters"), exports);
|
|
18
|
+
__exportStar(require("./report"), exports);
|
|
19
|
+
__exportStar(require("./reports-csv"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type IReportFilters } from '../index';
|
|
2
|
+
import { type ReportType, type ReportStatus } from '../../enums';
|
|
3
|
+
export interface IReportResponse {
|
|
4
|
+
id: string;
|
|
5
|
+
status: ReportStatus;
|
|
6
|
+
rows?: number | null;
|
|
7
|
+
type: ReportType;
|
|
8
|
+
filters: IReportFilters[];
|
|
9
|
+
expires_at?: string | null;
|
|
10
|
+
created_at: string;
|
|
11
|
+
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.2.
|
|
1
|
+
export declare const SDK_VERSION = "0.2.5";
|
package/dist/version.js
CHANGED