@knocklabs/node 0.4.6 → 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 +4 -1
- package/dist/src/resources/messages/index.js +26 -0
- package/dist/src/resources/messages/interfaces.d.ts +1 -0
- package/dist/src/resources/users/index.d.ts +2 -2
- 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,5 +1,5 @@
|
|
|
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 {
|
|
@@ -10,4 +10,7 @@ export declare class Messages {
|
|
|
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;
|
|
@@ -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,7 +13,7 @@ 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
18
|
/**
|
|
19
19
|
* @deprecated Use `users.getPreferences` instead
|