Skip to content

Commit

Permalink
feat(NotificationSetting): Add trafficSource field (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
danbillson authored Oct 15, 2024
1 parent 662553d commit 122dcc7
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a

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.

## 1.9.0 - 2024-10-15

### Added

- Added the `trafficSource` filter on notification settings

## 1.8.0 - 2024-10-08

### 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": "1.8.0",
"version": "1.9.0",
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/mocks/resources/notification-settings.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const UpdateNotificationSettingsMock: UpdateNotificationSettingsRequestBo
apiVersion: 10,
includeSensitiveFields: true,
subscribedEvents: ['address.updated'],
trafficSource: 'platform',
};

export const CreateNotificationSettingsExpectation = {
Expand All @@ -38,6 +39,7 @@ export const UpdateNotificationSettingsExpectation = {
api_version: 10,
include_sensitive_fields: true,
subscribed_events: ['address.updated'],
traffic_source: 'platform',
};

export const NotificationSettingsMock: INotificationSettingsResponse = {
Expand Down
4 changes: 3 additions & 1 deletion src/entities/notification-settings/notification-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Do not make changes to this file.
* Changes may be overwritten as part of auto-generation.
*/
import { type NotificationSettingsType } from '../../enums';
import { type TrafficSource, type NotificationSettingsType } from '../../enums';
import { EventType } from '../event-types';
import { type INotificationSettingsResponse } from '../../types/notification-settings';

Expand All @@ -15,6 +15,7 @@ export class NotificationSettings {
public readonly active: boolean;
public readonly apiVersion: number;
public readonly includeSensitiveFields: boolean;
public readonly trafficSource: TrafficSource;
public readonly subscribedEvents: EventType[];
public readonly endpointSecretKey: string;

Expand All @@ -26,6 +27,7 @@ export class NotificationSettings {
this.active = notificationSettings.active;
this.apiVersion = notificationSettings.api_version;
this.includeSensitiveFields = notificationSettings.include_sensitive_fields;
this.trafficSource = notificationSettings.traffic_source;
this.subscribedEvents = notificationSettings.subscribed_events.map(
(subscribed_event) => new EventType(subscribed_event),
);
Expand Down
1 change: 1 addition & 0 deletions src/enums/notification-settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*/

export * from './notification-settings-type';
export * from './traffic-source';
7 changes: 7 additions & 0 deletions src/enums/notification-settings/traffic-source.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* ! Autogenerated code !
* Do not make changes to this file.
* Changes may be overwritten as part of auto-generation.
*/

export type TrafficSource = 'platform' | 'simulation' | 'all';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Do not make changes to this file.
* Changes may be overwritten as part of auto-generation.
*/
import { type NotificationSettingsType } from '../../../enums';
import { type TrafficSource, type NotificationSettingsType } from '../../../enums';
import { type IEventName } from '../../../notifications';

export interface CreateNotificationSettingsRequestBody {
Expand All @@ -13,4 +13,5 @@ export interface CreateNotificationSettingsRequestBody {
type: NotificationSettingsType;
apiVersion?: number | null;
includeSensitiveFields?: boolean | null;
trafficSource?: TrafficSource | null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
* Changes may be overwritten as part of auto-generation.
*/

import { type TrafficSource } from '../../../enums';

export interface ListNotificationSettingsQueryParameters {
after?: string;
perPage?: number;
orderBy?: string;
active?: boolean;
trafficSource?: TrafficSource;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Do not make changes to this file.
* Changes may be overwritten as part of auto-generation.
*/
import { type TrafficSource } from '../../../enums';
import { type IEventName } from '../../../notifications';

export interface UpdateNotificationSettingsRequestBody {
Expand All @@ -12,4 +13,5 @@ export interface UpdateNotificationSettingsRequestBody {
apiVersion?: number;
includeSensitiveFields?: boolean;
subscribedEvents?: IEventName[];
trafficSource?: TrafficSource;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Do not make changes to this file.
* Changes may be overwritten as part of auto-generation.
*/
import { type NotificationSettingsType } from '../../enums';
import { type TrafficSource, type NotificationSettingsType } from '../../enums';
import { type IEventTypeResponse } from '../event-types';

export interface INotificationSettingsResponse {
Expand All @@ -14,6 +14,7 @@ export interface INotificationSettingsResponse {
active: boolean;
api_version: number;
include_sensitive_fields: boolean;
traffic_source: TrafficSource;
subscribed_events: IEventTypeResponse[];
endpoint_secret_key: string;
}

0 comments on commit 122dcc7

Please sign in to comment.