Skip to content

Commit 11586bd

Browse files
committed
refactor: Rename internal clients
1 parent c72cf47 commit 11586bd

File tree

16 files changed

+91
-90
lines changed

16 files changed

+91
-90
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
java-version: ${{ matrix.java }}
3737
cache: maven
3838
- name: Compile with Maven
39-
run: mvn -e --batch-mode compile
39+
run: mvn -e --batch-mode compile -T 1C
4040

4141
verify:
4242
runs-on: ${{ matrix.os }}
@@ -62,7 +62,7 @@ jobs:
6262
VONAGE_SIGNATURE_SECRET: abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQR
6363
VONAGE_APPLICATION_ID: 00000000-0000-4000-8000-000000000000
6464
VONAGE_PRIVATE_KEY_PATH: src/test/resources/com/vonage/client/kt/application_key
65-
run: mvn -e --batch-mode clean verify
65+
run: mvn -e --batch-mode clean verify -T 1C
6666
- name: Run Codecov
6767
uses: codecov/codecov-action@v4
6868
with:

pom.xml

Lines changed: 3 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>0.7.0</version>
8+
<version>0.8.0</version>
99

1010
<name>Vonage Kotlin Server SDK</name>
1111
<description>Kotlin client for Vonage APIs</description>
@@ -40,6 +40,7 @@
4040
</issueManagement>
4141

4242
<properties>
43+
<nexusUrl>https://oss.sonatype.org</nexusUrl>
4344
<project.scm.connection>scm:git@github.com:Vonage/vonage-kotlin-sdk</project.scm.connection>
4445
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4546
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@@ -269,7 +270,7 @@
269270
<extensions>true</extensions>
270271
<configuration>
271272
<serverId>nexus-releases</serverId>
272-
<nexusUrl>https://oss.sonatype.org</nexusUrl>
273+
<nexusUrl>${nexusUrl}</nexusUrl>
273274
<autoReleaseAfterClose>true</autoReleaseAfterClose>
274275
</configuration>
275276
</plugin>

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,34 @@ package com.vonage.client.kt
1717

1818
import com.vonage.client.account.*
1919

20-
class Account internal constructor(private val accountClient: AccountClient) {
20+
class Account internal constructor(private val client: AccountClient) {
2121

22-
fun getBalance(): BalanceResponse = accountClient.balance
22+
fun getBalance(): BalanceResponse = client.balance
2323

24-
fun topUp(transactionId: String): Unit = accountClient.topUp(transactionId)
24+
fun topUp(transactionId: String): Unit = client.topUp(transactionId)
2525

2626
fun updateSettings(incomingSmsUrl: String? = null, deliverReceiptUrl: String? = null): SettingsResponse =
27-
accountClient.updateSettings(SettingsRequest(incomingSmsUrl, deliverReceiptUrl))
27+
client.updateSettings(SettingsRequest(incomingSmsUrl, deliverReceiptUrl))
2828

2929
fun secrets(apiKey: String? = null): Secrets = Secrets(apiKey)
3030

3131
inner class Secrets internal constructor(val apiKey: String? = null) {
3232

3333
fun list(): List<SecretResponse> = (
34-
if (apiKey == null) accountClient.listSecrets()
35-
else accountClient.listSecrets(apiKey)
34+
if (apiKey == null) client.listSecrets()
35+
else client.listSecrets(apiKey)
3636
).secrets
3737

3838
fun create(secret: String): SecretResponse =
39-
if (apiKey == null) accountClient.createSecret(secret)
40-
else accountClient.createSecret(apiKey, secret)
39+
if (apiKey == null) client.createSecret(secret)
40+
else client.createSecret(apiKey, secret)
4141

4242
fun get(secretId: String): SecretResponse =
43-
if (apiKey == null) accountClient.getSecret(secretId)
44-
else accountClient.getSecret(apiKey, secretId)
43+
if (apiKey == null) client.getSecret(secretId)
44+
else client.getSecret(apiKey, secretId)
4545

4646
fun delete(secretId: String): Unit =
47-
if (apiKey == null) accountClient.revokeSecret(secretId)
48-
else accountClient.revokeSecret(apiKey, secretId)
47+
if (apiKey == null) client.revokeSecret(secretId)
48+
else client.revokeSecret(apiKey, secretId)
4949
}
5050
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import com.vonage.client.conversion.*
1919
import java.time.Instant
2020
import java.util.*
2121

22-
class Conversion internal constructor(private val conversionClient: ConversionClient) {
22+
class Conversion internal constructor(private val client: ConversionClient) {
2323

2424
private fun convert(type: ConversionRequest.Type,
2525
messageId: String, delivered: Boolean, timestamp: Instant?): Unit =
26-
conversionClient.submitConversion(type, messageId, delivered,
26+
client.submitConversion(type, messageId, delivered,
2727
if (timestamp != null) Date.from(timestamp) else null
2828
)
2929

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import com.vonage.client.messages.messenger.*
2323
import com.vonage.client.messages.viber.*
2424
import java.util.UUID
2525

26-
class Messages internal constructor(private val messagesClient: MessagesClient) {
26+
class Messages internal constructor(private val client: MessagesClient) {
2727
fun send(message: MessageRequest, sandbox: Boolean = false): UUID =
28-
(if (sandbox) messagesClient.useSandboxEndpoint()
29-
else messagesClient.useRegularEndpoint()).sendMessage(message).messageUuid
28+
(if (sandbox) client.useSandboxEndpoint()
29+
else client.useRegularEndpoint()).sendMessage(message).messageUuid
3030
}
3131

3232
fun smsText(init: SmsTextRequest.Builder.() -> Unit): SmsTextRequest =

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ package com.vonage.client.kt
1717

1818
import com.vonage.client.insight.*
1919

20-
class NumberInsight internal constructor(private val niClient: InsightClient) {
20+
class NumberInsight internal constructor(private val client: InsightClient) {
2121

2222
fun basic(number: String, countryCode: String? = null): BasicInsightResponse =
23-
niClient.getBasicNumberInsight(number, countryCode)
23+
client.getBasicNumberInsight(number, countryCode)
2424

2525
fun standard(number: String, countryCode: String? = null, cnam: Boolean? = null): StandardInsightResponse =
26-
niClient.getStandardNumberInsight(StandardInsightRequest.builder()
26+
client.getStandardNumberInsight(StandardInsightRequest.builder()
2727
.number(number).country(countryCode).cnam(cnam).build()
2828
)
2929

3030
fun advanced(number: String, countryCode: String? = null, cnam: Boolean = false,
3131
realTimeData: Boolean = false): AdvancedInsightResponse =
32-
niClient.getAdvancedNumberInsight(AdvancedInsightRequest.builder().async(false)
32+
client.getAdvancedNumberInsight(AdvancedInsightRequest.builder().async(false)
3333
.number(number).country(countryCode).cnam(cnam).realTimeData(realTimeData).build()
3434
)
3535

3636
fun advancedAsync(number: String, callbackUrl: String, countryCode: String? = null, cnam: Boolean = false) {
37-
niClient.getAdvancedNumberInsight(
37+
client.getAdvancedNumberInsight(
3838
AdvancedInsightRequest.builder().async(true)
3939
.number(number).country(countryCode).cnam(cnam).callback(callbackUrl).build()
4040
)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ package com.vonage.client.kt
1818
import com.vonage.client.camara.numberverification.*
1919
import java.net.URI
2020

21-
class NumberVerification internal constructor(private val nvClient: NumberVerificationClient) {
21+
class NumberVerification internal constructor(private val client: NumberVerificationClient) {
2222
private var redirectUri: URI? = null
2323

2424
fun createVerificationUrl(phoneNumber: String, redirectUrl: String, state: String? = null): URI {
2525
redirectUri = URI.create(redirectUrl)
26-
return nvClient.initiateVerification(phoneNumber, redirectUri, state)
26+
return client.initiateVerification(phoneNumber, redirectUri, state)
2727
}
2828

2929
fun verifyNumberWithCode(phoneNumber: String, code: String, redirectUrl: String? = null): Boolean {
3030
if (redirectUrl != null) redirectUri = URI.create(redirectUrl)
31-
return nvClient.verifyNumber(phoneNumber, redirectUri, code)
31+
return client.verifyNumber(phoneNumber, redirectUri, code)
3232
}
3333
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ package com.vonage.client.kt
1717

1818
import com.vonage.client.numbers.*
1919

20-
class Numbers internal constructor(private val numbersClient: NumbersClient) {
20+
class Numbers internal constructor(private val client: NumbersClient) {
2121

2222
fun number(countryCode: String, msisdn: String) = ExistingNumber(countryCode, msisdn)
2323

2424
inner class ExistingNumber internal constructor(val countryCode: String, val msisdn: String) {
2525

2626
fun buy(targetApiKey: String? = null): Unit =
27-
numbersClient.buyNumber(countryCode, msisdn, targetApiKey)
27+
client.buyNumber(countryCode, msisdn, targetApiKey)
2828

2929
fun cancel(targetApiKey: String? = null): Unit =
30-
numbersClient.cancelNumber(countryCode, msisdn, targetApiKey)
30+
client.cancelNumber(countryCode, msisdn, targetApiKey)
3131

3232
fun update(properties: UpdateNumberRequest.Builder.() -> Unit): Unit =
33-
numbersClient.updateNumber(UpdateNumberRequest.builder(msisdn, countryCode).apply(properties).build())
33+
client.updateNumber(UpdateNumberRequest.builder(msisdn, countryCode).apply(properties).build())
3434
}
3535

3636
fun listOwned(filter: ListNumbersFilter.Builder.() -> Unit = {}): ListNumbersResponse =
37-
numbersClient.listNumbers(ListNumbersFilter.builder().apply(filter).build())
37+
client.listNumbers(ListNumbersFilter.builder().apply(filter).build())
3838

3939
fun searchAvailable(filter: SearchNumbersFilter.Builder.() -> Unit): SearchNumbersResponse =
40-
numbersClient.searchNumbers(SearchNumbersFilter.builder().apply(filter).build())
40+
client.searchNumbers(SearchNumbersFilter.builder().apply(filter).build())
4141
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ package com.vonage.client.kt
1717

1818
import com.vonage.client.redact.*
1919

20-
class Redact internal constructor(private val redactClient: RedactClient) {
20+
class Redact internal constructor(private val client: RedactClient) {
2121

2222
fun redactSms(messageId: String, direction: RedactRequest.Type = RedactRequest.Type.OUTBOUND): Unit =
23-
redactClient.redactTransaction(messageId, RedactRequest.Product.SMS, direction)
23+
client.redactTransaction(messageId, RedactRequest.Product.SMS, direction)
2424

2525
fun redactMessage(messageId: String, direction: RedactRequest.Type = RedactRequest.Type.OUTBOUND): Unit =
26-
redactClient.redactTransaction(messageId, RedactRequest.Product.MESSAGES, direction)
26+
client.redactTransaction(messageId, RedactRequest.Product.MESSAGES, direction)
2727

2828
fun redactCall(callId: String, direction: RedactRequest.Type = RedactRequest.Type.OUTBOUND): Unit =
29-
redactClient.redactTransaction(callId, RedactRequest.Product.VOICE, direction)
29+
client.redactTransaction(callId, RedactRequest.Product.VOICE, direction)
3030

3131
fun redactInsight(requestId: String): Unit =
32-
redactClient.redactTransaction(requestId, RedactRequest.Product.NUMBER_INSIGHTS)
32+
client.redactTransaction(requestId, RedactRequest.Product.NUMBER_INSIGHTS)
3333

3434
fun redactVerification(requestId: String): Unit =
35-
redactClient.redactTransaction(requestId, RedactRequest.Product.VERIFY)
35+
client.redactTransaction(requestId, RedactRequest.Product.VERIFY)
3636
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ package com.vonage.client.kt
1818
import com.vonage.client.camara.simswap.*
1919
import java.time.Instant
2020

21-
class SimSwap internal constructor(private val simSwapClient: SimSwapClient) {
21+
class SimSwap internal constructor(private val client: SimSwapClient) {
2222

2323
fun checkSimSwap(phoneNumber: String, maxAgeHours: Int = 240): Boolean =
24-
simSwapClient.checkSimSwap(phoneNumber, maxAgeHours)
24+
client.checkSimSwap(phoneNumber, maxAgeHours)
2525

2626
fun retrieveSimSwapDate(phoneNumber: String): Instant? =
27-
simSwapClient.retrieveSimSwapDate(phoneNumber)
27+
client.retrieveSimSwapDate(phoneNumber)
2828
}

0 commit comments

Comments
 (0)