Skip to content

Commit d362b5e

Browse files
authored
feat(kno-4303): bulk add subscriptions API support (#24)
1 parent 1e1615f commit d362b5e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

knockapi/resources/objects.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,22 @@ def add_subscriptions(self, collection, id, recipients, properties={}):
488488
endpoint = '/objects/{}/{}/subscriptions'.format(collection, id)
489489
return self.client.request('post', endpoint, payload={'recipients': recipients, 'properties': properties})
490490

491+
def bulk_add_subscriptions(self, collection, subscriptions):
492+
"""
493+
Creates a bulk operation to add subscriptions for a set recipients to a
494+
set of objects within the given collection.
495+
496+
Args:
497+
collection (str): The collection the objects belong to
498+
subscriptions(list): The set of subscriptions to create
499+
500+
Returns:
501+
dict: BulkOperation from Knock
502+
"""
503+
504+
endpoint = '/object/{}/bulk/subscriptions/add'.format(collection)
505+
return self.client.request('post', endpoint, payload={'subscriptions': subscriptions})
506+
491507
def delete_subscriptions(self, collection, id, recipients):
492508
"""
493509
Delete subscription to object for recipients

0 commit comments

Comments
 (0)