Skip to content

Commit

Permalink
feat(kno-4286): bulk add subscriptions method (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
bceskavich committed Sep 11, 2023
1 parent 2eebe42 commit 237e77e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/knock/objects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,23 @@ def add_subscriptions(collection:, id:, recipients: [], properties: {})
execute_request(request: request)
end

# Creates a bulk operation to create subscriptions for a set recipients to
# a set of objects within the given collection.
#
# @param [String] collection The collection the objects are in.
# @param [Array<Hash>] subscriptions The set of subscriptions to create.
#
# @return [Hash] a BulkOperation
def bulk_add_subscriptions(collection:, subscriptions: [])
request = post_request(
auth: true,
path: "/v1/objects/#{collection}/bulk/subscriptions/add",
body: { subscriptions: subscriptions }
)

execute_request(request: request)
end

# Removes subscriptions for the recipients on the object
#
# @param [String] collection The collection the object is in
Expand Down

0 comments on commit 237e77e

Please sign in to comment.