Skip to content

Commit d6e70dc

Browse files
Removed *Includes entity in favour of standard entities (#5)
1 parent 1be29ff commit d6e70dc

22 files changed

+102
-322
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88
99
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.
1010

11+
## 0.6.0 - 2024-02-20
12+
13+
> **Breaking changes:** This version includes major improvements that introduce breaking changes. These are called out below.
14+
15+
### Removed
16+
17+
- **Breaking change:** Removed `*Includes` entity in favour of standard entities.
18+
19+
- Use `Price` instead of `PriceWithIncludes`
20+
- Use `Product` instead of `ProductWithIncludes`
21+
- Use `Subscription` instead of `SubscriptionIncludes`
22+
- Use `Transaction` instead of `TransactionIncludes`
23+
24+
---
25+
1126
## 0.5.0 - 2024-02-16
1227

1328
> **Breaking changes:** This version includes major improvements that introduce breaking changes. These are called out below.
@@ -16,6 +31,8 @@ Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx
1631

1732
- We removed the shared entities between API and Notification as we foresee them diverging. No Action required for this change
1833

34+
---
35+
1936
## 0.4.0 - 2024-02-14
2037

2138
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@paddle/paddle-node-sdk",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/entities/price/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* Changes may be overwritten as part of auto-generation.
55
*/
66

7-
export * from './price-with-includes';
87
export * from './price-collection';
98
export * from './price-quantity';
109
export * from './price';

src/entities/price/price-collection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* Changes may be overwritten as part of auto-generation.
55
*/
66

7-
import { PriceWithIncludes } from './price-with-includes';
87
import { type IPriceResponse } from '../../types';
98
import { Collection } from '../../internal/base';
9+
import { Price } from './price';
1010

11-
export class PriceCollection extends Collection<IPriceResponse, PriceWithIncludes> {
12-
override fromJson(data: IPriceResponse): PriceWithIncludes {
13-
return new PriceWithIncludes(data);
11+
export class PriceCollection extends Collection<IPriceResponse, Price> {
12+
override fromJson(data: IPriceResponse): Price {
13+
return new Price(data);
1414
}
1515
}

src/entities/price/price-with-includes.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/entities/price/price.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import { type ICustomData, type IPriceResponse } from '../../types';
8-
import { ImportMeta, Money, PriceQuantity, TimePeriod, UnitPriceOverride } from '../index';
8+
import { ImportMeta, Money, PriceQuantity, Product, TimePeriod, UnitPriceOverride } from '../index';
99
import { type CatalogType, type Status, type TaxMode } from '../../enums';
1010

1111
export class Price {
@@ -23,6 +23,7 @@ export class Price {
2323
public readonly status: Status;
2424
public readonly customData: ICustomData | null;
2525
public readonly importMeta: ImportMeta | null;
26+
public readonly product: Product | null;
2627

2728
constructor(price: IPriceResponse) {
2829
this.id = price.id;
@@ -41,5 +42,6 @@ export class Price {
4142
this.status = price.status;
4243
this.customData = price.custom_data ? price.custom_data : null;
4344
this.importMeta = price.import_meta ? new ImportMeta(price.import_meta) : null;
45+
this.product = price.product ? new Product(price.product) : null;
4446
}
4547
}

src/entities/product/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
* Changes may be overwritten as part of auto-generation.
55
*/
66

7-
export * from './product-with-includes';
87
export * from './product-collection';
98
export * from './product';

src/entities/product/product-collection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* Changes may be overwritten as part of auto-generation.
55
*/
66

7-
import { ProductWithIncludes } from './product-with-includes';
87
import { type IProductResponse } from '../../types';
98
import { Collection } from '../../internal/base';
9+
import { Product } from './product';
1010

11-
export class ProductCollection extends Collection<IProductResponse, ProductWithIncludes> {
12-
override fromJson(data: IProductResponse): ProductWithIncludes {
13-
return new ProductWithIncludes(data);
11+
export class ProductCollection extends Collection<IProductResponse, Product> {
12+
override fromJson(data: IProductResponse): Product {
13+
return new Product(data);
1414
}
1515
}

src/entities/product/product-with-includes.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/entities/product/product.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* Changes may be overwritten as part of auto-generation.
55
*/
66

7-
import { type ISharedProductResponse } from '../../types';
8-
import { type CustomData, ImportMeta } from '../index';
9-
import { type TaxCategory, type Status, type CatalogType } from '../../enums';
7+
import { type IProductResponse } from '../../types';
8+
import { type CustomData, ImportMeta, Price } from '../index';
9+
import { type CatalogType, type Status, type TaxCategory } from '../../enums';
1010

1111
export class Product {
1212
public readonly id: string;
@@ -19,8 +19,9 @@ export class Product {
1919
public readonly status: Status;
2020
public readonly createdAt: string;
2121
public readonly importMeta: ImportMeta | null;
22+
public readonly prices: Price[] | null;
2223

23-
constructor(product: ISharedProductResponse) {
24+
constructor(product: IProductResponse) {
2425
this.id = product.id;
2526
this.name = product.name;
2627
this.type = product.type ?? null;
@@ -31,5 +32,6 @@ export class Product {
3132
this.status = product.status;
3233
this.createdAt = product.created_at;
3334
this.importMeta = product.import_meta ? new ImportMeta(product.import_meta) : null;
35+
this.prices = product.prices ? product.prices.map((price) => new Price(price)) : null;
3436
}
3537
}

src/entities/subscription/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export * from './subscription-management';
1111
export * from './subscription-item';
1212
export * from './subscription';
1313
export * from './subscription-collection';
14-
export * from './subscription-includes';
1514
export * from './next-transaction';
1615
export * from './transaction-details-preview';
1716
export * from './transaction-line-item-preview';

src/entities/subscription/subscription-includes.ts

Lines changed: 0 additions & 85 deletions
This file was deleted.

src/entities/subscription/subscription.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import {
88
BillingDetails,
99
type CustomData,
1010
ImportMeta,
11+
NextTransaction,
1112
SubscriptionDiscount,
1213
SubscriptionItem,
1314
SubscriptionManagement,
1415
SubscriptionScheduledChange,
1516
SubscriptionTimePeriod,
1617
TimePeriod,
18+
TransactionDetailsPreview,
1719
} from '../index';
1820
import { type CollectionMode, type CurrencyCode, type SubscriptionStatus } from '../../enums';
1921
import { type ISubscriptionResponse } from '../../types';
@@ -42,6 +44,8 @@ export class Subscription {
4244
public readonly items: SubscriptionItem[];
4345
public readonly customData: CustomData | null;
4446
public readonly importMeta: ImportMeta | null;
47+
public readonly nextTransaction: NextTransaction | null;
48+
public readonly recurringTransactionDetails: TransactionDetailsPreview | null;
4549

4650
constructor(subscription: ISubscriptionResponse) {
4751
this.id = subscription.id;
@@ -73,5 +77,9 @@ export class Subscription {
7377
this.items = subscription.items.map((item) => new SubscriptionItem(item));
7478
this.customData = subscription.custom_data ? subscription.custom_data : null;
7579
this.importMeta = subscription.import_meta ? new ImportMeta(subscription.import_meta) : null;
80+
this.nextTransaction = subscription.next_transaction ? new NextTransaction(subscription.next_transaction) : null;
81+
this.recurringTransactionDetails = subscription.recurring_transaction_details
82+
? new TransactionDetailsPreview(subscription.recurring_transaction_details)
83+
: null;
7684
}
7785
}

src/entities/transaction/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export * from './transaction-adjustment-item';
1313
export * from './transaction-adjustment';
1414
export * from './adjustment-totals-breakdown';
1515
export * from './adjustment-totals';
16-
export * from './transaction-includes';
1716
export * from './transaction';
1817
export * from './transaction-collection';
1918
export * from './transaction-invoice-pdf';

src/entities/transaction/transaction-collection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* Changes may be overwritten as part of auto-generation.
55
*/
66

7-
import { TransactionIncludes } from './transaction-includes';
87
import { type ITransactionResponse } from '../../types';
98
import { Collection } from '../../internal/base';
9+
import { Transaction } from './transaction';
1010

11-
export class TransactionCollection extends Collection<ITransactionResponse, TransactionIncludes> {
12-
override fromJson(data: ITransactionResponse): TransactionIncludes {
13-
return new TransactionIncludes(data);
11+
export class TransactionCollection extends Collection<ITransactionResponse, Transaction> {
12+
override fromJson(data: ITransactionResponse): Transaction {
13+
return new Transaction(data);
1414
}
1515
}

0 commit comments

Comments
 (0)