sentdm 0.34.0 → 0.35.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 +8 -0
- data/README.md +11 -9
- data/lib/sentdm/client.rb +25 -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 +133 -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/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 +235 -0
- data/lib/sentdm/resources/channels/voice.rb +381 -0
- data/lib/sentdm/resources/channels.rb +45 -0
- data/lib/sentdm/version.rb +1 -1
- data/lib/sentdm.rb +50 -0
- data/rbi/sentdm/client.rbi +23 -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 +177 -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/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 +206 -0
- data/rbi/sentdm/resources/channels/voice.rbi +371 -0
- data/rbi/sentdm/resources/channels.rbi +42 -0
- 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
data/lib/sentdm/models.rb
CHANGED
|
@@ -41,6 +41,12 @@ module Sentdm
|
|
|
41
41
|
|
|
42
42
|
APIMeta = Sentdm::Models::APIMeta
|
|
43
43
|
|
|
44
|
+
APIResponseOfCall = Sentdm::Models::APIResponseOfCall
|
|
45
|
+
|
|
46
|
+
APIResponseOfCallRecordings = Sentdm::Models::APIResponseOfCallRecordings
|
|
47
|
+
|
|
48
|
+
APIResponseOfCallsList = Sentdm::Models::APIResponseOfCallsList
|
|
49
|
+
|
|
44
50
|
APIResponseOfContact = Sentdm::Models::APIResponseOfContact
|
|
45
51
|
|
|
46
52
|
APIResponseOfContactMessageSummary = Sentdm::Models::APIResponseOfContactMessageSummary
|
|
@@ -67,10 +73,40 @@ module Sentdm
|
|
|
67
73
|
|
|
68
74
|
BrandsBrandData = Sentdm::Models::BrandsBrandData
|
|
69
75
|
|
|
76
|
+
Call = Sentdm::Models::Call
|
|
77
|
+
|
|
78
|
+
CallEvent = Sentdm::Models::CallEvent
|
|
79
|
+
|
|
80
|
+
CallEventPayload = Sentdm::Models::CallEventPayload
|
|
81
|
+
|
|
82
|
+
CallHangupParams = Sentdm::Models::CallHangupParams
|
|
83
|
+
|
|
84
|
+
CallListParams = Sentdm::Models::CallListParams
|
|
85
|
+
|
|
86
|
+
CallListRecordingsParams = Sentdm::Models::CallListRecordingsParams
|
|
87
|
+
|
|
88
|
+
CallParty = Sentdm::Models::CallParty
|
|
89
|
+
|
|
90
|
+
CallRecording = Sentdm::Models::CallRecording
|
|
91
|
+
|
|
92
|
+
CallRecordings = Sentdm::Models::CallRecordings
|
|
93
|
+
|
|
94
|
+
CallRecordParams = Sentdm::Models::CallRecordParams
|
|
95
|
+
|
|
96
|
+
CallRetrieveParams = Sentdm::Models::CallRetrieveParams
|
|
97
|
+
|
|
98
|
+
Calls = Sentdm::Models::Calls
|
|
99
|
+
|
|
100
|
+
CallsList = Sentdm::Models::CallsList
|
|
101
|
+
|
|
102
|
+
CallTimelineEntry = Sentdm::Models::CallTimelineEntry
|
|
103
|
+
|
|
70
104
|
ChannelEvent = Sentdm::Models::ChannelEvent
|
|
71
105
|
|
|
72
106
|
ChannelEventPayload = Sentdm::Models::ChannelEventPayload
|
|
73
107
|
|
|
108
|
+
Channels = Sentdm::Models::Channels
|
|
109
|
+
|
|
74
110
|
ContactCreateParams = Sentdm::Models::ContactCreateParams
|
|
75
111
|
|
|
76
112
|
ContactDeleteParams = Sentdm::Models::ContactDeleteParams
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sentdm
|
|
4
|
+
module Resources
|
|
5
|
+
class Calls
|
|
6
|
+
# Phone calls from the numbers you hold, driven by your own callback URL.
|
|
7
|
+
#
|
|
8
|
+
# `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
|
|
9
|
+
# asks what to do with each call on it, and `POST /v3/channels/voice/tokens` mints
|
|
10
|
+
# a short-lived token that lets a user of your app place and receive calls as that
|
|
11
|
+
# number. When a call arrives or a caller presses a key, a signed question is
|
|
12
|
+
# POSTed to the callback URL and the answer decides the call;
|
|
13
|
+
# `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
|
|
14
|
+
# before a real call reaches it, and
|
|
15
|
+
# `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
|
|
16
|
+
# The call events themselves (`call.completed` and the rest) arrive through your
|
|
17
|
+
# webhooks.
|
|
18
|
+
#
|
|
19
|
+
# Every call is a record under `/v3/calls`: read it, list its recordings once one
|
|
20
|
+
# is ready, hang it up, start or stop recording, and add, mute or remove
|
|
21
|
+
# conference participants while it is live. A leg to a phone number runs for at
|
|
22
|
+
# most what your balance affords at the destination's rate.
|
|
23
|
+
class Participants
|
|
24
|
+
# Some parameter documentations has been truncated, see
|
|
25
|
+
# {Sentdm::Models::Calls::ParticipantUpdateParams} for more details.
|
|
26
|
+
#
|
|
27
|
+
# Mutes or unmutes one participant of the conference room a live call is in, named
|
|
28
|
+
# by the participant's own call id from the participants list: send muted true to
|
|
29
|
+
# silence them, muted false to let them be heard again. Muting a participant who
|
|
30
|
+
# is already muted succeeds, as does unmuting one who is not. A participant who is
|
|
31
|
+
# not in this call's room answers 404. A call that has ended answers 409, as does
|
|
32
|
+
# a call that is not in a conference.
|
|
33
|
+
#
|
|
34
|
+
# @overload update(participant_id, id:, muted: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
|
|
35
|
+
#
|
|
36
|
+
# @param participant_id [String] Path param: The participant's own call id from the route, as listed by the parti
|
|
37
|
+
#
|
|
38
|
+
# @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
|
|
39
|
+
#
|
|
40
|
+
# @param muted [Boolean] Body param: true to mute the participant, false to unmute them
|
|
41
|
+
#
|
|
42
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
43
|
+
#
|
|
44
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
45
|
+
#
|
|
46
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
47
|
+
#
|
|
48
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
49
|
+
#
|
|
50
|
+
# @return [nil]
|
|
51
|
+
#
|
|
52
|
+
# @see Sentdm::Models::Calls::ParticipantUpdateParams
|
|
53
|
+
def update(participant_id, params)
|
|
54
|
+
parsed, options = Sentdm::Calls::ParticipantUpdateParams.dump_request(params)
|
|
55
|
+
id =
|
|
56
|
+
parsed.delete(:id) do
|
|
57
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
58
|
+
end
|
|
59
|
+
header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
|
|
60
|
+
@client.request(
|
|
61
|
+
method: :patch,
|
|
62
|
+
path: ["v3/calls/%1$s/participants/%2$s", id, participant_id],
|
|
63
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
64
|
+
body: parsed.except(*header_params.keys),
|
|
65
|
+
model: NilClass,
|
|
66
|
+
options: options
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Some parameter documentations has been truncated, see
|
|
71
|
+
# {Sentdm::Models::Calls::ParticipantListParams} for more details.
|
|
72
|
+
#
|
|
73
|
+
# Lists who is in the conference room one of your live calls is in: each
|
|
74
|
+
# participant's own call id, who they are, whether the room mutes them, and how
|
|
75
|
+
# long they have been connected. The call itself is one of the participants. Use a
|
|
76
|
+
# participant's id to mute or remove them; it is also a call id, so GET
|
|
77
|
+
# /v3/calls/{id} accepts it. A call that has ended answers 409, as does a call
|
|
78
|
+
# that is not in a conference.
|
|
79
|
+
#
|
|
80
|
+
# @overload list(id, x_profile_id: nil, request_options: {})
|
|
81
|
+
#
|
|
82
|
+
# @param id [String] The call id from the route, as carried by call webhooks and the calls list, for
|
|
83
|
+
#
|
|
84
|
+
# @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
|
|
85
|
+
#
|
|
86
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
87
|
+
#
|
|
88
|
+
# @return [Sentdm::Models::Calls::APIResponseOfListOfCallParticipant]
|
|
89
|
+
#
|
|
90
|
+
# @see Sentdm::Models::Calls::ParticipantListParams
|
|
91
|
+
def list(id, params = {})
|
|
92
|
+
parsed, options = Sentdm::Calls::ParticipantListParams.dump_request(params)
|
|
93
|
+
@client.request(
|
|
94
|
+
method: :get,
|
|
95
|
+
path: ["v3/calls/%1$s/participants", id],
|
|
96
|
+
headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
|
|
97
|
+
model: Sentdm::Calls::APIResponseOfListOfCallParticipant,
|
|
98
|
+
options: options
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Some parameter documentations has been truncated, see
|
|
103
|
+
# {Sentdm::Models::Calls::ParticipantAddParams} for more details.
|
|
104
|
+
#
|
|
105
|
+
# Dials one of your app users or a phone number into a call that is in a
|
|
106
|
+
# conference room, and answers with the participant's own call record. The
|
|
107
|
+
# participant is a call of their own: it has its own id, can be looked up and hung
|
|
108
|
+
# up, and is billed and reported through call.completed and call.failed like any
|
|
109
|
+
# other call. A phone participant is called from caller_id, which must be one of
|
|
110
|
+
# your numbers, or from the call's owning number when omitted, and needs a
|
|
111
|
+
# destination you may call and a positive balance. Only a call your answer
|
|
112
|
+
# connected to a conference can take participants: a call connected to a user or a
|
|
113
|
+
# number answers 409.
|
|
114
|
+
#
|
|
115
|
+
# @overload add(id, caller_id: nil, sandbox: nil, to: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
|
|
116
|
+
#
|
|
117
|
+
# @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
|
|
118
|
+
#
|
|
119
|
+
# @param caller_id [String, nil] Body param: The number shown to a phone participant as the caller, in E.164 form
|
|
120
|
+
#
|
|
121
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
122
|
+
#
|
|
123
|
+
# @param to [Sentdm::Models::Calls::CallParticipantTarget] Body param: A participant to add to a call
|
|
124
|
+
#
|
|
125
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
126
|
+
#
|
|
127
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
128
|
+
#
|
|
129
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
130
|
+
#
|
|
131
|
+
# @return [Sentdm::Models::APIResponseOfCall]
|
|
132
|
+
#
|
|
133
|
+
# @see Sentdm::Models::Calls::ParticipantAddParams
|
|
134
|
+
def add(id, params = {})
|
|
135
|
+
parsed, options = Sentdm::Calls::ParticipantAddParams.dump_request(params)
|
|
136
|
+
header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
|
|
137
|
+
@client.request(
|
|
138
|
+
method: :post,
|
|
139
|
+
path: ["v3/calls/%1$s/participants", id],
|
|
140
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
141
|
+
body: parsed.except(*header_params.keys),
|
|
142
|
+
model: Sentdm::APIResponseOfCall,
|
|
143
|
+
options: options
|
|
144
|
+
)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Some parameter documentations has been truncated, see
|
|
148
|
+
# {Sentdm::Models::Calls::ParticipantRemoveParams} for more details.
|
|
149
|
+
#
|
|
150
|
+
# Removes one participant from the conference room a live call is in, named by the
|
|
151
|
+
# participant's own call id from the participants list. Their leg ends and is
|
|
152
|
+
# reported through call.completed like any other call; everyone else stays
|
|
153
|
+
# connected. A participant who is not in this call's room answers 404. A call that
|
|
154
|
+
# has ended answers 409, as does a call that is not in a conference.
|
|
155
|
+
#
|
|
156
|
+
# @overload remove(participant_id, id:, sandbox: nil, x_profile_id: nil, request_options: {})
|
|
157
|
+
#
|
|
158
|
+
# @param participant_id [String] Path param: The participant's own call id from the route, as listed by the parti
|
|
159
|
+
#
|
|
160
|
+
# @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
|
|
161
|
+
#
|
|
162
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
163
|
+
#
|
|
164
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
165
|
+
#
|
|
166
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
167
|
+
#
|
|
168
|
+
# @return [nil]
|
|
169
|
+
#
|
|
170
|
+
# @see Sentdm::Models::Calls::ParticipantRemoveParams
|
|
171
|
+
def remove(participant_id, params)
|
|
172
|
+
parsed, options = Sentdm::Calls::ParticipantRemoveParams.dump_request(params)
|
|
173
|
+
id =
|
|
174
|
+
parsed.delete(:id) do
|
|
175
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
176
|
+
end
|
|
177
|
+
header_params = {x_profile_id: "x-profile-id"}
|
|
178
|
+
@client.request(
|
|
179
|
+
method: :delete,
|
|
180
|
+
path: ["v3/calls/%1$s/participants/%2$s", id, participant_id],
|
|
181
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
182
|
+
body: parsed.except(*header_params.keys),
|
|
183
|
+
model: NilClass,
|
|
184
|
+
options: options
|
|
185
|
+
)
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Some parameter documentations has been truncated, see
|
|
189
|
+
# {Sentdm::Models::Calls::ParticipantRemoveAllParams} for more details.
|
|
190
|
+
#
|
|
191
|
+
# Removes every participant from the conference room a live call is in, the call
|
|
192
|
+
# itself included. Every leg ends and is reported through call.completed like any
|
|
193
|
+
# other call. A room that is already empty answers 204 as well. A call that has
|
|
194
|
+
# ended answers 409, as does a call that is not in a conference.
|
|
195
|
+
#
|
|
196
|
+
# @overload remove_all(id, sandbox: nil, x_profile_id: nil, request_options: {})
|
|
197
|
+
#
|
|
198
|
+
# @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
|
|
199
|
+
#
|
|
200
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
201
|
+
#
|
|
202
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
203
|
+
#
|
|
204
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
205
|
+
#
|
|
206
|
+
# @return [nil]
|
|
207
|
+
#
|
|
208
|
+
# @see Sentdm::Models::Calls::ParticipantRemoveAllParams
|
|
209
|
+
def remove_all(id, params = {})
|
|
210
|
+
parsed, options = Sentdm::Calls::ParticipantRemoveAllParams.dump_request(params)
|
|
211
|
+
header_params = {x_profile_id: "x-profile-id"}
|
|
212
|
+
@client.request(
|
|
213
|
+
method: :delete,
|
|
214
|
+
path: ["v3/calls/%1$s/participants", id],
|
|
215
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
216
|
+
body: parsed.except(*header_params.keys),
|
|
217
|
+
model: NilClass,
|
|
218
|
+
options: options
|
|
219
|
+
)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# @api private
|
|
223
|
+
#
|
|
224
|
+
# @param client [Sentdm::Client]
|
|
225
|
+
def initialize(client:)
|
|
226
|
+
@client = client
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
end
|
|
@@ -0,0 +1,235 @@
|
|
|
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: its
|
|
122
|
+
# status moves to completed and call.completed is sent once the disconnect is
|
|
123
|
+
# reported. A call that has already ended answers 409, and so does a call with no
|
|
124
|
+
# phone leg, such as one between two app users.
|
|
125
|
+
#
|
|
126
|
+
# @overload hangup(id, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
|
|
127
|
+
#
|
|
128
|
+
# @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
|
|
129
|
+
#
|
|
130
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
131
|
+
#
|
|
132
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
133
|
+
#
|
|
134
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
135
|
+
#
|
|
136
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
137
|
+
#
|
|
138
|
+
# @return [nil]
|
|
139
|
+
#
|
|
140
|
+
# @see Sentdm::Models::CallHangupParams
|
|
141
|
+
def hangup(id, params = {})
|
|
142
|
+
parsed, options = Sentdm::CallHangupParams.dump_request(params)
|
|
143
|
+
header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
|
|
144
|
+
@client.request(
|
|
145
|
+
method: :post,
|
|
146
|
+
path: ["v3/calls/%1$s/hangup", id],
|
|
147
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
148
|
+
body: parsed.except(*header_params.keys),
|
|
149
|
+
model: NilClass,
|
|
150
|
+
options: options
|
|
151
|
+
)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Some parameter documentations has been truncated, see
|
|
155
|
+
# {Sentdm::Models::CallListRecordingsParams} for more details.
|
|
156
|
+
#
|
|
157
|
+
# Returns pre-signed links to the recordings of one of your calls, each valid
|
|
158
|
+
# until its url_expires_at. A recording appears once the call was recorded, by a
|
|
159
|
+
# connect answer with record set, a startRecording instruction or the recordings
|
|
160
|
+
# command, and the call.recording_ready webhook has been sent; until then, and for
|
|
161
|
+
# a call that was never recorded, the list is empty. A call recorded more than
|
|
162
|
+
# once lists every recording, oldest first, each under the recording_id its
|
|
163
|
+
# call.recording_ready webhook carried.
|
|
164
|
+
#
|
|
165
|
+
# @overload list_recordings(id, x_profile_id: nil, request_options: {})
|
|
166
|
+
#
|
|
167
|
+
# @param id [String] The call id from the route, as carried by call webhooks and the calls list, for
|
|
168
|
+
#
|
|
169
|
+
# @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
|
|
170
|
+
#
|
|
171
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
172
|
+
#
|
|
173
|
+
# @return [Sentdm::Models::APIResponseOfCallRecordings]
|
|
174
|
+
#
|
|
175
|
+
# @see Sentdm::Models::CallListRecordingsParams
|
|
176
|
+
def list_recordings(id, params = {})
|
|
177
|
+
parsed, options = Sentdm::CallListRecordingsParams.dump_request(params)
|
|
178
|
+
@client.request(
|
|
179
|
+
method: :get,
|
|
180
|
+
path: ["v3/calls/%1$s/recordings", id],
|
|
181
|
+
headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
|
|
182
|
+
model: Sentdm::APIResponseOfCallRecordings,
|
|
183
|
+
options: options
|
|
184
|
+
)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Some parameter documentations has been truncated, see
|
|
188
|
+
# {Sentdm::Models::CallRecordParams} for more details.
|
|
189
|
+
#
|
|
190
|
+
# Starts or stops recording one of your live calls. Use start to begin recording
|
|
191
|
+
# mid-call, or stop to end a recording, whether it was started here or by a
|
|
192
|
+
# connect answer with record set. A call that has already ended answers 409, and
|
|
193
|
+
# so does a call with no phone leg, such as one between two app users, which can't
|
|
194
|
+
# be recorded.
|
|
195
|
+
#
|
|
196
|
+
# @overload record(id, action: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
|
|
197
|
+
#
|
|
198
|
+
# @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
|
|
199
|
+
#
|
|
200
|
+
# @param action [String] Body param: start to begin recording, stop to end it
|
|
201
|
+
#
|
|
202
|
+
# @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
|
|
203
|
+
#
|
|
204
|
+
# @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
205
|
+
#
|
|
206
|
+
# @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
|
|
207
|
+
#
|
|
208
|
+
# @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
209
|
+
#
|
|
210
|
+
# @return [nil]
|
|
211
|
+
#
|
|
212
|
+
# @see Sentdm::Models::CallRecordParams
|
|
213
|
+
def record(id, params = {})
|
|
214
|
+
parsed, options = Sentdm::CallRecordParams.dump_request(params)
|
|
215
|
+
header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
|
|
216
|
+
@client.request(
|
|
217
|
+
method: :post,
|
|
218
|
+
path: ["v3/calls/%1$s/recordings", id],
|
|
219
|
+
headers: parsed.slice(*header_params.keys).transform_keys(header_params),
|
|
220
|
+
body: parsed.except(*header_params.keys),
|
|
221
|
+
model: NilClass,
|
|
222
|
+
options: options
|
|
223
|
+
)
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# @api private
|
|
227
|
+
#
|
|
228
|
+
# @param client [Sentdm::Client]
|
|
229
|
+
def initialize(client:)
|
|
230
|
+
@client = client
|
|
231
|
+
@participants = Sentdm::Resources::Calls::Participants.new(client: client)
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
end
|