Skip to content

Commit 5b5fdb9

Browse files
committed
feat: Add network_apis capability
1 parent ffff17b commit 5b5fdb9

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ First stable GA release
1010
### Added
1111
- `Voice.downloadRecording(String, Path)` method
1212
- `InputAction.Builder.type` Boolean overload method (preferable to the Collection method)
13+
- `Application.Builder#networkApis` DSL method
1314

1415
### Changed
1516
- `Sms.wasSuccessfullySent()` now an extension function rather than being part of the client

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<dependency>
5656
<groupId>com.vonage</groupId>
5757
<artifactId>server-sdk</artifactId>
58-
<version>8.11.0</version>
58+
<version>8.12.0</version>
5959
</dependency>
6060
<dependency>
6161
<groupId>org.jetbrains.kotlin</groupId>

src/main/kotlin/com/vonage/client/kt/Application.kt

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fun Application.Builder.removeCapabilities(vararg capabilities: Capability.Type)
225225
}
226226

227227
/**
228-
* Adds a [Voice] capability to the application.
228+
* Adds the [Voice] capability to the application.
229229
*
230230
* @param capability A lambda function for setting additional properties on the capability.
231231
*
@@ -235,7 +235,7 @@ fun Application.Builder.voice(capability: Voice.Builder.() -> Unit): Application
235235
addCapability(Voice.builder().apply(capability).build())
236236

237237
/**
238-
* Adds a [Messages] capability to the application.
238+
* Adds the [Messages] capability to the application.
239239
*
240240
* @param capability A lambda function for setting additional properties on the capability.
241241
*
@@ -245,7 +245,7 @@ fun Application.Builder.messages(capability: Messages.Builder.() -> Unit): Appli
245245
addCapability(Messages.builder().apply(capability).build())
246246

247247
/**
248-
* Adds a [Verify] capability to the application.
248+
* Adds the [Verify] capability to the application.
249249
*
250250
* @param capability A lambda function for setting additional properties on the capability.
251251
*
@@ -255,7 +255,7 @@ fun Application.Builder.verify(capability: Verify.Builder.() -> Unit): Applicati
255255
addCapability(Verify.builder().apply(capability).build())
256256

257257
/**
258-
* Adds an [Rtc] capability to the application.
258+
* Adds the [Rtc] capability to the application.
259259
*
260260
* @param capability A lambda function for setting additional properties on the capability.
261261
*
@@ -265,8 +265,19 @@ fun Application.Builder.rtc(capability: Rtc.Builder.() -> Unit): Application.Bui
265265
addCapability(Rtc.builder().apply(capability).build())
266266

267267
/**
268-
* Adds a [Vbc] capability to the application.
268+
* Adds the [Vbc] capability to the application.
269269
*
270270
* @return The application builder.
271271
*/
272272
fun Application.Builder.vbc(): Application.Builder = addCapability(Vbc.builder().build())
273+
274+
/**
275+
* Adds the [NetworkApis] capability to the application.
276+
*
277+
* @param capability A lambda function for setting additional properties on the capability.
278+
*
279+
* @return The application builder.
280+
*/
281+
fun Application.Builder.networkApis(capability: NetworkApis.Builder.() -> Unit): Application.Builder =
282+
addCapability(NetworkApis.builder().apply(capability).build())
283+

src/test/kotlin/com/vonage/client/kt/ApplicationTest.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class ApplicationTest : AbstractTest() {
3030
private val baseUrl = "/v2/applications"
3131
private val appUrl = "$baseUrl/$testUuid"
3232
private val answerUrl = "$exampleUrlBase/answer"
33+
private val redirectUri = "$exampleUrlBase/redirect"
3334
private val page = 3
3435
private val pageSize = 25
3536
private val connectionTimeout = 500
@@ -43,6 +44,7 @@ class ApplicationTest : AbstractTest() {
4344
private val fallbackAnswerUrl = "$answerUrl-fallback"
4445
private val conversationsTtl = 12
4546
private val name = "My Application"
47+
private val networkApplicationId = "2bzfIFqRG128IcjSj1YhZNtw6LADG"
4648
private val publicKey = "-----BEGIN PUBLIC KEY-----\npublic key\n-----END PUBLIC KEY-----"
4749
private val improveAi = false
4850
private val basicApplicationRequest = mapOf(
@@ -98,6 +100,10 @@ class ApplicationTest : AbstractTest() {
98100
)
99101
)
100102
),
103+
"network_apis" to mapOf(
104+
"redirect_uri" to redirectUri,
105+
"network_application_id" to networkApplicationId
106+
),
101107
"vbc" to emptyMap(),
102108
"verify" to mapOf(
103109
"webhooks" to mapOf(
@@ -299,6 +305,7 @@ class ApplicationTest : AbstractTest() {
299305
Capability.Type.VOICE,
300306
Capability.Type.RTC,
301307
Capability.Type.MESSAGES,
308+
Capability.Type.NETWORK,
302309
Capability.Type.VERIFY
303310
)
304311
}
@@ -358,6 +365,10 @@ class ApplicationTest : AbstractTest() {
358365
method(statusMethod)
359366
}
360367
}
368+
networkApis {
369+
redirectUri(redirectUri)
370+
networkApplicationId(networkApplicationId)
371+
}
361372
vbc()
362373
verify {
363374
status {

0 commit comments

Comments
 (0)