Skip to content

Commit 11dce53

Browse files
author
stlc-bot
committed
feat(api)!: move calls and voice tokens under the voice resource
Stainless-Generated-From: d6bdab1
1 parent 3fc7a60 commit 11dce53

94 files changed

Lines changed: 1548 additions & 876 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎sent-java-core/src/main/kotlin/dm/sent/client/SentClient.kt‎

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package dm.sent.client
44

55
import dm.sent.core.ClientOptions
6-
import dm.sent.services.blocking.CallService
76
import dm.sent.services.blocking.ChannelService
87
import dm.sent.services.blocking.ContactService
98
import dm.sent.services.blocking.ConversationService
@@ -13,6 +12,7 @@ import dm.sent.services.blocking.NumberService
1312
import dm.sent.services.blocking.ProfileService
1413
import dm.sent.services.blocking.TemplateService
1514
import dm.sent.services.blocking.UserService
15+
import dm.sent.services.blocking.VoiceService
1616
import dm.sent.services.blocking.WebhookService
1717
import java.util.function.Consumer
1818

@@ -150,24 +150,7 @@ interface SentClient {
150150
*/
151151
fun conversations(): ConversationService
152152

153-
/**
154-
* Phone calls from the numbers you hold, driven by your own callback URL.
155-
*
156-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to
157-
* do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived token that
158-
* lets a user of your app place and receive calls as that number. When a call arrives or a
159-
* caller presses a key, a signed question is POSTed to the callback URL and the answer decides
160-
* the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
161-
* before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces
162-
* the signing secret. The call events themselves (`call.completed` and the rest) arrive through
163-
* your webhooks.
164-
*
165-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready,
166-
* hang it up, start or stop recording, and add, mute or remove conference participants while it
167-
* is live. A leg to a phone number runs for at most what your balance affords at the
168-
* destination's rate.
169-
*/
170-
fun calls(): CallService
153+
fun voice(): VoiceService
171154

172155
fun channels(): ChannelService
173156

@@ -303,24 +286,7 @@ interface SentClient {
303286
*/
304287
fun conversations(): ConversationService.WithRawResponse
305288

306-
/**
307-
* Phone calls from the numbers you hold, driven by your own callback URL.
308-
*
309-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks
310-
* what to do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived
311-
* token that lets a user of your app place and receive calls as that number. When a call
312-
* arrives or a caller presses a key, a signed question is POSTed to the callback URL and
313-
* the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL
314-
* answers the way we need before a real call reaches it, and `POST
315-
* /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events
316-
* themselves (`call.completed` and the rest) arrive through your webhooks.
317-
*
318-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready,
319-
* hang it up, start or stop recording, and add, mute or remove conference participants
320-
* while it is live. A leg to a phone number runs for at most what your balance affords at
321-
* the destination's rate.
322-
*/
323-
fun calls(): CallService.WithRawResponse
289+
fun voice(): VoiceService.WithRawResponse
324290

325291
fun channels(): ChannelService.WithRawResponse
326292

‎sent-java-core/src/main/kotlin/dm/sent/client/SentClientAsync.kt‎

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
package dm.sent.client
44

55
import dm.sent.core.ClientOptions
6-
import dm.sent.services.async.CallServiceAsync
76
import dm.sent.services.async.ChannelServiceAsync
87
import dm.sent.services.async.ContactServiceAsync
98
import dm.sent.services.async.ConversationServiceAsync
@@ -13,6 +12,7 @@ import dm.sent.services.async.NumberServiceAsync
1312
import dm.sent.services.async.ProfileServiceAsync
1413
import dm.sent.services.async.TemplateServiceAsync
1514
import dm.sent.services.async.UserServiceAsync
15+
import dm.sent.services.async.VoiceServiceAsync
1616
import dm.sent.services.async.WebhookServiceAsync
1717
import java.util.function.Consumer
1818

@@ -150,24 +150,7 @@ interface SentClientAsync {
150150
*/
151151
fun conversations(): ConversationServiceAsync
152152

153-
/**
154-
* Phone calls from the numbers you hold, driven by your own callback URL.
155-
*
156-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to
157-
* do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived token that
158-
* lets a user of your app place and receive calls as that number. When a call arrives or a
159-
* caller presses a key, a signed question is POSTed to the callback URL and the answer decides
160-
* the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
161-
* before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces
162-
* the signing secret. The call events themselves (`call.completed` and the rest) arrive through
163-
* your webhooks.
164-
*
165-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready,
166-
* hang it up, start or stop recording, and add, mute or remove conference participants while it
167-
* is live. A leg to a phone number runs for at most what your balance affords at the
168-
* destination's rate.
169-
*/
170-
fun calls(): CallServiceAsync
153+
fun voice(): VoiceServiceAsync
171154

172155
fun channels(): ChannelServiceAsync
173156

@@ -303,24 +286,7 @@ interface SentClientAsync {
303286
*/
304287
fun conversations(): ConversationServiceAsync.WithRawResponse
305288

306-
/**
307-
* Phone calls from the numbers you hold, driven by your own callback URL.
308-
*
309-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks
310-
* what to do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived
311-
* token that lets a user of your app place and receive calls as that number. When a call
312-
* arrives or a caller presses a key, a signed question is POSTed to the callback URL and
313-
* the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL
314-
* answers the way we need before a real call reaches it, and `POST
315-
* /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events
316-
* themselves (`call.completed` and the rest) arrive through your webhooks.
317-
*
318-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready,
319-
* hang it up, start or stop recording, and add, mute or remove conference participants
320-
* while it is live. A leg to a phone number runs for at most what your balance affords at
321-
* the destination's rate.
322-
*/
323-
fun calls(): CallServiceAsync.WithRawResponse
289+
fun voice(): VoiceServiceAsync.WithRawResponse
324290

325291
fun channels(): ChannelServiceAsync.WithRawResponse
326292

‎sent-java-core/src/main/kotlin/dm/sent/client/SentClientAsyncImpl.kt‎

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ package dm.sent.client
44

55
import dm.sent.core.ClientOptions
66
import dm.sent.core.getPackageVersion
7-
import dm.sent.services.async.CallServiceAsync
8-
import dm.sent.services.async.CallServiceAsyncImpl
97
import dm.sent.services.async.ChannelServiceAsync
108
import dm.sent.services.async.ChannelServiceAsyncImpl
119
import dm.sent.services.async.ContactServiceAsync
@@ -24,6 +22,8 @@ import dm.sent.services.async.TemplateServiceAsync
2422
import dm.sent.services.async.TemplateServiceAsyncImpl
2523
import dm.sent.services.async.UserServiceAsync
2624
import dm.sent.services.async.UserServiceAsyncImpl
25+
import dm.sent.services.async.VoiceServiceAsync
26+
import dm.sent.services.async.VoiceServiceAsyncImpl
2727
import dm.sent.services.async.WebhookServiceAsync
2828
import dm.sent.services.async.WebhookServiceAsyncImpl
2929
import java.util.function.Consumer
@@ -75,7 +75,9 @@ class SentClientAsyncImpl(private val clientOptions: ClientOptions) : SentClient
7575
ConversationServiceAsyncImpl(clientOptionsWithUserAgent)
7676
}
7777

78-
private val calls: CallServiceAsync by lazy { CallServiceAsyncImpl(clientOptionsWithUserAgent) }
78+
private val voice: VoiceServiceAsync by lazy {
79+
VoiceServiceAsyncImpl(clientOptionsWithUserAgent)
80+
}
7981

8082
private val channels: ChannelServiceAsync by lazy {
8183
ChannelServiceAsyncImpl(clientOptionsWithUserAgent)
@@ -188,24 +190,7 @@ class SentClientAsyncImpl(private val clientOptions: ClientOptions) : SentClient
188190
*/
189191
override fun conversations(): ConversationServiceAsync = conversations
190192

191-
/**
192-
* Phone calls from the numbers you hold, driven by your own callback URL.
193-
*
194-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to
195-
* do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived token that
196-
* lets a user of your app place and receive calls as that number. When a call arrives or a
197-
* caller presses a key, a signed question is POSTed to the callback URL and the answer decides
198-
* the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
199-
* before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces
200-
* the signing secret. The call events themselves (`call.completed` and the rest) arrive through
201-
* your webhooks.
202-
*
203-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready,
204-
* hang it up, start or stop recording, and add, mute or remove conference participants while it
205-
* is live. A leg to a phone number runs for at most what your balance affords at the
206-
* destination's rate.
207-
*/
208-
override fun calls(): CallServiceAsync = calls
193+
override fun voice(): VoiceServiceAsync = voice
209194

210195
override fun channels(): ChannelServiceAsync = channels
211196

@@ -255,8 +240,8 @@ class SentClientAsyncImpl(private val clientOptions: ClientOptions) : SentClient
255240
ConversationServiceAsyncImpl.WithRawResponseImpl(clientOptions)
256241
}
257242

258-
private val calls: CallServiceAsync.WithRawResponse by lazy {
259-
CallServiceAsyncImpl.WithRawResponseImpl(clientOptions)
243+
private val voice: VoiceServiceAsync.WithRawResponse by lazy {
244+
VoiceServiceAsyncImpl.WithRawResponseImpl(clientOptions)
260245
}
261246

262247
private val channels: ChannelServiceAsync.WithRawResponse by lazy {
@@ -374,24 +359,7 @@ class SentClientAsyncImpl(private val clientOptions: ClientOptions) : SentClient
374359
*/
375360
override fun conversations(): ConversationServiceAsync.WithRawResponse = conversations
376361

377-
/**
378-
* Phone calls from the numbers you hold, driven by your own callback URL.
379-
*
380-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks
381-
* what to do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived
382-
* token that lets a user of your app place and receive calls as that number. When a call
383-
* arrives or a caller presses a key, a signed question is POSTed to the callback URL and
384-
* the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL
385-
* answers the way we need before a real call reaches it, and `POST
386-
* /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events
387-
* themselves (`call.completed` and the rest) arrive through your webhooks.
388-
*
389-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready,
390-
* hang it up, start or stop recording, and add, mute or remove conference participants
391-
* while it is live. A leg to a phone number runs for at most what your balance affords at
392-
* the destination's rate.
393-
*/
394-
override fun calls(): CallServiceAsync.WithRawResponse = calls
362+
override fun voice(): VoiceServiceAsync.WithRawResponse = voice
395363

396364
override fun channels(): ChannelServiceAsync.WithRawResponse = channels
397365

‎sent-java-core/src/main/kotlin/dm/sent/client/SentClientImpl.kt‎

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ package dm.sent.client
44

55
import dm.sent.core.ClientOptions
66
import dm.sent.core.getPackageVersion
7-
import dm.sent.services.blocking.CallService
8-
import dm.sent.services.blocking.CallServiceImpl
97
import dm.sent.services.blocking.ChannelService
108
import dm.sent.services.blocking.ChannelServiceImpl
119
import dm.sent.services.blocking.ContactService
@@ -24,6 +22,8 @@ import dm.sent.services.blocking.TemplateService
2422
import dm.sent.services.blocking.TemplateServiceImpl
2523
import dm.sent.services.blocking.UserService
2624
import dm.sent.services.blocking.UserServiceImpl
25+
import dm.sent.services.blocking.VoiceService
26+
import dm.sent.services.blocking.VoiceServiceImpl
2727
import dm.sent.services.blocking.WebhookService
2828
import dm.sent.services.blocking.WebhookServiceImpl
2929
import java.util.function.Consumer
@@ -65,7 +65,7 @@ class SentClientImpl(private val clientOptions: ClientOptions) : SentClient {
6565
ConversationServiceImpl(clientOptionsWithUserAgent)
6666
}
6767

68-
private val calls: CallService by lazy { CallServiceImpl(clientOptionsWithUserAgent) }
68+
private val voice: VoiceService by lazy { VoiceServiceImpl(clientOptionsWithUserAgent) }
6969

7070
private val channels: ChannelService by lazy { ChannelServiceImpl(clientOptionsWithUserAgent) }
7171

@@ -176,24 +176,7 @@ class SentClientImpl(private val clientOptions: ClientOptions) : SentClient {
176176
*/
177177
override fun conversations(): ConversationService = conversations
178178

179-
/**
180-
* Phone calls from the numbers you hold, driven by your own callback URL.
181-
*
182-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to
183-
* do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived token that
184-
* lets a user of your app place and receive calls as that number. When a call arrives or a
185-
* caller presses a key, a signed question is POSTed to the callback URL and the answer decides
186-
* the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
187-
* before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces
188-
* the signing secret. The call events themselves (`call.completed` and the rest) arrive through
189-
* your webhooks.
190-
*
191-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready,
192-
* hang it up, start or stop recording, and add, mute or remove conference participants while it
193-
* is live. A leg to a phone number runs for at most what your balance affords at the
194-
* destination's rate.
195-
*/
196-
override fun calls(): CallService = calls
179+
override fun voice(): VoiceService = voice
197180

198181
override fun channels(): ChannelService = channels
199182

@@ -243,8 +226,8 @@ class SentClientImpl(private val clientOptions: ClientOptions) : SentClient {
243226
ConversationServiceImpl.WithRawResponseImpl(clientOptions)
244227
}
245228

246-
private val calls: CallService.WithRawResponse by lazy {
247-
CallServiceImpl.WithRawResponseImpl(clientOptions)
229+
private val voice: VoiceService.WithRawResponse by lazy {
230+
VoiceServiceImpl.WithRawResponseImpl(clientOptions)
248231
}
249232

250233
private val channels: ChannelService.WithRawResponse by lazy {
@@ -362,24 +345,7 @@ class SentClientImpl(private val clientOptions: ClientOptions) : SentClient {
362345
*/
363346
override fun conversations(): ConversationService.WithRawResponse = conversations
364347

365-
/**
366-
* Phone calls from the numbers you hold, driven by your own callback URL.
367-
*
368-
* `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks
369-
* what to do with each call on it, and `POST /v3/channels/voice/tokens` mints a short-lived
370-
* token that lets a user of your app place and receive calls as that number. When a call
371-
* arrives or a caller presses a key, a signed question is POSTed to the callback URL and
372-
* the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL
373-
* answers the way we need before a real call reaches it, and `POST
374-
* /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events
375-
* themselves (`call.completed` and the rest) arrive through your webhooks.
376-
*
377-
* Every call is a record under `/v3/calls`: read it, list its recordings once one is ready,
378-
* hang it up, start or stop recording, and add, mute or remove conference participants
379-
* while it is live. A leg to a phone number runs for at most what your balance affords at
380-
* the destination's rate.
381-
*/
382-
override fun calls(): CallService.WithRawResponse = calls
348+
override fun voice(): VoiceService.WithRawResponse = voice
383349

384350
override fun channels(): ChannelService.WithRawResponse = channels
385351

0 commit comments

Comments
 (0)