Skip to content

Commit

Permalink
Revert "fix(node): add includeInactiveChannels option in sdk method (#…
Browse files Browse the repository at this point in the history
…7115)"

This reverts commit 4a715e4.
  • Loading branch information
SokratisVidros authored Nov 29, 2024
1 parent 4a715e4 commit 4dd144d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 37 deletions.
24 changes: 2 additions & 22 deletions packages/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,22 +337,12 @@ await novu.subscribers.updateOnlineStatus('subscriberId', false);

- #### Get subscriber preference for all workflows

This method returns subscriber preference for all workflows with inactive channels by default. To get subscriber preference for all workflows without inactive (means only active) channels, pass `false` as second argument.

```ts
import { Novu } from '@novu/node';

const novu = new Novu('<NOVU_SECRET_KEY>');

// return subscriber preference for all workflows without inactive channels
await novu.subscribers.getPreference('subscriberId', {
includeInactiveChannels: false,
});

// return subscriber preference for all workflows with inactive channels
await novu.subscribers.getPreference('subscriberId', {
includeInactiveChannels: true,
});
await novu.subscribers.getPreference('subscriberId');
```

- #### Get subscriber global preference
Expand Down Expand Up @@ -766,23 +756,13 @@ await novu.messages.list(params);
- #### Delete a message by `messageId`

```ts
import { Novu } from '@novu/node';
import { Novu, ChannelTypeEnum } from '@novu/node';

const novu = new Novu('<NOVU_SECRET_KEY>');

await novu.messages.deleteById('messageId');
```

- #### Delete multiple messages by `transactionId`

```ts
import { Novu } from '@novu/node';

const novu = new Novu('<NOVU_SECRET_KEY>');

await novu.messages.deleteByTransactionId('transactionId');
```

### Layouts

- #### Create a layout
Expand Down
5 changes: 1 addition & 4 deletions packages/node/src/lib/subscribers/subscriber.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ export interface ISubscribers {
*/
unsetCredentials(subscriberId: string, providerId: string);
updateOnlineStatus(subscriberId: string, online: boolean);
getPreference(
subscriberId: string,
{ includeInactiveChannels }: { includeInactiveChannels: boolean },
);
getPreference(subscriberId: string);
getGlobalPreference(subscriberId: string);
getPreferenceByLevel(subscriberId: string, level: PreferenceLevelEnum);
updatePreference(
Expand Down
6 changes: 2 additions & 4 deletions packages/node/src/lib/subscribers/subscribers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,11 @@ describe('test use of novus node package - Subscribers class', () => {
test('should get subscriber preference', async () => {
mockedAxios.get.mockResolvedValue({});

await novu.subscribers.getPreference('test-subscriber-preference', {
includeInactiveChannels: true,
});
await novu.subscribers.getPreference('test-subscriber-preference');

expect(mockedAxios.get).toHaveBeenCalled();
expect(mockedAxios.get).toHaveBeenCalledWith(
'/subscribers/test-subscriber-preference/preferences?includeInactiveChannels=true',
'/subscribers/test-subscriber-preference/preferences',
);
});

Expand Down
9 changes: 2 additions & 7 deletions packages/node/src/lib/subscribers/subscribers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,8 @@ export class Subscribers extends WithHttp implements ISubscribers {
return await this.http.delete(`/subscribers/${subscriberId}`);
}

async getPreference(
subscriberId: string,
{ includeInactiveChannels = true }: { includeInactiveChannels: boolean },
) {
return await this.http.get(
`/subscribers/${subscriberId}/preferences?includeInactiveChannels=${includeInactiveChannels}`,
);
async getPreference(subscriberId: string) {
return await this.http.get(`/subscribers/${subscriberId}/preferences`);
}

async getGlobalPreference(subscriberId: string) {
Expand Down

0 comments on commit 4dd144d

Please sign in to comment.