Skip to content

Commit

Permalink
chore: Bump version & misc cleanup (#511)
Browse files Browse the repository at this point in the history
* Address some IDE warnings

* Bump Java version in CI

* Bump version: v8.1.0 → v8.2.0

* Use Java 17 for publish

* Update build.gradle
  • Loading branch information
SMadani authored Jan 29, 2024
1 parent 18389ef commit bb39ee2
Show file tree
Hide file tree
Showing 21 changed files with 69 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bumpversion]
commit = True
tag = False
current_version = v8.1.0
current_version = v8.2.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}-{release}{build}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [8, 11, 17]
java: [8, 11, 20]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- name: Checkout the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
Expand All @@ -41,7 +41,7 @@ jobs:
run: chmod +x gradlew

- name: Cache Gradle packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
with:
ref: ${{ github.event.release.target_commitish }}
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Cache Gradle packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
Expand Down
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Bumped dependency versions

## [6.4.0] - 2021-05-28
- Adding Random From Number Feature for the Voice API, if set to `true`, the from number will be randomly selected from the pool of numbers available to the application making the call.
- Adding Random From Number Feature for the Voice API, if set to `true`, the `from` number will be randomly selected from the pool of numbers available to the application making the call.
- adjusting operator used to check json payloads
- Adding extra parsing for top level Roaming Status in Advanced Number Insights

Expand Down Expand Up @@ -585,8 +585,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.0.1] - 2017-03-18
### Changed
- Made servlet-api an optional dependency so it isn't bundled in war files. (This
could result in class conflicts in Tomcat.)
- Made servlet-api an optional dependency, so it isn't bundled in WAR files. (This could result in class conflicts in Tomcat.)

## [2.0.0] - 2017-03-16
### Added
Expand Down Expand Up @@ -630,7 +629,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
- Correcting some comments and log statements
- Fix some small things reported by findbugs
- Re-factor NexmoSmsClient. There are now sub-classes of this client class depending on the level of security required
- Re-factor NexmoSmsClient. There are now subclasses of this client class depending on the level of security required
- `com.nexmo.messaging.sdk.NexmoSmsClient`: The default client
- `com.nexmo.messaging.sdk.NexmoSmsClientSSL`: Uses SSL / HTTPS to encrypt the requests
- `com.nexmo.messaging.sdk.NexmoSmsClientSignedRequests`: Signs the requests using the secret key assigned to your account
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ See all of our SDKs and integrations on the [Vonage Developer portal](https://de

## Installation

Releases are published to [Maven Central](https://central.sonatype.com/artifact/com.vonage/server-sdk/8.1.0/snippets).
Releases are published to [Maven Central](https://central.sonatype.com/artifact/com.vonage/server-sdk/8.2.0/snippets).
Instructions for your build system can be found in the snippets section.
They're also available from [here](https://mvnrepository.com/artifact/com.vonage/server-sdk/8.1.0).
They're also available from [here](https://mvnrepository.com/artifact/com.vonage/server-sdk/8.2.0).
Release notes can be found in the [changelog](CHANGELOG.md).

### Build It Yourself
Expand Down
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ plugins {

group = "com.vonage"
archivesBaseName = "server-sdk"
version = "8.1.0"
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
version = "8.2.0"

ext.githubPath = 'Vonage/vonage-java-sdk'

Expand All @@ -23,6 +21,11 @@ repositories {
mavenCentral()
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = sourceCompatibility
}

dependencies {
def jacksonVersion = '2.16.1'
def httpclientVersion = '4.5.14'
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/vonage/client/AbstractMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.vonage.client.auth.JWTAuthMethod;
import com.vonage.client.auth.SignatureAuthMethod;
import com.vonage.client.auth.TokenAuthMethod;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
Expand All @@ -46,7 +45,10 @@
* response
*/
public abstract class AbstractMethod<RequestT, ResultT> implements RestEndpoint<RequestT, ResultT> {
private static final Log LOG = LogFactory.getLog(AbstractMethod.class);
static {
LogFactory.getLog(AbstractMethod.class);
}

protected static final BasicResponseHandler basicResponseHandler = new BasicResponseHandler();

protected final HttpWrapper httpWrapper;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/vonage/client/HttpWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
public class HttpWrapper {
private static final String CLIENT_NAME = "vonage-java-sdk";
private static final String CLIENT_VERSION = "8.1.0";
private static final String CLIENT_VERSION = "8.2.0";
private static final String JAVA_VERSION = System.getProperty("java.version");
private static final String USER_AGENT = String.format("%s/%s java/%s", CLIENT_NAME, CLIENT_VERSION, JAVA_VERSION);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
public class HashUtil {

private static Map<HashType, AbstractHasher> hashTypes = new HashMap<HashType, AbstractHasher>() {{
private static final Map<HashType, AbstractHasher> hashTypes = new HashMap<HashType, AbstractHasher>() {{
put(HashType.MD5, new Md5Hasher());
put(HashType.HMAC_SHA1, new HmacSha1Hasher());
put(HashType.HMAC_MD5, new HmacMd5Hasher());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,21 @@ public class NumberInsight2Client {
*
* @param wrapper (REQUIRED) shared HTTP wrapper object used for making REST calls.
*/
@SuppressWarnings("unchecked")
public NumberInsight2Client(HttpWrapper wrapper) {

class Endpoint<T, R> extends DynamicEndpoint<T, R> {
Endpoint(HttpMethod method, R... type) {
@SuppressWarnings("unchecked")
final class Endpoint<T, R> extends DynamicEndpoint<T, R> {
Endpoint(R... type) {
super(DynamicEndpoint.<T, R> builder(type)
.authMethod(TokenAuthMethod.class)
.responseExceptionType(NumberInsight2ResponseException.class)
.requestMethod(method).wrapper(wrapper).pathGetter((de, req) -> {
String base = de.getHttpWrapper().getHttpConfig().getApiBaseUri();
return base + "/v2/ni";
})
.requestMethod(HttpMethod.POST).wrapper(wrapper).pathGetter((de, req) ->
de.getHttpWrapper().getHttpConfig().getApiBaseUri() + "/v2/ni"
)
);
}
}

fraudCheck = new Endpoint<>(HttpMethod.POST);
fraudCheck = new Endpoint<>();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ListNumbersResponse extends JsonableBaseObject {
private int count = 0;
private OwnedNumber[] numbers = new OwnedNumber[0];
private int count;
private OwnedNumber[] numbers;

@JsonProperty("count")
public int getCount() {
Expand All @@ -37,7 +37,7 @@ public int getCount() {

@JsonProperty("numbers")
public OwnedNumber[] getNumbers() {
return numbers;
return numbers != null ? numbers : new OwnedNumber[0];
}

public static ListNumbersResponse fromJson(String json) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class SearchNumbersResponse extends JsonableBaseObject {
private int count = 0;
private AvailableNumber[] numbers = new AvailableNumber[]{};
private int count;
private AvailableNumber[] numbers;

/**
* @return the number of responses returned by the Vonage API.
Expand All @@ -44,7 +44,7 @@ public int getCount() {
*/
@JsonProperty("numbers")
public AvailableNumber[] getNumbers() {
return numbers;
return numbers != null ? numbers : new AvailableNumber[0];
}

public static SearchNumbersResponse fromJson(String json) {
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/com/vonage/client/redact/RedactClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,18 @@ public class RedactClient {
public RedactClient(HttpWrapper wrapper) {
@SuppressWarnings("unchecked")
final class Endpoint<T, R> extends DynamicEndpoint<T, R> {
Endpoint(String path, HttpMethod method, R... type) {
Endpoint(R... type) {
super(DynamicEndpoint.<T, R> builder(type)
.wrapper(wrapper).requestMethod(method).applyAsBasicAuth()
.wrapper(wrapper).requestMethod(HttpMethod.POST).applyAsBasicAuth()
.responseExceptionType(VonageBadRequestException.class)
.authMethod(SignatureAuthMethod.class, TokenAuthMethod.class)
.pathGetter((de, req) -> {
String base = de.getHttpWrapper().getHttpConfig().getVersionedApiBaseUri("v1");
return base + path;
})
.pathGetter((de, req) -> de.getHttpWrapper().getHttpConfig()
.getVersionedApiBaseUri("v1") + "/redact/transaction"
)
);
}
}
redactTransaction = new Endpoint<>("/redact/transaction", HttpMethod.POST);
redactTransaction = new Endpoint<>();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class BinaryMessage extends Message {
* This api, and the Vonage sms service will send this data 'as-is' (in conjunction with the binary UDH) and will not make any corrections.
* so you should ensure that it is a correctly constructed message
* @param udh Most binary content will require a UserDataHeader portion of the message containing commands to enable the handset to interpret the binary data
* (for example, a binary ringtone, a wap-push, OverTheAir configuration, etc).
* (for example, a binary ringtone, a wap-push, OverTheAir configuration etc.).
* Additionally, if you are sending a long text message as multiple concatenated messages and are performing this operation manually rather than
* using the automated long sms handling in the Vonage sms service, then you will need to construct and include here an appropriate
* UserDataHeader field that describes the segmentation/re-assembly fields required to successfully concatenate multiple short messages.
Expand All @@ -61,7 +61,7 @@ public byte[] getMessageBody() {

/**
* @return byte[] Most binary content will require a UserDataHeader portion of the message containing commands to enable the handset to interpret the binary data
* (for example, a binary ringtone, a wap-push, OverTheAir configuration, etc).
* (for example, a binary ringtone, a wap-push, OverTheAir configuration, etc.).
* Additionally, if you are sending a long text message as multiple concatenated messages and are performing this operation manually rather than
* using the automated long sms handling in the Vonage sms service, then you will need to construct and include here an appropriate
* UserDataHeader field that describes the segmentation/re-assembly fields required to successfully concatenate multiple short messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ public String getFrom() {
public String getTo() {
return to;
}

@Override
public String toString() {
return getClass().getSimpleName()+' '+toJson();
}

@SuppressWarnings("unchecked")
protected abstract static class Builder<T extends AbstractTransfer, B extends Builder<? extends T, ? extends B>> {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/vonage/client/verify/VerifyDetails.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class VerifyDetails extends JsonableBaseObject {
private Date dateSubmitted, dateFinalized, firstEventDate, lastEventDate;
private Status status;
private BigDecimal price, estimatedPriceMessagesSent;
private List<VerifyCheck> checks = new ArrayList<>();
private List<VerifyCheck> checks = new ArrayList<>(0);

/**
* @return The {@code request_id} that you received in the response to the
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/vonage/client/video/Archive.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public static Builder builder(String sessionId) {
}

/**
* Used to construct a Archive object.
* Used to construct an Archive object.
*
* @see Archive
*/
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/vonage/client/video/Broadcast.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.util.Objects;

/**
* Represents properties of a live streaming broadcast.
* Represents properties of a live-streaming broadcast.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(value = JsonInclude.Include.NON_NULL)
Expand Down Expand Up @@ -260,8 +260,8 @@ public Builder layout(StreamCompositionLayout layout) {
* For each RTMP stream, specify serverUrl (the RTMP server URL), streamName
* (the stream name, such as the YouTube Live stream name or the Facebook stream key), and
* (optionally) id (a unique ID for the stream). If you specify an ID, it will be included in the REST call
* response and the REST method for getting information about a live streaming broadcast. Vonage streams
* the session to each RTMP URL you specify. Note that Vonage live streaming supports RTMP and RTMPS.
* response and the REST method for getting information about a live-streaming broadcast. Vonage streams
* the session to each RTMP URL you specify. Note that Vonage live-streaming supports RTMP and RTMPS.
*
* @param rtmp The RTMP stream to include in the broadcast.
*
Expand All @@ -278,8 +278,8 @@ public Builder addRtmpStream(Rtmp rtmp) {
* For each RTMP stream, specify serverUrl (the RTMP server URL), streamName
* (the stream name, such as the YouTube Live stream name or the Facebook stream key), and
* (optionally) id (a unique ID for the stream). If you specify an ID, it will be included in the REST call
* response and the REST method for getting information about a live streaming broadcast. Vonage streams
* the session to each RTMP URL you specify. Note that Vonage live streaming supports RTMP and RTMPS.
* response and the REST method for getting information about a live-streaming broadcast. Vonage streams
* the session to each RTMP URL you specify. Note that Vonage live-streaming supports RTMP and RTMPS.
*
* @param rtmps The RTMP streams to include in the broadcast.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ Many of these are straightforward and your IDE will help you with auto-completio
## Supported Features
The following is a list of Vonage Video API features and whether the Vonage Java SDK currently supports them:

| API | Supported?
|----------|:-------------:|
| Session Creation | |
| Stream Management | |
| Signaling | |
| Moderation | |
| Archiving | |
| Live Streaming Broadcasts | |
| SIP Interconnect | |
| Account Management | |
| Experience Composer | |
| Audio Connector | |
| Live Captions | |
| Custom S3/Azure buckets | |
| API | Supported? |
|---------------------------|:----------:|
| Session Creation | |
| Stream Management | |
| Signaling | |
| Moderation | |
| Archiving | |
| Live Streaming Broadcasts | |
| SIP Interconnect | |
| Account Management | |
| Experience Composer | |
| Audio Connector | |
| Live Captions | |
| Custom S3/Azure buckets | |
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public Builder name(String name) {

/**
* @param musicOnHoldUrl A URL to the mp3 file to stream to participants until the conversation starts.
* By default the conversation starts when the first person calls the virtual number
* By default, the conversation starts when the first person calls the virtual number
* associated with your Voice app. To stream this mp3 before the moderator joins the
* conversation, set startOnEnter to false for all users other than the moderator.
*
Expand All @@ -162,7 +162,7 @@ public Builder musicOnHoldUrl(Collection<String> musicOnHoldUrl) {

/**
* @param musicOnHoldUrl A URL to the mp3 file to stream to participants until the conversation starts.
* By default the conversation starts when the first person calls the virtual number
* By default, the conversation starts when the first person calls the virtual number
* associated with your Voice app. To stream this mp3 before the moderator joins the
* conversation, set startOnEnter to false for all users other than the moderator.
*
Expand Down Expand Up @@ -203,7 +203,7 @@ public Builder endOnExit(Boolean endOnExit) {
* startOnEnter is set to true. When the recording is terminated, the URL you download the
* recording from is sent to the event URL.
* <p>
* By default audio is recorded in MP3 format. See the <a href="https://developer.nexmo.com/voice/voice-api/guides/recordingfile-formats">recording guide</a> for more details
* By default, audio is recorded in MP3 format. See the <a href="https://developer.nexmo.com/voice/voice-api/guides/recordingfile-formats">recording guide</a> for more details
*
* @return This builder.
*/
Expand Down
Loading

0 comments on commit bb39ee2

Please sign in to comment.