signalwire_agents 1.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.
- checksums.yaml +7 -0
- data/README.md +79 -0
- data/bin/swaig-test +310 -0
- data/lib/signalwire_agents/agent/agent_base.rb +1171 -0
- data/lib/signalwire_agents/contexts/context_builder.rb +622 -0
- data/lib/signalwire_agents/datamap/data_map.rb +279 -0
- data/lib/signalwire_agents/logging.rb +92 -0
- data/lib/signalwire_agents/prefabs/concierge.rb +92 -0
- data/lib/signalwire_agents/prefabs/faq_bot.rb +67 -0
- data/lib/signalwire_agents/prefabs/info_gatherer.rb +79 -0
- data/lib/signalwire_agents/prefabs/receptionist.rb +74 -0
- data/lib/signalwire_agents/prefabs/survey.rb +75 -0
- data/lib/signalwire_agents/relay/action.rb +291 -0
- data/lib/signalwire_agents/relay/call.rb +523 -0
- data/lib/signalwire_agents/relay/client.rb +671 -0
- data/lib/signalwire_agents/relay/constants.rb +124 -0
- data/lib/signalwire_agents/relay/message.rb +137 -0
- data/lib/signalwire_agents/relay/relay_event.rb +670 -0
- data/lib/signalwire_agents/rest/http_client.rb +147 -0
- data/lib/signalwire_agents/rest/namespaces/addresses.rb +19 -0
- data/lib/signalwire_agents/rest/namespaces/calling.rb +179 -0
- data/lib/signalwire_agents/rest/namespaces/chat.rb +18 -0
- data/lib/signalwire_agents/rest/namespaces/compat.rb +229 -0
- data/lib/signalwire_agents/rest/namespaces/datasphere.rb +39 -0
- data/lib/signalwire_agents/rest/namespaces/fabric.rb +175 -0
- data/lib/signalwire_agents/rest/namespaces/imported_numbers.rb +18 -0
- data/lib/signalwire_agents/rest/namespaces/logs.rb +46 -0
- data/lib/signalwire_agents/rest/namespaces/lookup.rb +18 -0
- data/lib/signalwire_agents/rest/namespaces/mfa.rb +26 -0
- data/lib/signalwire_agents/rest/namespaces/number_groups.rb +32 -0
- data/lib/signalwire_agents/rest/namespaces/phone_numbers.rb +20 -0
- data/lib/signalwire_agents/rest/namespaces/project.rb +33 -0
- data/lib/signalwire_agents/rest/namespaces/pubsub.rb +18 -0
- data/lib/signalwire_agents/rest/namespaces/queues.rb +28 -0
- data/lib/signalwire_agents/rest/namespaces/recordings.rb +18 -0
- data/lib/signalwire_agents/rest/namespaces/registry.rb +67 -0
- data/lib/signalwire_agents/rest/namespaces/short_codes.rb +26 -0
- data/lib/signalwire_agents/rest/namespaces/sip_profile.rb +22 -0
- data/lib/signalwire_agents/rest/namespaces/verified_callers.rb +24 -0
- data/lib/signalwire_agents/rest/namespaces/video.rb +129 -0
- data/lib/signalwire_agents/rest/signalwire_client.rb +110 -0
- data/lib/signalwire_agents/security/session_manager.rb +124 -0
- data/lib/signalwire_agents/server/agent_server.rb +260 -0
- data/lib/signalwire_agents/skills/builtin/api_ninjas_trivia.rb +91 -0
- data/lib/signalwire_agents/skills/builtin/claude_skills.rb +92 -0
- data/lib/signalwire_agents/skills/builtin/custom_skills.rb +54 -0
- data/lib/signalwire_agents/skills/builtin/datasphere.rb +141 -0
- data/lib/signalwire_agents/skills/builtin/datasphere_serverless.rb +107 -0
- data/lib/signalwire_agents/skills/builtin/datetime.rb +97 -0
- data/lib/signalwire_agents/skills/builtin/google_maps.rb +168 -0
- data/lib/signalwire_agents/skills/builtin/info_gatherer.rb +189 -0
- data/lib/signalwire_agents/skills/builtin/joke.rb +65 -0
- data/lib/signalwire_agents/skills/builtin/math.rb +176 -0
- data/lib/signalwire_agents/skills/builtin/mcp_gateway.rb +121 -0
- data/lib/signalwire_agents/skills/builtin/native_vector_search.rb +116 -0
- data/lib/signalwire_agents/skills/builtin/play_background_file.rb +86 -0
- data/lib/signalwire_agents/skills/builtin/spider.rb +142 -0
- data/lib/signalwire_agents/skills/builtin/swml_transfer.rb +118 -0
- data/lib/signalwire_agents/skills/builtin/weather_api.rb +85 -0
- data/lib/signalwire_agents/skills/builtin/web_search.rb +123 -0
- data/lib/signalwire_agents/skills/builtin/wikipedia_search.rb +109 -0
- data/lib/signalwire_agents/skills/skill_base.rb +58 -0
- data/lib/signalwire_agents/skills/skill_manager.rb +85 -0
- data/lib/signalwire_agents/skills/skill_registry.rb +76 -0
- data/lib/signalwire_agents/swaig/function_result.rb +777 -0
- data/lib/signalwire_agents/swml/document.rb +84 -0
- data/lib/signalwire_agents/swml/schema.json +12250 -0
- data/lib/signalwire_agents/swml/schema.rb +81 -0
- data/lib/signalwire_agents/swml/service.rb +304 -0
- data/lib/signalwire_agents/version.rb +5 -0
- data/lib/signalwire_agents.rb +19 -0
- metadata +212 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Standard fabric resource with CRUD + addresses.
|
|
7
|
+
class FabricResource < CrudResource
|
|
8
|
+
def list_addresses(resource_id, **params)
|
|
9
|
+
@http.get(_path(resource_id, 'addresses'), params.empty? ? nil : params)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Fabric resource that uses PUT for updates.
|
|
14
|
+
class FabricResourcePUT < FabricResource
|
|
15
|
+
self.update_method = 'PUT'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Call flows with version management.
|
|
19
|
+
class CallFlowsResource < FabricResourcePUT
|
|
20
|
+
def list_addresses(resource_id, **params)
|
|
21
|
+
path = @base_path.sub('/call_flows', '/call_flow')
|
|
22
|
+
@http.get("#{path}/#{resource_id}/addresses", params.empty? ? nil : params)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def list_versions(resource_id, **params)
|
|
26
|
+
path = @base_path.sub('/call_flows', '/call_flow')
|
|
27
|
+
@http.get("#{path}/#{resource_id}/versions", params.empty? ? nil : params)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def deploy_version(resource_id, **kwargs)
|
|
31
|
+
path = @base_path.sub('/call_flows', '/call_flow')
|
|
32
|
+
@http.post("#{path}/#{resource_id}/versions", kwargs)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Conference rooms -- uses singular 'conference_room' for sub-resource paths.
|
|
37
|
+
class ConferenceRoomsResource < FabricResourcePUT
|
|
38
|
+
def list_addresses(resource_id, **params)
|
|
39
|
+
path = @base_path.sub('/conference_rooms', '/conference_room')
|
|
40
|
+
@http.get("#{path}/#{resource_id}/addresses", params.empty? ? nil : params)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Subscribers with SIP endpoint management.
|
|
45
|
+
class SubscribersResource < FabricResourcePUT
|
|
46
|
+
def list_sip_endpoints(subscriber_id, **params)
|
|
47
|
+
@http.get(_path(subscriber_id, 'sip_endpoints'), params.empty? ? nil : params)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def create_sip_endpoint(subscriber_id, **kwargs)
|
|
51
|
+
@http.post(_path(subscriber_id, 'sip_endpoints'), kwargs)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def get_sip_endpoint(subscriber_id, endpoint_id)
|
|
55
|
+
@http.get(_path(subscriber_id, 'sip_endpoints', endpoint_id))
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def update_sip_endpoint(subscriber_id, endpoint_id, **kwargs)
|
|
59
|
+
@http.patch(_path(subscriber_id, 'sip_endpoints', endpoint_id), kwargs)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def delete_sip_endpoint(subscriber_id, endpoint_id)
|
|
63
|
+
@http.delete(_path(subscriber_id, 'sip_endpoints', endpoint_id))
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# cXML applications -- no create method.
|
|
68
|
+
class CxmlApplicationsResource < FabricResourcePUT
|
|
69
|
+
def create(**_kwargs)
|
|
70
|
+
raise NotImplementedError, 'cXML applications cannot be created via this API'
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Generic resource operations across all fabric resource types.
|
|
75
|
+
class GenericResources < BaseResource
|
|
76
|
+
def list(**params)
|
|
77
|
+
@http.get(@base_path, params.empty? ? nil : params)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def get(resource_id)
|
|
81
|
+
@http.get(_path(resource_id))
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def delete(resource_id)
|
|
85
|
+
@http.delete(_path(resource_id))
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def list_addresses(resource_id, **params)
|
|
89
|
+
@http.get(_path(resource_id, 'addresses'), params.empty? ? nil : params)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def assign_phone_route(resource_id, **kwargs)
|
|
93
|
+
@http.post(_path(resource_id, 'phone_routes'), kwargs)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def assign_domain_application(resource_id, **kwargs)
|
|
97
|
+
@http.post(_path(resource_id, 'domain_applications'), kwargs)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Read-only fabric addresses.
|
|
102
|
+
class FabricAddresses < BaseResource
|
|
103
|
+
def list(**params)
|
|
104
|
+
@http.get(@base_path, params.empty? ? nil : params)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def get(address_id)
|
|
108
|
+
@http.get(_path(address_id))
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Subscriber, guest, invite, and embed token creation.
|
|
113
|
+
class FabricTokens < BaseResource
|
|
114
|
+
def initialize(http)
|
|
115
|
+
super(http, '/api/fabric')
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def create_subscriber_token(**kwargs)
|
|
119
|
+
@http.post(_path('subscribers', 'tokens'), kwargs)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def refresh_subscriber_token(**kwargs)
|
|
123
|
+
@http.post(_path('subscribers', 'tokens', 'refresh'), kwargs)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def create_invite_token(**kwargs)
|
|
127
|
+
@http.post(_path('subscriber', 'invites'), kwargs)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def create_guest_token(**kwargs)
|
|
131
|
+
@http.post(_path('guests', 'tokens'), kwargs)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def create_embed_token(**kwargs)
|
|
135
|
+
@http.post(_path('embeds', 'tokens'), kwargs)
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Fabric API namespace grouping all resource types.
|
|
140
|
+
class FabricNamespace
|
|
141
|
+
attr_reader :swml_scripts, :relay_applications, :call_flows,
|
|
142
|
+
:conference_rooms, :freeswitch_connectors, :subscribers,
|
|
143
|
+
:sip_endpoints, :cxml_scripts, :cxml_applications,
|
|
144
|
+
:swml_webhooks, :ai_agents, :sip_gateways, :cxml_webhooks,
|
|
145
|
+
:resources, :addresses, :tokens
|
|
146
|
+
|
|
147
|
+
def initialize(http)
|
|
148
|
+
base = '/api/fabric/resources'
|
|
149
|
+
|
|
150
|
+
# PUT-update resources
|
|
151
|
+
@swml_scripts = FabricResourcePUT.new(http, "#{base}/swml_scripts")
|
|
152
|
+
@relay_applications = FabricResourcePUT.new(http, "#{base}/relay_applications")
|
|
153
|
+
@call_flows = CallFlowsResource.new(http, "#{base}/call_flows")
|
|
154
|
+
@conference_rooms = ConferenceRoomsResource.new(http, "#{base}/conference_rooms")
|
|
155
|
+
@freeswitch_connectors = FabricResourcePUT.new(http, "#{base}/freeswitch_connectors")
|
|
156
|
+
@subscribers = SubscribersResource.new(http, "#{base}/subscribers")
|
|
157
|
+
@sip_endpoints = FabricResourcePUT.new(http, "#{base}/sip_endpoints")
|
|
158
|
+
@cxml_scripts = FabricResourcePUT.new(http, "#{base}/cxml_scripts")
|
|
159
|
+
@cxml_applications = CxmlApplicationsResource.new(http, "#{base}/cxml_applications")
|
|
160
|
+
|
|
161
|
+
# PATCH-update resources
|
|
162
|
+
@swml_webhooks = FabricResource.new(http, "#{base}/swml_webhooks")
|
|
163
|
+
@ai_agents = FabricResource.new(http, "#{base}/ai_agents")
|
|
164
|
+
@sip_gateways = FabricResource.new(http, "#{base}/sip_gateways")
|
|
165
|
+
@cxml_webhooks = FabricResource.new(http, "#{base}/cxml_webhooks")
|
|
166
|
+
|
|
167
|
+
# Special resources
|
|
168
|
+
@resources = GenericResources.new(http, base)
|
|
169
|
+
@addresses = FabricAddresses.new(http, '/api/fabric/addresses')
|
|
170
|
+
@tokens = FabricTokens.new(http)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Import externally-hosted phone numbers.
|
|
7
|
+
class ImportedNumbersResource < BaseResource
|
|
8
|
+
def initialize(http)
|
|
9
|
+
super(http, '/api/relay/rest/imported_phone_numbers')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create(**kwargs)
|
|
13
|
+
@http.post(@base_path, kwargs)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Message log queries.
|
|
7
|
+
class MessageLogs < BaseResource
|
|
8
|
+
def list(**params) = @http.get(@base_path, params.empty? ? nil : params)
|
|
9
|
+
def get(log_id) = @http.get(_path(log_id))
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Voice log queries.
|
|
13
|
+
class VoiceLogs < BaseResource
|
|
14
|
+
def list(**params) = @http.get(@base_path, params.empty? ? nil : params)
|
|
15
|
+
def get(log_id) = @http.get(_path(log_id))
|
|
16
|
+
|
|
17
|
+
def list_events(log_id, **params)
|
|
18
|
+
@http.get(_path(log_id, 'events'), params.empty? ? nil : params)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Fax log queries.
|
|
23
|
+
class FaxLogs < BaseResource
|
|
24
|
+
def list(**params) = @http.get(@base_path, params.empty? ? nil : params)
|
|
25
|
+
def get(log_id) = @http.get(_path(log_id))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Conference log queries.
|
|
29
|
+
class ConferenceLogs < BaseResource
|
|
30
|
+
def list(**params) = @http.get(@base_path, params.empty? ? nil : params)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Logs API namespace.
|
|
34
|
+
class LogsNamespace
|
|
35
|
+
attr_reader :messages, :voice, :fax, :conferences
|
|
36
|
+
|
|
37
|
+
def initialize(http)
|
|
38
|
+
@messages = MessageLogs.new(http, '/api/messaging/logs')
|
|
39
|
+
@voice = VoiceLogs.new(http, '/api/voice/logs')
|
|
40
|
+
@fax = FaxLogs.new(http, '/api/fax/logs')
|
|
41
|
+
@conferences = ConferenceLogs.new(http, '/api/logs/conferences')
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Phone number lookup (carrier, CNAM).
|
|
7
|
+
class LookupResource < BaseResource
|
|
8
|
+
def initialize(http)
|
|
9
|
+
super(http, '/api/relay/rest/lookup')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def phone_number(e164, **params)
|
|
13
|
+
@http.get(_path('phone_number', e164), params.empty? ? nil : params)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Multi-factor authentication via SMS or phone call.
|
|
7
|
+
class MfaResource < BaseResource
|
|
8
|
+
def initialize(http)
|
|
9
|
+
super(http, '/api/relay/rest/mfa')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def sms(**kwargs)
|
|
13
|
+
@http.post(_path('sms'), kwargs)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def call(**kwargs)
|
|
17
|
+
@http.post(_path('call'), kwargs)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def verify(request_id, **kwargs)
|
|
21
|
+
@http.post(_path(request_id, 'verify'), kwargs)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Number group management with membership operations.
|
|
7
|
+
class NumberGroupsResource < CrudResource
|
|
8
|
+
self.update_method = 'PUT'
|
|
9
|
+
|
|
10
|
+
def initialize(http)
|
|
11
|
+
super(http, '/api/relay/rest/number_groups')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def list_memberships(group_id, **params)
|
|
15
|
+
@http.get(_path(group_id, 'number_group_memberships'), params.empty? ? nil : params)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def add_membership(group_id, **kwargs)
|
|
19
|
+
@http.post(_path(group_id, 'number_group_memberships'), kwargs)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def get_membership(membership_id)
|
|
23
|
+
@http.get("/api/relay/rest/number_group_memberships/#{membership_id}")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def delete_membership(membership_id)
|
|
27
|
+
@http.delete("/api/relay/rest/number_group_memberships/#{membership_id}")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Phone number management.
|
|
7
|
+
class PhoneNumbersResource < CrudResource
|
|
8
|
+
self.update_method = 'PUT'
|
|
9
|
+
|
|
10
|
+
def initialize(http)
|
|
11
|
+
super(http, '/api/relay/rest/phone_numbers')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def search(**params)
|
|
15
|
+
@http.get(_path('search'), params.empty? ? nil : params)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Project API token management.
|
|
7
|
+
class ProjectTokens < BaseResource
|
|
8
|
+
def initialize(http)
|
|
9
|
+
super(http, '/api/project/tokens')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create(**kwargs) = @http.post(@base_path, kwargs)
|
|
13
|
+
|
|
14
|
+
def update(token_id, **kwargs)
|
|
15
|
+
@http.patch(_path(token_id), kwargs)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def delete(token_id)
|
|
19
|
+
@http.delete(_path(token_id))
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Project API namespace.
|
|
24
|
+
class ProjectNamespace
|
|
25
|
+
attr_reader :tokens
|
|
26
|
+
|
|
27
|
+
def initialize(http)
|
|
28
|
+
@tokens = ProjectTokens.new(http)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# PubSub token generation.
|
|
7
|
+
class PubSubResource < BaseResource
|
|
8
|
+
def initialize(http)
|
|
9
|
+
super(http, '/api/pubsub/tokens')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create_token(**kwargs)
|
|
13
|
+
@http.post(@base_path, kwargs)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Queue management with member operations.
|
|
7
|
+
class QueuesResource < CrudResource
|
|
8
|
+
self.update_method = 'PUT'
|
|
9
|
+
|
|
10
|
+
def initialize(http)
|
|
11
|
+
super(http, '/api/relay/rest/queues')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def list_members(queue_id, **params)
|
|
15
|
+
@http.get(_path(queue_id, 'members'), params.empty? ? nil : params)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get_next_member(queue_id)
|
|
19
|
+
@http.get(_path(queue_id, 'members', 'next'))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def get_member(queue_id, member_id)
|
|
23
|
+
@http.get(_path(queue_id, 'members', member_id))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Recording management (read-only + delete).
|
|
7
|
+
class RecordingsResource < BaseResource
|
|
8
|
+
def initialize(http)
|
|
9
|
+
super(http, '/api/relay/rest/recordings')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def list(**params) = @http.get(@base_path, params.empty? ? nil : params)
|
|
13
|
+
def get(recording_id) = @http.get(_path(recording_id))
|
|
14
|
+
def delete(recording_id) = @http.delete(_path(recording_id))
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# 10DLC brand management.
|
|
7
|
+
class RegistryBrands < BaseResource
|
|
8
|
+
def list(**params) = @http.get(@base_path, params.empty? ? nil : params)
|
|
9
|
+
def create(**kwargs) = @http.post(@base_path, kwargs)
|
|
10
|
+
def get(brand_id) = @http.get(_path(brand_id))
|
|
11
|
+
|
|
12
|
+
def list_campaigns(brand_id, **params)
|
|
13
|
+
@http.get(_path(brand_id, 'campaigns'), params.empty? ? nil : params)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def create_campaign(brand_id, **kwargs)
|
|
17
|
+
@http.post(_path(brand_id, 'campaigns'), kwargs)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# 10DLC campaign management.
|
|
22
|
+
class RegistryCampaigns < BaseResource
|
|
23
|
+
def get(campaign_id) = @http.get(_path(campaign_id))
|
|
24
|
+
def update(campaign_id, **kwargs) = @http.put(_path(campaign_id), kwargs)
|
|
25
|
+
|
|
26
|
+
def list_numbers(campaign_id, **params)
|
|
27
|
+
@http.get(_path(campaign_id, 'numbers'), params.empty? ? nil : params)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def list_orders(campaign_id, **params)
|
|
31
|
+
@http.get(_path(campaign_id, 'orders'), params.empty? ? nil : params)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def create_order(campaign_id, **kwargs)
|
|
35
|
+
@http.post(_path(campaign_id, 'orders'), kwargs)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# 10DLC assignment order management.
|
|
40
|
+
class RegistryOrders < BaseResource
|
|
41
|
+
def get(order_id)
|
|
42
|
+
@http.get(_path(order_id))
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# 10DLC number assignment management.
|
|
47
|
+
class RegistryNumbers < BaseResource
|
|
48
|
+
def delete(number_id)
|
|
49
|
+
@http.delete(_path(number_id))
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# 10DLC Campaign Registry namespace.
|
|
54
|
+
class RegistryNamespace
|
|
55
|
+
attr_reader :brands, :campaigns, :orders, :numbers
|
|
56
|
+
|
|
57
|
+
def initialize(http)
|
|
58
|
+
base = '/api/relay/rest/registry/beta'
|
|
59
|
+
@brands = RegistryBrands.new(http, "#{base}/brands")
|
|
60
|
+
@campaigns = RegistryCampaigns.new(http, "#{base}/campaigns")
|
|
61
|
+
@orders = RegistryOrders.new(http, "#{base}/orders")
|
|
62
|
+
@numbers = RegistryNumbers.new(http, "#{base}/numbers")
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Short code management (read + update only).
|
|
7
|
+
class ShortCodesResource < BaseResource
|
|
8
|
+
def initialize(http)
|
|
9
|
+
super(http, '/api/relay/rest/short_codes')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def list(**params)
|
|
13
|
+
@http.get(@base_path, params.empty? ? nil : params)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get(short_code_id)
|
|
17
|
+
@http.get(_path(short_code_id))
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def update(short_code_id, **kwargs)
|
|
21
|
+
@http.put(_path(short_code_id), kwargs)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Project SIP profile (singleton resource).
|
|
7
|
+
class SipProfileResource < BaseResource
|
|
8
|
+
def initialize(http)
|
|
9
|
+
super(http, '/api/relay/rest/sip_profile')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def get
|
|
13
|
+
@http.get(@base_path)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def update(**kwargs)
|
|
17
|
+
@http.put(@base_path, kwargs)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SignalWireAgents
|
|
4
|
+
module REST
|
|
5
|
+
module Namespaces
|
|
6
|
+
# Verified caller ID management with verification flow.
|
|
7
|
+
class VerifiedCallersResource < CrudResource
|
|
8
|
+
self.update_method = 'PUT'
|
|
9
|
+
|
|
10
|
+
def initialize(http)
|
|
11
|
+
super(http, '/api/relay/rest/verified_caller_ids')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def redial_verification(caller_id)
|
|
15
|
+
@http.post(_path(caller_id, 'verification'))
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def submit_verification(caller_id, **kwargs)
|
|
19
|
+
@http.put(_path(caller_id, 'verification'), kwargs)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|