Skip to content

Commit 122dcc7

Browse files
authored
feat(NotificationSetting): Add trafficSource field (#56)
1 parent 662553d commit 122dcc7

File tree

10 files changed

+29
-4
lines changed

10 files changed

+29
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a
1212

1313
This means when upgrading minor versions of the SDK, you may notice type errors. You can safely ignore these or fix by adding additional type guards.
1414

15+
## 1.9.0 - 2024-10-15
16+
17+
### Added
18+
19+
- Added the `trafficSource` filter on notification settings
20+
1521
## 1.8.0 - 2024-10-08
1622

1723
### 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": "1.8.0",
3+
"version": "1.9.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/cjs/index.js",
66
"module": "./dist/esm/index.js",

src/__tests__/mocks/resources/notification-settings.mock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const UpdateNotificationSettingsMock: UpdateNotificationSettingsRequestBo
2222
apiVersion: 10,
2323
includeSensitiveFields: true,
2424
subscribedEvents: ['address.updated'],
25+
trafficSource: 'platform',
2526
};
2627

2728
export const CreateNotificationSettingsExpectation = {
@@ -38,6 +39,7 @@ export const UpdateNotificationSettingsExpectation = {
3839
api_version: 10,
3940
include_sensitive_fields: true,
4041
subscribed_events: ['address.updated'],
42+
traffic_source: 'platform',
4143
};
4244

4345
export const NotificationSettingsMock: INotificationSettingsResponse = {

src/entities/notification-settings/notification-settings.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Do not make changes to this file.
44
* Changes may be overwritten as part of auto-generation.
55
*/
6-
import { type NotificationSettingsType } from '../../enums';
6+
import { type TrafficSource, type NotificationSettingsType } from '../../enums';
77
import { EventType } from '../event-types';
88
import { type INotificationSettingsResponse } from '../../types/notification-settings';
99

@@ -15,6 +15,7 @@ export class NotificationSettings {
1515
public readonly active: boolean;
1616
public readonly apiVersion: number;
1717
public readonly includeSensitiveFields: boolean;
18+
public readonly trafficSource: TrafficSource;
1819
public readonly subscribedEvents: EventType[];
1920
public readonly endpointSecretKey: string;
2021

@@ -26,6 +27,7 @@ export class NotificationSettings {
2627
this.active = notificationSettings.active;
2728
this.apiVersion = notificationSettings.api_version;
2829
this.includeSensitiveFields = notificationSettings.include_sensitive_fields;
30+
this.trafficSource = notificationSettings.traffic_source;
2931
this.subscribedEvents = notificationSettings.subscribed_events.map(
3032
(subscribed_event) => new EventType(subscribed_event),
3133
);

src/enums/notification-settings/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
*/
66

77
export * from './notification-settings-type';
8+
export * from './traffic-source';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* ! Autogenerated code !
3+
* Do not make changes to this file.
4+
* Changes may be overwritten as part of auto-generation.
5+
*/
6+
7+
export type TrafficSource = 'platform' | 'simulation' | 'all';

src/resources/notification-settings/operations/create-notification-settings-request-body.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Do not make changes to this file.
44
* Changes may be overwritten as part of auto-generation.
55
*/
6-
import { type NotificationSettingsType } from '../../../enums';
6+
import { type TrafficSource, type NotificationSettingsType } from '../../../enums';
77
import { type IEventName } from '../../../notifications';
88

99
export interface CreateNotificationSettingsRequestBody {
@@ -13,4 +13,5 @@ export interface CreateNotificationSettingsRequestBody {
1313
type: NotificationSettingsType;
1414
apiVersion?: number | null;
1515
includeSensitiveFields?: boolean | null;
16+
trafficSource?: TrafficSource | null;
1617
}

src/resources/notification-settings/operations/list-notification-settings-query-parameters.ts

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

7+
import { type TrafficSource } from '../../../enums';
8+
79
export interface ListNotificationSettingsQueryParameters {
810
after?: string;
911
perPage?: number;
1012
orderBy?: string;
1113
active?: boolean;
14+
trafficSource?: TrafficSource;
1215
}

src/resources/notification-settings/operations/update-notification-settings-request-body.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Do not make changes to this file.
44
* Changes may be overwritten as part of auto-generation.
55
*/
6+
import { type TrafficSource } from '../../../enums';
67
import { type IEventName } from '../../../notifications';
78

89
export interface UpdateNotificationSettingsRequestBody {
@@ -12,4 +13,5 @@ export interface UpdateNotificationSettingsRequestBody {
1213
apiVersion?: number;
1314
includeSensitiveFields?: boolean;
1415
subscribedEvents?: IEventName[];
16+
trafficSource?: TrafficSource;
1517
}

src/types/notification-settings/notification-settings-response.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Do not make changes to this file.
44
* Changes may be overwritten as part of auto-generation.
55
*/
6-
import { type NotificationSettingsType } from '../../enums';
6+
import { type TrafficSource, type NotificationSettingsType } from '../../enums';
77
import { type IEventTypeResponse } from '../event-types';
88

99
export interface INotificationSettingsResponse {
@@ -14,6 +14,7 @@ export interface INotificationSettingsResponse {
1414
active: boolean;
1515
api_version: number;
1616
include_sensitive_fields: boolean;
17+
traffic_source: TrafficSource;
1718
subscribed_events: IEventTypeResponse[];
1819
endpoint_secret_key: string;
1920
}

0 commit comments

Comments
 (0)