From 769a608859678b46a3a0d4e5c07806429a1ecdbf Mon Sep 17 00:00:00 2001 From: NilmaPeiris <62905380+NilmaPeiris@users.noreply.github.com> Date: Tue, 20 Oct 2020 11:15:04 +0530 Subject: [PATCH 1/2] updated the readme.md according to requirements --- README.md | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/README.md b/README.md index e6269c5..9aeb4a7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,135 @@ # vonage-spring-boot-starter-java Spring Boot Starter for Vonage + +[![Maven Central](https://img.shields.io/maven-central/v/com.vonage/nexmo-spring-boot-starter.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.nexmo%22%20AND%20a:%22nexmo-spring-boot-starter%22) +[![Build Status](https://travis-ci.org/vonage/vonage-spring-boot-starter.svg?branch=master)](https://travis-ci.org/vonage/vonage-spring-boot-starter) +[![codecov](https://codecov.io/gh/vonage/vonage-spring-boot-starter/branch/master/graph/badge.svg)](https://codecov.io/gh/vonage/vonage-spring-boot-starter) + +Nexmo is now known as Vonage + +This Spring Boot Starter has been provided to help with integrating the [vonage Java SDK](https://github.com/vonage/nexmo-java) into your [Spring Boot](https://spring.io/projects/spring-boot) project. + + * [Installation](#installation) + * [Usage](#usage) + * [Customizing the NexmoClient](#customizing-the-nexmoclient) + * [Customize Nexmo Client Version](#customize-nexmo-client-version) + +## Installation + +For Gradle: + +```groovy +repositories { + mavenCentral() +} + +dependencies { + implementation 'com.nexmo:nexmo-spring-boot-starter:1.1.0' +} +``` + +For Maven: + +```xml + + com.nexmo + nexmo-spring-boot-starter + 1.1.0 + +``` + +## Usage + +The Nexmo Spring Boot Starter will automatically configure instances of the `NexmoClient.Builder`, `NexmoClient`, and any of the other sub-clients (`AccountClient`, `VoiceClient`, etc..) once you have provided the required configuration values. + +* For help understanding our APIs, check out our [developer portal](https://developer.nexmo.com/). +* There are also **many useful code samples** in our [vonage/nexmo-java-code-snippets](https://github.com/Nexmo/nexmo-java-code-snippets) repository. + +### Configuration + +The following configuration values are used to configure the starter. Check out the [Application Property Files](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config-application-property-files) and [Externalized Configuration](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config) reference in the Spring Boot documentation for how to provide configuration values. + +#### API Key and Secret Configuration + +``` +vonage.creds.api-key=your-api-key +vonage.creds.secret=your-api-secret +``` + +This will give you access to automatically wire in the `NexmoClient`, `AccountClient`, `ApplicationClient`, `ConversionClient`, `InsightClient`, `NumbersClient`, `RedactClient`, `SmsClient`, `SnsClient`, and `VerifyClient`. + +You can also provide a signature secret: + +``` +vonage.creds.api-key=your-api-key +vonage.creds.signature=signature +``` + +#### Application ID and Private Key Configuration +To gain access to the `VoiceClient` you will need to provide a [Nexmo Application ID]() and location or contents of a private key file associated with the Nexmo Application. + +Here is an example providing the path to the key: +``` +vonage.creds.application-id=application-id +vonage.creds.private-key-path=/path/to/your/private.key +``` + +Here is an example providing the contents of the key: +``` +vonage.creds.application-id=application-id +vonage.creds.private-key-contents=contents-of-the-key +``` + +### Customizing the `NexmoClient` + +By default, the auto configuration will create a `NexmoClient.Builder` using the information provided in your `application.properties`, `application.yml`, or other external configuration source. However, when registering the `NexmoClient` and all of the other sub-clients, the auto configuration can opt to use a pre-registered `NexmoClient.Builder`. + +For example, if you would like to customize the base URI that the library uses, you can register a custom version of the `NexmoClient.Builder` in your configuration class: + +```java +@Autowired +NexmoCredentialsProperties nexmoCredentialsProperties; + +@Bean +public NexmoClient.Builder customNexmoBuilder() { + return NexmoClient.builder() + .apiKey(nexmoCredentialsProperties.getApiKey()) + .apiSecret(nexmoCredentialsProperties.getSecret()) + .httpConfig(HttpConfig.builder().baseUri("https://example.com").build()); +} +``` +> Note that you must include your credentials as shown in this example. This builder completely replaces the automatically configured one. + +## Customize Nexmo Client Version + +By default, the Nexmo Spring Boot Starter will transitively define Nexmo Client to the latest version at its release. You can override this by adding a dependency on the Nexmo Client, bringing in `4.2.0` for example: + +For Gradle: + +```groovy +repositories { + mavenCentral() +} + +dependencies { + implementation 'com.nexmo:client:4.2.0' +} +``` + +For Maven: + +```xml + + com.nexmo + client + 4.2.0 + +``` + +Bringing in older versions of the supported Nexmo Client, may result in some unforseen consequences and build errors. As a result here is a list of each version targeted by each version of the starter: + +| Nexmo Spring Boot Starter | Nexmo Java Client | +|---|---| +| v1.0.0 | v4.3.0 | +| v1.0.1 | v4.3.1 | +| v1.1.0 | v4.4.0 | From 04a6ccaeb6b8b869f021cf24e6acdf33d2dc049e Mon Sep 17 00:00:00 2001 From: NilmaPeiris <62905380+NilmaPeiris@users.noreply.github.com> Date: Wed, 20 Jan 2021 21:55:31 +0530 Subject: [PATCH 2/2] corrected a grammar mistake --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9aeb4a7..7d27989 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ For Maven: ## Usage -The Nexmo Spring Boot Starter will automatically configure instances of the `NexmoClient.Builder`, `NexmoClient`, and any of the other sub-clients (`AccountClient`, `VoiceClient`, etc..) once you have provided the required configuration values. +The Nexmo Spring Boot Starter will automatically configure instances of the `NexmoClient.Builder`, `NexmoClient`, and any of the other sub-clients (`AccountClient`, `VoiceClient`, etc..) once you provid the required configuration values. * For help understanding our APIs, check out our [developer portal](https://developer.nexmo.com/). * There are also **many useful code samples** in our [vonage/nexmo-java-code-snippets](https://github.com/Nexmo/nexmo-java-code-snippets) repository.