Module: Novu::Api::Topics
- Included in:
- Client
- Defined in:
- lib/novu/api/topics.rb
Overview
Module Novu::Api::Topics provides an API for managing topics in the Novu application.
This module includes methods for creating and retrieving and updating topic. It also includes methods for subscriber addition and removal.
For more information on the Novu API(api.novu.co/api#/Topics), see docs.novu.co/api/topic-creation/.
Instance Method Summary collapse
-
#add_subscribers(topic_key, body) ⇒ number
@bodyparams:.
-
#create_topic(body) ⇒ number
Create a topic.
-
#delete_topic(topic_key) ⇒ number
Delete topic Delete a topic by its topic key if it has no subscribers.
-
#remove_subscribers(topic_key, body) ⇒ number
@bodyparams:.
-
#rename_topic(topic_key, body) ⇒ Hash, number
Rename a topic by providing a new name.
-
#subscriber_topic(topic_key, externalSubscriberId) ⇒ number
Check topic subsriber Check if a subscriber belongs to a certain topic.
-
#topic(topic_key) ⇒ Hash, number
Get a topic by its topic key.
-
#topics(query = {}) ⇒ Hash, number
Returns a list of topics that can be paginated using the ‘page` query parameter and filtered by the topic key with the `key` query parameter.
Instance Method Details
#add_subscribers(topic_key, body) ⇒ number
@bodyparams:
47 48 49 |
# File 'lib/novu/api/topics.rb', line 47 def add_subscribers(topic_key, body) post("/topics/#{topic_key}/subscribers", body: body) end |
#create_topic(body) ⇒ number
Create a topic
@bodyparams:
19 20 21 |
# File 'lib/novu/api/topics.rb', line 19 def create_topic(body) post("/topics", body: body) end |
#delete_topic(topic_key) ⇒ number
Delete topic Delete a topic by its topic key if it has no subscribers
110 111 112 |
# File 'lib/novu/api/topics.rb', line 110 def delete_topic(topic_key) delete("/topics/#{topic_key}") end |
#remove_subscribers(topic_key, body) ⇒ number
@bodyparams:
60 61 62 |
# File 'lib/novu/api/topics.rb', line 60 def remove_subscribers(topic_key, body) post("/topics/#{topic_key}/subscribers/removal", body: body) end |
#rename_topic(topic_key, body) ⇒ Hash, number
Rename a topic by providing a new name
@bodyparams:
99 100 101 |
# File 'lib/novu/api/topics.rb', line 99 def rename_topic(topic_key, body) patch("/topics/#{topic_key}", body: body) end |
#subscriber_topic(topic_key, externalSubscriberId) ⇒ number
Check topic subsriber Check if a subscriber belongs to a certain topic
72 73 74 |
# File 'lib/novu/api/topics.rb', line 72 def subscriber_topic(topic_key, externalSubscriberId) get("/topics/#{topic_key}/subscribers/#{externalSubscriberId}") end |
#topic(topic_key) ⇒ Hash, number
Get a topic by its topic key
84 85 86 |
# File 'lib/novu/api/topics.rb', line 84 def topic(topic_key) get("/topics/#{topic_key}") end |
#topics(query = {}) ⇒ Hash, number
Returns a list of topics that can be paginated using the ‘page` query parameter and
filtered by the topic key with the `key` query parameter
@queryparams:
34 35 36 |
# File 'lib/novu/api/topics.rb', line 34 def topics(query = {}) get("/topics", query: query) end |