attlaz-client 1.18.1 → 1.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
2
  import { Subscriber } from '../Model/Messaging/Subscriber.js';
3
3
  import { CollectionResult } from '../Model/Result/CollectionResult.js';
4
+ import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
4
5
  export declare class SubscriberEndpoint extends Endpoint {
5
- getSubscribersByFlow(flowId: string, projectEnvironmentId?: string | null): Promise<CollectionResult<Subscriber>>;
6
- getSubscribersByChannel(channelId: string): Promise<CollectionResult<Subscriber>>;
6
+ getSubscribersByFlow(flowId: string, projectEnvironmentId?: string | null, pagination?: CursorPagination | null): Promise<CollectionResult<Subscriber>>;
7
+ getSubscribersByChannel(channelId: string, pagination?: CursorPagination | null): Promise<CollectionResult<Subscriber>>;
7
8
  save(subscriber: Subscriber): Promise<Subscriber>;
8
9
  }
@@ -1,17 +1,20 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
2
  import { Subscriber } from '../Model/Messaging/Subscriber.js';
3
- import { Utils } from '../Utils.js';
3
+ import { QueryString } from '../Http/Data/QueryString.js';
4
4
  export class SubscriberEndpoint extends Endpoint {
5
- async getSubscribersByFlow(flowId, projectEnvironmentId = null) {
6
- let parameters = null;
7
- if (!Utils.isNullOrUndefined(projectEnvironmentId)) {
8
- parameters = { environment: projectEnvironmentId };
5
+ async getSubscribersByFlow(flowId, projectEnvironmentId = null, pagination = null) {
6
+ const qu = new QueryString('/flows/' + flowId + '/subscribers');
7
+ if (projectEnvironmentId !== null && projectEnvironmentId !== undefined) {
8
+ qu.set('environment', projectEnvironmentId);
9
9
  }
10
- const result = await this.requestCollection('/flows/' + flowId + '/subscribers', Subscriber.parseRaw, parameters);
10
+ qu.addPagination(pagination);
11
+ const result = await this.requestCollection(qu, Subscriber.parseRaw);
11
12
  return result;
12
13
  }
13
- async getSubscribersByChannel(channelId) {
14
- const result = await this.requestCollection('/channels/' + channelId + '/subscribers', Subscriber.parseRaw);
14
+ async getSubscribersByChannel(channelId, pagination = null) {
15
+ const qu = new QueryString('/channels/' + channelId + '/subscribers');
16
+ qu.addPagination(pagination);
17
+ const result = await this.requestCollection(qu, Subscriber.parseRaw);
15
18
  return result;
16
19
  }
17
20
  async save(subscriber) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.18.1",
3
+ "version": "1.18.2",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",