novu 0.1.0

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.
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::Events provides an API for managing events in the Novu application.
6
+ #
7
+ # This module includes methods for trigger, bulk trigger, broadcast and cancel events.
8
+ #
9
+ # For more information on the Novu API(https://api.novu.co/api#/Events), see https://docs.novu.co/api/trigger-event/.
10
+ module Events
11
+ # Trigger event is the main (and the only) way to send notification to subscribers.
12
+ # The trigger identifier is used to match the particular template associated with it.
13
+ # Additional information can be passed according the body interface below
14
+ #
15
+ # @bodyparams:
16
+ # @param `name` [String] The trigger identifier of the template you wish to send. This identifier can be found on the template page.
17
+ # @param `payload` [Hash] The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it. This data will also be available when fetching the notifications feed from the API to display certain parts of the UI.
18
+ # @param `overrides` [Hash(optional)] This could be used to override provider specific configurations.
19
+ # @param `to` [Hash] The recipients list of people who will receive the notification.
20
+ # @param `transactionId` [String(optional)] A unique identifier for this transaction, we will generated a UUID if not provided.
21
+ # @param `actor` [Hash(optional)] It is used to display the Avatar of the provided actor's subscriber id or actor object. If a new actor object is provided, we will create a new subscriber in our system
22
+ #
23
+ # @return [Hash]
24
+ # - acknowledged [Boolean] - If trigger was acknowledged or not
25
+ # - status [String] - Status for trigger
26
+ # - error [Array(optional)] - In case of an error, this field will contain the error message
27
+ # - transactionId [String(optional)] - Transaction id for trigger
28
+ # @return [number] status - The status code. Returns 201 if the event has been successfully triggered.
29
+ def trigger_event(body)
30
+ post("/events/trigger", body: body)
31
+ end
32
+
33
+ # Using this endpoint you can trigger multiple events at once, to avoid multiple calls to the API.
34
+ # The bulk API is limited to 100 events per request.
35
+ #
36
+ # @bodyparams:
37
+ # @param `events` [Array[event]]
38
+ # @event : event structure
39
+ # @param `name` [String] The trigger identifier of the template you wish to send. This identifier can be found on the template page.
40
+ # @param `payload` [Hash] The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it. This data will also be available when fetching the notifications feed from the API to display certain parts of the UI.
41
+ # @param `overrides` [Hash(optional)] This could be used to override provider specific configurations.
42
+ # @param `to` [Hash] The recipients list of people who will receive the notification.
43
+ # @param `transactionId` [String(optional)] A unique identifier for this transaction, we will generated a UUID if not provided.
44
+ # @param `actor` [Hash(optional)] It is used to display the Avatar of the provided actor's subscriber id or actor object. If a new actor object is provided, we will create a new subscriber in our system
45
+ #
46
+ # @return [Hash]
47
+ # - acknowledged [Boolean] - If trigger was acknowledged or not
48
+ # - status [String] - Status for trigger
49
+ # - error [Array(optional)] - In case of an error, this field will contain the error message
50
+ # - transactionId [String(optional)] - Transaction id for trigger
51
+ # @return [number] status - The status code. Returns 201 if the event has been successfully triggered.
52
+ def trigger_bulk_event(body)
53
+ post("/events/trigger/bulk", body: body)
54
+ end
55
+
56
+ # Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc.
57
+ # In the future could be used to trigger events to a subset of subscribers based on defined filters.
58
+ #
59
+ # @bodyparams:
60
+ # @param `name` [String] The trigger identifier associated for the template you wish to send. This identifier can be found on the template page.
61
+ # @param `payload` [Hash] The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it. This data will also be available when fetching the notifications feed from the API to display certain parts of the UI
62
+ # @param `overrides` [Hash(optional)] This could be used to override provider specific configurations.
63
+ # @param `transactionId` [String(optional)] A unique identifier for this transaction, we will generated a UUID if not provided.
64
+ # @param `actor` [Hash(optional)] It is used to display the Avatar of the provided actor's subscriber id or actor object. If a new actor object is provided, we will create a new subscriber in our system
65
+ #
66
+ # @return [Hash]
67
+ # - acknowledged [Boolean] - If trigger was acknowledged or not
68
+ # - status [String] - Status for trigger
69
+ # - error [Array(optional)] - In case of an error, this field will contain the error message
70
+ # - transactionId [String(optional)] - Transaction id for trigger
71
+ # @return [number] status - The status code. Returns 201 if the event has been successfully broadcast to all existing subscribers.
72
+ def broadcast_event(body)
73
+ post("/events/trigger/broadcast", body: body)
74
+ end
75
+
76
+ # Using a previously generated transactionId during the event trigger, will cancel any active or pending workflows.
77
+ # This is useful to cancel active digests, delays etc...
78
+ #
79
+ # @pathparams:
80
+ # @param `transactionId` [String] - transaction id of the event
81
+ #
82
+ # @return [number] status - The status code. Returns 200 if the event has been successfully cancelled.
83
+ def cancel_triggered_event(transaction_id)
84
+ delete("/events/trigger/#{transaction_id}")
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::ExecutionDetails provides an API for managing execution details in the Novu application.
6
+ #
7
+ # This module includes method for retrieving execution details.
8
+ #
9
+ # For more information on the Novu API(https://api.novu.co/api#/Execution%20Details), see https://docs.novu.co/api/get-execution-details/.
10
+ module ExecutionDetails
11
+ # Returns a list of execution details
12
+ #
13
+ # @queryparams:
14
+ # @param `notificationId` [String]
15
+ # @param `subscriberId` [String]
16
+ #
17
+ # @return [Hash] The list of execution details that match the criteria of the query params are successfully returned.
18
+ # @return [number] status
19
+ # - Returns 200 if successful
20
+ def execution_details(query = {})
21
+ get("/execution-details", query: query)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::Feeds provides an API for managing feeds in the Novu application.
6
+ #
7
+ # This module includes methods for creating, retrieving, and deleting feeds.
8
+ #
9
+ # For more information on the Novu API(https://api.novu.co/api#/Feeds), see https://docs.novu.co/api/create-feed/.
10
+ module Feeds
11
+ # Creates a new feed.
12
+ #
13
+ # @bodyparams:
14
+ # @param `name` [String]
15
+ #
16
+ # @return [Hash] Feed entity.
17
+ # @return [number] status - The status code. Returns 201 if the feed has been successfully created.
18
+ def create_feed(body)
19
+ post("/feeds", body: body)
20
+ end
21
+
22
+ # Returns a list of feeds
23
+ #
24
+ # @return [Hash] list of feeds
25
+ # @return [number] status
26
+ # - Returns 200 if successful
27
+ def feeds
28
+ get("/feeds")
29
+ end
30
+
31
+ # Execute a soft delete of a feed given a certain ID.
32
+ #
33
+ # @pathparams:
34
+ # @param `feed_id` [String] The ID of the feed to delete.
35
+ #
36
+ # @return [Hash] The retrieved feed.
37
+ # @return [number] status
38
+ # - Returns 204 if the feed has been deleted correctly.
39
+ def delete_feed(feed_id)
40
+ delete("/feeds/#{feed_id}")
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::InboundParse provides an API for managing inbound-parse in the Novu application.
6
+ #
7
+ # This module includes method for retrieving inbound-parse.
8
+ #
9
+ # For more information on the Novu API(https://api.novu.co/api#/inbound-parse), see https://docs.novu.co/api/overview/.
10
+ module InboundParse
11
+ # Validate the mx record setup for the inbound parse functionality
12
+ def validate_mx_record_setup_for_inbound_parse
13
+ get("/inbound-parse/mx/status")
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::Integrations provides an API for managing integrations in the Novu application.
6
+ #
7
+ # This module includes methods for creating, retrieving, updating, and deleting integrations.
8
+ # It also includes methods for retrieving channel limit, in-app status, webhook provider status.
9
+ #
10
+ # For more information on the Novu API(https://api.novu.co/api#/Integrations), see https://docs.novu.co/api/get-integrations/.
11
+ module Integrations
12
+ # Returns a list of integrations
13
+ #
14
+ # @return [Hash] The list of integrations.
15
+ # @return [number] status
16
+ # - Returns 200 if successful
17
+ def integrations
18
+ get("/integrations")
19
+ end
20
+
21
+ # Creates a new integration.
22
+ #
23
+ # @bodyparams:
24
+ # @param `providerId` [String]
25
+ # @param `channel` [String]
26
+ # @param `credentials` [Hash]
27
+ # @param `active` [Boolean]
28
+ # @param `check` [Boolean]
29
+ #
30
+ # @return [Hash] The created integration entity.
31
+ # @return [number] status - The status code. Returns 201 if the intgration has been successfully created.
32
+ def create_integration(body)
33
+ post("/integrations", body: body)
34
+ end
35
+
36
+ # Returns a list of active integrations
37
+ #
38
+ # @return [Hash] The list of active integrations.
39
+ # @return [number] status
40
+ # - Returns 200 if successful
41
+ def active_integrations
42
+ get("/integrations/active")
43
+ end
44
+
45
+ # Get webhook support status for provider
46
+ #
47
+ # @pathparams
48
+ # @param `provider_id` [String]
49
+ #
50
+ # @return [number] status
51
+ # - Returns 200 if successful
52
+ def webhook_provider_status(provider_id)
53
+ get("/integrations/webhook/provider/#{provider_id}/status")
54
+ end
55
+
56
+ # Update the credentials of a integration.
57
+ #
58
+ # @pathparams:
59
+ # @param `integration_id` [Integer] The ID of the integration to update.
60
+ #
61
+ # @bodyparams
62
+ # @param `active` [Boolean]
63
+ # @param `credentials` [Hash]
64
+ # @param `check` [Boolean]
65
+ #
66
+ # @return [Hash] The updated intgration.
67
+ # @return [number] status
68
+ # - Returns 200 if the integration with the integrationId provided has been updated correctly.
69
+ def update_integration(integration_id, body)
70
+ put("/integrations/#{integration_id}", body: body)
71
+ end
72
+
73
+ # Execute a soft delete of a integration given a certain ID.
74
+ #
75
+ # @pathparams:
76
+ # @param `integration_id` [Integer] The ID of the integration to delete.
77
+ #
78
+ # @return [Hash] The retrieved integration.
79
+ # @return [number] status
80
+ # - Returns 200 if the integration has been deleted correctly.
81
+ def delete_integration(integration_id)
82
+ delete("/integrations/#{integration_id}")
83
+ end
84
+
85
+ # Returns a channel limit
86
+ #
87
+ # @pathparams
88
+ # @param `channel_type` [String]
89
+ #
90
+ # @return [number] status
91
+ # - Returns 200 if successful
92
+ def channel_limit(channel_type)
93
+ get("/integrations/#{channel_type}/limit")
94
+ end
95
+
96
+ # Returns in-app status
97
+ #
98
+ # @return [number] status
99
+ # - Returns 200 if successful
100
+ def in_app_status
101
+ get("/integrations/in-app/status")
102
+ end
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::Layouts provides an API for managing layouts in the Novu application.
6
+ #
7
+ # This module includes methods for creating, retrieving, updating, and deleting layouts.
8
+ # It also includes methods for setting and getting the default layout.
9
+ #
10
+ # For more information on the Novu API(https://api.novu.co/api#/Layouts), see https://docs.novu.co/api/layout-creation/.
11
+ module Layouts
12
+ # Creates a new layout.
13
+ #
14
+ # @bodyparams:
15
+ # @param `name` [String] User defined custom name and provided by the user that will name the Layout created.
16
+ # @param `content` [String] User defined content for the layout.
17
+ # @param `description` [String(optional)] User description of the layout.
18
+ # @param `variables` [Array(optional)] User defined variables to render in the layout placeholders.
19
+ # @param `isDefault` [Boolean(optional)] User defined variables to render in the layout placeholders.
20
+ #
21
+ # @return [_id: "_id"] The created layout id.
22
+ # @return [number] status - The status code. Returns 201 if the layout has been successfully created.
23
+ def create_layout(body)
24
+ post("/layouts", body: body)
25
+ end
26
+
27
+ # Returns a list of layouts that can be paginated using the `page` query parameter and
28
+ # filtered by the environment where it is executed from the organization the user belongs to.
29
+ #
30
+ # @queryparams:
31
+ # @param `page` [Integer(optional)] Number of page for the pagination.
32
+ # @param `pageSize` [Integer(optional)] Size of page for the pagination.
33
+ # @param `sortBy` [String(optional)] Sort field. Currently only supported `createdAt`.
34
+ # @param `orderBy` [Integer(optional)] Direction of the sorting query param. Either ascending (1) or descending (-1).
35
+ #
36
+ # @return [Hash] The list of layouts that match the criteria of the query params are successfully returned.
37
+ # @return [number] status
38
+ # - Returns 200 if successful
39
+ # - Returns 400 if Page size can not be larger than the page size limit.
40
+ def layouts(query = {})
41
+ get("/layouts", query: query)
42
+ end
43
+
44
+ # Retrieves the layout with the given ID.
45
+ #
46
+ # @pathparams
47
+ # @param `layout_id` [Integer] The ID of the layout to retrieve.
48
+ #
49
+ # @return [Hash] The retrieved layout.
50
+ # @return [number] status
51
+ # - Returns 200 if the layout with the layoutId provided exists in the database.
52
+ # - Returns 404 The layout with the layoutId provided does not exist in the database.
53
+ def layout(layout_id)
54
+ get("/layouts/#{layout_id}")
55
+ end
56
+
57
+ # Execute a soft delete of a layout given a certain ID.
58
+ #
59
+ # @pathparams:
60
+ # @param `layout_id` [Integer] The ID of the layout to delete.
61
+ #
62
+ # @return [Hash] The retrieved layout.
63
+ # @return [number] status
64
+ # - Returns 204 if the layout has been deleted correctly.
65
+ # - Returns 404 if the layout with the layoutId provided does not exist in the database so it can not be deleted.
66
+ # - Returns 409 if either you are trying to delete a layout that is being used or a layout that is the default in the environment.
67
+ def delete_layout(layout_id)
68
+ delete("/layouts/#{layout_id}")
69
+ end
70
+
71
+ # Update the name, content and variables of a layout. Also change it to be default or no.
72
+ #
73
+ # @pathparams:
74
+ # @param `layout_id` [Integer] The ID of the layout to update.
75
+ #
76
+ # @bodyparams
77
+ # @param `name` [String(optional)] User defined custom name and provided by the user that will name the Layout updated.
78
+ # @param `description` [String(optional)] User defined description of the layout.
79
+ # @param `content` [String(optional)] User defined content for the layout.
80
+ # @param `variables` [Array(optional)] User defined variables to render in the layout placeholders.
81
+ # @param `isDefault` [Boolean(optional)] Variable that defines if the layout is chosen as default when creating a layout.
82
+ #
83
+ # @return [Hash] The updated layout.
84
+ # @return [number] status
85
+ # - Returns 200 if the layout with the layoutId provided has been updated correctly.
86
+ # - Returns 400 if the payload provided or the URL param are not right.
87
+ # - Returns 404 if the layout with the layoutId provided does not exist in the database so it can not be updated.
88
+ # - Returns 409 if one default layout is needed. If you are trying to turn a default layout as not default, you should turn a different layout as default first and automatically it will be done by the system.
89
+ def update_layout(layout_id, body)
90
+ patch("/layouts/#{layout_id}", body: body)
91
+ end
92
+
93
+ # Sets the default layout for the environment and updates to non default to the existing default layout (if any).
94
+ #
95
+ # @pathparams:
96
+ # @param `layout_id` [Integer] The ID of the layout to set the default.
97
+ #
98
+ # @return [number] status
99
+ # - Returns 204 if the selected layout has been set as the default for the environment.
100
+ # - Returns 404 if the layout with the layoutId provided does not exist in the database so it can not be set as the default for the environment.
101
+ def make_default_layout(layout_id)
102
+ post("/layouts/#{layout_id}/default")
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::Messages provides an API for managing messages in the Novu application.
6
+ #
7
+ # This module includes methods for retrieving, and deleting messages.
8
+ #
9
+ # For more information on the Novu API(https://api.novu.co/api#/Messages), see https://docs.novu.co/api/get-messages/.
10
+ module Messages
11
+ # Returns a list of messages that can be paginated using the `page` query parameter and
12
+ # filtered by the environment where it is executed from the organization the user belongs to.
13
+ #
14
+ # @queryparams:
15
+ # @param `page` [Integer(optional)] Number of page for the pagination. The page to fetch, defaults to 0.
16
+ # @param `limit` [Integer(optional)] The number of messages to fetch, defaults to 10.
17
+ # @param `channel` [String(optional)] The channel for the messages you wish to list.
18
+ # @param `subscriberId` [String(optional)] The subscriberId for the subscriber you like to list messages for.
19
+ #
20
+ # @return [Hash] The list of messages that match the criteria of the query params are successfully returned.
21
+ # @return [number] status
22
+ # - Returns 200 if successful
23
+ def messages(query = {})
24
+ get("/messages", query: query)
25
+ end
26
+
27
+ # Deletes a message entity from the Novu platform
28
+ #
29
+ # @pathparams:
30
+ # @param `message_id` [String] The ID of the message to delete.
31
+ #
32
+ # @return [Hash] of acknowledged and status.
33
+ # @return [number] status
34
+ # - Returns 200 if the message has been deleted correctly.
35
+ def delete_message(message_id)
36
+ delete("/messages/#{message_id}")
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::Notification provides an API for managing Notification in the Novu application.
6
+ #
7
+ # This module includes methods for retrieving notifications, notifications stats and notifications graph stats.
8
+ #
9
+ # For more information on the Novu API(https://api.novu.co/api#/Notification), see https://docs.novu.co/api/.
10
+ module Notification
11
+ # Returns a list of notifications that can be paginated using the `page` query parameter and
12
+ # filtered by the environment where it is executed from the organization the user belongs to.
13
+ #
14
+ # @queryparams:
15
+ # @param `channels` [Array[String]] Available values : in_app, email, sms, chat, push
16
+ # @param `templates` [Array[String]]
17
+ # @param `emails` [Array[String]]
18
+ # @param `search` [String(optional)]
19
+ # @param `transactionId` [String(optional)]
20
+ # @param `page` [Integer(optional)] Number of page for the pagination. Default value is 0
21
+ #
22
+ # @return [Hash] The list of notification that match the criteria of the query params are successfully returned.
23
+ # @return [number] status
24
+ # - Returns 200 if successful.
25
+ def notifications(query = {})
26
+ get("/notifications", query: query)
27
+ end
28
+
29
+ # Returns a list of notifications stats
30
+ #
31
+ # @return [Hash] notification stats.
32
+ # @return [number] status
33
+ # - Returns 200 if successful.
34
+ def notifications_stats
35
+ get("/notifications/stats")
36
+ end
37
+
38
+ # Returns a list of notifications stats
39
+ #
40
+ # @queryparams:
41
+ # @param `days` [Integer]
42
+ #
43
+ # @return [Hash] notification graph stats.
44
+ # @return [number] status
45
+ # - Returns 200 if successful.
46
+ def notifications_graph_stats(query = {})
47
+ get("/notifications/graph/stats", query: query)
48
+ end
49
+
50
+ # Returns a notification
51
+ #
52
+ # @pathparams:
53
+ # @param `notification_id` [String]
54
+ #
55
+ # @return [Hash] notification entity
56
+ # @return [number] status
57
+ # - Returns 200 if successful.
58
+ def notification(notification_id)
59
+ get("/notifications/#{notification_id}")
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::NotificationGroups provides an API for managing notification groups in the Novu application.
6
+ #
7
+ # This module includes methods for creating, retrieving notification groups.
8
+ #
9
+ # For more information on the Novu API(https://api.novu.co/api#/Notification%20groups), see https://docs.novu.co/api/create-notification-group/.
10
+ module NotificationGroups
11
+ # Creates a notification group.
12
+ #
13
+ # @bodyparams:
14
+ # @param `name` [String] User defined custom name and provided by the user that will name the notification group created.
15
+ #
16
+ # @return [Hash] The created notification group entity.
17
+ # @return [number] status - The status code. Returns 201 if the notification group has been successfully created.
18
+ def create_notification_group(body)
19
+ post("/notification-groups", body: body)
20
+ end
21
+
22
+ # Returns a list of notification groups
23
+ #
24
+ # @return [Hash] list of notification groups.
25
+ # @return [number] status
26
+ # - Returns 200 if successful
27
+ def notification_groups
28
+ get("/notification-groups")
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,125 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Novu
4
+ class Api
5
+ # Module Novu::Api::NotificationTemplates provides an API for managing notification templates in the Novu application.
6
+ #
7
+ # This module includes methods for creating, retrieving, updating, and deleting notification templates.
8
+ # It also includes methods for creating and retrieving the notification blueprint.
9
+ #
10
+ # For more information on the Novu API(https://api.novu.co/api#/Notification%20templates), see https://docs.novu.co/api/get-notification-templates/.
11
+ module NotificationTemplates
12
+ # Returns a list of notification template that can be paginated using the `page` query parameter
13
+ #
14
+ # @queryparams:
15
+ # @param `page` [Integer(optional)] Number of page for the pagination.
16
+ # @param `limit` [Integer(optional)]
17
+ #
18
+ # @return [Hash] The list of notification templates that match the criteria of the query params are successfully returned.
19
+ # @return [number] status
20
+ # - Returns 200 if successful
21
+ def notification_templates(query = {})
22
+ get("/notification-templates", query: query)
23
+ end
24
+
25
+ # Creates a new notification template.
26
+ #
27
+ # @bodyparams:
28
+ # @param `name` [String]
29
+ # @param `notificationGroupId` [String]
30
+ # @param `tags` [Array(optional)]
31
+ # @param `description` [String(optional)]
32
+ # @param `steps` [Array]
33
+ # @param `active` [Boolean(optional)]
34
+ # @param `draft` [Boolean(optional)]
35
+ # @param `critical` [Boolean(optional)]
36
+ # @param `preferenceSettings` [Hash(optional)]
37
+ #
38
+ # @return [Hash] Notification template entity.
39
+ # @return [number] status - The status code. Returns 201 if the notification template has been successfully created.
40
+ def create_notification_template(body)
41
+ post("/notification-templates", body: body)
42
+ end
43
+
44
+ # Updates new notification template.
45
+ #
46
+ # @pathparams:
47
+ # @param `template_id` [String] The ID of the notification template to update.
48
+ #
49
+ # @bodyparams:
50
+ # @param `name` [String]
51
+ # @param `tags` [Array(optional)]
52
+ # @param `description` [String(optional)]
53
+ # @param `identifier` [String(optional)]
54
+ # @param `steps` [Array(optional)]
55
+ # @param `notificationGroupId` [String]
56
+ # @param `active` [Boolean(optional)]
57
+ # @param `critical` [Boolean(optional)]
58
+ # @param `preferenceSettings` [Hash(optional)]
59
+ #
60
+ # @return [Hash] Updated notification template entity.
61
+ # @return [number] status - The status code. Returns 200 if the notification template has been successfully updated.
62
+ def update_notification_template(template_id, body)
63
+ put("/notification-templates/#{template_id}", body: body)
64
+ end
65
+
66
+ # Execute a soft delete of a notification template given a certain ID.
67
+ #
68
+ # @pathparams:
69
+ # @param `template_id` [String] The ID of the template to delete.
70
+ #
71
+ # @return [number] status
72
+ # - Returns 200 if the notification template has been deleted correctly.
73
+ def delete_notification_template(template_id)
74
+ delete("/notification-templates/#{template_id}")
75
+ end
76
+
77
+ # Retrieves the notification template with the given ID.
78
+ #
79
+ # @pathparams
80
+ # @param `template_id` [String] The ID of the template to retrieve.
81
+ #
82
+ # @return [Hash] The retrieved template.
83
+ # @return [number] status
84
+ # - Returns 200 if the template with the template_id provided exists in the database.
85
+ def notification_template(template_id)
86
+ get("/notification-templates/#{template_id}")
87
+ end
88
+
89
+ # Retrieves the notification template blueprint with the given ID.
90
+ #
91
+ # @pathparams
92
+ # @param `template_id` [String] The ID of the template to retrieve.
93
+ #
94
+ # @return [Hash] The retrieved template blueprint.
95
+ # @return [number] status
96
+ # - Returns 200 if the template blueprint with the template_id provided exists in the database.
97
+ def notification_template_blueprint(template_id)
98
+ get("/notification-templates/#{template_id}/blueprint")
99
+ end
100
+
101
+ # Creates a new notification template blueprint.
102
+ #
103
+ # @return [Hash] Notification template blueprint entity.
104
+ # @return [number] status - The status code. Returns 201 if the notification template blueprint has been successfully created.
105
+ def create_notification_template_blueprint(template_id)
106
+ post("/notification-templates/#{template_id}/blueprint")
107
+ end
108
+
109
+ # Update notification template status
110
+ #
111
+ # @pathparams:
112
+ # @param `template_id` [String] The ID of the template to update.
113
+ #
114
+ # @bodyparams
115
+ # @param `active` [Boolean]
116
+ #
117
+ # @return [Hash] The updated notification template.
118
+ # @return [number] status
119
+ # - Returns 200 if the notification template with the template_id provided has been updated correctly.
120
+ def update_notification_template_status(template_id, body)
121
+ put("/notification-templates/#{template_id}/status", body: body)
122
+ end
123
+ end
124
+ end
125
+ end