@knocklabs/node 0.4.20 → 0.4.22

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.20",
3
+ "version": "0.4.22",
4
4
  "description": "Library for interacting with the Knock API",
5
5
  "homepage": "https://github.com/knocklabs/knock-node",
6
6
  "author": "@knocklabs",
@@ -30,6 +30,7 @@ declare type PageInfo = {
30
30
  before: string;
31
31
  after: string;
32
32
  page_size: number;
33
+ total_count: number;
33
34
  };
34
35
  export interface PaginatedEntriesResponse<T> {
35
36
  entries: T[];
@@ -32,6 +32,7 @@ export declare class Objects {
32
32
  setCategoriesPreferences(collection: string, objectId: string, categoryPreferences: WorkflowPreferences, options?: PreferenceOptions): Promise<PreferenceSet>;
33
33
  setCategoryPreferences(collection: string, objectId: string, categoryKey: string, setting: WorkflowPreferenceSetting, options?: PreferenceOptions): Promise<PreferenceSet>;
34
34
  listSubscriptions(collection: string, objectId: string, options?: ListObjectSubscriptionsOptions): Promise<PaginatedEntriesResponse<ObjectSubscription>>;
35
+ getSubscriptions(collection: string, objectId: string, options?: ListObjectSubscriptionsOptions): Promise<PaginatedEntriesResponse<ObjectSubscription>>;
35
36
  addSubscriptions(collection: string, objectId: string, properties?: AddObjectSubscriptionProperties): Promise<ObjectSubscription[]>;
36
37
  deleteSubscriptions(collection: string, objectId: string, properties?: DeleteObjectSubscriptionProperties): Promise<ObjectSubscription[]>;
37
38
  getSchedules(collection: string, objectId: string, filteringOptions?: ListSchedulesProps): Promise<PaginatedEntriesResponse<Schedule>>;
@@ -169,6 +169,12 @@ class Objects {
169
169
  return data;
170
170
  });
171
171
  }
172
+ getSubscriptions(collection, objectId, options = {}) {
173
+ return __awaiter(this, void 0, void 0, function* () {
174
+ const { data } = yield this.knock.get(`/v1/objects/${collection}/${objectId}/subscriptions`, Object.assign(Object.assign({}, options), { mode: "recipient" }));
175
+ return data;
176
+ });
177
+ }
172
178
  addSubscriptions(collection, objectId, properties = { recipients: [] }) {
173
179
  return __awaiter(this, void 0, void 0, function* () {
174
180
  const { data } = yield this.knock.post(`/v1/objects/${collection}/${objectId}/subscriptions`, properties);
@@ -29,6 +29,7 @@ export interface ListObjectSubscriptionsOptions extends PaginationOptions {
29
29
  }
30
30
  export interface ObjectSubscription<T = CommonMetadata> {
31
31
  recipient: User | Object;
32
+ object: Object;
32
33
  properties: T;
33
34
  inserted_at: string;
34
35
  updated_at: string;
@@ -35,4 +35,5 @@ export declare class Users {
35
35
  unsetChannelData(userId: string, channelId: string): Promise<any>;
36
36
  getMessages(userId: string, filteringOptions?: ListMessagesOptions): Promise<PaginatedItemsResponse<Message>>;
37
37
  getSchedules(userId: string, filteringOptions?: ListSchedulesProps): Promise<PaginatedEntriesResponse<Schedule>>;
38
+ getSubscriptions(userId: string, filteringOptions?: ListSchedulesProps): Promise<PaginatedEntriesResponse<Schedule>>;
38
39
  }
@@ -224,5 +224,17 @@ class Users {
224
224
  return data;
225
225
  });
226
226
  }
227
+ //
228
+ // Subscriptions
229
+ //
230
+ getSubscriptions(userId, filteringOptions = {}) {
231
+ return __awaiter(this, void 0, void 0, function* () {
232
+ if (!userId) {
233
+ throw new Error(`Incomplete arguments. You must provide a 'userId'`);
234
+ }
235
+ const { data } = yield this.knock.get(`/v1/users/${userId}/subscriptions`, filteringOptions);
236
+ return data;
237
+ });
238
+ }
227
239
  }
228
240
  exports.Users = Users;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knocklabs/node",
3
- "version": "0.4.20",
3
+ "version": "0.4.22",
4
4
  "description": "Library for interacting with the Knock API",
5
5
  "homepage": "https://github.com/knocklabs/knock-node",
6
6
  "author": "@knocklabs",