sentdm 0.34.0 → 0.36.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 +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +11 -9
- data/lib/sentdm/client.rb +30 -0
- data/lib/sentdm/internal/calls_page.rb +115 -0
- data/lib/sentdm/models/api_response_of_call.rb +43 -0
- data/lib/sentdm/models/api_response_of_call_recordings.rb +43 -0
- data/lib/sentdm/models/api_response_of_calls_list.rb +42 -0
- data/lib/sentdm/models/call.rb +134 -0
- data/lib/sentdm/models/call_event.rb +72 -0
- data/lib/sentdm/models/call_event_payload.rb +102 -0
- data/lib/sentdm/models/call_hangup_params.rb +32 -0
- data/lib/sentdm/models/call_list_params.rb +83 -0
- data/lib/sentdm/models/call_list_recordings_params.rb +26 -0
- data/lib/sentdm/models/call_party.rb +31 -0
- data/lib/sentdm/models/call_record_params.rb +55 -0
- data/lib/sentdm/models/call_recording.rb +38 -0
- data/lib/sentdm/models/call_recordings.rb +24 -0
- data/lib/sentdm/models/call_retrieve_params.rb +26 -0
- data/lib/sentdm/models/call_timeline_entry.rb +26 -0
- data/lib/sentdm/models/calls/api_response_of_list_of_call_participant.rb +45 -0
- data/lib/sentdm/models/calls/call_participant.rb +60 -0
- data/lib/sentdm/models/calls/call_participant_target.rb +30 -0
- data/lib/sentdm/models/calls/participant_add_params.rb +66 -0
- data/lib/sentdm/models/calls/participant_list_params.rb +28 -0
- data/lib/sentdm/models/calls/participant_remove_all_params.rb +28 -0
- data/lib/sentdm/models/calls/participant_remove_params.rb +34 -0
- data/lib/sentdm/models/calls/participant_update_params.rb +64 -0
- data/lib/sentdm/models/calls_list.rb +26 -0
- data/lib/sentdm/models/channels/api_response_of_list_of_voice_number.rb +45 -0
- data/lib/sentdm/models/channels/api_response_of_voice_callback_test.rb +45 -0
- data/lib/sentdm/models/channels/api_response_of_voice_number.rb +45 -0
- data/lib/sentdm/models/channels/api_response_of_voice_number_created.rb +45 -0
- data/lib/sentdm/models/channels/api_response_of_voice_secret.rb +45 -0
- data/lib/sentdm/models/channels/api_response_of_voice_token.rb +45 -0
- data/lib/sentdm/models/channels/voice_callback_test.rb +65 -0
- data/lib/sentdm/models/channels/voice_callback_test_error_info.rb +41 -0
- data/lib/sentdm/models/channels/voice_callback_test_request_info.rb +40 -0
- data/lib/sentdm/models/channels/voice_callback_test_response_info.rb +28 -0
- data/lib/sentdm/models/channels/voice_create_params.rb +86 -0
- data/lib/sentdm/models/channels/voice_create_token_params.rb +69 -0
- data/lib/sentdm/models/channels/voice_list_params.rb +22 -0
- data/lib/sentdm/models/channels/voice_number.rb +68 -0
- data/lib/sentdm/models/channels/voice_number_created.rb +26 -0
- data/lib/sentdm/models/channels/voice_retrieve_params.rb +28 -0
- data/lib/sentdm/models/channels/voice_rotate_secret_params.rb +34 -0
- data/lib/sentdm/models/channels/voice_secret.rb +25 -0
- data/lib/sentdm/models/channels/voice_test_params.rb +34 -0
- data/lib/sentdm/models/channels/voice_token.rb +44 -0
- data/lib/sentdm/models/channels/voice_update_params.rb +95 -0
- data/lib/sentdm/models/message_event_payload.rb +9 -4
- data/lib/sentdm/models/message_retrieve_activities_response.rb +7 -5
- data/lib/sentdm/models/webhook_list_events_response.rb +4 -173
- data/lib/sentdm/models.rb +36 -0
- data/lib/sentdm/resources/calls/participants.rb +231 -0
- data/lib/sentdm/resources/calls.rb +236 -0
- data/lib/sentdm/resources/channels/voice.rb +381 -0
- data/lib/sentdm/resources/channels.rb +45 -0
- data/lib/sentdm/resources/messages.rb +10 -4
- data/lib/sentdm/version.rb +1 -1
- data/lib/sentdm.rb +50 -0
- data/rbi/sentdm/client.rbi +28 -0
- data/rbi/sentdm/internal/calls_page.rbi +71 -0
- data/rbi/sentdm/models/api_response_of_call.rbi +74 -0
- data/rbi/sentdm/models/api_response_of_call_recordings.rbi +74 -0
- data/rbi/sentdm/models/api_response_of_calls_list.rbi +74 -0
- data/rbi/sentdm/models/call.rbi +179 -0
- data/rbi/sentdm/models/call_event.rbi +114 -0
- data/rbi/sentdm/models/call_event_payload.rbi +135 -0
- data/rbi/sentdm/models/call_hangup_params.rbi +59 -0
- data/rbi/sentdm/models/call_list_params.rbi +112 -0
- data/rbi/sentdm/models/call_list_recordings_params.rbi +46 -0
- data/rbi/sentdm/models/call_party.rbi +41 -0
- data/rbi/sentdm/models/call_record_params.rbi +83 -0
- data/rbi/sentdm/models/call_recording.rbi +59 -0
- data/rbi/sentdm/models/call_recordings.rbi +39 -0
- data/rbi/sentdm/models/call_retrieve_params.rbi +46 -0
- data/rbi/sentdm/models/call_timeline_entry.rbi +40 -0
- data/rbi/sentdm/models/calls/api_response_of_list_of_call_participant.rbi +76 -0
- data/rbi/sentdm/models/calls/call_participant.rbi +92 -0
- data/rbi/sentdm/models/calls/call_participant_target.rbi +47 -0
- data/rbi/sentdm/models/calls/participant_add_params.rbi +98 -0
- data/rbi/sentdm/models/calls/participant_list_params.rbi +51 -0
- data/rbi/sentdm/models/calls/participant_remove_all_params.rbi +51 -0
- data/rbi/sentdm/models/calls/participant_remove_params.rbi +61 -0
- data/rbi/sentdm/models/calls/participant_update_params.rbi +94 -0
- data/rbi/sentdm/models/calls_list.rbi +47 -0
- data/rbi/sentdm/models/channels/api_response_of_list_of_voice_number.rbi +76 -0
- data/rbi/sentdm/models/channels/api_response_of_voice_callback_test.rbi +83 -0
- data/rbi/sentdm/models/channels/api_response_of_voice_number.rbi +81 -0
- data/rbi/sentdm/models/channels/api_response_of_voice_number_created.rbi +83 -0
- data/rbi/sentdm/models/channels/api_response_of_voice_secret.rbi +81 -0
- data/rbi/sentdm/models/channels/api_response_of_voice_token.rbi +81 -0
- data/rbi/sentdm/models/channels/voice_callback_test.rbi +126 -0
- data/rbi/sentdm/models/channels/voice_callback_test_error_info.rbi +65 -0
- data/rbi/sentdm/models/channels/voice_callback_test_request_info.rbi +66 -0
- data/rbi/sentdm/models/channels/voice_callback_test_response_info.rbi +48 -0
- data/rbi/sentdm/models/channels/voice_create_params.rbi +127 -0
- data/rbi/sentdm/models/channels/voice_create_token_params.rbi +104 -0
- data/rbi/sentdm/models/channels/voice_list_params.rbi +40 -0
- data/rbi/sentdm/models/channels/voice_number.rbi +105 -0
- data/rbi/sentdm/models/channels/voice_number_created.rbi +42 -0
- data/rbi/sentdm/models/channels/voice_retrieve_params.rbi +51 -0
- data/rbi/sentdm/models/channels/voice_rotate_secret_params.rbi +64 -0
- data/rbi/sentdm/models/channels/voice_secret.rbi +35 -0
- data/rbi/sentdm/models/channels/voice_test_params.rbi +61 -0
- data/rbi/sentdm/models/channels/voice_token.rbi +76 -0
- data/rbi/sentdm/models/channels/voice_update_params.rbi +158 -0
- data/rbi/sentdm/models/message_event_payload.rbi +16 -6
- data/rbi/sentdm/models/message_retrieve_activities_response.rbi +12 -8
- data/rbi/sentdm/models/webhook_list_events_response.rbi +3 -269
- data/rbi/sentdm/models.rbi +36 -0
- data/rbi/sentdm/resources/calls/participants.rbi +199 -0
- data/rbi/sentdm/resources/calls.rbi +207 -0
- data/rbi/sentdm/resources/channels/voice.rbi +371 -0
- data/rbi/sentdm/resources/channels.rbi +42 -0
- data/rbi/sentdm/resources/messages.rbi +10 -4
- data/sig/sentdm/client.rbs +4 -0
- data/sig/sentdm/internal/calls_page.rbs +41 -0
- data/sig/sentdm/models/api_response_of_call.rbs +39 -0
- data/sig/sentdm/models/api_response_of_call_recordings.rbs +39 -0
- data/sig/sentdm/models/api_response_of_calls_list.rbs +39 -0
- data/sig/sentdm/models/call.rbs +101 -0
- data/sig/sentdm/models/call_event.rbs +44 -0
- data/sig/sentdm/models/call_event_payload.rbs +68 -0
- data/sig/sentdm/models/call_hangup_params.rbs +38 -0
- data/sig/sentdm/models/call_list_params.rbs +67 -0
- data/sig/sentdm/models/call_list_recordings_params.rbs +30 -0
- data/sig/sentdm/models/call_party.rbs +17 -0
- data/sig/sentdm/models/call_record_params.rbs +54 -0
- data/sig/sentdm/models/call_recording.rbs +32 -0
- data/sig/sentdm/models/call_recordings.rbs +17 -0
- data/sig/sentdm/models/call_retrieve_params.rbs +30 -0
- data/sig/sentdm/models/call_timeline_entry.rbs +19 -0
- data/sig/sentdm/models/calls/api_response_of_list_of_call_participant.rbs +41 -0
- data/sig/sentdm/models/calls/call_participant.rbs +52 -0
- data/sig/sentdm/models/calls/call_participant_target.rbs +23 -0
- data/sig/sentdm/models/calls/participant_add_params.rbs +63 -0
- data/sig/sentdm/models/calls/participant_list_params.rbs +32 -0
- data/sig/sentdm/models/calls/participant_remove_all_params.rbs +34 -0
- data/sig/sentdm/models/calls/participant_remove_params.rbs +40 -0
- data/sig/sentdm/models/calls/participant_update_params.rbs +61 -0
- data/sig/sentdm/models/calls_list.rbs +26 -0
- data/sig/sentdm/models/channels/api_response_of_list_of_voice_number.rbs +41 -0
- data/sig/sentdm/models/channels/api_response_of_voice_callback_test.rbs +41 -0
- data/sig/sentdm/models/channels/api_response_of_voice_number.rbs +41 -0
- data/sig/sentdm/models/channels/api_response_of_voice_number_created.rbs +41 -0
- data/sig/sentdm/models/channels/api_response_of_voice_secret.rbs +41 -0
- data/sig/sentdm/models/channels/api_response_of_voice_token.rbs +41 -0
- data/sig/sentdm/models/channels/voice_callback_test.rbs +51 -0
- data/sig/sentdm/models/channels/voice_callback_test_error_info.rbs +28 -0
- data/sig/sentdm/models/channels/voice_callback_test_request_info.rbs +34 -0
- data/sig/sentdm/models/channels/voice_callback_test_response_info.rbs +20 -0
- data/sig/sentdm/models/channels/voice_create_params.rbs +64 -0
- data/sig/sentdm/models/channels/voice_create_token_params.rbs +61 -0
- data/sig/sentdm/models/channels/voice_list_params.rbs +27 -0
- data/sig/sentdm/models/channels/voice_number.rbs +57 -0
- data/sig/sentdm/models/channels/voice_number_created.rbs +17 -0
- data/sig/sentdm/models/channels/voice_retrieve_params.rbs +32 -0
- data/sig/sentdm/models/channels/voice_rotate_secret_params.rbs +40 -0
- data/sig/sentdm/models/channels/voice_secret.rbs +17 -0
- data/sig/sentdm/models/channels/voice_test_params.rbs +40 -0
- data/sig/sentdm/models/channels/voice_token.rbs +40 -0
- data/sig/sentdm/models/channels/voice_update_params.rbs +78 -0
- data/sig/sentdm/models/webhook_list_events_response.rbs +1 -107
- data/sig/sentdm/models.rbs +36 -0
- data/sig/sentdm/resources/calls/participants.rbs +50 -0
- data/sig/sentdm/resources/calls.rbs +50 -0
- data/sig/sentdm/resources/channels/voice.rbs +68 -0
- data/sig/sentdm/resources/channels.rbs +9 -0
- metadata +152 -2
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sentdm
|
|
4
|
+
module Resources
|
|
5
|
+
# Phone calls from the numbers you hold, driven by your own callback URL.
|
|
6
|
+
#
|
|
7
|
+
# `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
|
|
8
|
+
# asks what to do with each call on it, and `POST /v3/channels/voice/tokens` mints
|
|
9
|
+
# a short-lived token that lets a user of your app place and receive calls as that
|
|
10
|
+
# number. When a call arrives or a caller presses a key, a signed question is
|
|
11
|
+
# POSTed to the callback URL and the answer decides the call;
|
|
12
|
+
# `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
|
|
13
|
+
# before a real call reaches it, and
|
|
14
|
+
# `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
|
|
15
|
+
# The call events themselves (`call.completed` and the rest) arrive through your
|
|
16
|
+
# webhooks.
|
|
17
|
+
#
|
|
18
|
+
# Every call is a record under `/v3/calls`: read it, list its recordings once one
|
|
19
|
+
# is ready, hang it up, start or stop recording, and add, mute or remove
|
|
20
|
+
# conference participants while it is live. A leg to a phone number runs for at
|
|
21
|
+
# most what your balance affords at the destination's rate.
|
|
22
|
+
class Calls
|
|
23
|
+
# Phone calls from the numbers you hold, driven by your own callback URL.
|
|
24
|
+
#
|
|
25
|
+
# `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
|
|
26
|
+
# asks what to do with each call on it, and `POST /v3/channels/voice/tokens` mints
|
|
27
|
+
# a short-lived token that lets a user of your app place and receive calls as that
|
|
28
|
+
# number. When a call arrives or a caller presses a key, a signed question is
|
|
29
|
+
# POSTed to the callback URL and the answer decides the call;
|
|
30
|
+
# `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
|
|
31
|
+
# before a real call reaches it, and
|
|
32
|
+
# `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
|
|
33
|
+
# The call events themselves (`call.completed` and the rest) arrive through your
|
|
34
|
+
# webhooks.
|
|
35
|
+
#
|
|
36
|
+
# Every call is a record under `/v3/calls`: read it, list its recordings once one
|
|
37
|
+
# is ready, hang it up, start or stop recording, and add, mute or remove
|
|
38
|
+
# conference participants while it is live. A leg to a phone number runs for at
|
|
39
|
+
# most what your balance affords at the destination's rate.
|
|
40
|
+
# @return [Sentdm::Resources::Calls::Participants]
|
|
41
|
+
attr_reader :participants
|
|
42
|
+
|
|
43
|
+
# Some parameter documentations has been truncated, see
|
|
44
|
+
# {Sentdm::Models::CallRetrieveParams} for more details.
|
|
45
|
+
#
|
|
46
|
+
# Retrieves one of your calls by id: the parties, the owning number, the current
|
|
47
|
+
# status with its failure reason, duration, price, recording availability, and a
|
|
48
|
+
# timeline of when the call entered each status.
|
|
49
|
+
#
|
|
50
|
+
# @overload retrieve(id, x_profile_id: nil, request_options: {})
|
|
51
|
+
#
|
|
52
|
+
# @param id [String] The call id from the route, as carried by call webhooks and the calls list, for
|
|
53
|
+
#
|
|
54
|
+
# @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
|
|
55
|
+
#
|
|
56
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
57
|
+
#
|
|
58
|
+
# @return [Sentdm::Models::APIResponseOfCall]
|
|
59
|
+
#
|
|
60
|
+
# @see Sentdm::Models::CallRetrieveParams
|
|
61
|
+
def retrieve(id, params = {})
|
|
62
|
+
parsed, options = Sentdm::CallRetrieveParams.dump_request(params)
|
|
63
|
+
@client.request(
|
|
64
|
+
method: :get,
|
|
65
|
+
path: ["v3/calls/%1$s", id],
|
|
66
|
+
headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
|
|
67
|
+
model: Sentdm::APIResponseOfCall,
|
|
68
|
+
options: options
|
|
69
|
+
)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Some parameter documentations has been truncated, see
|
|
73
|
+
# {Sentdm::Models::CallListParams} for more details.
|
|
74
|
+
#
|
|
75
|
+
# Retrieves a paginated list of your calls, most recent first. Filter by
|
|
76
|
+
# direction, status, the owning number, and the time the call started (from and to
|
|
77
|
+
# are inclusive). Use the call webhooks for real-time updates; this list is for
|
|
78
|
+
# looking calls up afterwards.
|
|
79
|
+
#
|
|
80
|
+
# @overload list(direction: nil, from: nil, number: nil, page: nil, page_size: nil, status: nil, to: nil, x_profile_id: nil, request_options: {})
|
|
81
|
+
#
|
|
82
|
+
# @param direction [String, nil] Query param: Optional direction filter: outbound for calls placed from your app,
|
|
83
|
+
#
|
|
84
|
+
# @param from [Time, nil] Query param: Only calls started at or after this time (ISO 8601)
|
|
85
|
+
#
|
|
86
|
+
# @param number [String, nil] Query param: Optional filter on the number that owns the call, one of your voice
|
|
87
|
+
#
|
|
88
|
+
# @param page [Integer] Query param: Page number (1-indexed)
|
|
89
|
+
#
|
|
90
|
+
# @param page_size [Integer] Query param: Number of items per page
|
|
91
|
+
#
|
|
92
|
+
# @param status [String, nil] Query param: Optional status filter: initiated, ringing, answered, completed, fa
|
|
93
|
+
#
|
|
94
|
+
# @param to [Time, nil] Query param: Only calls started at or before this time (ISO 8601)
|
|
95
|
+
#
|
|
96
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
97
|
+
#
|
|
98
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
99
|
+
#
|
|
100
|
+
# @return [Sentdm::Internal::CallsPage<Sentdm::Models::Call>]
|
|
101
|
+
#
|
|
102
|
+
# @see Sentdm::Models::CallListParams
|
|
103
|
+
def list(params = {})
|
|
104
|
+
query_params = [:direction, :from, :number, :page, :page_size, :status, :to]
|
|
105
|
+
parsed, options = Sentdm::CallListParams.dump_request(params)
|
|
106
|
+
query = Sentdm::Internal::Util.encode_query_params(parsed.slice(*query_params))
|
|
107
|
+
@client.request(
|
|
108
|
+
method: :get,
|
|
109
|
+
path: "v3/calls",
|
|
110
|
+
query: query,
|
|
111
|
+
headers: parsed.except(*query_params).transform_keys(x_profile_id: "x-profile-id"),
|
|
112
|
+
page: Sentdm::Internal::CallsPage,
|
|
113
|
+
model: Sentdm::Call,
|
|
114
|
+
options: options
|
|
115
|
+
)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Some parameter documentations has been truncated, see
|
|
119
|
+
# {Sentdm::Models::CallHangupParams} for more details.
|
|
120
|
+
#
|
|
121
|
+
# Ends one of your live calls. The call then ends the way any other call does once
|
|
122
|
+
# the disconnect is reported: an answered call as COMPLETED with call.completed, a
|
|
123
|
+
# call still ringing as NO_ANSWER, REJECTED or FAILED with call.failed. A call
|
|
124
|
+
# that has already ended answers 409, and so does a call with no phone leg, such
|
|
125
|
+
# as one between two app users.
|
|
126
|
+
#
|
|
127
|
+
# @overload hangup(id, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
|
|
128
|
+
#
|
|
129
|
+
# @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
|
|
130
|
+
#
|
|
131
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
132
|
+
#
|
|
133
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
134
|
+
#
|
|
135
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
136
|
+
#
|
|
137
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
138
|
+
#
|
|
139
|
+
# @return [nil]
|
|
140
|
+
#
|
|
141
|
+
# @see Sentdm::Models::CallHangupParams
|
|
142
|
+
def hangup(id, params = {})
|
|
143
|
+
parsed, options = Sentdm::CallHangupParams.dump_request(params)
|
|
144
|
+
header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
|
|
145
|
+
@client.request(
|
|
146
|
+
method: :post,
|
|
147
|
+
path: ["v3/calls/%1$s/hangup", id],
|
|
148
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
149
|
+
body: parsed.except(*header_params.keys),
|
|
150
|
+
model: NilClass,
|
|
151
|
+
options: options
|
|
152
|
+
)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Some parameter documentations has been truncated, see
|
|
156
|
+
# {Sentdm::Models::CallListRecordingsParams} for more details.
|
|
157
|
+
#
|
|
158
|
+
# Returns pre-signed links to the recordings of one of your calls, each valid
|
|
159
|
+
# until its url_expires_at. A recording appears once the call was recorded, by a
|
|
160
|
+
# connect answer with record set, a startRecording instruction or the recordings
|
|
161
|
+
# command, and the call.recording_ready webhook has been sent; until then, and for
|
|
162
|
+
# a call that was never recorded, the list is empty. A call recorded more than
|
|
163
|
+
# once lists every recording, oldest first, each under the recording_id its
|
|
164
|
+
# call.recording_ready webhook carried.
|
|
165
|
+
#
|
|
166
|
+
# @overload list_recordings(id, x_profile_id: nil, request_options: {})
|
|
167
|
+
#
|
|
168
|
+
# @param id [String] The call id from the route, as carried by call webhooks and the calls list, for
|
|
169
|
+
#
|
|
170
|
+
# @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
|
|
171
|
+
#
|
|
172
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
173
|
+
#
|
|
174
|
+
# @return [Sentdm::Models::APIResponseOfCallRecordings]
|
|
175
|
+
#
|
|
176
|
+
# @see Sentdm::Models::CallListRecordingsParams
|
|
177
|
+
def list_recordings(id, params = {})
|
|
178
|
+
parsed, options = Sentdm::CallListRecordingsParams.dump_request(params)
|
|
179
|
+
@client.request(
|
|
180
|
+
method: :get,
|
|
181
|
+
path: ["v3/calls/%1$s/recordings", id],
|
|
182
|
+
headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
|
|
183
|
+
model: Sentdm::APIResponseOfCallRecordings,
|
|
184
|
+
options: options
|
|
185
|
+
)
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Some parameter documentations has been truncated, see
|
|
189
|
+
# {Sentdm::Models::CallRecordParams} for more details.
|
|
190
|
+
#
|
|
191
|
+
# Starts or stops recording one of your live calls. Use start to begin recording
|
|
192
|
+
# mid-call, or stop to end a recording, whether it was started here or by a
|
|
193
|
+
# connect answer with record set. A call that has already ended answers 409, and
|
|
194
|
+
# so does a call with no phone leg, such as one between two app users, which can't
|
|
195
|
+
# be recorded.
|
|
196
|
+
#
|
|
197
|
+
# @overload record(id, action: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
|
|
198
|
+
#
|
|
199
|
+
# @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
|
|
200
|
+
#
|
|
201
|
+
# @param action [String] Body param: start to begin recording, stop to end it
|
|
202
|
+
#
|
|
203
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
204
|
+
#
|
|
205
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
206
|
+
#
|
|
207
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
208
|
+
#
|
|
209
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
210
|
+
#
|
|
211
|
+
# @return [nil]
|
|
212
|
+
#
|
|
213
|
+
# @see Sentdm::Models::CallRecordParams
|
|
214
|
+
def record(id, params = {})
|
|
215
|
+
parsed, options = Sentdm::CallRecordParams.dump_request(params)
|
|
216
|
+
header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
|
|
217
|
+
@client.request(
|
|
218
|
+
method: :post,
|
|
219
|
+
path: ["v3/calls/%1$s/recordings", id],
|
|
220
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
221
|
+
body: parsed.except(*header_params.keys),
|
|
222
|
+
model: NilClass,
|
|
223
|
+
options: options
|
|
224
|
+
)
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# @api private
|
|
228
|
+
#
|
|
229
|
+
# @param client [Sentdm::Client]
|
|
230
|
+
def initialize(client:)
|
|
231
|
+
@client = client
|
|
232
|
+
@participants = Sentdm::Resources::Calls::Participants.new(client: client)
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
end
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sentdm
|
|
4
|
+
module Resources
|
|
5
|
+
class Channels
|
|
6
|
+
# The senders you send from, one per channel.
|
|
7
|
+
#
|
|
8
|
+
# **SMS is a list of markets**, each keyed by `(country, number_type)` — a
|
|
9
|
+
# customer can hold `us/10dlc` and `gb/alphanumeric` at once, so a market is
|
|
10
|
+
# addressed by the pair rather than by country alone. **WhatsApp and RCS are
|
|
11
|
+
# single**: a customer has one business account and one agent. **Voice is per
|
|
12
|
+
# number**: each number you hold can carry phone calls on its own
|
|
13
|
+
# (`POST /v3/channels/voice`), each with the callback URL Sent asks what to do
|
|
14
|
+
# with its calls, one of them is the default line for calls placed from your app,
|
|
15
|
+
# and voice tokens are minted under `POST /v3/channels/voice/tokens`. Read your
|
|
16
|
+
# voice numbers with `GET /v3/channels/voice` and change one with
|
|
17
|
+
# `PATCH /v3/channels/voice/{number}`.
|
|
18
|
+
#
|
|
19
|
+
# ## Compliance lives on the market
|
|
20
|
+
#
|
|
21
|
+
# Adding a market records everything that market registers with, in its
|
|
22
|
+
# `compliance` object. Only **US `TEN_DLC`** registers with a regime — The
|
|
23
|
+
# Campaign Registry — and it is the only market whose compliance carries `brand`
|
|
24
|
+
# and `campaign`. Everywhere else compliance is documents, and many markets ask
|
|
25
|
+
# for none at all.
|
|
26
|
+
#
|
|
27
|
+
# `GET` and `PATCH` on a market return and accept the same shape, so what comes
|
|
28
|
+
# back can be sent back: an omitted key is left alone, and a key reported in
|
|
29
|
+
# `requirements` is the path into the body that clears it.
|
|
30
|
+
#
|
|
31
|
+
# Call `GET /v3/compliance/requirements` first — it answers what a market demands
|
|
32
|
+
# before you hold it, with a body you can fill in and post.
|
|
33
|
+
class Voice
|
|
34
|
+
# Some parameter documentations has been truncated, see
|
|
35
|
+
# {Sentdm::Models::Channels::VoiceCreateParams} for more details.
|
|
36
|
+
#
|
|
37
|
+
# Adds voice to one of the numbers you hold, or gives you a new one. Send `number`
|
|
38
|
+
# for a number that is already yours (see `GET /v3/channels`); leave it out to be
|
|
39
|
+
# given a new US number, optionally in a particular `area_code`. Sending both is
|
|
40
|
+
# refused. Nothing registers, so the number can carry calls as soon as this
|
|
41
|
+
# returns.
|
|
42
|
+
#
|
|
43
|
+
# What happens on a call is decided by your `callback_url`: when a call arrives on
|
|
44
|
+
# the number, or a caller presses a key on a menu, Sent POSTs a signed question
|
|
45
|
+
# there and follows the answer. The response carries the `callback_secret` the
|
|
46
|
+
# questions are signed with, the one time it is shown without rotating; verify a
|
|
47
|
+
# question the way you verify a webhook. `POST /v3/channels/voice/{number}/test`
|
|
48
|
+
# sends a test question and reports the verdict.
|
|
49
|
+
#
|
|
50
|
+
# Your first voice number becomes the line app-originated calls are placed from
|
|
51
|
+
# when a voice token names no number; send `default_for_app_calls: true` to give
|
|
52
|
+
# that role to another number. A number you turned off earlier is turned back on,
|
|
53
|
+
# and the same number with a different `callback_url` has its URL replaced and
|
|
54
|
+
# keeps its secret.
|
|
55
|
+
#
|
|
56
|
+
# Read the number's settings with `GET /v3/channels/voice` and change them with
|
|
57
|
+
# `PATCH /v3/channels/voice/{number}`.
|
|
58
|
+
#
|
|
59
|
+
# With `sandbox: true` the request is validated and a simulated number reported
|
|
60
|
+
# with `202`; nothing is written and no number is bought.
|
|
61
|
+
#
|
|
62
|
+
# @overload create(callback_url:, area_code: nil, default_for_app_calls: nil, number: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
|
|
63
|
+
#
|
|
64
|
+
# @param callback_url [String] Body param: Where Sent asks what to do with each call on this number: an absolut
|
|
65
|
+
#
|
|
66
|
+
# @param area_code [String, nil] Body param: The US area code a new number should be in, as 212. Only for a reque
|
|
67
|
+
#
|
|
68
|
+
# @param default_for_app_calls [Boolean, nil] Body param: Make this the line app-originated calls are placed from when a voice
|
|
69
|
+
#
|
|
70
|
+
# @param number [String, nil] Body param: One of your phone numbers, in E.164 format. Leave the field out enti
|
|
71
|
+
#
|
|
72
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
73
|
+
#
|
|
74
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
75
|
+
#
|
|
76
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
77
|
+
#
|
|
78
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
79
|
+
#
|
|
80
|
+
# @return [Sentdm::Models::Channels::APIResponseOfVoiceNumberCreated]
|
|
81
|
+
#
|
|
82
|
+
# @see Sentdm::Models::Channels::VoiceCreateParams
|
|
83
|
+
def create(params)
|
|
84
|
+
parsed, options = Sentdm::Channels::VoiceCreateParams.dump_request(params)
|
|
85
|
+
header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
|
|
86
|
+
@client.request(
|
|
87
|
+
method: :post,
|
|
88
|
+
path: "v3/channels/voice",
|
|
89
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
90
|
+
body: parsed.except(*header_params.keys),
|
|
91
|
+
model: Sentdm::Channels::APIResponseOfVoiceNumberCreated,
|
|
92
|
+
options: options
|
|
93
|
+
)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Some parameter documentations has been truncated, see
|
|
97
|
+
# {Sentdm::Models::Channels::VoiceRetrieveParams} for more details.
|
|
98
|
+
#
|
|
99
|
+
# Reads one of your voice numbers, active or inactive: its status, whether it is
|
|
100
|
+
# the default line for calls placed from your app, and its callback URL. The
|
|
101
|
+
# signing secret is not on this read.
|
|
102
|
+
#
|
|
103
|
+
# The same shape `GET /v3/channels/voice` lists, and the same shape `PATCH` on
|
|
104
|
+
# this path accepts and returns, so what comes back can be sent back.
|
|
105
|
+
#
|
|
106
|
+
# The number is the E.164 value in the path with the plus sign URL-encoded
|
|
107
|
+
# (`%2B`).
|
|
108
|
+
#
|
|
109
|
+
# @overload retrieve(number, x_profile_id: nil, request_options: {})
|
|
110
|
+
#
|
|
111
|
+
# @param number [String] The number in E.164 format with the plus sign URL-encoded, e.g. %2B12125550100
|
|
112
|
+
#
|
|
113
|
+
# @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
|
|
114
|
+
#
|
|
115
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
116
|
+
#
|
|
117
|
+
# @return [Sentdm::Models::Channels::APIResponseOfVoiceNumber]
|
|
118
|
+
#
|
|
119
|
+
# @see Sentdm::Models::Channels::VoiceRetrieveParams
|
|
120
|
+
def retrieve(number, params = {})
|
|
121
|
+
parsed, options = Sentdm::Channels::VoiceRetrieveParams.dump_request(params)
|
|
122
|
+
@client.request(
|
|
123
|
+
method: :get,
|
|
124
|
+
path: ["v3/channels/voice/%1$s", number],
|
|
125
|
+
headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
|
|
126
|
+
model: Sentdm::Channels::APIResponseOfVoiceNumber,
|
|
127
|
+
options: options
|
|
128
|
+
)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Some parameter documentations has been truncated, see
|
|
132
|
+
# {Sentdm::Models::Channels::VoiceUpdateParams} for more details.
|
|
133
|
+
#
|
|
134
|
+
# Changes one of your voice numbers and answers with the number as stored, the
|
|
135
|
+
# same shape `GET` on this path returns, so what comes back can be sent back.
|
|
136
|
+
#
|
|
137
|
+
# ## What it changes
|
|
138
|
+
#
|
|
139
|
+
# | Body | Effect |
|
|
140
|
+
# | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
141
|
+
# | `"status": "ACTIVE"` | turns calls on again for a number you turned off; the callback URL and the secret it had are kept |
|
|
142
|
+
# | `"status": "INACTIVE"` | turns calls off; the callback URL and the secret stay on the number |
|
|
143
|
+
# | `"default_for_app_calls": true` | makes this the line app-originated calls are placed from when a voice token names no number |
|
|
144
|
+
# | `"callback_url": "https://example.com/voice"` | replaces where Sent asks what to do with each call on the number; the signing secret is kept, and a number that was waiting for its first URL is turned on |
|
|
145
|
+
# | key omitted | left exactly as it is |
|
|
146
|
+
#
|
|
147
|
+
# `status` is matched ignoring case. Any combination is accepted:
|
|
148
|
+
# `status: "ACTIVE"` with `default_for_app_calls: true` turns a number on as the
|
|
149
|
+
# new default, and a `callback_url` sent with either status is written too. A body
|
|
150
|
+
# that names none of the three is refused.
|
|
151
|
+
#
|
|
152
|
+
# ## What it will refuse
|
|
153
|
+
#
|
|
154
|
+
# **`default_for_app_calls: false` is `400`.** An account with active voice
|
|
155
|
+
# numbers always has exactly one default, so the default moves by giving it to
|
|
156
|
+
# another number.
|
|
157
|
+
#
|
|
158
|
+
# **Turning the default line off is `409`** while other active voice numbers
|
|
159
|
+
# remain. Move the default to another number first. Turning off your last voice
|
|
160
|
+
# number is allowed; that turns phone calls off.
|
|
161
|
+
#
|
|
162
|
+
# **Making an inactive number the default is `400`.** Send `status: "ACTIVE"` in
|
|
163
|
+
# the same call.
|
|
164
|
+
#
|
|
165
|
+
# A number added without a `callback_url` is `INACTIVE` for that one reason, so
|
|
166
|
+
# sending it a `callback_url` turns it on by itself, and it becomes your default
|
|
167
|
+
# line if you have no other active voice number. A number you turned off while it
|
|
168
|
+
# had a URL stays off.
|
|
169
|
+
#
|
|
170
|
+
# **A number you never turned voice on for is `404`.** Add it with
|
|
171
|
+
# `POST /v3/channels/voice`.
|
|
172
|
+
#
|
|
173
|
+
# The number is the E.164 value in the path with the plus sign URL-encoded
|
|
174
|
+
# (`%2B`).
|
|
175
|
+
#
|
|
176
|
+
# With `sandbox: true` nothing is written: the request is validated against the
|
|
177
|
+
# stored number and the number is reported with `200` as it would read after the
|
|
178
|
+
# change.
|
|
179
|
+
#
|
|
180
|
+
# @overload update(number, callback_url: nil, default_for_app_calls: nil, sandbox: nil, status: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
|
|
181
|
+
#
|
|
182
|
+
# @param number [String] Path param: The number in E.164 format with the plus sign URL-encoded, e.g. %2B1
|
|
183
|
+
#
|
|
184
|
+
# @param callback_url [String, nil] Body param: A new callback URL for the number, active or not: an absolute HTTP o
|
|
185
|
+
#
|
|
186
|
+
# @param default_for_app_calls [Boolean, nil] Body param: true makes this the line app-originated calls are placed from when a
|
|
187
|
+
#
|
|
188
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
189
|
+
#
|
|
190
|
+
# @param status [Symbol, Sentdm::Models::Channels::VoiceUpdateParams::Status, nil] Body param: ACTIVE turns calls on for the number again, INACTIVE turns them off.
|
|
191
|
+
#
|
|
192
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
193
|
+
#
|
|
194
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
195
|
+
#
|
|
196
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
197
|
+
#
|
|
198
|
+
# @return [Sentdm::Models::Channels::APIResponseOfVoiceNumber]
|
|
199
|
+
#
|
|
200
|
+
# @see Sentdm::Models::Channels::VoiceUpdateParams
|
|
201
|
+
def update(number, params = {})
|
|
202
|
+
parsed, options = Sentdm::Channels::VoiceUpdateParams.dump_request(params)
|
|
203
|
+
header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
|
|
204
|
+
@client.request(
|
|
205
|
+
method: :patch,
|
|
206
|
+
path: ["v3/channels/voice/%1$s", number],
|
|
207
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
208
|
+
body: parsed.except(*header_params.keys),
|
|
209
|
+
model: Sentdm::Channels::APIResponseOfVoiceNumber,
|
|
210
|
+
options: options
|
|
211
|
+
)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Some parameter documentations has been truncated, see
|
|
215
|
+
# {Sentdm::Models::Channels::VoiceListParams} for more details.
|
|
216
|
+
#
|
|
217
|
+
# Every number you turned phone calls on for, active or inactive, oldest first.
|
|
218
|
+
# Each entry carries the number's status, whether it is the default line for calls
|
|
219
|
+
# placed from your app, and its callback URL. The signing secret is never on a
|
|
220
|
+
# read; it is shown when voice is turned on and by
|
|
221
|
+
# `POST /v3/channels/voice/{number}/rotate-secret`.
|
|
222
|
+
#
|
|
223
|
+
# The same entries `GET /v3/channels` reports under `voice`, and the same shape
|
|
224
|
+
# `GET /v3/channels/voice/{number}` returns for one of them. Change a number with
|
|
225
|
+
# `PATCH /v3/channels/voice/{number}`.
|
|
226
|
+
#
|
|
227
|
+
# @overload list(x_profile_id: nil, request_options: {})
|
|
228
|
+
#
|
|
229
|
+
# @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
|
|
230
|
+
#
|
|
231
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
232
|
+
#
|
|
233
|
+
# @return [Sentdm::Models::Channels::APIResponseOfListOfVoiceNumber]
|
|
234
|
+
#
|
|
235
|
+
# @see Sentdm::Models::Channels::VoiceListParams
|
|
236
|
+
def list(params = {})
|
|
237
|
+
parsed, options = Sentdm::Channels::VoiceListParams.dump_request(params)
|
|
238
|
+
@client.request(
|
|
239
|
+
method: :get,
|
|
240
|
+
path: "v3/channels/voice",
|
|
241
|
+
headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
|
|
242
|
+
model: Sentdm::Channels::APIResponseOfListOfVoiceNumber,
|
|
243
|
+
options: options
|
|
244
|
+
)
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# Some parameter documentations has been truncated, see
|
|
248
|
+
# {Sentdm::Models::Channels::VoiceCreateTokenParams} for more details.
|
|
249
|
+
#
|
|
250
|
+
# Mints a short-lived token for one of your app users. Call this from your backend
|
|
251
|
+
# and return the token to your app, which passes it to the voice client SDK to
|
|
252
|
+
# register. The identity is bound to the given number, or to your default app-call
|
|
253
|
+
# number when omitted, and calls placed by that identity are routed through the
|
|
254
|
+
# bound number. Minting again re-binds the identity, so an identity can move
|
|
255
|
+
# between numbers.
|
|
256
|
+
#
|
|
257
|
+
# @overload create_token(identity: nil, number: nil, sandbox: nil, ttl: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
|
|
258
|
+
#
|
|
259
|
+
# @param identity [String] Body param: Your identifier for the app user, such as an agent or account id. Le
|
|
260
|
+
#
|
|
261
|
+
# @param number [String, nil] Body param: One of your voice-enabled phone numbers in E.164 format. Calls place
|
|
262
|
+
#
|
|
263
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
264
|
+
#
|
|
265
|
+
# @param ttl [Integer, nil] Body param: Token lifetime in seconds. Defaults to 600 and cannot exceed 3600.
|
|
266
|
+
#
|
|
267
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
268
|
+
#
|
|
269
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
270
|
+
#
|
|
271
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
272
|
+
#
|
|
273
|
+
# @return [Sentdm::Models::Channels::APIResponseOfVoiceToken]
|
|
274
|
+
#
|
|
275
|
+
# @see Sentdm::Models::Channels::VoiceCreateTokenParams
|
|
276
|
+
def create_token(params = {})
|
|
277
|
+
parsed, options = Sentdm::Channels::VoiceCreateTokenParams.dump_request(params)
|
|
278
|
+
header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
|
|
279
|
+
@client.request(
|
|
280
|
+
method: :post,
|
|
281
|
+
path: "v3/channels/voice/tokens",
|
|
282
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
283
|
+
body: parsed.except(*header_params.keys),
|
|
284
|
+
model: Sentdm::Channels::APIResponseOfVoiceToken,
|
|
285
|
+
options: options
|
|
286
|
+
)
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# Some parameter documentations has been truncated, see
|
|
290
|
+
# {Sentdm::Models::Channels::VoiceRotateSecretParams} for more details.
|
|
291
|
+
#
|
|
292
|
+
# Generates a new signing secret for the questions Sent sends to this number's
|
|
293
|
+
# callback URL and returns it. The previous secret stops signing immediately, so
|
|
294
|
+
# update your backend before the next call reaches it. The number is the E.164
|
|
295
|
+
# value in the path with the plus sign URL-encoded (`%2B`).
|
|
296
|
+
#
|
|
297
|
+
# With `sandbox: true` a secret is generated and returned with `202`, and nothing
|
|
298
|
+
# is written.
|
|
299
|
+
#
|
|
300
|
+
# @overload rotate_secret(number, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
|
|
301
|
+
#
|
|
302
|
+
# @param number [String] Path param: The voice number from the route, in E.164 format with the plus sign
|
|
303
|
+
#
|
|
304
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
305
|
+
#
|
|
306
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
307
|
+
#
|
|
308
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
309
|
+
#
|
|
310
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
311
|
+
#
|
|
312
|
+
# @return [Sentdm::Models::Channels::APIResponseOfVoiceSecret]
|
|
313
|
+
#
|
|
314
|
+
# @see Sentdm::Models::Channels::VoiceRotateSecretParams
|
|
315
|
+
def rotate_secret(number, params = {})
|
|
316
|
+
parsed, options = Sentdm::Channels::VoiceRotateSecretParams.dump_request(params)
|
|
317
|
+
header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
|
|
318
|
+
@client.request(
|
|
319
|
+
method: :post,
|
|
320
|
+
path: ["v3/channels/voice/%1$s/rotate-secret", number],
|
|
321
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
322
|
+
body: parsed.except(*header_params.keys),
|
|
323
|
+
model: Sentdm::Channels::APIResponseOfVoiceSecret,
|
|
324
|
+
options: options
|
|
325
|
+
)
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# Some parameter documentations has been truncated, see
|
|
329
|
+
# {Sentdm::Models::Channels::VoiceTestParams} for more details.
|
|
330
|
+
#
|
|
331
|
+
# Sends a synthetic call.request question, flagged "test": true, to the number's
|
|
332
|
+
# callback URL, signed with that number's real secret, and reports what came back.
|
|
333
|
+
# Use it to build and debug your callback endpoint without placing calls: no call
|
|
334
|
+
# is placed, nothing is billed, and nothing is stored. One attempt with the same
|
|
335
|
+
# deadline as a live call, no retry. The outcome is ok when your endpoint answered
|
|
336
|
+
# 2xx with a valid answer; otherwise it is timeout, connection_failed, http_error
|
|
337
|
+
# or invalid_answer, with the reason and, for an invalid answer, the field at
|
|
338
|
+
# fault. The number is the E.164 value in the path with the plus sign URL-encoded
|
|
339
|
+
# (`%2B`).
|
|
340
|
+
#
|
|
341
|
+
# With `sandbox: true` nothing is sent: the verdict comes back ok with `202` and
|
|
342
|
+
# no request or response in it.
|
|
343
|
+
#
|
|
344
|
+
# @overload test_(number, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
|
|
345
|
+
#
|
|
346
|
+
# @param number [String] Path param: The voice number from the route, in E.164 format with the plus sign
|
|
347
|
+
#
|
|
348
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
349
|
+
#
|
|
350
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
351
|
+
#
|
|
352
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
353
|
+
#
|
|
354
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
355
|
+
#
|
|
356
|
+
# @return [Sentdm::Models::Channels::APIResponseOfVoiceCallbackTest]
|
|
357
|
+
#
|
|
358
|
+
# @see Sentdm::Models::Channels::VoiceTestParams
|
|
359
|
+
def test_(number, params = {})
|
|
360
|
+
parsed, options = Sentdm::Channels::VoiceTestParams.dump_request(params)
|
|
361
|
+
header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
|
|
362
|
+
@client.request(
|
|
363
|
+
method: :post,
|
|
364
|
+
path: ["v3/channels/voice/%1$s/test", number],
|
|
365
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
366
|
+
body: parsed.except(*header_params.keys),
|
|
367
|
+
model: Sentdm::Channels::APIResponseOfVoiceCallbackTest,
|
|
368
|
+
options: options
|
|
369
|
+
)
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
# @api private
|
|
373
|
+
#
|
|
374
|
+
# @param client [Sentdm::Client]
|
|
375
|
+
def initialize(client:)
|
|
376
|
+
@client = client
|
|
377
|
+
end
|
|
378
|
+
end
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sentdm
|
|
4
|
+
module Resources
|
|
5
|
+
class Channels
|
|
6
|
+
# The senders you send from, one per channel.
|
|
7
|
+
#
|
|
8
|
+
# **SMS is a list of markets**, each keyed by `(country, number_type)` — a
|
|
9
|
+
# customer can hold `us/10dlc` and `gb/alphanumeric` at once, so a market is
|
|
10
|
+
# addressed by the pair rather than by country alone. **WhatsApp and RCS are
|
|
11
|
+
# single**: a customer has one business account and one agent. **Voice is per
|
|
12
|
+
# number**: each number you hold can carry phone calls on its own
|
|
13
|
+
# (`POST /v3/channels/voice`), each with the callback URL Sent asks what to do
|
|
14
|
+
# with its calls, one of them is the default line for calls placed from your app,
|
|
15
|
+
# and voice tokens are minted under `POST /v3/channels/voice/tokens`. Read your
|
|
16
|
+
# voice numbers with `GET /v3/channels/voice` and change one with
|
|
17
|
+
# `PATCH /v3/channels/voice/{number}`.
|
|
18
|
+
#
|
|
19
|
+
# ## Compliance lives on the market
|
|
20
|
+
#
|
|
21
|
+
# Adding a market records everything that market registers with, in its
|
|
22
|
+
# `compliance` object. Only **US `TEN_DLC`** registers with a regime — The
|
|
23
|
+
# Campaign Registry — and it is the only market whose compliance carries `brand`
|
|
24
|
+
# and `campaign`. Everywhere else compliance is documents, and many markets ask
|
|
25
|
+
# for none at all.
|
|
26
|
+
#
|
|
27
|
+
# `GET` and `PATCH` on a market return and accept the same shape, so what comes
|
|
28
|
+
# back can be sent back: an omitted key is left alone, and a key reported in
|
|
29
|
+
# `requirements` is the path into the body that clears it.
|
|
30
|
+
#
|
|
31
|
+
# Call `GET /v3/compliance/requirements` first — it answers what a market demands
|
|
32
|
+
# before you hold it, with a body you can fill in and post.
|
|
33
|
+
# @return [Sentdm::Resources::Channels::Voice]
|
|
34
|
+
attr_reader :voice
|
|
35
|
+
|
|
36
|
+
# @api private
|
|
37
|
+
#
|
|
38
|
+
# @param client [Sentdm::Client]
|
|
39
|
+
def initialize(client:)
|
|
40
|
+
@client = client
|
|
41
|
+
@voice = Sentdm::Resources::Channels::Voice.new(client: client)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|