File tree Expand file tree Collapse file tree 4 files changed +40
-5
lines changed
main/kotlin/com/vonage/client/kt
test/kotlin/com/vonage/client/kt Expand file tree Collapse file tree 4 files changed +40
-5
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
5
5
and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
6
6
7
- ## [ 1.0.0] - 2024-10-25 (expected)
7
+ ## [ 1.0.0] - 2024-10-25
8
8
First stable GA release
9
9
10
10
### Added
11
11
- ` Voice.downloadRecording(String, Path) ` method
12
+ - ` InputAction.Builder.type ` Boolean overload method (preferable to the Collection method)
12
13
13
14
### Changed
14
15
- ` Sms.wasSuccessfullySent() ` now an extension function rather than being part of the client
Original file line number Diff line number Diff line change 47
47
<kotlin .compiler.languageVersion>2.0</kotlin .compiler.languageVersion>
48
48
<kotlin .compiler.apiVersion>${kotlin.compiler.languageVersion} </kotlin .compiler.apiVersion>
49
49
<kotlin .compiler.jvmTarget>1.8</kotlin .compiler.jvmTarget>
50
- <kotlin .lib.version>2.0.20 </kotlin .lib.version>
50
+ <kotlin .lib.version>2.0.21 </kotlin .lib.version>
51
51
<java .version>8</java .version>
52
52
</properties >
53
53
Original file line number Diff line number Diff line change @@ -217,6 +217,25 @@ fun InputAction.Builder.speech(settings: SpeechSettings.Builder.() -> Unit = {})
217
217
fun InputAction.Builder.dtmf (settings : DtmfSettings .Builder .() -> Unit = {}): InputAction .Builder =
218
218
dtmf(DtmfSettings .builder().apply (settings).build())
219
219
220
+ /* *
221
+ * Sets the input type(s). At least one must be specified (i.e. set to `true`).
222
+ *
223
+ * @param dtmf Whether to accept DTMF input.
224
+ * @param speech Whether to accept speech input.
225
+ *
226
+ * @return The updated [InputAction.Builder].
227
+ * @see InputAction.Builder.type(Collection)
228
+ */
229
+ fun InputAction.Builder.type (dtmf : Boolean = false, speech : Boolean = false): InputAction .Builder {
230
+ var type = mutableListOf<String >()
231
+ if (dtmf) type.add(" dtmf" )
232
+ if (speech) type.add(" speech" )
233
+ if (type.isEmpty()) {
234
+ throw IllegalArgumentException (" At least one input type must be specified." )
235
+ }
236
+ return type(type)
237
+ }
238
+
220
239
/* *
221
240
* Configure the behaviour of call recording transcription. If present (even if all settings are default),
222
241
* transcription is activated. The [ConversationAction.Builder.record] parameter must also be set to `true`.
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import com.vonage.client.common.HttpMethod
19
19
import com.vonage.client.voice.*
20
20
import com.vonage.client.voice.ncco.*
21
21
import org.junit.jupiter.api.Assertions.assertArrayEquals
22
+ import org.junit.jupiter.api.assertThrows
22
23
import java.nio.file.Files
23
24
import java.util.*
24
25
import kotlin.io.path.deleteExisting
@@ -596,11 +597,25 @@ class VoiceTest : AbstractTest() {
596
597
597
598
@Test
598
599
fun `create call with input action required parameters only` () {
599
- val types = listOf (" dtmf" , " speech" )
600
600
testSingleNcco(
601
- additionalParams = mapOf (" type" to types ),
602
- ncco = inputAction { type(types ) }
601
+ additionalParams = mapOf (" type" to listOf ( " dtmf " , " speech " ) ),
602
+ ncco = inputAction { type(speech = true , dtmf = true ) }
603
603
)
604
+ testSingleNcco(
605
+ additionalParams = mapOf (" type" to listOf (" dtmf" )),
606
+ ncco = inputAction { type(dtmf = true ) }
607
+ )
608
+ testSingleNcco(
609
+ additionalParams = mapOf (" type" to listOf (" speech" )),
610
+ ncco = inputAction { type(speech = true ) }
611
+ )
612
+ }
613
+
614
+ @Test
615
+ fun `at least one type should be specified in inputAction` () {
616
+ assertThrows<IllegalArgumentException > {
617
+ inputAction { type() }
618
+ }
604
619
}
605
620
606
621
@Test
You can’t perform that action at this time.
0 commit comments