@knocklabs/node 0.4.12 → 0.4.14

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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knocklabs/node",
3
- "version": "0.4.12",
3
+ "version": "0.4.14",
4
4
  "description": "Library for interacting with the Knock API",
5
5
  "homepage": "https://github.com/knocklabs/knock-node",
6
6
  "author": "@knocklabs",
@@ -1,5 +1,5 @@
1
1
  import { PaginatedResponse, PaginationOptions } from "../../common/interfaces";
2
- import { Message, MessageContent, MessageEvent, ListMessagesOptions, MessageEngagementStatus } from "./interfaces";
2
+ import { Message, MessageContent, MessageEvent, ListMessageActivitiesOptions, ListMessagesOptions, MessageEngagementStatus } from "./interfaces";
3
3
  import { Activity } from "../activities/interfaces";
4
4
  import { Knock } from "../../knock";
5
5
  export declare class Messages {
@@ -9,7 +9,7 @@ export declare class Messages {
9
9
  get(messageId: string): Promise<Message>;
10
10
  getContent(messageId: string): Promise<MessageContent>;
11
11
  getEvents(messageId: string, paginationOptions?: PaginationOptions): Promise<PaginatedResponse<MessageEvent>>;
12
- getActivities(messageId: string, paginationOptions?: PaginationOptions): Promise<PaginatedResponse<Activity>>;
12
+ getActivities(messageId: string, filteringOptions?: ListMessageActivitiesOptions): Promise<PaginatedResponse<Activity>>;
13
13
  setStatus(messageId: string, status: MessageEngagementStatus): Promise<Message>;
14
14
  deleteStatus(messageId: string, status: MessageEngagementStatus): Promise<Message>;
15
15
  batchSetStatus(messageIds: string[], status: MessageEngagementStatus | "unseen" | "unread" | "unarchived"): Promise<Message[]>;
@@ -47,12 +47,12 @@ class Messages {
47
47
  return data;
48
48
  });
49
49
  }
50
- getActivities(messageId, paginationOptions = {}) {
50
+ getActivities(messageId, filteringOptions = {}) {
51
51
  return __awaiter(this, void 0, void 0, function* () {
52
52
  if (!messageId) {
53
53
  throw new Error(`Incomplete arguments. You must provide a 'messageId'`);
54
54
  }
55
- const { data } = yield this.knock.get(`/v1/messages/${messageId}/activities`, paginationOptions);
55
+ const { data } = yield this.knock.get(`/v1/messages/${messageId}/activities`, filteringOptions);
56
56
  return data;
57
57
  });
58
58
  }
@@ -34,6 +34,10 @@ export interface ListMessagesOptions extends PaginationOptions {
34
34
  tenant?: string;
35
35
  status?: MessageStatus[];
36
36
  channel_id?: string;
37
+ trigger_data?: Record<string, any>;
38
+ }
39
+ export interface ListMessageActivitiesOptions extends PaginationOptions {
40
+ trigger_data?: Record<string, any>;
37
41
  }
38
42
  declare type WorkflowSource = {
39
43
  version_id: string;
@@ -1,6 +1,6 @@
1
1
  import { ChannelData, CommonMetadata, SetChannelDataProperties, PaginatedResponse, ChannelType } from "../../common/interfaces";
2
2
  import { Knock } from "../../knock";
3
- import { BulkSetObjectOption, Object, SetObjectProperties } from "./interfaces";
3
+ import { BulkSetObjectOption, ListObjectOptions, Object, SetObjectProperties } from "./interfaces";
4
4
  import { BulkOperation } from "../bulk_operations/interfaces";
5
5
  import { ListMessagesOptions, Message } from "../messages/interfaces";
6
6
  import { ChannelTypePreferences, PreferenceOptions, PreferenceSet, SetPreferencesProperties, WorkflowPreferences, WorkflowPreferenceSetting } from "../preferences/interfaces";
@@ -9,6 +9,7 @@ export declare class Objects {
9
9
  constructor(knock: Knock);
10
10
  get<T = CommonMetadata>(collection: string, id: string): Promise<Object<T>>;
11
11
  set<T = CommonMetadata>(collection: string, id: string, properties: SetObjectProperties): Promise<Object<T>>;
12
+ list<T = CommonMetadata>(collection: string, filteringOptions?: ListObjectOptions): Promise<PaginatedResponse<Object<T>>>;
12
13
  bulkSet(collection: string, objects: BulkSetObjectOption[]): Promise<BulkOperation>;
13
14
  delete(collection: string, id: string): Promise<null>;
14
15
  bulkDelete(collection: string, objectIds: string[]): Promise<BulkOperation>;
@@ -27,6 +27,12 @@ class Objects {
27
27
  return data;
28
28
  });
29
29
  }
30
+ list(collection, filteringOptions = {}) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const { data } = yield this.knock.get(`/v1/objects/${collection}`, filteringOptions);
33
+ return data;
34
+ });
35
+ }
30
36
  bulkSet(collection, objects) {
31
37
  return __awaiter(this, void 0, void 0, function* () {
32
38
  const attrs = { objects };
@@ -1,4 +1,4 @@
1
- import { CommonMetadata } from "../../common/interfaces";
1
+ import { CommonMetadata, PaginationOptions } from "../../common/interfaces";
2
2
  export interface ObjectRef {
3
3
  collection: string;
4
4
  id: string;
@@ -19,3 +19,7 @@ export interface BulkSetObjectOption {
19
19
  name?: string;
20
20
  [key: string]: any;
21
21
  }
22
+ export interface ListObjectOptions extends PaginationOptions {
23
+ object_id?: string;
24
+ name?: string;
25
+ }
@@ -3,13 +3,14 @@ import { BulkOperation } from "../bulk_operations/interfaces";
3
3
  import { ChannelTypePreferences, PreferenceOptions, PreferenceSet, SetPreferencesProperties, WorkflowPreferences, WorkflowPreferenceSetting } from "../preferences/interfaces";
4
4
  import { ListMessagesOptions, Message } from "../messages/interfaces";
5
5
  import { Knock } from "../../knock";
6
- import { BulkIdentifyUser, IdentifyProperties, User, UserFeedOptions } from "./interfaces";
6
+ import { BulkIdentifyUser, IdentifyProperties, ListUserOptions, User, UserFeedOptions } from "./interfaces";
7
7
  export declare class Users {
8
8
  readonly knock: Knock;
9
9
  constructor(knock: Knock);
10
10
  identify(userId: string, properties?: IdentifyProperties): Promise<User>;
11
11
  bulkIdentify(users: BulkIdentifyUser[]): Promise<BulkOperation>;
12
12
  get(userId: string): Promise<User>;
13
+ list(filteringOptions?: ListUserOptions): Promise<PaginatedResponse<User>>;
13
14
  delete(userId: string): Promise<null>;
14
15
  bulkDelete(userIds: string[]): Promise<BulkOperation>;
15
16
  merge(toUserId: string, fromUserId: string): Promise<User>;
@@ -43,6 +43,12 @@ class Users {
43
43
  return data;
44
44
  });
45
45
  }
46
+ list(filteringOptions = {}) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const { data } = yield this.knock.get(`/v1/users`, filteringOptions);
49
+ return data;
50
+ });
51
+ }
46
52
  delete(userId) {
47
53
  return __awaiter(this, void 0, void 0, function* () {
48
54
  if (!userId) {
@@ -23,4 +23,10 @@ export interface UserFeedOptions extends PaginationOptions {
23
23
  has_tenant?: boolean;
24
24
  archived?: "include" | "exclude" | "only";
25
25
  status?: "unread" | "unseen" | "all";
26
+ trigger_data?: Record<string, any>;
27
+ }
28
+ export interface ListUserOptions extends PaginationOptions {
29
+ name?: string;
30
+ email?: string;
31
+ user_id?: string;
26
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knocklabs/node",
3
- "version": "0.4.12",
3
+ "version": "0.4.14",
4
4
  "description": "Library for interacting with the Knock API",
5
5
  "homepage": "https://github.com/knocklabs/knock-node",
6
6
  "author": "@knocklabs",