Class: Notiflows::Resources::Topics::Subscriptions
- Inherits:
-
Object
- Object
- Notiflows::Resources::Topics::Subscriptions
- Defined in:
- lib/notiflows/resources/topics/subscriptions.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ Subscriptions
constructor
private
A new instance of Subscriptions.
-
#list(topic_id, after: nil, before: nil, created_after: nil, created_before: nil, limit: nil, request_options: {}) ⇒ Notiflows::Internal::CursorPage<Notiflows::Models::Users::Subscription>
Retrieve all users subscribed to a specific topic.
-
#subscribe_bulk(topic_id, user_external_ids:, request_options: {}) ⇒ Notiflows::Models::Topics::BulkOperationResponse
Subscribe multiple users to a topic in a single request.
-
#unsubscribe_bulk(topic_id, user_external_ids:, request_options: {}) ⇒ Notiflows::Models::Topics::BulkOperationResponse
Unsubscribe multiple users from a topic in a single request.
Constructor Details
#initialize(client:) ⇒ Subscriptions
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Subscriptions.
100 101 102 |
# File 'lib/notiflows/resources/topics/subscriptions.rb', line 100 def initialize(client:) @client = client end |
Instance Method Details
#list(topic_id, after: nil, before: nil, created_after: nil, created_before: nil, limit: nil, request_options: {}) ⇒ Notiflows::Internal::CursorPage<Notiflows::Models::Users::Subscription>
Retrieve all users subscribed to a specific topic.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/notiflows/resources/topics/subscriptions.rb', line 28 def list(topic_id, params = {}) parsed, = ::Notiflows::Topics::SubscriptionListParams.dump_request(params) @client.request( method: :get, path: ["topics/%1$s/subscriptions", topic_id], query: parsed, page: ::Notiflows::Internal::CursorPage, model: ::Notiflows::Users::Subscription, options: ) end |
#subscribe_bulk(topic_id, user_external_ids:, request_options: {}) ⇒ Notiflows::Models::Topics::BulkOperationResponse
Subscribe multiple users to a topic in a single request.
- Topics are created automatically if they don't exist.
- If a user is already subscribed, they are included in the
successfulresponse. - Returns
207 Multi-Statusif some subscriptions failed.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/notiflows/resources/topics/subscriptions.rb', line 58 def subscribe_bulk(topic_id, params) parsed, = ::Notiflows::Topics::SubscriptionSubscribeBulkParams.dump_request(params) @client.request( method: :post, path: ["topics/%1$s/subscriptions", topic_id], body: parsed, model: ::Notiflows::Topics::BulkOperationResponse, options: ) end |
#unsubscribe_bulk(topic_id, user_external_ids:, request_options: {}) ⇒ Notiflows::Models::Topics::BulkOperationResponse
Unsubscribe multiple users from a topic in a single request.
- Returns
207 Multi-Statusif some unsubscriptions failed (e.g., user not found). - Users not subscribed to the topic are included in the
failedresponse.
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/notiflows/resources/topics/subscriptions.rb', line 86 def unsubscribe_bulk(topic_id, params) parsed, = ::Notiflows::Topics::SubscriptionUnsubscribeBulkParams.dump_request(params) @client.request( method: :delete, path: ["topics/%1$s/subscriptions", topic_id], body: parsed, model: ::Notiflows::Topics::BulkOperationResponse, options: ) end |