@knocklabs/node 0.4.4 → 0.4.7
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 +1 -1
- package/dist/src/common/interfaces.d.ts +5 -1
- package/dist/src/resources/messages/index.d.ts +5 -2
- package/dist/src/resources/messages/index.js +26 -0
- package/dist/src/resources/messages/interfaces.d.ts +1 -0
- package/dist/src/resources/objects/index.d.ts +4 -0
- package/dist/src/resources/objects/index.js +8 -0
- package/dist/src/resources/users/index.d.ts +6 -2
- package/dist/src/resources/users/index.js +8 -0
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -28,10 +28,14 @@ declare type PageInfo = {
|
|
|
28
28
|
after: string;
|
|
29
29
|
page_size: number;
|
|
30
30
|
};
|
|
31
|
-
export interface
|
|
31
|
+
export interface PaginatedFeedResponse<T> {
|
|
32
32
|
entries: T[];
|
|
33
33
|
page_info: PageInfo;
|
|
34
34
|
}
|
|
35
|
+
export interface PaginatedResponse<T> {
|
|
36
|
+
items: T[];
|
|
37
|
+
page_info: PageInfo;
|
|
38
|
+
}
|
|
35
39
|
export interface PaginationOptions {
|
|
36
40
|
page_size?: number;
|
|
37
41
|
after?: string;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { PaginatedResponse, PaginationOptions } from "../../common/interfaces";
|
|
2
|
-
import { Message, MessageContent, MessageEvent, ListMessagesOptions } from "./interfaces";
|
|
2
|
+
import { Message, MessageContent, MessageEvent, ListMessagesOptions, MessageEngagementStatus } from "./interfaces";
|
|
3
3
|
import { Activity } from "../activities/interfaces";
|
|
4
4
|
import { Knock } from "../../knock";
|
|
5
5
|
export declare class Messages {
|
|
6
6
|
readonly knock: Knock;
|
|
7
7
|
constructor(knock: Knock);
|
|
8
|
-
list(filteringOptions?: ListMessagesOptions): Promise<Message
|
|
8
|
+
list(filteringOptions?: ListMessagesOptions): Promise<PaginatedResponse<Message>>;
|
|
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
12
|
getActivities(messageId: string, paginationOptions?: PaginationOptions): Promise<PaginatedResponse<Activity>>;
|
|
13
|
+
setStatus(messageId: string, status: MessageEngagementStatus): Promise<Message>;
|
|
14
|
+
deleteStatus(messageId: string, status: MessageEngagementStatus): Promise<Message>;
|
|
15
|
+
batchSetStatus(messageIds: string[], status: MessageEngagementStatus | "unseen" | "unread" | "unarchived"): Promise<Message[]>;
|
|
13
16
|
}
|
|
@@ -56,5 +56,31 @@ class Messages {
|
|
|
56
56
|
return data;
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
+
setStatus(messageId, status) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
if (!messageId) {
|
|
62
|
+
throw new Error(`Incomplete arguments. You must provide a 'messageId'`);
|
|
63
|
+
}
|
|
64
|
+
const { data } = yield this.knock.put(`/v1/messages/${messageId}/${status}`, {});
|
|
65
|
+
return data;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
deleteStatus(messageId, status) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
if (!messageId) {
|
|
71
|
+
throw new Error(`Incomplete arguments. You must provide a 'messageId'`);
|
|
72
|
+
}
|
|
73
|
+
const { data } = yield this.knock.delete(`/v1/messages/${messageId}/${status}`);
|
|
74
|
+
return data;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
batchSetStatus(messageIds, status) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const { data } = yield this.knock.post(`/v1/messages/batch/${status}`, {
|
|
80
|
+
message_ids: messageIds,
|
|
81
|
+
});
|
|
82
|
+
return data;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
59
85
|
}
|
|
60
86
|
exports.Messages = Messages;
|
|
@@ -17,7 +17,11 @@ export declare class Objects {
|
|
|
17
17
|
unsetChannelData(collection: string, id: string, channelId: string): Promise<any>;
|
|
18
18
|
getMessages(collection: string, objectId: string, filteringOptions?: ListMessagesOptions): Promise<PaginatedResponse<Message>>;
|
|
19
19
|
getAllPreferences(collection: string, objectId: string): Promise<PreferenceSet[]>;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use `objects.getPreferences` instead
|
|
22
|
+
*/
|
|
20
23
|
getPrefences(collection: string, objectId: string, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
24
|
+
getPreferences(collection: string, objectId: string, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
21
25
|
setPreferences(collection: string, objectId: string, preferenceSet: SetPreferencesProperties, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
22
26
|
setChannelTypesPreferences(collection: string, objectId: string, channelTypePreferences: ChannelTypePreferences, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
23
27
|
setChannelTypePreferences(collection: string, objectId: string, channelType: ChannelType, setting: boolean, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
@@ -90,7 +90,15 @@ class Objects {
|
|
|
90
90
|
return data;
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated Use `objects.getPreferences` instead
|
|
95
|
+
*/
|
|
93
96
|
getPrefences(collection, objectId, options = {}) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
return this.getPreferences(collection, objectId, options);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
getPreferences(collection, objectId, options = {}) {
|
|
94
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
103
|
const preferenceSetId = options.preferenceSet || helpers_1.DEFAULT_PREFERENCE_SET_ID;
|
|
96
104
|
const { data } = yield this.knock.get(`/v1/objects/${collection}/${objectId}/preferences/${preferenceSetId}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChannelData, ChannelType, CommonMetadata, PaginatedResponse } from "../../common/interfaces";
|
|
1
|
+
import { ChannelData, ChannelType, CommonMetadata, PaginatedFeedResponse, PaginatedResponse } from "../../common/interfaces";
|
|
2
2
|
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";
|
|
@@ -13,9 +13,13 @@ export declare class Users {
|
|
|
13
13
|
delete(userId: string): Promise<null>;
|
|
14
14
|
bulkDelete(userIds: string[]): Promise<BulkOperation>;
|
|
15
15
|
merge(toUserId: string, fromUserId: string): Promise<User>;
|
|
16
|
-
getFeed(userId: string, channelId: string, feedOptions?: UserFeedOptions): Promise<any
|
|
16
|
+
getFeed(userId: string, channelId: string, feedOptions?: UserFeedOptions): Promise<PaginatedFeedResponse<any>>;
|
|
17
17
|
getAllPreferences(userId: string): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use `users.getPreferences` instead
|
|
20
|
+
*/
|
|
18
21
|
getPrefences(userId: string, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
22
|
+
getPreferences(userId: string, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
19
23
|
setPreferences(userId: string, preferenceSet: SetPreferencesProperties, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
20
24
|
bulkSetPreferences(userIds: string[], preferenceSet: SetPreferencesProperties, options?: PreferenceOptions): Promise<BulkOperation>;
|
|
21
25
|
setChannelTypesPreferences(userId: string, channelTypePreferences: ChannelTypePreferences, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
@@ -88,7 +88,15 @@ class Users {
|
|
|
88
88
|
return data;
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated Use `users.getPreferences` instead
|
|
93
|
+
*/
|
|
91
94
|
getPrefences(userId, options = {}) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
return this.getPreferences(userId, options);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
getPreferences(userId, options = {}) {
|
|
92
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
101
|
const preferenceSetId = options.preferenceSet || helpers_1.DEFAULT_PREFERENCE_SET_ID;
|
|
94
102
|
const { data } = yield this.knock.get(`/v1/users/${userId}/preferences/${preferenceSetId}`);
|