Skip to content

Commit

Permalink
refactor!: Use DtmfSettings builder
Browse files Browse the repository at this point in the history
  • Loading branch information
SMadani committed Jul 30, 2024
1 parent 7c15ab9 commit da8f54e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.6.0] - 2024-07-31
## [0.6.0] - 2024-07-30

### Added
- SIM Swap API
- Number Verification API

### Changed
- `InputAction.Builder.dtmf` extension method uses `DtmfSettings` builder instead of setters

## [0.5.0] - 2024-07-25

### Added
Expand Down
9 changes: 2 additions & 7 deletions src/main/kotlin/com/vonage/client/kt/Voice.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,8 @@ fun Call.Builder.advancedMachineDetection(amd: AdvancedMachineDetection.Builder.
fun InputAction.Builder.speech(settings: SpeechSettings.Builder.() -> Unit = {}): InputAction.Builder =
speech(SpeechSettings.builder().apply(settings).build())

fun InputAction.Builder.dtmf(timeout: Int? = null, maxDigits: Int? = null, submitOnHash: Boolean? = null): InputAction.Builder {
val dtmfSettings = DtmfSettings()
dtmfSettings.timeOut = timeout
dtmfSettings.maxDigits = maxDigits
dtmfSettings.isSubmitOnHash = submitOnHash
return dtmf(dtmfSettings)
}
fun InputAction.Builder.dtmf(settings: DtmfSettings.Builder.() -> Unit = {}): InputAction.Builder =
dtmf(DtmfSettings.builder().apply(settings).build())

fun ConversationAction.Builder.transcription(settings: TranscriptionSettings.Builder.() -> Unit = {}):
ConversationAction.Builder = transcription(TranscriptionSettings.builder().apply(settings).build())
Expand Down
7 changes: 4 additions & 3 deletions src/test/kotlin/com/vonage/client/kt/VoiceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -918,13 +918,14 @@ class VoiceTest : AbstractTest() {
inputAction {
eventUrl(eventUrl); eventMethod(inputEventMethod)
type(inputActionTypes); speech {
uuid(speechUuid); context(speechContext)
uuid(speechUuid); context(speechContext); saveAudio(saveAudio)
language(SpeechSettings.Language.UKRAINIAN)
endOnSilence(endOnSilenceSpeech); maxDuration(maxDuration)
sensitivity(sensitivity); startTimeout(startTimeout)
saveAudio(saveAudio);
}
dtmf(timeout = dtmfTimeout, maxDigits = maxDigits, submitOnHash = submitOnHash)
dtmf {
timeOut(dtmfTimeout); maxDigits(maxDigits); submitOnHash(submitOnHash)
}
},
notifyAction(eventUrl, customHeaders, notifyEventMethod),
recordAction {
Expand Down

0 comments on commit da8f54e

Please sign in to comment.