Skip to content

Commit 588bc98

Browse files
committed
refactor!: Update based on Java SDK 9.0.0
1 parent f25b9a6 commit 588bc98

30 files changed

+138
-484
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [2.0.0] - 2025-04-08
8+
9+
### Changed
10+
- Bumped Java SDK version to 9.0.0 (see Java SDK changelog for details of breaking changes)
11+
- Moved most enums from inner classes
12+
- Stronger typing for response fields
13+
- Removed deprecated methods, constructors, classes, fields, packages etc.
14+
- Internal refactoring
15+
- Refactored `Archive.setLayout` and `Broadcast.setLayout` parameters to take `StreamCompositionLayout` directly
16+
17+
### Removed
18+
- `Verify.whatsappCodeless` workflow
19+
- Pricing API
20+
- `dateStart` and `dateEnd` methods in `CallsFilter` (as previously deprecated)
21+
- `realTimeData` in `NumberInsight.advanced` (as previously deprecated)
22+
723
## [1.2.1] - 2025-03-19
824

925
### Changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ See all of our SDKs and integrations on the [Vonage Developer portal](https://de
5353
## Installation
5454
Releases are published to [Maven Central](https://central.sonatype.com/artifact/com.vonage/server-sdk-kotlin).
5555
Instructions for your build system can be found in the snippets section.
56-
They're also available from [here](https://search.maven.org/artifact/com.vonage/server-sdk-kotlin/1.2.1/jar).
56+
They're also available from [here](https://search.maven.org/artifact/com.vonage/server-sdk-kotlin/2.0.0/jar).
5757
Release notes for each version can be found in the [changelog](CHANGELOG.md).
5858

5959
Here are the instructions for including the SDK in your project:
@@ -63,7 +63,7 @@ Add the following to your `build.gradle` or `build.gradle.kts` file:
6363

6464
```groovy
6565
dependencies {
66-
implementation("com.vonage:server-sdk-kotlin:1.2.1")
66+
implementation("com.vonage:server-sdk-kotlin:2.0.0")
6767
}
6868
```
6969

@@ -74,7 +74,7 @@ Add the following to the `<dependencies>` section of your `pom.xml` file:
7474
<dependency>
7575
<groupId>com.vonage</groupId>
7676
<artifactId>server-sdk-kotlin</artifactId>
77-
<version>1.2.1</version>
77+
<version>2.0.0</version>
7878
</dependency>
7979
```
8080

@@ -160,8 +160,8 @@ including [**a searchable list of snippets**](https://github.com/Vonage/vonage-k
160160

161161
The SDK is fully documented with [KDocs](https://kotlinlang.org/docs/kotlin-doc.html), so you should have complete
162162
documentation from your IDE. You may need to click "Download Sources" in IntelliJ to get the full documentation.
163-
Alternatively, you can browse the documentation using a service like [Javadoc.io](https://javadoc.io/doc/com.vonage/server-sdk-kotlin/1.2.1/index.html),
164-
which renders the documentation for you from [the artifacts on Maven Central](https://repo.maven.apache.org/maven2/com/vonage/server-sdk-kotlin/1.2.1/).
163+
Alternatively, you can browse the documentation using a service like [Javadoc.io](https://javadoc.io/doc/com.vonage/server-sdk-kotlin/2.0.0/index.html),
164+
which renders the documentation for you from [the artifacts on Maven Central](https://repo.maven.apache.org/maven2/com/vonage/server-sdk-kotlin/2.0.0/).
165165

166166
For help with any specific APIs, refer to the relevant documentation on our [developer portal](https://developer.vonage.com/en/documentation),
167167
using the links provided in the [Supported APIs](#supported-apis) section. For completeness, you can also consult the

bumpversion.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ then
44
exit 1
55
fi
66

7-
mvn versions:set -DnewVersion=$1
7+
mvn versions:set -DnewVersion="$1"
88
mvn validate
99
rm pom.xml.versionsBackup #pom.xml.releaseBackup
1010
#mvn versions:display-plugin-updates

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.vonage</groupId>
77
<artifactId>server-sdk-kotlin</artifactId>
8-
<version>1.2.1</version>
8+
<version>2.0.0</version>
99

1010
<name>Vonage Kotlin Server SDK</name>
1111
<description>Kotlin client for Vonage APIs</description>
@@ -55,7 +55,7 @@
5555
<dependency>
5656
<groupId>com.vonage</groupId>
5757
<artifactId>server-sdk</artifactId>
58-
<version>8.20.1</version>
58+
<version>9.0.0</version>
5959
</dependency>
6060
<dependency>
6161
<groupId>org.jetbrains.kotlin</groupId>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Account internal constructor(private val client: AccountClient) {
8686
fun list(): List<SecretResponse> = (
8787
if (apiKey == null) client.listSecrets()
8888
else client.listSecrets(apiKey)
89-
).secrets
89+
)
9090

9191
/**
9292
* Creates a new secret for the account.

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import com.vonage.client.application.capabilities.*
2121
import com.vonage.client.application.capabilities.Messages
2222
import com.vonage.client.application.capabilities.Verify
2323
import com.vonage.client.application.capabilities.Voice
24-
import com.vonage.client.common.Webhook
2524
import java.util.*
2625

2726
/**
@@ -108,8 +107,8 @@ class Application internal constructor(private val client: ApplicationClient) {
108107
*/
109108
fun list(page: Int? = null, pageSize: Int? = null): List<Application> {
110109
val filter = ListApplicationRequest.builder()
111-
if (page != null) filter.page(page.toLong())
112-
if (pageSize != null) filter.pageSize(pageSize.toLong())
110+
if (page != null) filter.page(page)
111+
if (pageSize != null) filter.pageSize(pageSize)
113112
return client.listApplications(filter.build()).applications
114113
}
115114

@@ -147,7 +146,7 @@ fun Webhook.Builder.url(url: String): Webhook.Builder = address(url)
147146
* @return The Voice capability builder.
148147
*/
149148
fun Voice.Builder.answer(properties: Webhook.Builder.() -> Unit): Voice.Builder =
150-
addWebhook(Webhook.Type.ANSWER, webhookBuilder(properties))
149+
answer(webhookBuilder(properties))
151150

152151
/**
153152
* Adds an `fallback_answer_url` webhook to the [Voice] capability.
@@ -157,7 +156,7 @@ fun Voice.Builder.answer(properties: Webhook.Builder.() -> Unit): Voice.Builder
157156
* @return The Voice capability builder.
158157
*/
159158
fun Voice.Builder.fallbackAnswer(properties: Webhook.Builder.() -> Unit): Voice.Builder =
160-
addWebhook(Webhook.Type.FALLBACK_ANSWER, webhookBuilder(properties))
159+
fallbackAnswer(webhookBuilder(properties))
161160

162161
/**
163162
* Adds an `event_url` webhook to the [Voice] capability.
@@ -167,7 +166,7 @@ fun Voice.Builder.fallbackAnswer(properties: Webhook.Builder.() -> Unit): Voice.
167166
* @return The Voice capability builder.
168167
*/
169168
fun Voice.Builder.event(properties: Webhook.Builder.() -> Unit): Voice.Builder =
170-
addWebhook(Webhook.Type.EVENT, webhookBuilder(properties))
169+
event(webhookBuilder(properties))
171170

172171
/**
173172
* Adds an `event_url` webhook to the [Rtc] capability.
@@ -177,7 +176,7 @@ fun Voice.Builder.event(properties: Webhook.Builder.() -> Unit): Voice.Builder =
177176
* @return The RTC capability builder.
178177
*/
179178
fun Rtc.Builder.event(properties: Webhook.Builder.() -> Unit): Rtc.Builder =
180-
addWebhook(Webhook.Type.EVENT, webhookBuilder(properties))
179+
event(webhookBuilder(properties))
181180

182181
/**
183182
* Adds a `status_url` webhook to the [Verify] capability.
@@ -187,7 +186,7 @@ fun Rtc.Builder.event(properties: Webhook.Builder.() -> Unit): Rtc.Builder =
187186
* @return The Verify capability builder.
188187
*/
189188
fun Verify.Builder.status(properties: Webhook.Builder.() -> Unit): Verify.Builder =
190-
addWebhook(Webhook.Type.STATUS, webhookBuilder(properties))
189+
status(webhookBuilder(properties))
191190

192191
/**
193192
* Adds an `inbound_url` webhook to the [Messages] capability.
@@ -197,7 +196,7 @@ fun Verify.Builder.status(properties: Webhook.Builder.() -> Unit): Verify.Builde
197196
* @return The Messages capability builder.
198197
*/
199198
fun Messages.Builder.inbound(properties: Webhook.Builder.() -> Unit): Messages.Builder =
200-
addWebhook(Webhook.Type.INBOUND, webhookBuilder(properties))
199+
inbound(webhookBuilder(properties))
201200

202201
/**
203202
* Adds an `status_url` webhook to the [Messages] capability.
@@ -207,7 +206,7 @@ fun Messages.Builder.inbound(properties: Webhook.Builder.() -> Unit): Messages.B
207206
* @return The Messages capability builder.
208207
*/
209208
fun Messages.Builder.status(properties: Webhook.Builder.() -> Unit): Messages.Builder =
210-
addWebhook(Webhook.Type.STATUS, webhookBuilder(properties))
209+
status(webhookBuilder(properties))
211210

212211
/**
213212
* Adds the [Voice] capability to the application.

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ import java.util.*
2626
*/
2727
class Conversion internal constructor(private val client: ConversionClient) {
2828

29-
private fun convert(type: ConversionRequest.Type,
30-
messageId: String, delivered: Boolean, timestamp: Instant?): Unit =
29+
private fun convert(type: Type, messageId: String, delivered: Boolean, timestamp: Instant?): Unit =
3130
client.submitConversion(type, messageId, delivered,
3231
if (timestamp != null) Date.from(timestamp) else null
3332
)
@@ -40,7 +39,7 @@ class Conversion internal constructor(private val client: ConversionClient) {
4039
* @param timestamp (OPTIONAL) Timestamp of the conversion.
4140
*/
4241
fun convertSms(messageId: String, delivered: Boolean, timestamp: Instant? = null): Unit =
43-
convert(ConversionRequest.Type.SMS, messageId, delivered, timestamp)
42+
convert(Type.SMS, messageId, delivered, timestamp)
4443

4544
/**
4645
* Submit conversion for a voice call.
@@ -50,5 +49,5 @@ class Conversion internal constructor(private val client: ConversionClient) {
5049
* @param timestamp (OPTIONAL) Timestamp of the conversion.
5150
*/
5251
fun convertVoice(callId: String, delivered: Boolean, timestamp: Instant? = null): Unit =
53-
convert(ConversionRequest.Type.VOICE, callId, delivered, timestamp)
52+
convert(Type.VOICE, callId, delivered, timestamp)
5453
}

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

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,6 @@ class NumberInsight internal constructor(private val client: InsightClient) {
5454
.number(number).country(countryCode).cnam(cnam).build()
5555
)
5656

57-
/**
58-
* Obtain advanced insight about a number synchronously. This is not recommended due to potential timeouts.
59-
*
60-
* @param number The phone number to look up in E.164 format.
61-
*
62-
* @param countryCode (OPTIONAL) The two-character country code in ISO 3166-1 alpha-2 format.
63-
*
64-
* @param cnam (OPTIONAL) Whether the name of the person who owns the phone number should be looked up
65-
* and returned in the response. Set to true to receive phone number owner name in the response. This
66-
* feature is available for US numbers only and incurs an additional charge.
67-
*
68-
* @param realTimeData (OPTIONAL) Whether to receive real-time data back in the response.
69-
*
70-
* @return Advanced details about the number and insight metadata.
71-
*/
72-
@Deprecated("`realTimeData` is deprecated and will be removed in a future release.")
73-
fun advanced(number: String, countryCode: String? = null, cnam: Boolean = false,
74-
realTimeData: Boolean): AdvancedInsightResponse =
75-
client.getAdvancedNumberInsight(AdvancedInsightRequest.builder().async(false)
76-
.number(number).country(countryCode).cnam(cnam).realTimeData(realTimeData).build()
77-
)
78-
7957
/**
8058
* Obtain advanced insight about a number synchronously. This is not recommended due to potential timeouts.
8159
*
@@ -92,7 +70,7 @@ class NumberInsight internal constructor(private val client: InsightClient) {
9270
* @since 1.1.3
9371
*/
9472
fun advanced(number: String, countryCode: String? = null, cnam: Boolean = false): AdvancedInsightResponse =
95-
client.getAdvancedNumberInsight(AdvancedInsightRequest.builder().async(false)
73+
client.getAdvancedNumberInsight(AdvancedInsightRequest.builder()
9674
.number(number).country(countryCode).cnam(cnam).build()
9775
)
9876

@@ -109,10 +87,9 @@ class NumberInsight internal constructor(private val client: InsightClient) {
10987
* and returned in the response. Set to true to receive phone number owner name in the response. This
11088
* feature is available for US numbers only and incurs an additional charge.
11189
*/
112-
fun advancedAsync(number: String, callbackUrl: String, countryCode: String? = null, cnam: Boolean = false) {
113-
client.getAdvancedNumberInsight(
114-
AdvancedInsightRequest.builder().async(true)
90+
fun advancedAsync(number: String, callbackUrl: String,
91+
countryCode: String? = null, cnam: Boolean = false) : AdvancedAsyncInsightResponse =
92+
client.getAdvancedAsyncNumberInsight(AdvancedInsightAsyncRequest.builder()
11593
.number(number).country(countryCode).cnam(cnam).callback(callbackUrl).build()
11694
)
117-
}
11895
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class Numbers internal constructor(private val client: NumbersClient) {
8585
* @throws [NumbersResponseException] If the list could not be retrieved.
8686
*/
8787
fun listOwned(filter: ListNumbersFilter.Builder.() -> Unit = {}): List<OwnedNumber> =
88-
client.listNumbers(ListNumbersFilter.builder().apply(filter).build()).numbers.asList()
88+
client.listNumbers(ListNumbersFilter.builder().apply(filter).build())
8989

9090
/**
9191
* Search for numbers that are available to purchase.

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

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

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,40 +30,40 @@ class Redact internal constructor(private val client: RedactClient) {
3030
* @param messageId ID of the message to redact.
3131
* @param direction Direction of the message to redact; either `INBOUND` or `OUTBOUND`.
3232
*/
33-
fun redactSms(messageId: String, direction: RedactRequest.Type = RedactRequest.Type.OUTBOUND): Unit =
34-
client.redactTransaction(messageId, RedactRequest.Product.SMS, direction)
33+
fun redactSms(messageId: String, direction: Type = Type.OUTBOUND): Unit =
34+
client.redactTransaction(messageId, Product.SMS, direction)
3535

3636
/**
3737
* Redact a message sent using the Messages API.
3838
*
3939
* @param messageId UUID of the message to redact.
4040
* @param direction Direction of the message to redact; either `INBOUND` or `OUTBOUND`.
4141
*/
42-
fun redactMessage(messageId: String, direction: RedactRequest.Type = RedactRequest.Type.OUTBOUND): Unit =
43-
client.redactTransaction(messageId, RedactRequest.Product.MESSAGES, direction)
42+
fun redactMessage(messageId: String, direction: Type = Type.OUTBOUND): Unit =
43+
client.redactTransaction(messageId, Product.MESSAGES, direction)
4444

4545
/**
4646
* Redact a call made using the Voice API.
4747
*
4848
* @param callId UUID of the call to redact.
4949
* @param direction Direction of the call to redact; either `INBOUND` or `OUTBOUND`.
5050
*/
51-
fun redactCall(callId: String, direction: RedactRequest.Type = RedactRequest.Type.OUTBOUND): Unit =
52-
client.redactTransaction(callId, RedactRequest.Product.VOICE, direction)
51+
fun redactCall(callId: String, direction: Type = Type.OUTBOUND): Unit =
52+
client.redactTransaction(callId, Product.VOICE, direction)
5353

5454
/**
5555
* Redact a number insight request made using the Number Insight API.
5656
*
5757
* @param requestId ID of the insight request to redact.
5858
*/
5959
fun redactInsight(requestId: String): Unit =
60-
client.redactTransaction(requestId, RedactRequest.Product.NUMBER_INSIGHTS)
60+
client.redactTransaction(requestId, Product.NUMBER_INSIGHTS)
6161

6262
/**
6363
* Redact a verification request made using the Verify API.
6464
*
6565
* @param requestId UUID of the verification request to redact.
6666
*/
6767
fun redactVerification(requestId: String): Unit =
68-
client.redactTransaction(requestId, RedactRequest.Product.VERIFY)
68+
client.redactTransaction(requestId, Product.VERIFY)
6969
}

0 commit comments

Comments
 (0)