@knocklabs/node 0.4.14 → 0.4.15
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
|
import { ChannelData, CommonMetadata, SetChannelDataProperties, PaginatedResponse, ChannelType } from "../../common/interfaces";
|
|
2
2
|
import { Knock } from "../../knock";
|
|
3
|
-
import { BulkSetObjectOption, ListObjectOptions, Object, SetObjectProperties } from "./interfaces";
|
|
3
|
+
import { AddObjectSubscriptionProperties, BulkSetObjectOption, DeleteObjectSubscriptionProperties, ListObjectOptions, ListObjectSubscriptionsOptions, Object, ObjectSubscription, 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";
|
|
@@ -30,4 +30,7 @@ export declare class Objects {
|
|
|
30
30
|
setWorkflowPreferences(collection: string, objectId: string, workflowKey: string, setting: WorkflowPreferenceSetting, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
31
31
|
setCategoriesPreferences(collection: string, objectId: string, categoryPreferences: WorkflowPreferences, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
32
32
|
setCategoryPreferences(collection: string, objectId: string, categoryKey: string, setting: WorkflowPreferenceSetting, options?: PreferenceOptions): Promise<PreferenceSet>;
|
|
33
|
+
listSubscriptions(collection: string, objectId: string, options?: ListObjectSubscriptionsOptions): Promise<PaginatedResponse<ObjectSubscription>>;
|
|
34
|
+
addSubscriptions(collection: string, objectId: string, properties?: AddObjectSubscriptionProperties): Promise<ObjectSubscription[]>;
|
|
35
|
+
deleteSubscriptions(collection: string, objectId: string, properties?: DeleteObjectSubscriptionProperties): Promise<ObjectSubscription[]>;
|
|
33
36
|
}
|
|
@@ -160,5 +160,26 @@ class Objects {
|
|
|
160
160
|
return data;
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
+
//
|
|
164
|
+
// Subscriptions
|
|
165
|
+
//
|
|
166
|
+
listSubscriptions(collection, objectId, options = {}) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
const { data } = yield this.knock.get(`/v1/objects/${collection}/${objectId}/subscriptions`, options);
|
|
169
|
+
return data;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
addSubscriptions(collection, objectId, properties = { recipients: [] }) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
const { data } = yield this.knock.post(`/v1/objects/${collection}/${objectId}/subscriptions`, properties);
|
|
175
|
+
return data;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
deleteSubscriptions(collection, objectId, properties = { recipients: [] }) {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
const { data } = yield this.knock.delete(`/v1/objects/${collection}/${objectId}/subscriptions`, properties);
|
|
181
|
+
return data;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
163
184
|
}
|
|
164
185
|
exports.Objects = Objects;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CommonMetadata, PaginationOptions } from "../../common/interfaces";
|
|
2
|
+
import { User } from "../users/interfaces";
|
|
3
|
+
import { Recipient, RecipientWithUpsert } from "../workflows/interfaces";
|
|
2
4
|
export interface ObjectRef {
|
|
3
5
|
collection: string;
|
|
4
6
|
id: string;
|
|
@@ -23,3 +25,18 @@ export interface ListObjectOptions extends PaginationOptions {
|
|
|
23
25
|
object_id?: string;
|
|
24
26
|
name?: string;
|
|
25
27
|
}
|
|
28
|
+
export interface ListObjectSubscriptionsOptions extends PaginationOptions {
|
|
29
|
+
}
|
|
30
|
+
export interface ObjectSubscription<T = CommonMetadata> {
|
|
31
|
+
recipient: User | Object;
|
|
32
|
+
properties: T;
|
|
33
|
+
inserted_at: string;
|
|
34
|
+
updated_at: string;
|
|
35
|
+
}
|
|
36
|
+
export interface AddObjectSubscriptionProperties {
|
|
37
|
+
recipients: (Recipient | RecipientWithUpsert)[];
|
|
38
|
+
properties?: CommonMetadata;
|
|
39
|
+
}
|
|
40
|
+
export interface DeleteObjectSubscriptionProperties {
|
|
41
|
+
recipients: Recipient[];
|
|
42
|
+
}
|