Skip to content

Commit

Permalink
feat: Add Numbers API
Browse files Browse the repository at this point in the history
  • Loading branch information
SMadani committed Aug 2, 2024
1 parent f4f1dfe commit 1afae86
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ 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.7.0] - 2024-08-??

### Added
- Numbers API

## [0.6.0] - 2024-07-30

### Added
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ You'll need to have [created a Vonage account](https://dashboard.nexmo.com/sign-
- [Voice](https://developer.vonage.com/en/voice/voice-api/overview)
- [SIM Swap](https://developer.vonage.com/en/sim-swap/overview)
- [Number Verification](https://developer.vonage.com/en/number-verification/overview)
- [Number Management](https://developer.vonage.com/en/numbers/overview)
- [Number Insight](https://developer.vonage.com/en/number-insight/overview)
- [SMS](https://developer.vonage.com/en/messaging/sms/overview)
- [Conversion](https://developer.vonage.com/en/messaging/conversion-api/overview)
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.vonage</groupId>
<artifactId>server-sdk-kotlin</artifactId>
<version>0.6.0</version>
<version>0.7.0</version>

<name>Vonage Kotlin Server SDK</name>
<description>Kotlin client for Vonage APIs</description>
Expand Down
24 changes: 24 additions & 0 deletions src/main/kotlin/com/vonage/client/kt/Numbers.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2024 Vonage
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.vonage.client.kt

import com.vonage.client.numbers.*

class Numbers(private val numbersClient: NumbersClient) {

fun buyNumber(msisdn: String, countryCode: String) =
numbersClient.buyNumber(countryCode, msisdn)
}
3 changes: 2 additions & 1 deletion src/main/kotlin/com/vonage/client/kt/Vonage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ class Vonage(init: VonageClient.Builder.() -> Unit) {
val redact = Redact(vonageClient.redactClient)
val verifyLegacy = VerifyLegacy(vonageClient.verifyClient)
val numberInsight = NumberInsight(vonageClient.insightClient)
val simSwap = SimSwap(vonageClient.simSwapClient)
val numbers = Numbers(vonageClient.numbersClient)
val numberVerification = NumberVerification(vonageClient.numberVerificationClient)
val simSwap = SimSwap(vonageClient.simSwapClient)
}

fun VonageClient.Builder.authFromEnv(): VonageClient.Builder {
Expand Down
38 changes: 38 additions & 0 deletions src/test/kotlin/com/vonage/client/kt/NumbersTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2024 Vonage
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.vonage.client.kt

import com.vonage.client.numbers.*
import kotlin.test.*

class NumbersTest : AbstractTest() {
private val numbersClient = vonage.numbers
private val numbersBaseUrl = "/numbers"
private val country = "GB"
private val baseRequestParams = mapOf(
"country" to country,
"msisdn" to toNumber
)
private val successResponseJson = """
{
"error-code": "200",
"error-code-label": "success"
}
""".trimIndent()



}

0 comments on commit 1afae86

Please sign in to comment.