sentdm 0.38.1 → 0.39.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.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +1 -1
  4. data/lib/sentdm/client.rb +3 -20
  5. data/lib/sentdm/models/call_event_payload.rb +4 -3
  6. data/lib/sentdm/models/message_send_params.rb +8 -1
  7. data/lib/sentdm/models/template.rb +6 -5
  8. data/lib/sentdm/models/template_body.rb +8 -8
  9. data/lib/sentdm/models/{calls/api_response_of_list_of_call_participant.rb → voice/api_response_of_call.rb} +7 -7
  10. data/lib/sentdm/models/voice/api_response_of_call_recordings.rb +45 -0
  11. data/lib/sentdm/models/voice/api_response_of_calls_list.rb +44 -0
  12. data/lib/sentdm/models/{channels → voice}/api_response_of_voice_token.rb +5 -5
  13. data/lib/sentdm/models/voice/call.rb +149 -0
  14. data/lib/sentdm/models/{calls/participant_remove_params.rb → voice/call_hangup_params.rb} +8 -8
  15. data/lib/sentdm/models/voice/call_list_params.rb +85 -0
  16. data/lib/sentdm/models/{calls/participant_remove_all_params.rb → voice/call_list_recordings_params.rb} +3 -3
  17. data/lib/sentdm/models/voice/call_party.rb +33 -0
  18. data/lib/sentdm/models/{calls/participant_update_params.rb → voice/call_record_params.rb} +10 -17
  19. data/lib/sentdm/models/voice/call_recording.rb +40 -0
  20. data/lib/sentdm/models/voice/call_recordings.rb +26 -0
  21. data/lib/sentdm/models/{calls/participant_list_params.rb → voice/call_retrieve_params.rb} +3 -3
  22. data/lib/sentdm/models/voice/call_timeline_entry.rb +28 -0
  23. data/lib/sentdm/models/voice/calls/api_response_of_list_of_call_participant.rb +51 -0
  24. data/lib/sentdm/models/voice/calls/call_participant.rb +62 -0
  25. data/lib/sentdm/models/voice/calls/call_participant_target.rb +32 -0
  26. data/lib/sentdm/models/voice/calls/participant_add_params.rb +68 -0
  27. data/lib/sentdm/models/voice/calls/participant_list_params.rb +30 -0
  28. data/lib/sentdm/models/voice/calls/participant_remove_all_params.rb +30 -0
  29. data/lib/sentdm/models/voice/calls/participant_remove_params.rb +36 -0
  30. data/lib/sentdm/models/voice/calls/participant_update_params.rb +66 -0
  31. data/lib/sentdm/models/voice/calls_list.rb +28 -0
  32. data/lib/sentdm/models/{channels/voice_create_token_params.rb → voice/token_create_params.rb} +4 -4
  33. data/lib/sentdm/models/{channels → voice}/voice_token.rb +9 -3
  34. data/lib/sentdm/models.rb +2 -30
  35. data/lib/sentdm/resources/channels/voice.rb +13 -56
  36. data/lib/sentdm/resources/channels.rb +2 -2
  37. data/lib/sentdm/resources/voice/calls/participants.rb +233 -0
  38. data/lib/sentdm/resources/voice/calls.rb +238 -0
  39. data/lib/sentdm/resources/voice/tokens.rb +75 -0
  40. data/lib/sentdm/resources/voice.rb +56 -0
  41. data/lib/sentdm/version.rb +1 -1
  42. data/lib/sentdm.rb +30 -28
  43. data/rbi/sentdm/client.rbi +2 -19
  44. data/rbi/sentdm/models/call_event_payload.rbi +6 -4
  45. data/rbi/sentdm/models/message_send_params.rbi +16 -2
  46. data/rbi/sentdm/models/template.rbi +12 -10
  47. data/rbi/sentdm/models/template_body.rbi +12 -12
  48. data/rbi/sentdm/models/voice/api_response_of_call.rbi +76 -0
  49. data/rbi/sentdm/models/voice/api_response_of_call_recordings.rbi +81 -0
  50. data/rbi/sentdm/models/{calls/api_response_of_list_of_call_participant.rbi → voice/api_response_of_calls_list.rbi} +12 -9
  51. data/rbi/sentdm/models/{channels → voice}/api_response_of_voice_token.rbi +6 -8
  52. data/rbi/sentdm/models/voice/call.rbi +196 -0
  53. data/rbi/sentdm/models/{calls/participant_remove_params.rbi → voice/call_hangup_params.rbi} +11 -11
  54. data/rbi/sentdm/models/voice/call_list_params.rbi +114 -0
  55. data/rbi/sentdm/models/{calls/participant_list_params.rbi → voice/call_list_recordings_params.rbi} +3 -3
  56. data/rbi/sentdm/models/voice/call_party.rbi +47 -0
  57. data/rbi/sentdm/models/{calls/participant_update_params.rbi → voice/call_record_params.rbi} +12 -21
  58. data/rbi/sentdm/models/voice/call_recording.rbi +63 -0
  59. data/rbi/sentdm/models/voice/call_recordings.rbi +49 -0
  60. data/rbi/sentdm/models/{calls/participant_remove_all_params.rbi → voice/call_retrieve_params.rbi} +3 -6
  61. data/rbi/sentdm/models/voice/call_timeline_entry.rbi +44 -0
  62. data/rbi/sentdm/models/voice/calls/api_response_of_list_of_call_participant.rbi +84 -0
  63. data/rbi/sentdm/models/voice/calls/call_participant.rbi +97 -0
  64. data/rbi/sentdm/models/voice/calls/call_participant_target.rbi +49 -0
  65. data/rbi/sentdm/models/voice/calls/participant_add_params.rbi +104 -0
  66. data/rbi/sentdm/models/voice/calls/participant_list_params.rbi +53 -0
  67. data/rbi/sentdm/models/voice/calls/participant_remove_all_params.rbi +53 -0
  68. data/rbi/sentdm/models/voice/calls/participant_remove_params.rbi +63 -0
  69. data/rbi/sentdm/models/voice/calls/participant_update_params.rbi +96 -0
  70. data/rbi/sentdm/models/voice/calls_list.rbi +54 -0
  71. data/rbi/sentdm/models/{channels/voice_create_token_params.rbi → voice/token_create_params.rbi} +3 -6
  72. data/rbi/sentdm/models/{channels → voice}/voice_token.rbi +8 -4
  73. data/rbi/sentdm/models.rbi +2 -30
  74. data/rbi/sentdm/resources/channels/voice.rbi +13 -56
  75. data/rbi/sentdm/resources/channels.rbi +2 -2
  76. data/rbi/sentdm/resources/messages.rbi +8 -1
  77. data/rbi/sentdm/resources/voice/calls/participants.rbi +201 -0
  78. data/rbi/sentdm/resources/voice/calls.rbi +209 -0
  79. data/rbi/sentdm/resources/voice/tokens.rbi +73 -0
  80. data/rbi/sentdm/resources/voice.rbi +52 -0
  81. data/sig/sentdm/client.rbs +1 -1
  82. data/sig/sentdm/models/{calls/api_response_of_list_of_call_participant.rbs → voice/api_response_of_call.rbs} +7 -7
  83. data/sig/sentdm/models/voice/api_response_of_call_recordings.rbs +41 -0
  84. data/sig/sentdm/models/voice/api_response_of_calls_list.rbs +41 -0
  85. data/sig/sentdm/models/{channels → voice}/api_response_of_voice_token.rbs +5 -5
  86. data/sig/sentdm/models/voice/call.rbs +110 -0
  87. data/sig/sentdm/models/{calls/participant_remove_params.rbs → voice/call_hangup_params.rbs} +8 -8
  88. data/sig/sentdm/models/voice/call_list_params.rbs +69 -0
  89. data/sig/sentdm/models/{calls/participant_remove_all_params.rbs → voice/call_list_recordings_params.rbs} +6 -8
  90. data/sig/sentdm/models/voice/call_party.rbs +19 -0
  91. data/sig/sentdm/models/{calls/participant_update_params.rbs → voice/call_record_params.rbs} +8 -13
  92. data/sig/sentdm/models/voice/call_recording.rbs +34 -0
  93. data/sig/sentdm/models/voice/call_recordings.rbs +22 -0
  94. data/sig/sentdm/models/{calls/participant_list_params.rbs → voice/call_retrieve_params.rbs} +3 -3
  95. data/sig/sentdm/models/voice/call_timeline_entry.rbs +21 -0
  96. data/sig/sentdm/models/voice/calls/api_response_of_list_of_call_participant.rbs +43 -0
  97. data/sig/sentdm/models/voice/calls/call_participant.rbs +54 -0
  98. data/sig/sentdm/models/voice/calls/call_participant_target.rbs +25 -0
  99. data/sig/sentdm/models/voice/calls/participant_add_params.rbs +65 -0
  100. data/sig/sentdm/models/voice/calls/participant_list_params.rbs +34 -0
  101. data/sig/sentdm/models/voice/calls/participant_remove_all_params.rbs +36 -0
  102. data/sig/sentdm/models/voice/calls/participant_remove_params.rbs +42 -0
  103. data/sig/sentdm/models/voice/calls/participant_update_params.rbs +63 -0
  104. data/sig/sentdm/models/voice/calls_list.rbs +33 -0
  105. data/sig/sentdm/models/{channels/voice_create_token_params.rbs → voice/token_create_params.rbs} +3 -3
  106. data/sig/sentdm/models/{channels → voice}/voice_token.rbs +3 -1
  107. data/sig/sentdm/models.rbs +2 -30
  108. data/sig/sentdm/resources/channels/voice.rbs +0 -10
  109. data/sig/sentdm/resources/voice/calls/participants.rbs +52 -0
  110. data/sig/sentdm/resources/{calls/participants.rbs → voice/calls.rbs} +23 -21
  111. data/sig/sentdm/resources/voice/tokens.rbs +19 -0
  112. data/sig/sentdm/resources/voice.rbs +11 -0
  113. metadata +89 -83
  114. data/lib/sentdm/models/api_response_of_call.rb +0 -43
  115. data/lib/sentdm/models/api_response_of_call_recordings.rb +0 -43
  116. data/lib/sentdm/models/api_response_of_calls_list.rb +0 -42
  117. data/lib/sentdm/models/call.rb +0 -134
  118. data/lib/sentdm/models/call_hangup_params.rb +0 -32
  119. data/lib/sentdm/models/call_list_params.rb +0 -83
  120. data/lib/sentdm/models/call_list_recordings_params.rb +0 -26
  121. data/lib/sentdm/models/call_party.rb +0 -31
  122. data/lib/sentdm/models/call_record_params.rb +0 -55
  123. data/lib/sentdm/models/call_recording.rb +0 -38
  124. data/lib/sentdm/models/call_recordings.rb +0 -24
  125. data/lib/sentdm/models/call_retrieve_params.rb +0 -26
  126. data/lib/sentdm/models/call_timeline_entry.rb +0 -26
  127. data/lib/sentdm/models/calls/call_participant.rb +0 -60
  128. data/lib/sentdm/models/calls/call_participant_target.rb +0 -30
  129. data/lib/sentdm/models/calls/participant_add_params.rb +0 -66
  130. data/lib/sentdm/models/calls_list.rb +0 -26
  131. data/lib/sentdm/resources/calls/participants.rb +0 -231
  132. data/lib/sentdm/resources/calls.rb +0 -236
  133. data/rbi/sentdm/models/api_response_of_call.rbi +0 -74
  134. data/rbi/sentdm/models/api_response_of_call_recordings.rbi +0 -74
  135. data/rbi/sentdm/models/api_response_of_calls_list.rbi +0 -74
  136. data/rbi/sentdm/models/call.rbi +0 -179
  137. data/rbi/sentdm/models/call_hangup_params.rbi +0 -59
  138. data/rbi/sentdm/models/call_list_params.rbi +0 -112
  139. data/rbi/sentdm/models/call_list_recordings_params.rbi +0 -46
  140. data/rbi/sentdm/models/call_party.rbi +0 -41
  141. data/rbi/sentdm/models/call_record_params.rbi +0 -83
  142. data/rbi/sentdm/models/call_recording.rbi +0 -59
  143. data/rbi/sentdm/models/call_recordings.rbi +0 -39
  144. data/rbi/sentdm/models/call_retrieve_params.rbi +0 -46
  145. data/rbi/sentdm/models/call_timeline_entry.rbi +0 -40
  146. data/rbi/sentdm/models/calls/call_participant.rbi +0 -92
  147. data/rbi/sentdm/models/calls/call_participant_target.rbi +0 -47
  148. data/rbi/sentdm/models/calls/participant_add_params.rbi +0 -98
  149. data/rbi/sentdm/models/calls_list.rbi +0 -47
  150. data/rbi/sentdm/resources/calls/participants.rbi +0 -199
  151. data/rbi/sentdm/resources/calls.rbi +0 -207
  152. data/sig/sentdm/models/api_response_of_call.rbs +0 -39
  153. data/sig/sentdm/models/api_response_of_call_recordings.rbs +0 -39
  154. data/sig/sentdm/models/api_response_of_calls_list.rbs +0 -39
  155. data/sig/sentdm/models/call.rbs +0 -101
  156. data/sig/sentdm/models/call_hangup_params.rbs +0 -38
  157. data/sig/sentdm/models/call_list_params.rbs +0 -67
  158. data/sig/sentdm/models/call_list_recordings_params.rbs +0 -30
  159. data/sig/sentdm/models/call_party.rbs +0 -17
  160. data/sig/sentdm/models/call_record_params.rbs +0 -54
  161. data/sig/sentdm/models/call_recording.rbs +0 -32
  162. data/sig/sentdm/models/call_recordings.rbs +0 -17
  163. data/sig/sentdm/models/call_retrieve_params.rbs +0 -30
  164. data/sig/sentdm/models/call_timeline_entry.rbs +0 -19
  165. data/sig/sentdm/models/calls/call_participant.rbs +0 -52
  166. data/sig/sentdm/models/calls/call_participant_target.rbs +0 -23
  167. data/sig/sentdm/models/calls/participant_add_params.rbs +0 -63
  168. data/sig/sentdm/models/calls_list.rbs +0 -26
  169. data/sig/sentdm/resources/calls.rbs +0 -50
data/lib/sentdm/models.rb CHANGED
@@ -41,12 +41,6 @@ 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
-
50
44
  APIResponseOfContact = Sentdm::Models::APIResponseOfContact
51
45
 
52
46
  APIResponseOfContactMessageSummary = Sentdm::Models::APIResponseOfContactMessageSummary
@@ -73,34 +67,10 @@ module Sentdm
73
67
 
74
68
  BrandsBrandData = Sentdm::Models::BrandsBrandData
75
69
 
76
- Call = Sentdm::Models::Call
77
-
78
70
  CallEvent = Sentdm::Models::CallEvent
79
71
 
80
72
  CallEventPayload = Sentdm::Models::CallEventPayload
81
73
 
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
-
104
74
  ChannelEvent = Sentdm::Models::ChannelEvent
105
75
 
106
76
  ChannelEventPayload = Sentdm::Models::ChannelEventPayload
@@ -227,6 +197,8 @@ module Sentdm
227
197
 
228
198
  UserUpdateRoleParams = Sentdm::Models::UserUpdateRoleParams
229
199
 
200
+ Voice = Sentdm::Models::Voice
201
+
230
202
  WebhookCreateParams = Sentdm::Models::WebhookCreateParams
231
203
 
232
204
  WebhookDeleteParams = Sentdm::Models::WebhookDeleteParams
@@ -12,8 +12,8 @@ module Sentdm
12
12
  # number**: each number you hold can carry phone calls on its own
13
13
  # (`POST /v3/channels/voice`), each with the callback URL Sent asks what to do
14
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
15
+ # and voice tokens are minted with `POST /v3/voice/tokens`. Read your voice
16
+ # numbers with `GET /v3/channels/voice` and change one with
17
17
  # `PATCH /v3/channels/voice/{number}`.
18
18
  #
19
19
  # ## Compliance lives on the market
@@ -136,19 +136,23 @@ module Sentdm
136
136
  #
137
137
  # ## What it changes
138
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 |
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 and the status are kept |
145
+ # | key omitted | left exactly as it is |
146
146
  #
147
147
  # `status` is matched ignoring case. Any combination is accepted:
148
148
  # `status: "ACTIVE"` with `default_for_app_calls: true` turns a number on as the
149
149
  # new default, and a `callback_url` sent with either status is written too. A body
150
150
  # that names none of the three is refused.
151
151
  #
152
+ # A number can be on without a callback URL: calls placed from your app then
153
+ # connect straight to the number or user they dial, and calls to the number are
154
+ # declined.
155
+ #
152
156
  # ## What it will refuse
153
157
  #
154
158
  # **`default_for_app_calls: false` is `400`.** An account with active voice
@@ -162,11 +166,6 @@ module Sentdm
162
166
  # **Making an inactive number the default is `400`.** Send `status: "ACTIVE"` in
163
167
  # the same call.
164
168
  #
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
169
  # **A number you never turned voice on for is `404`.** Add it with
171
170
  # `POST /v3/channels/voice`.
172
171
  #
@@ -244,48 +243,6 @@ module Sentdm
244
243
  )
245
244
  end
246
245
 
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
246
  # Some parameter documentations has been truncated, see
290
247
  # {Sentdm::Models::Channels::VoiceRotateSecretParams} for more details.
291
248
  #
@@ -12,8 +12,8 @@ module Sentdm
12
12
  # number**: each number you hold can carry phone calls on its own
13
13
  # (`POST /v3/channels/voice`), each with the callback URL Sent asks what to do
14
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
15
+ # and voice tokens are minted with `POST /v3/voice/tokens`. Read your voice
16
+ # numbers with `GET /v3/channels/voice` and change one with
17
17
  # `PATCH /v3/channels/voice/{number}`.
18
18
  #
19
19
  # ## Compliance lives on the market
@@ -0,0 +1,233 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentdm
4
+ module Resources
5
+ class Voice
6
+ class Calls
7
+ # Phone calls from the numbers you hold, driven by your own callback URL.
8
+ #
9
+ # `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
10
+ # asks what to do with each call on it, and `POST /v3/voice/tokens` mints a
11
+ # short-lived token that lets a user of your app place and receive calls as that
12
+ # number. When a call arrives or a caller presses a key, a signed question is
13
+ # POSTed to the callback URL and the answer decides the call;
14
+ # `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
15
+ # before a real call reaches it, and
16
+ # `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
17
+ # The call events themselves (`call.completed` and the rest) arrive through your
18
+ # webhooks.
19
+ #
20
+ # Every call is a record under `/v3/voice/calls`: read it, list its recordings
21
+ # once one is ready, hang it up, start or stop recording, and add, mute or remove
22
+ # conference participants while it is live. A leg to a phone number runs for at
23
+ # most what your balance affords at the destination's rate.
24
+ class Participants
25
+ # Some parameter documentations has been truncated, see
26
+ # {Sentdm::Models::Voice::Calls::ParticipantUpdateParams} for more details.
27
+ #
28
+ # Mutes or unmutes one participant of the conference room a live call is in, named
29
+ # by the participant's own call id from the participants list: send muted true to
30
+ # silence them, muted false to let them be heard again. Muting a participant who
31
+ # is already muted succeeds, as does unmuting one who is not. A participant who is
32
+ # not in this call's room answers 404. A call that has ended answers 409, as does
33
+ # a call that is not in a conference.
34
+ #
35
+ # @overload update(participant_id, id:, muted: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
36
+ #
37
+ # @param participant_id [String] Path param: The participant's own call id from the route, as listed by the parti
38
+ #
39
+ # @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
40
+ #
41
+ # @param muted [Boolean] Body param: true to mute the participant, false to unmute them
42
+ #
43
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
44
+ #
45
+ # @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
46
+ #
47
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
48
+ #
49
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
50
+ #
51
+ # @return [nil]
52
+ #
53
+ # @see Sentdm::Models::Voice::Calls::ParticipantUpdateParams
54
+ def update(participant_id, params)
55
+ parsed, options = Sentdm::Voice::Calls::ParticipantUpdateParams.dump_request(params)
56
+ id =
57
+ parsed.delete(:id) do
58
+ raise ArgumentError.new("missing required path argument #{_1}")
59
+ end
60
+ header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
61
+ @client.request(
62
+ method: :patch,
63
+ path: ["v3/voice/calls/%1$s/participants/%2$s", id, participant_id],
64
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
65
+ body: parsed.except(*header_params.keys),
66
+ model: NilClass,
67
+ options: options
68
+ )
69
+ end
70
+
71
+ # Some parameter documentations has been truncated, see
72
+ # {Sentdm::Models::Voice::Calls::ParticipantListParams} for more details.
73
+ #
74
+ # Lists who is in the conference room one of your live calls is in: each
75
+ # participant's own call id, who they are, whether the room mutes them, and how
76
+ # long they have been connected. The call itself is one of the participants. Use a
77
+ # participant's id to mute or remove them; it is also a call id, so GET
78
+ # /v3/voice/calls/{id} accepts it. A call that has ended answers 409, as does a
79
+ # call that is not in a conference.
80
+ #
81
+ # @overload list(id, x_profile_id: nil, request_options: {})
82
+ #
83
+ # @param id [String] The call id from the route, as carried by call webhooks and the calls list, for
84
+ #
85
+ # @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
86
+ #
87
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
88
+ #
89
+ # @return [Sentdm::Models::Voice::Calls::APIResponseOfListOfCallParticipant]
90
+ #
91
+ # @see Sentdm::Models::Voice::Calls::ParticipantListParams
92
+ def list(id, params = {})
93
+ parsed, options = Sentdm::Voice::Calls::ParticipantListParams.dump_request(params)
94
+ @client.request(
95
+ method: :get,
96
+ path: ["v3/voice/calls/%1$s/participants", id],
97
+ headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
98
+ model: Sentdm::Voice::Calls::APIResponseOfListOfCallParticipant,
99
+ options: options
100
+ )
101
+ end
102
+
103
+ # Some parameter documentations has been truncated, see
104
+ # {Sentdm::Models::Voice::Calls::ParticipantAddParams} for more details.
105
+ #
106
+ # Dials one of your app users or a phone number into a call that is in a
107
+ # conference room, and answers with the participant's own call record. The
108
+ # participant is a call of their own: it has its own id, can be looked up and hung
109
+ # up, and is billed and reported through call.completed and call.failed like any
110
+ # other call. Every participant needs a positive balance. A phone participant is
111
+ # called from caller_id, which must be one of your numbers, or from the call's
112
+ # owning number when omitted, and needs a destination you may call. Only a call
113
+ # your answer connected to a conference can take participants: a call connected to
114
+ # a user or a number answers 409.
115
+ #
116
+ # @overload add(id, caller_id: nil, sandbox: nil, to: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
117
+ #
118
+ # @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
119
+ #
120
+ # @param caller_id [String, nil] Body param: The number shown to a phone participant as the caller, in E.164 form
121
+ #
122
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
123
+ #
124
+ # @param to [Sentdm::Models::Voice::Calls::CallParticipantTarget] Body param: A participant to add to a call
125
+ #
126
+ # @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
127
+ #
128
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
129
+ #
130
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
131
+ #
132
+ # @return [Sentdm::Models::Voice::APIResponseOfCall]
133
+ #
134
+ # @see Sentdm::Models::Voice::Calls::ParticipantAddParams
135
+ def add(id, params = {})
136
+ parsed, options = Sentdm::Voice::Calls::ParticipantAddParams.dump_request(params)
137
+ header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
138
+ @client.request(
139
+ method: :post,
140
+ path: ["v3/voice/calls/%1$s/participants", id],
141
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
142
+ body: parsed.except(*header_params.keys),
143
+ model: Sentdm::Voice::APIResponseOfCall,
144
+ options: options
145
+ )
146
+ end
147
+
148
+ # Some parameter documentations has been truncated, see
149
+ # {Sentdm::Models::Voice::Calls::ParticipantRemoveParams} for more details.
150
+ #
151
+ # Removes one participant from the conference room a live call is in, named by the
152
+ # participant's own call id from the participants list. Their leg ends and is
153
+ # reported through call.completed like any other call; everyone else stays
154
+ # connected. A participant who is not in this call's room answers 404. A call that
155
+ # has ended answers 409, as does a call that is not in a conference.
156
+ #
157
+ # @overload remove(participant_id, id:, sandbox: nil, x_profile_id: nil, request_options: {})
158
+ #
159
+ # @param participant_id [String] Path param: The participant's own call id from the route, as listed by the parti
160
+ #
161
+ # @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
162
+ #
163
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
164
+ #
165
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
166
+ #
167
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
168
+ #
169
+ # @return [nil]
170
+ #
171
+ # @see Sentdm::Models::Voice::Calls::ParticipantRemoveParams
172
+ def remove(participant_id, params)
173
+ parsed, options = Sentdm::Voice::Calls::ParticipantRemoveParams.dump_request(params)
174
+ id =
175
+ parsed.delete(:id) do
176
+ raise ArgumentError.new("missing required path argument #{_1}")
177
+ end
178
+ header_params = {x_profile_id: "x-profile-id"}
179
+ @client.request(
180
+ method: :delete,
181
+ path: ["v3/voice/calls/%1$s/participants/%2$s", id, participant_id],
182
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
183
+ body: parsed.except(*header_params.keys),
184
+ model: NilClass,
185
+ options: options
186
+ )
187
+ end
188
+
189
+ # Some parameter documentations has been truncated, see
190
+ # {Sentdm::Models::Voice::Calls::ParticipantRemoveAllParams} for more details.
191
+ #
192
+ # Removes every participant from the conference room a live call is in, the call
193
+ # itself included. Every leg ends and is reported through call.completed like any
194
+ # other call. A room that is already empty answers 204 as well. A call that has
195
+ # ended answers 409, as does a call that is not in a conference.
196
+ #
197
+ # @overload remove_all(id, sandbox: 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 sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
202
+ #
203
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
204
+ #
205
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
206
+ #
207
+ # @return [nil]
208
+ #
209
+ # @see Sentdm::Models::Voice::Calls::ParticipantRemoveAllParams
210
+ def remove_all(id, params = {})
211
+ parsed, options = Sentdm::Voice::Calls::ParticipantRemoveAllParams.dump_request(params)
212
+ header_params = {x_profile_id: "x-profile-id"}
213
+ @client.request(
214
+ method: :delete,
215
+ path: ["v3/voice/calls/%1$s/participants", id],
216
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
217
+ body: parsed.except(*header_params.keys),
218
+ model: NilClass,
219
+ options: options
220
+ )
221
+ end
222
+
223
+ # @api private
224
+ #
225
+ # @param client [Sentdm::Client]
226
+ def initialize(client:)
227
+ @client = client
228
+ end
229
+ end
230
+ end
231
+ end
232
+ end
233
+ end
@@ -0,0 +1,238 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentdm
4
+ module Resources
5
+ class Voice
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/voice/tokens` mints a
10
+ # 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/voice/calls`: read it, list its recordings
20
+ # once one 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 Calls
24
+ # Phone calls from the numbers you hold, driven by your own callback URL.
25
+ #
26
+ # `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
27
+ # asks what to do with each call on it, and `POST /v3/voice/tokens` mints a
28
+ # short-lived token that lets a user of your app place and receive calls as that
29
+ # number. When a call arrives or a caller presses a key, a signed question is
30
+ # POSTed to the callback URL and the answer decides the call;
31
+ # `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
32
+ # before a real call reaches it, and
33
+ # `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
34
+ # The call events themselves (`call.completed` and the rest) arrive through your
35
+ # webhooks.
36
+ #
37
+ # Every call is a record under `/v3/voice/calls`: read it, list its recordings
38
+ # once one is ready, hang it up, start or stop recording, and add, mute or remove
39
+ # conference participants while it is live. A leg to a phone number runs for at
40
+ # most what your balance affords at the destination's rate.
41
+ # @return [Sentdm::Resources::Voice::Calls::Participants]
42
+ attr_reader :participants
43
+
44
+ # Some parameter documentations has been truncated, see
45
+ # {Sentdm::Models::Voice::CallRetrieveParams} for more details.
46
+ #
47
+ # Retrieves one of your calls by id: the parties, the owning number, the current
48
+ # status with its failure reason, duration, price, recording availability, and a
49
+ # timeline of when the call entered each status.
50
+ #
51
+ # @overload retrieve(id, x_profile_id: nil, request_options: {})
52
+ #
53
+ # @param id [String] The call id from the route, as carried by call webhooks and the calls list, for
54
+ #
55
+ # @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
56
+ #
57
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
58
+ #
59
+ # @return [Sentdm::Models::Voice::APIResponseOfCall]
60
+ #
61
+ # @see Sentdm::Models::Voice::CallRetrieveParams
62
+ def retrieve(id, params = {})
63
+ parsed, options = Sentdm::Voice::CallRetrieveParams.dump_request(params)
64
+ @client.request(
65
+ method: :get,
66
+ path: ["v3/voice/calls/%1$s", id],
67
+ headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
68
+ model: Sentdm::Voice::APIResponseOfCall,
69
+ options: options
70
+ )
71
+ end
72
+
73
+ # Some parameter documentations has been truncated, see
74
+ # {Sentdm::Models::Voice::CallListParams} for more details.
75
+ #
76
+ # Retrieves a paginated list of your calls, most recent first. Filter by
77
+ # direction, status, the owning number, and the time the call started (from and to
78
+ # are inclusive). Use the call webhooks for real-time updates; this list is for
79
+ # looking calls up afterwards.
80
+ #
81
+ # @overload list(direction: nil, from: nil, number: nil, page: nil, page_size: nil, status: nil, to: nil, x_profile_id: nil, request_options: {})
82
+ #
83
+ # @param direction [String, nil] Query param: Optional direction filter: outbound for calls placed from your app,
84
+ #
85
+ # @param from [Time, nil] Query param: Only calls started at or after this time (ISO 8601)
86
+ #
87
+ # @param number [String, nil] Query param: Optional filter on the number that owns the call, one of your voice
88
+ #
89
+ # @param page [Integer] Query param: Page number (1-indexed)
90
+ #
91
+ # @param page_size [Integer] Query param: Number of items per page
92
+ #
93
+ # @param status [String, nil] Query param: Optional status filter: initiated, ringing, answered, completed, fa
94
+ #
95
+ # @param to [Time, nil] Query param: Only calls started at or before this time (ISO 8601)
96
+ #
97
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
98
+ #
99
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
100
+ #
101
+ # @return [Sentdm::Internal::CallsPage<Sentdm::Models::Voice::Call>]
102
+ #
103
+ # @see Sentdm::Models::Voice::CallListParams
104
+ def list(params = {})
105
+ query_params = [:direction, :from, :number, :page, :page_size, :status, :to]
106
+ parsed, options = Sentdm::Voice::CallListParams.dump_request(params)
107
+ query = Sentdm::Internal::Util.encode_query_params(parsed.slice(*query_params))
108
+ @client.request(
109
+ method: :get,
110
+ path: "v3/voice/calls",
111
+ query: query,
112
+ headers: parsed.except(*query_params).transform_keys(x_profile_id: "x-profile-id"),
113
+ page: Sentdm::Internal::CallsPage,
114
+ model: Sentdm::Voice::Call,
115
+ options: options
116
+ )
117
+ end
118
+
119
+ # Some parameter documentations has been truncated, see
120
+ # {Sentdm::Models::Voice::CallHangupParams} for more details.
121
+ #
122
+ # Ends one of your live calls. The call then ends the way any other call does once
123
+ # the disconnect is reported: an answered call as COMPLETED with call.completed, a
124
+ # call still ringing as NO_ANSWER, REJECTED or FAILED with call.failed. A call
125
+ # that has already ended answers 409, and so does a call with no phone leg, such
126
+ # as one between two app users.
127
+ #
128
+ # @overload hangup(id, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
129
+ #
130
+ # @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
131
+ #
132
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
133
+ #
134
+ # @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
135
+ #
136
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
137
+ #
138
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
139
+ #
140
+ # @return [nil]
141
+ #
142
+ # @see Sentdm::Models::Voice::CallHangupParams
143
+ def hangup(id, params = {})
144
+ parsed, options = Sentdm::Voice::CallHangupParams.dump_request(params)
145
+ header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
146
+ @client.request(
147
+ method: :post,
148
+ path: ["v3/voice/calls/%1$s/hangup", id],
149
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
150
+ body: parsed.except(*header_params.keys),
151
+ model: NilClass,
152
+ options: options
153
+ )
154
+ end
155
+
156
+ # Some parameter documentations has been truncated, see
157
+ # {Sentdm::Models::Voice::CallListRecordingsParams} for more details.
158
+ #
159
+ # Returns pre-signed links to the recordings of one of your calls, each valid
160
+ # until its url_expires_at. A recording appears once the call was recorded, by a
161
+ # connect answer with record set, a startRecording instruction or the recordings
162
+ # command, and the call.recording_ready webhook has been sent; until then, and for
163
+ # a call that was never recorded, the list is empty. A call recorded more than
164
+ # once lists every recording, oldest first, each under the recording_id its
165
+ # call.recording_ready webhook carried.
166
+ #
167
+ # @overload list_recordings(id, x_profile_id: nil, request_options: {})
168
+ #
169
+ # @param id [String] The call id from the route, as carried by call webhooks and the calls list, for
170
+ #
171
+ # @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
172
+ #
173
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
174
+ #
175
+ # @return [Sentdm::Models::Voice::APIResponseOfCallRecordings]
176
+ #
177
+ # @see Sentdm::Models::Voice::CallListRecordingsParams
178
+ def list_recordings(id, params = {})
179
+ parsed, options = Sentdm::Voice::CallListRecordingsParams.dump_request(params)
180
+ @client.request(
181
+ method: :get,
182
+ path: ["v3/voice/calls/%1$s/recordings", id],
183
+ headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
184
+ model: Sentdm::Voice::APIResponseOfCallRecordings,
185
+ options: options
186
+ )
187
+ end
188
+
189
+ # Some parameter documentations has been truncated, see
190
+ # {Sentdm::Models::Voice::CallRecordParams} for more details.
191
+ #
192
+ # Starts or stops recording one of your live calls. Use start to begin recording
193
+ # mid-call, or stop to end a recording, whether it was started here or by a
194
+ # connect answer with record set. A call that has already ended answers 409, and
195
+ # so does a call with no phone leg, such as one between two app users, which can't
196
+ # be recorded.
197
+ #
198
+ # @overload record(id, action: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
199
+ #
200
+ # @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
201
+ #
202
+ # @param action [String] Body param: start to begin recording, stop to end it
203
+ #
204
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
205
+ #
206
+ # @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
207
+ #
208
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
209
+ #
210
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
211
+ #
212
+ # @return [nil]
213
+ #
214
+ # @see Sentdm::Models::Voice::CallRecordParams
215
+ def record(id, params = {})
216
+ parsed, options = Sentdm::Voice::CallRecordParams.dump_request(params)
217
+ header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
218
+ @client.request(
219
+ method: :post,
220
+ path: ["v3/voice/calls/%1$s/recordings", id],
221
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
222
+ body: parsed.except(*header_params.keys),
223
+ model: NilClass,
224
+ options: options
225
+ )
226
+ end
227
+
228
+ # @api private
229
+ #
230
+ # @param client [Sentdm::Client]
231
+ def initialize(client:)
232
+ @client = client
233
+ @participants = Sentdm::Resources::Voice::Calls::Participants.new(client: client)
234
+ end
235
+ end
236
+ end
237
+ end
238
+ end