Skip to content

Commit a720db3

Browse files
committed
fix: Update snippets to be compatible with 2.0.0
1 parent a2fed57 commit a720db3

20 files changed

+34
-337
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
os: [ubuntu-latest, macos-latest, windows-latest]
2222
steps:
2323
- name: Checkout the repo
24-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
24+
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2
2525
- name: Setup Java
26-
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12
26+
uses: actions/setup-java@3b6c050358614dd082e53cdbc55580431fc4e437
2727
with:
2828
distribution: 'temurin'
2929
java-version: ${{ matrix.java }}

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ jobs:
2727
build-mode: autobuild
2828
steps:
2929
- name: Checkout repository
30-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
30+
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2
3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@1bb15d06a6fbb5d9d9ffd228746bf8ee208caec8
32+
uses: github/codeql-action/init@486ab5a2922b634015408a83e10f6867efb5922c
3333
with:
3434
languages: ${{ matrix.language }}
3535
build-mode: ${{ matrix.build-mode }}
3636
- name: Perform CodeQL Analysis
37-
uses: github/codeql-action/analyze@1bb15d06a6fbb5d9d9ffd228746bf8ee208caec8
37+
uses: github/codeql-action/analyze@486ab5a2922b634015408a83e10f6867efb5922c
3838
with:
3939
category: "/language:${{matrix.language}}"

SNIPPETS.md

Lines changed: 8 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ This file was generated by running [AggregateSnippets.kt](src/main/kotlin/Aggreg
1818
- [**Number Insight**](#number-insight)
1919
- [**Application**](#application)
2020
- [**Account**](#account)
21-
- [**Pricing**](#pricing)
2221

2322
## Initialize
2423
### Full Auth
@@ -1632,14 +1631,6 @@ val response = client.verify.sendVerification(VERIFY_BRAND_NAME) {
16321631
println("Verification sent: ${response.requestId}")
16331632
```
16341633

1635-
### Send Verification Request WhatsApp Interactive
1636-
```kotlin
1637-
val response = client.verify.sendVerification(VERIFY_BRAND_NAME) {
1638-
whatsappCodeless(VERIFY_NUMBER, VERIFY_WHATSAPP_NUMBER)
1639-
}
1640-
println("Verification sent: ${response.requestId}")
1641-
```
1642-
16431634
### Cancel Verification Request
16441635
```kotlin
16451636
client.verify.request(VERIFY_REQUEST_ID).cancel()
@@ -1747,7 +1738,7 @@ client.redact.redactInsight(VONAGE_REDACT_ID)
17471738
client.redact.redactSms(VONAGE_REDACT_ID)
17481739

17491740
// Inbound
1750-
client.redact.redactSms(VONAGE_REDACT_ID, RedactRequest.Type.INBOUND)
1741+
client.redact.redactSms(VONAGE_REDACT_ID, Type.INBOUND)
17511742
```
17521743

17531744
### Redact Verification
@@ -1761,7 +1752,7 @@ client.redact.redactVerification(VONAGE_REDACT_ID)
17611752
client.redact.redactCall(VONAGE_REDACT_ID)
17621753

17631754
// Inbound
1764-
client.redact.redactCall(VONAGE_REDACT_ID, RedactRequest.Type.INBOUND)
1755+
client.redact.redactCall(VONAGE_REDACT_ID, Type.INBOUND)
17651756
```
17661757

17671758
### Redact Message
@@ -1770,7 +1761,7 @@ client.redact.redactCall(VONAGE_REDACT_ID, RedactRequest.Type.INBOUND)
17701761
client.redact.redactMessage(VONAGE_REDACT_ID)
17711762

17721763
// Inbound
1773-
client.redact.redactMessage(VONAGE_REDACT_ID, RedactRequest.Type.INBOUND)
1764+
client.redact.redactMessage(VONAGE_REDACT_ID, Type.INBOUND)
17741765
```
17751766

17761767
## SIM Swap
@@ -1810,7 +1801,7 @@ embeddedServer(Netty, port = 8000) {
18101801
inputAction {
18111802
eventUrl(call.request.path().replace("answer", "asr"))
18121803
speech {
1813-
language(SpeechSettings.Language.ENGLISH_UNITED_STATES)
1804+
language(Language.ENGLISH_UNITED_STATES)
18141805
}
18151806
}
18161807
).toJson()
@@ -1842,11 +1833,11 @@ val now = Instant.now()
18421833
val yesterday = now.minus(Duration.ofDays(1))
18431834

18441835
val calls = client.voice.listCalls {
1845-
dateStart(yesterday)
1846-
dateEnd(now)
1836+
startDate(yesterday)
1837+
endDate(now)
18471838
}
18481839

1849-
calls.embedded.callInfos.forEach {
1840+
calls.callInfos.forEach {
18501841
println(it.toJson())
18511842
}
18521843
```
@@ -1912,7 +1903,6 @@ embeddedServer(Netty, port = 8000) {
19121903
recordAction {
19131904
eventUrl(call.request.path().replace("answer", "recordings"))
19141905
channels(2)
1915-
split(SplitRecording.CONVERSATION)
19161906
},
19171907
connectToPstn(VOICE_TO_NUMBER) {
19181908
from(VONAGE_VIRTUAL_NUMBER)
@@ -2193,7 +2183,7 @@ println(response)
21932183
embeddedServer(Netty, port = 8000) {
21942184
routing {
21952185
post ("/webhooks/insight") {
2196-
val insightDetails = AdvancedInsightResponse.fromJson(call.receive())
2186+
val insightDetails = Jsonable.fromJson(call.receive(), AdvancedInsightResponse::class.java)
21972187
println(insightDetails)
21982188
call.respond(204)
21992189
}
@@ -2344,46 +2334,3 @@ val settings = client.account.updateSettings(incomingSmsUrl = ACCOUNT_SMS_CALLBA
23442334
println("moCallBackUrl is now ${settings.incomingSmsUrl}")
23452335
```
23462336

2347-
## Pricing
2348-
### Get Outbound SMS Prefix Price
2349-
```kotlin
2350-
val response = client.pricing.getOutboundSmsPriceForPrefix(PRICING_DIAL_PREFIX)
2351-
response.forEach { println(it.toJson()) }
2352-
```
2353-
2354-
### List Outbound SMS Prices
2355-
```kotlin
2356-
val prices = client.pricing.listOutboundSmsPrices()
2357-
2358-
prices.forEach { println(
2359-
"It will cost ${it.defaultPrice} ${it.currency} to send an SMS to ${it.country.name}."
2360-
)}
2361-
```
2362-
2363-
### List Outbound Voice Prices
2364-
```kotlin
2365-
val prices = client.pricing.listOutboundVoicePrices()
2366-
2367-
prices.forEach { println(
2368-
"It will cost ${it.defaultPrice} ${it.currency} per minute to call ${it.country.name}."
2369-
)}
2370-
```
2371-
2372-
### Get Outbound Voice Price
2373-
```kotlin
2374-
val response = client.pricing.getOutboundVoicePriceForCountry(PRICING_COUNTRY_CODE)
2375-
println("${response.defaultPrice} ${response.currency} per minute.")
2376-
```
2377-
2378-
### Get Outbound SMS Price
2379-
```kotlin
2380-
val response = client.pricing.getOutboundSmsPrice(PRICING_COUNTRY_CODE)
2381-
println("${response.defaultPrice} ${response.currency} per message.")
2382-
```
2383-
2384-
### Get Outbound Voice Prefix Price
2385-
```kotlin
2386-
val response = client.pricing.getOutboundVoicePriceForPrefix(PRICING_DIAL_PREFIX)
2387-
response.forEach { println(it.toJson()) }
2388-
```
2389-

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repositories {
1313
}
1414

1515
dependencies {
16-
implementation("com.vonage:server-sdk-kotlin:1.+")
16+
implementation("com.vonage:server-sdk-kotlin:2.+")
1717
implementation("io.ktor:ktor-server-netty")
1818
implementation("io.ktor:ktor-serialization-jackson")
1919
implementation("io.github.cdimascio:dotenv-kotlin:6.+")

src/main/kotlin/com/vonage/quickstart/kt/EnvironmentVariables.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222
package com.vonage.quickstart.kt
2323

2424
import com.vonage.client.ApiRegion
25+
import com.vonage.client.numbers.CallbackType
2526
import com.vonage.client.numbers.Feature
2627
import com.vonage.client.numbers.SearchPattern
2728
import com.vonage.client.numbers.Type
2829
import com.vonage.client.numbers.UpdateNumberRequest
2930
import com.vonage.client.verify.Psd2Request
3031
import com.vonage.client.verify.VerifyRequest
32+
import com.vonage.client.verify.Workflow
3133
import com.vonage.client.voice.TextToSpeechLanguage
3234
import java.time.Instant
3335
import io.github.cdimascio.dotenv.Dotenv
@@ -115,7 +117,7 @@ val NUMBER_SEARCH_CRITERIA = envVar("NUMBER_SEARCH_CRITERIA")
115117
val NUMBER_SEARCH_PATTERN = SearchPattern.entries[envVar("NUMBER_SEARCH_PATTERN").toInt()]
116118
val NUMBER_SMS_CALLBACK_URL = envVar("NUMBER_SMS_CALLBACK_URL")
117119
val NUMBER_VOICE_CALLBACK_URL = envVar("NUMBER_VOICE_CALLBACK_URL")
118-
val NUMBER_VOICE_CALLBACK_TYPE = UpdateNumberRequest.CallbackType.fromString(envVar("NUMBER_VOICE_CALLBACK_TYPE"))
120+
val NUMBER_VOICE_CALLBACK_TYPE = CallbackType.fromString(envVar("NUMBER_VOICE_CALLBACK_TYPE"))
119121
val NUMBER_VOICE_STATUS_CALLBACK_URL = envVar("NUMBER_VOICE_STATUS_CALLBACK_URL")
120122

121123
// Pricing
@@ -155,8 +157,8 @@ val VERIFY_PAYEE_NAME = envVar("VERIFY_PAYEE_NAME")
155157
val VERIFY_AMOUNT = envVar("VERIFY_AMOUNT").toDouble()
156158
val VERIFY_REQUEST_ID = envVar("VERIFY_REQUEST_ID")
157159
val VERIFY_CODE = envVar("VERIFY_CODE")
158-
val VERIFY_WORKFLOW_ID = VerifyRequest.Workflow.entries.get(envVar("VERIFY_WORKFLOW_ID").toInt() + 1)
159-
val VERIFY_PSD2_WORKFLOW_ID = Psd2Request.Workflow.entries.get(envVar("VERIFY_WORKFLOW_ID").toInt() + 1)
160+
val VERIFY_WORKFLOW_ID = Workflow.entries.get(envVar("VERIFY_WORKFLOW_ID").toInt() + 1)
161+
val VERIFY_PSD2_WORKFLOW_ID = Workflow.entries.get(envVar("VERIFY_WORKFLOW_ID").toInt() + 1)
160162
val VERIFY_TO_EMAIL = envVar("VERIFY_TO_EMAIL")
161163
val VERIFY_FROM_EMAIL = envVar("VERIFY_FROM_EMAIL")
162164
val VERIFY_WHATSAPP_NUMBER = envVar("VERIFY_WHATSAPP_NUMBER")

src/main/kotlin/com/vonage/quickstart/kt/numberinsight/AdvancedInsightWebhook.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222
package com.vonage.quickstart.kt.numberinsight
2323

24+
import com.vonage.client.Jsonable
2425
import com.vonage.client.insight.AdvancedInsightResponse
2526
import io.ktor.server.application.call
2627
import io.ktor.server.engine.embeddedServer
@@ -34,7 +35,7 @@ fun main() {
3435
embeddedServer(Netty, port = 8000) {
3536
routing {
3637
post ("/webhooks/insight") {
37-
val insightDetails = AdvancedInsightResponse.fromJson(call.receive())
38+
val insightDetails = Jsonable.fromJson(call.receive(), AdvancedInsightResponse::class.java)
3839
println(insightDetails)
3940
call.respond(204)
4041
}

src/main/kotlin/com/vonage/quickstart/kt/pricing/GetOutboundSmsPrefixPrice.kt

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/main/kotlin/com/vonage/quickstart/kt/pricing/GetOutboundSmsPrice.kt

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/main/kotlin/com/vonage/quickstart/kt/pricing/GetOutboundVoicePrefixPrice.kt

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/main/kotlin/com/vonage/quickstart/kt/pricing/GetOutboundVoicePrice.kt

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)