teleflow 2.0.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.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +19 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +20 -0
- data/LICENSE.txt +21 -0
- data/README.md +952 -0
- data/Rakefile +13 -0
- data/lib/teleflow/api/blueprints.rb +29 -0
- data/lib/teleflow/api/changes.rb +58 -0
- data/lib/teleflow/api/connection.rb +62 -0
- data/lib/teleflow/api/environments.rb +91 -0
- data/lib/teleflow/api/events.rb +88 -0
- data/lib/teleflow/api/execution_details.rb +25 -0
- data/lib/teleflow/api/feeds.rb +44 -0
- data/lib/teleflow/api/inbound_parse.rb +17 -0
- data/lib/teleflow/api/integrations.rb +116 -0
- data/lib/teleflow/api/layouts.rb +106 -0
- data/lib/teleflow/api/messages.rb +40 -0
- data/lib/teleflow/api/notification.rb +63 -0
- data/lib/teleflow/api/notification_groups.rb +32 -0
- data/lib/teleflow/api/notification_templates.rb +125 -0
- data/lib/teleflow/api/organizations.rb +81 -0
- data/lib/teleflow/api/subscribers.rb +301 -0
- data/lib/teleflow/api/tenants.rb +82 -0
- data/lib/teleflow/api/topics.rb +115 -0
- data/lib/teleflow/client.rb +97 -0
- data/lib/teleflow/version.rb +5 -0
- data/lib/teleflow.rb +13 -0
- data/sig/teleflow.rbs +4 -0
- data/techstack.md +125 -0
- data/techstack.yml +152 -0
- metadata +140 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Teleflow
|
4
|
+
class Api
|
5
|
+
# Module Teleflow::Api::Messages provides an API for managing messages in the Teleflow application.
|
6
|
+
#
|
7
|
+
# This module includes methods for retrieving, and deleting messages.
|
8
|
+
#
|
9
|
+
# For more information on the Teleflow API(https://api-teleflow.khulnasoft.com/api#/Messages), see https://docs.teleflow.khulnasoft.com/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 Teleflow 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 Teleflow
|
4
|
+
class Api
|
5
|
+
# Module Teleflow::Api::Notification provides an API for managing Notification in the Teleflow application.
|
6
|
+
#
|
7
|
+
# This module includes methods for retrieving notifications, notifications stats and notifications graph stats.
|
8
|
+
#
|
9
|
+
# For more information on the Teleflow API(https://api-teleflow.khulnasoft.com/api#/Notification), see https://docs.teleflow.khulnasoft.com/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 Teleflow
|
4
|
+
class Api
|
5
|
+
# Module Teleflow::Api::NotificationGroups provides an API for managing notification groups in the Teleflow application.
|
6
|
+
#
|
7
|
+
# This module includes methods for creating, retrieving notification groups.
|
8
|
+
#
|
9
|
+
# For more information on the Teleflow API(https://api-teleflow.khulnasoft.com/api#/Notification%20groups), see https://docs.teleflow.khulnasoft.com/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 Teleflow
|
4
|
+
class Api
|
5
|
+
# Module Teleflow::Api::NotificationTemplates provides an API for managing notification templates in the Teleflow 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 Teleflow API(https://api-teleflow.khulnasoft.com/api#/Notification%20templates), see https://docs.teleflow.khulnasoft.com/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
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Teleflow
|
4
|
+
class Api
|
5
|
+
# Module Teleflow::Api::Organizations provides an API for managing Organization within your Teleflow account.
|
6
|
+
#
|
7
|
+
# This module includes methods for creating, retrieving, updating and deleting organization.
|
8
|
+
#
|
9
|
+
# For more information on the Teleflow API see https://api-teleflow.khulnasoft.com/api#/Organizations, https://docs.teleflow.khulnasoft.com/api-reference/organizations/create-organization.
|
10
|
+
module Organizations
|
11
|
+
# Create an organization
|
12
|
+
#
|
13
|
+
# @bodyparams:
|
14
|
+
# @param `logo` [String] - A valid image URL with one of the following extensions: jpg, jpeg, png, gif, svg.
|
15
|
+
# @param `name` [String] - A human-readable name of the organization.
|
16
|
+
#
|
17
|
+
# @return [Hash] data - The list of information with respect to the created organization.
|
18
|
+
# @return [number] status - The status code. Returns 200 if the organization has been successfully created.
|
19
|
+
def create_organization(body)
|
20
|
+
post("/organizations", body: body)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get all organizations
|
24
|
+
#
|
25
|
+
# @return [Hash] data - The list of organizations already created.
|
26
|
+
# @return [number] status - Returns 200 if successful
|
27
|
+
def organizations()
|
28
|
+
get("/organizations")
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get details of the current organization
|
32
|
+
#
|
33
|
+
# @return [Hash] data - The details of the current organization.
|
34
|
+
# @return [number] status - Returns 200 if successful
|
35
|
+
def current_organization()
|
36
|
+
get("/organizations/me")
|
37
|
+
end
|
38
|
+
|
39
|
+
# Get all members of the current organization
|
40
|
+
#
|
41
|
+
# @return [Hash] data - The list of all members of the current organization.
|
42
|
+
# @return [number] status - Returns 200 if successful
|
43
|
+
def current_organization_members()
|
44
|
+
get("/organizations/members")
|
45
|
+
end
|
46
|
+
|
47
|
+
# Rename organization name
|
48
|
+
#
|
49
|
+
# @return [Hash] data - The list of updated details of the organization.
|
50
|
+
# @return [number] status - Returns 200 if successful
|
51
|
+
def rename_organization(body)
|
52
|
+
patch("/organizations", body: body)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Update organization branding details
|
56
|
+
#
|
57
|
+
# @bodyparams:
|
58
|
+
# @param `logo` [String] - A valid image URL with one of the following extensions: jpg, jpeg, png, gif, svg.
|
59
|
+
# @param `color` [String] - The hexadecimal color style of the organization.
|
60
|
+
# @param `contentBackground` [String] - The hexadecimal content background style of the organization.
|
61
|
+
# @param `fontColor` [String] - The hexadecimal font color style of the organization.
|
62
|
+
# @param `fontFamily` [String(optional)] - The font family style of the organization.
|
63
|
+
#
|
64
|
+
# @return [Hash] data - The list of branding details of the organization.
|
65
|
+
# @return [number] status - Returns 200 if successful
|
66
|
+
def organization_branding(body)
|
67
|
+
put("/organizations/branding", body: body)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Remove a member from organization
|
71
|
+
#
|
72
|
+
# @pathparams
|
73
|
+
# @param `member_id` [String]
|
74
|
+
#
|
75
|
+
# @return [number] status - The status code. Returns 200 if memeber was removed successfully by their id.
|
76
|
+
def delete_organization_member(member_id)
|
77
|
+
delete("/organizations/members/#{member_id}")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,301 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Teleflow
|
4
|
+
class Api
|
5
|
+
# Module Teleflow::Api::Subscribers provides an API for managing subscribers in the Teleflow application.
|
6
|
+
#
|
7
|
+
# This module includes methods for creating, retrieving, updating, and deleting subscribers.
|
8
|
+
# It also includes methods for updating subscriber credentials, online status, preferences etc.
|
9
|
+
#
|
10
|
+
# For more information on the Teleflow API(https://api-teleflow.khulnasoft.com/api#/Subscribers), see https://docs.teleflow.khulnasoft.com/api/get-subscribers/.
|
11
|
+
module Subscribers
|
12
|
+
# Returns a list of subscribers, could paginated using the `page` query parameter
|
13
|
+
#
|
14
|
+
# @queryparams:
|
15
|
+
# @param `page` [Integer(optional)] Number of page for the pagination. The page to fetch, defaults to 0.
|
16
|
+
#
|
17
|
+
# @return [Hash] The list of subscribers that match the criteria of the query params are successfully returned.
|
18
|
+
# @return [number] status
|
19
|
+
# - Returns 200 if successful
|
20
|
+
def subscribers(query = {})
|
21
|
+
get("/subscribers", query: query)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Creates a subscriber entity, in the Teleflow platform.
|
25
|
+
# The subscriber will be later used to receive notifications, and access notification feeds.
|
26
|
+
# Communication credentials such as email, phone number, and 3 rd party credentials
|
27
|
+
# i.e slack tokens could be later associated to this entity.
|
28
|
+
#
|
29
|
+
# @bodyparams:
|
30
|
+
# @param `subscriberId` [String] The internal identifier you used to create this subscriber, usually correlates to the id the user in your systems.
|
31
|
+
# @param `email` [String(optional)]
|
32
|
+
# @param `firstName` [String(optional)]
|
33
|
+
# @param `lastName` [String(optional)]
|
34
|
+
# @param `phone` [String(optional)]
|
35
|
+
# @param `avatar` [String(optional)] An http url to the profile image of your subscriber
|
36
|
+
# @param `locale` [String(optional)]
|
37
|
+
# @param `data` [Hash(optional)]
|
38
|
+
#
|
39
|
+
# @return [Hash] The hash of subscriber data is successfully returned.
|
40
|
+
# @return [number] status - The status code. Returns 201 if the susbscriber has been successfully created.
|
41
|
+
def create_subscriber(body)
|
42
|
+
post("/subscribers", body: body)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Retrieves the subscriber with the given ID.
|
46
|
+
#
|
47
|
+
# @pathparams
|
48
|
+
# @param `subscriber_id` [String] The ID of the subscriber to retrieve.
|
49
|
+
#
|
50
|
+
# @return [Hash] The retrieved subscriber.
|
51
|
+
# @return [number] status
|
52
|
+
# - Returns 200 if the subscriber with the subscriber_id provided exists in the database.
|
53
|
+
def subscriber(subscriber_id)
|
54
|
+
get("/subscribers/#{subscriber_id}")
|
55
|
+
end
|
56
|
+
|
57
|
+
# Used to update the subscriber entity with new information
|
58
|
+
#
|
59
|
+
# @pathparams:
|
60
|
+
# @param `subscriber_id` [String] The ID of the subscriber to update.
|
61
|
+
#
|
62
|
+
# @bodyparams
|
63
|
+
# @param `email` [String(optional)]
|
64
|
+
# @param `firstName` [String(optional)]
|
65
|
+
# @param `lastName` [String(optional)]
|
66
|
+
# @param `phone` [String(optional)]
|
67
|
+
# @param `avatar` [String(optional)]
|
68
|
+
# @param `locale` [String(optional)]
|
69
|
+
# @param `data` [String(optional)]
|
70
|
+
#
|
71
|
+
# @return [Hash] The updated subscriber entity.
|
72
|
+
# @return [number] status
|
73
|
+
# - Returns 200 if the subscriber with the subscriber_id provided has been updated correctly.
|
74
|
+
def update_subscriber(subscriber_id, body)
|
75
|
+
put("/subscribers/#{subscriber_id}", body: body)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Deletes a subscriber entity from the Teleflow platform
|
79
|
+
#
|
80
|
+
# @pathparams:
|
81
|
+
# @param `subscriber_id` [String] The ID of the subscriber to delete.
|
82
|
+
#
|
83
|
+
# @return [Hash] Hash of acknowledged and status.
|
84
|
+
# @return [number] status
|
85
|
+
# - Returns 200 if the subscriber has been deleted correctly.
|
86
|
+
def delete_subscriber(subscriber_id)
|
87
|
+
delete("/subscribers/#{subscriber_id}")
|
88
|
+
end
|
89
|
+
|
90
|
+
# Update subscriber credentials from the Teleflow platform. Subscriber credentials associated to the delivery methods such as slack and push tokens.
|
91
|
+
#
|
92
|
+
# @pathparams:
|
93
|
+
# @param `subscriber_id` [String] The ID of the subscriber to update credentials.
|
94
|
+
#
|
95
|
+
# @bodyparams:
|
96
|
+
# @param `providerId` [String] The provider identifier for the credentials
|
97
|
+
# @param `credentials` [Hash] Credentials payload for the specified provider
|
98
|
+
#
|
99
|
+
# @return [Hash] Hash of updated subscriber credentials entity
|
100
|
+
# @return [number] status
|
101
|
+
# - Returns 200 if the subscriber credentials has been updated correctly.
|
102
|
+
def update_subscriber_credentials(subscriber_id, body)
|
103
|
+
put("/subscribers/#{subscriber_id}/credentials", body: body)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Delete subscriber credentials by providerId
|
107
|
+
# Delete subscriber credentials such as slack and expo tokens.
|
108
|
+
#
|
109
|
+
# @pathParams:
|
110
|
+
# @param `subscriberId` [String] The ID of the subscriber to update credentials.
|
111
|
+
# @param `providerId` [String] The provider identifier for the credentials
|
112
|
+
#
|
113
|
+
# @return [number] status
|
114
|
+
# - Returns 204 if the subscriber credentials has been deleted successfully.
|
115
|
+
def delete_subscriber_credentials(subscriberId, providerId)
|
116
|
+
delete("/subscribers/#{subscriberId}/credentials/#{providerId}")
|
117
|
+
end
|
118
|
+
|
119
|
+
# Used to update the subscriber isOnline flag.
|
120
|
+
#
|
121
|
+
# @pathparams:
|
122
|
+
# @param `subscriber_id` [String] The ID of the subscriber to update online status.
|
123
|
+
#
|
124
|
+
# @bodyparams:
|
125
|
+
# @param `isOnline` [Boolean]
|
126
|
+
#
|
127
|
+
# @return [Hash] The updated subscriber entity.
|
128
|
+
# @return [number] status
|
129
|
+
# - Returns 200 if the subscriber online status has been updated correctly.
|
130
|
+
def update_subscriber_online_status(subscriber_id, body)
|
131
|
+
patch("/subscribers/#{subscriber_id}/online-status", body: body)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Used to get the subscriber preference
|
135
|
+
#
|
136
|
+
# @pathparams:
|
137
|
+
# @param `subscriber_id` [String] The ID of the subscriber.
|
138
|
+
#
|
139
|
+
# @return [Hash] Hash of template and preference.
|
140
|
+
# @return [number] status
|
141
|
+
# - Returns 200 if the subscriber preference has been retrieved successfully.
|
142
|
+
def subscriber_preferences(subscriber_id)
|
143
|
+
get("/subscribers/#{subscriber_id}/preferences")
|
144
|
+
end
|
145
|
+
|
146
|
+
# Used to update the subscriber preference
|
147
|
+
#
|
148
|
+
# @pathparams:
|
149
|
+
# @param `subscriber_id` [String] The ID of the subscriber to update preference.
|
150
|
+
# @param `template_id` [String] The ID of the template to update preference.
|
151
|
+
#
|
152
|
+
# @bodyparams:
|
153
|
+
# @param `channel` [Hash(optional)] The subscriber preferences for every ChannelTypeEnum for the notification template assigned.
|
154
|
+
# @param `enabled` [Boolean(optional)] Sets if the notification template is fully enabled for all channels or not for the subscriber.
|
155
|
+
#
|
156
|
+
# @return [Hash] Hash of template and preference.
|
157
|
+
# @return [number] status
|
158
|
+
# - Returns 200 if the subscriber preference has been updated correctly.
|
159
|
+
def update_subscriber_preference(subscriber_id, template_id, body)
|
160
|
+
patch("/subscribers/#{subscriber_id}/preferences/#{template_id}", body: body)
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns a notification feed for a particular subscriber
|
164
|
+
#
|
165
|
+
# @pathparams
|
166
|
+
# @param `subscriber_id` [String]
|
167
|
+
#
|
168
|
+
# @queryparams:
|
169
|
+
# @param `page` [Integer(optional)] Number of page for the pagination.
|
170
|
+
# @param `feedIdentifier` [String]
|
171
|
+
# @param `seen` [Boolean(optional)]
|
172
|
+
#
|
173
|
+
# @return [Hash] List of notification feed of a subscriber that match the criteria of the query params are successfully returned.
|
174
|
+
# @return [number] status
|
175
|
+
# - Returns 200 if successful
|
176
|
+
def subscriber_notification_feed(subscriber_id, query = {})
|
177
|
+
get("/subscribers/#{subscriber_id}/notifications/feed", query: query)
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the unseen notification count for subscribers feed
|
181
|
+
#
|
182
|
+
# @pathparams
|
183
|
+
# @param `subscriber_id` [String]
|
184
|
+
#
|
185
|
+
# @queryparams:
|
186
|
+
# @param `seen` [Boolean]
|
187
|
+
#
|
188
|
+
# @return [Hash] the unseen notification count
|
189
|
+
# @return [number] status
|
190
|
+
# - Returns 200 if successful
|
191
|
+
def subscriber_unseen_notification_count(subscriber_id, query = {})
|
192
|
+
get("/subscribers/#{subscriber_id}/notifications/unseen", query: query)
|
193
|
+
end
|
194
|
+
|
195
|
+
# Mark a subscriber feed message as seen
|
196
|
+
#
|
197
|
+
# @pathparams
|
198
|
+
# @param `subscriber_id` [String]
|
199
|
+
#
|
200
|
+
# @bodyparams:
|
201
|
+
# @param `messageId` [Hash]
|
202
|
+
# @param `mark` [Hash]
|
203
|
+
#
|
204
|
+
# @return [Hash] the unseen notification count
|
205
|
+
# @return [number] status
|
206
|
+
# - Returns 201 if successful
|
207
|
+
def mark_subscriber_feed_seen(subscriber_id, body)
|
208
|
+
post("/subscribers/#{subscriber_id}/messages/markAs", body: body)
|
209
|
+
end
|
210
|
+
|
211
|
+
# Mark message action as seen
|
212
|
+
#
|
213
|
+
# @pathparams
|
214
|
+
# @param `message_id` [String]
|
215
|
+
# @param `type` [String]
|
216
|
+
# @param `subscriber_id` [String]
|
217
|
+
#
|
218
|
+
# @return [Hash] the unseen notification count
|
219
|
+
# @return [number] status
|
220
|
+
# - Returns 201 if successful
|
221
|
+
def mark_message_action_seen(subscriber_id, message_id, type)
|
222
|
+
post("/subscribers/#{subscriber_id}/messages/#{message_id}/actions/#{type}")
|
223
|
+
end
|
224
|
+
|
225
|
+
# Using this endpoint you can create multiple subscribers at once, to avoid multiple calls to the API.
|
226
|
+
# The bulk API is limited to 500 subscribers per request.
|
227
|
+
#
|
228
|
+
# @bodyparams:
|
229
|
+
# @param `subscribers` [Array[subscriber]]
|
230
|
+
# @subscriber : subscriber structure
|
231
|
+
# @param `firstName` [Stringoptional)] The first name of the subscriber.
|
232
|
+
# @param `lastName` [Stringoptional)] The last name of the subscriber.
|
233
|
+
# @param `email` [Stringoptional)] The email of the subscriber.
|
234
|
+
# @param `data` [Hash(optional)] The data object is used to pass additional custom information that could be used to identify the subscriber.
|
235
|
+
# @param `phone` [Hash(optional)] This phone of the subscriber.
|
236
|
+
# @param `locale` [String(optional)] The location of the subscriber.
|
237
|
+
# @param `subscriberId` [String] A unique identifier for the subscriber, usually correlates to the id the user in your systems.
|
238
|
+
# @param `avatar` [String(optional)] An http url to the profile image of your subscriber
|
239
|
+
#
|
240
|
+
# @return data [Hash]
|
241
|
+
# - updated [Array] - If the subscriber was updated
|
242
|
+
# - created [Array] - Array of objects for the subsribers ID created
|
243
|
+
# - failed [Array] - In case of an error, this field will contain the error message
|
244
|
+
#
|
245
|
+
# @return [number] status - The status code. Returns 201 if the subscribers were created successfully.
|
246
|
+
def bulk_create_subscribers(body)
|
247
|
+
post("/subscribers/bulk", body: body.to_json, headers: {'Content-Type': 'application/json'})
|
248
|
+
end
|
249
|
+
# Marks all the subscriber messages as read, unread, seen or unseen.
|
250
|
+
#
|
251
|
+
# @pathparams
|
252
|
+
# @param `subscriber_id` [String]
|
253
|
+
#
|
254
|
+
# @bodyParams:
|
255
|
+
# @param `markAs` [String] The type of action to perform either read, unread, seen or unseen.
|
256
|
+
# @param `feedIdentifier` [String|Array(Optional)] The feed id (or array) to mark messages of a particular feed.
|
257
|
+
#
|
258
|
+
# @return [number] status
|
259
|
+
# - Returns 201 if successful
|
260
|
+
def mark_all_subscriber_messages(subscriber_id, body)
|
261
|
+
post("/subscribers/#{subscriber_id}/messages/mark-all", body: body)
|
262
|
+
end
|
263
|
+
|
264
|
+
# Handle providers OAUTH redirect
|
265
|
+
#
|
266
|
+
# @pathparams:
|
267
|
+
# @param `subscriberId` [String]
|
268
|
+
# @param `providerId` [String]
|
269
|
+
#
|
270
|
+
# @queryparams:
|
271
|
+
# @param `code` [String]
|
272
|
+
# @param `hmacHash` [String]
|
273
|
+
# @param `environmentId` [String]
|
274
|
+
# @param `integrationIdentifier` [String]
|
275
|
+
#
|
276
|
+
# @return [Hash] The list of changes that match the criteria of the query params are successfully returned.
|
277
|
+
# @return [number] status
|
278
|
+
# - Returns 200 if successful
|
279
|
+
def provider_oauth_redirect(subscriberId, providerId, query = {})
|
280
|
+
get("/subscribers/#{subscriberId}/credentials/#{providerId}/oauth/callback", query: query)
|
281
|
+
end
|
282
|
+
|
283
|
+
# Handle chat OAUTH
|
284
|
+
#
|
285
|
+
# @pathparams:
|
286
|
+
# @param `subscriberId` [String]
|
287
|
+
# @param `providerId` [String]
|
288
|
+
#
|
289
|
+
# @queryparams:
|
290
|
+
# @param `hmacHash` [String]
|
291
|
+
# @param `environmentId` [String]
|
292
|
+
# @param `integrationIdentifier` [String]
|
293
|
+
#
|
294
|
+
# @return [number] status
|
295
|
+
# - Returns 200 if successful
|
296
|
+
def chat_oauth(subscriberId, providerId, query = {})
|
297
|
+
get("/subscribers/#{subscriberId}/credentials/#{providerId}/oauth", query: query)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|