Skip to content

Commit

Permalink
Removed *Includes entity in favour of standard entities (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayasingam-paddle authored Feb 20, 2024
1 parent 1be29ff commit d6e70dc
Show file tree
Hide file tree
Showing 22 changed files with 102 additions and 322 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
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.

## 0.6.0 - 2024-02-20

> **Breaking changes:** This version includes major improvements that introduce breaking changes. These are called out below.
### Removed

- **Breaking change:** Removed `*Includes` entity in favour of standard entities.

- Use `Price` instead of `PriceWithIncludes`
- Use `Product` instead of `ProductWithIncludes`
- Use `Subscription` instead of `SubscriptionIncludes`
- Use `Transaction` instead of `TransactionIncludes`

---

## 0.5.0 - 2024-02-16

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

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

---

## 0.4.0 - 2024-02-14

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paddle/paddle-node-sdk",
"version": "0.5.0",
"version": "0.6.0",
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
1 change: 0 additions & 1 deletion src/entities/price/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Changes may be overwritten as part of auto-generation.
*/

export * from './price-with-includes';
export * from './price-collection';
export * from './price-quantity';
export * from './price';
8 changes: 4 additions & 4 deletions src/entities/price/price-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* Changes may be overwritten as part of auto-generation.
*/

import { PriceWithIncludes } from './price-with-includes';
import { type IPriceResponse } from '../../types';
import { Collection } from '../../internal/base';
import { Price } from './price';

export class PriceCollection extends Collection<IPriceResponse, PriceWithIncludes> {
override fromJson(data: IPriceResponse): PriceWithIncludes {
return new PriceWithIncludes(data);
export class PriceCollection extends Collection<IPriceResponse, Price> {
override fromJson(data: IPriceResponse): Price {
return new Price(data);
}
}
47 changes: 0 additions & 47 deletions src/entities/price/price-with-includes.ts

This file was deleted.

4 changes: 3 additions & 1 deletion src/entities/price/price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

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

export class Price {
Expand All @@ -23,6 +23,7 @@ export class Price {
public readonly status: Status;
public readonly customData: ICustomData | null;
public readonly importMeta: ImportMeta | null;
public readonly product: Product | null;

constructor(price: IPriceResponse) {
this.id = price.id;
Expand All @@ -41,5 +42,6 @@ export class Price {
this.status = price.status;
this.customData = price.custom_data ? price.custom_data : null;
this.importMeta = price.import_meta ? new ImportMeta(price.import_meta) : null;
this.product = price.product ? new Product(price.product) : null;
}
}
1 change: 0 additions & 1 deletion src/entities/product/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
* Changes may be overwritten as part of auto-generation.
*/

export * from './product-with-includes';
export * from './product-collection';
export * from './product';
8 changes: 4 additions & 4 deletions src/entities/product/product-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* Changes may be overwritten as part of auto-generation.
*/

import { ProductWithIncludes } from './product-with-includes';
import { type IProductResponse } from '../../types';
import { Collection } from '../../internal/base';
import { Product } from './product';

export class ProductCollection extends Collection<IProductResponse, ProductWithIncludes> {
override fromJson(data: IProductResponse): ProductWithIncludes {
return new ProductWithIncludes(data);
export class ProductCollection extends Collection<IProductResponse, Product> {
override fromJson(data: IProductResponse): Product {
return new Product(data);
}
}
37 changes: 0 additions & 37 deletions src/entities/product/product-with-includes.ts

This file was deleted.

10 changes: 6 additions & 4 deletions src/entities/product/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* Changes may be overwritten as part of auto-generation.
*/

import { type ISharedProductResponse } from '../../types';
import { type CustomData, ImportMeta } from '../index';
import { type TaxCategory, type Status, type CatalogType } from '../../enums';
import { type IProductResponse } from '../../types';
import { type CustomData, ImportMeta, Price } from '../index';
import { type CatalogType, type Status, type TaxCategory } from '../../enums';

export class Product {
public readonly id: string;
Expand All @@ -19,8 +19,9 @@ export class Product {
public readonly status: Status;
public readonly createdAt: string;
public readonly importMeta: ImportMeta | null;
public readonly prices: Price[] | null;

constructor(product: ISharedProductResponse) {
constructor(product: IProductResponse) {
this.id = product.id;
this.name = product.name;
this.type = product.type ?? null;
Expand All @@ -31,5 +32,6 @@ export class Product {
this.status = product.status;
this.createdAt = product.created_at;
this.importMeta = product.import_meta ? new ImportMeta(product.import_meta) : null;
this.prices = product.prices ? product.prices.map((price) => new Price(price)) : null;
}
}
1 change: 0 additions & 1 deletion src/entities/subscription/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export * from './subscription-management';
export * from './subscription-item';
export * from './subscription';
export * from './subscription-collection';
export * from './subscription-includes';
export * from './next-transaction';
export * from './transaction-details-preview';
export * from './transaction-line-item-preview';
Expand Down
85 changes: 0 additions & 85 deletions src/entities/subscription/subscription-includes.ts

This file was deleted.

8 changes: 8 additions & 0 deletions src/entities/subscription/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import {
BillingDetails,
type CustomData,
ImportMeta,
NextTransaction,
SubscriptionDiscount,
SubscriptionItem,
SubscriptionManagement,
SubscriptionScheduledChange,
SubscriptionTimePeriod,
TimePeriod,
TransactionDetailsPreview,
} from '../index';
import { type CollectionMode, type CurrencyCode, type SubscriptionStatus } from '../../enums';
import { type ISubscriptionResponse } from '../../types';
Expand Down Expand Up @@ -42,6 +44,8 @@ export class Subscription {
public readonly items: SubscriptionItem[];
public readonly customData: CustomData | null;
public readonly importMeta: ImportMeta | null;
public readonly nextTransaction: NextTransaction | null;
public readonly recurringTransactionDetails: TransactionDetailsPreview | null;

constructor(subscription: ISubscriptionResponse) {
this.id = subscription.id;
Expand Down Expand Up @@ -73,5 +77,9 @@ export class Subscription {
this.items = subscription.items.map((item) => new SubscriptionItem(item));
this.customData = subscription.custom_data ? subscription.custom_data : null;
this.importMeta = subscription.import_meta ? new ImportMeta(subscription.import_meta) : null;
this.nextTransaction = subscription.next_transaction ? new NextTransaction(subscription.next_transaction) : null;
this.recurringTransactionDetails = subscription.recurring_transaction_details
? new TransactionDetailsPreview(subscription.recurring_transaction_details)
: null;
}
}
1 change: 0 additions & 1 deletion src/entities/transaction/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export * from './transaction-adjustment-item';
export * from './transaction-adjustment';
export * from './adjustment-totals-breakdown';
export * from './adjustment-totals';
export * from './transaction-includes';
export * from './transaction';
export * from './transaction-collection';
export * from './transaction-invoice-pdf';
Expand Down
8 changes: 4 additions & 4 deletions src/entities/transaction/transaction-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* Changes may be overwritten as part of auto-generation.
*/

import { TransactionIncludes } from './transaction-includes';
import { type ITransactionResponse } from '../../types';
import { Collection } from '../../internal/base';
import { Transaction } from './transaction';

export class TransactionCollection extends Collection<ITransactionResponse, TransactionIncludes> {
override fromJson(data: ITransactionResponse): TransactionIncludes {
return new TransactionIncludes(data);
export class TransactionCollection extends Collection<ITransactionResponse, Transaction> {
override fromJson(data: ITransactionResponse): Transaction {
return new Transaction(data);
}
}
Loading

0 comments on commit d6e70dc

Please sign in to comment.