Skip to content

Commit

Permalink
feat: Add Experience Composer to Video API (#526)
Browse files Browse the repository at this point in the history
* feat: Add Experience Composer

* Bump version: v8.5.0 → v8.6.0

* Test Experience Composer

* Base class for listX in Video

* Add reason to RenderResponse

* Fixes based on live testing
  • Loading branch information
SMadani committed Apr 17, 2024
1 parent a306e6d commit 0e0952d
Show file tree
Hide file tree
Showing 23 changed files with 971 additions and 122 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.5.0
current_version = v8.6.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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ 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/).

# [8.6.0] - 2024-04-19
- Added Experience Composer to Video API
- Fixed regression in `createSession` endpoint which caused the API to return XML instead of JSON.

# [8.5.0] - 2024-04-12
- Added Live Captions and Audio Connector endpoints to Video API
- Added `publisheronly` role to Video API
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {

group = "com.vonage"
archivesBaseName = "server-sdk"
version = "8.5.0"
version = "8.6.0"

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

Expand Down
11 changes: 8 additions & 3 deletions src/main/java/com/vonage/client/DynamicEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ protected DynamicEndpoint(Builder<T, R> builder) {
responseExceptionType = builder.responseExceptionType;
responseType = builder.responseType;
contentType = builder.contentType;
if ((accept = builder.accept) == null && Jsonable.class.isAssignableFrom(responseType)) {
if ((accept = builder.accept) == null &&
(Jsonable.class.isAssignableFrom(responseType) || isJsonableArrayResponse())
) {
accept = ContentType.APPLICATION_JSON.getMimeType();
}
}
Expand Down Expand Up @@ -185,6 +187,10 @@ else if (applyBasicAuth) {
}
}

private boolean isJsonableArrayResponse() {
return responseType.isArray() && Jsonable.class.isAssignableFrom(responseType.getComponentType());
}

private String getRequestHeader(T requestBody) {
if (contentType != null)
return contentType;
Expand Down Expand Up @@ -294,8 +300,7 @@ else if (byte[].class.equals(responseType)) {
if (Jsonable.class.isAssignableFrom(responseType)) {
return (R) Jsonable.fromJson(deser, (Class<? extends Jsonable>) responseType);
}
else if (Collection.class.isAssignableFrom(responseType) ||
(responseType.isArray() && Jsonable.class.isAssignableFrom(responseType.getComponentType()))) {
else if (Collection.class.isAssignableFrom(responseType) || isJsonableArrayResponse()) {
return Jsonable.createDefaultObjectMapper().readValue(deser, responseType);
}
else {
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.5.0";
private static final String CLIENT_VERSION = "8.6.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 @@ -268,7 +268,7 @@ public String getPrivateKey() {
}
}

public static class Capabilities extends JsonableBaseObject {
public static class Capabilities extends JsonableBaseObject {
private Voice voice;
private Messages messages;
private Rtc rtc;
Expand Down
26 changes: 1 addition & 25 deletions src/main/java/com/vonage/client/video/ListArchivesResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,5 @@
*/
package com.vonage.client.video;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.vonage.client.Jsonable;
import com.vonage.client.JsonableBaseObject;
import java.util.List;

class ListArchivesResponse extends JsonableBaseObject {
private Integer count;
private List<Archive> items;

protected ListArchivesResponse() {
}

@JsonProperty("count")
public Integer getCount() {
return count;
}

@JsonProperty("items")
public List<Archive> getItems() {
return items;
}

public static ListArchivesResponse fromJson(String json) {
return Jsonable.fromJson(json);
}
final class ListArchivesResponse extends ListResourceResponse<Archive> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,5 @@
*/
package com.vonage.client.video;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.vonage.client.JsonableBaseObject;
import java.util.List;

class ListBroadcastsResponse extends JsonableBaseObject {
private Integer count;
private List<Broadcast> items;

protected ListBroadcastsResponse() {
}

/**
* @return The total number of broadcasts in the results.
*/
@JsonProperty("count")
public Integer getCount() {
return count;
}

/**
* @return List of objects defining each broadcast retrieved.
* Broadcasts are listed from the newest to the oldest in the return set.
*/
@JsonProperty("items")
public List<Broadcast> getItems() {
return items;
}
final class ListBroadcastsResponse extends ListResourceResponse<Broadcast> {
}
19 changes: 19 additions & 0 deletions src/main/java/com/vonage/client/video/ListRendersResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* 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.video;

final class ListRendersResponse extends ListResourceResponse<RenderResponse> {
}
38 changes: 38 additions & 0 deletions src/main/java/com/vonage/client/video/ListResourceResponse.java
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.video;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.vonage.client.JsonableBaseObject;
import java.util.List;

class ListResourceResponse<T> extends JsonableBaseObject {
private Integer count;
private List<T> items;

protected ListResourceResponse() {
}

@JsonProperty("count")
public Integer getCount() {
return count;
}

@JsonProperty("items")
public List<T> getItems() {
return items;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,25 @@ public Integer getCount() {
}

/**
* Retrive only compositions for a given session ID.
* Retrieve only compositions for a given session ID.
*
* @return The session ID to filter by.
*/
public String getSessionId() {
return sessionId;
}

/**
* Used in {@linkplain VideoClient} for default retrieval (no-args).
*
* @return A new filter for returning the maximum number of results.
*
* @since 8.6.0
*/
static ListStreamCompositionsRequest maxResults() {
return builder().count(1000).build();
}

/**
* Instantiates a Builder, used to construct this object.
*
Expand Down Expand Up @@ -126,7 +137,7 @@ public Builder count(int count) {

/**
* Set a sessionId query parameter to list compositions for a specific session ID. This is useful
* when listing multiple compositions for sessions with {@link StreamMode#AUTO}.
* when listing multiple compositions for sessions with {@link StreamMode#AUTO}.
*
* @param sessionId The session ID to filter by.
*
Expand Down
38 changes: 1 addition & 37 deletions src/main/java/com/vonage/client/video/ListStreamsResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,5 @@
*/
package com.vonage.client.video;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.vonage.client.Jsonable;
import com.vonage.client.JsonableBaseObject;
import java.util.List;

class ListStreamsResponse extends JsonableBaseObject {
private Integer count;
private List<GetStreamResponse> items;

protected ListStreamsResponse() {
}

/**
* @return Number of items in the list.
*/
@JsonProperty("count")
public Integer getCount() {
return count;
}

/**
* @return The response object for each video stream.
*/
@JsonProperty("items")
public List<GetStreamResponse> getItems() {
return items;
}

/**
* Creates an instance of this class from a JSON payload.
*
* @param json The JSON string to parse.
* @return An instance of this class with the fields populated, if present.
*/
public static ListStreamsResponse fromJson(String json) {
return Jsonable.fromJson(json);
}
final class ListStreamsResponse extends ListResourceResponse<GetStreamResponse> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ For more detailed usage instructions, see the [Java Sever SDK video guide](https
There are a few small changes to be aware of when migrating to Vonage from OpenTok.
Many of these are straightforward and your IDE will help you with auto-completion, but for clarity, consider the following:

- `projectId` is now `applicationId` where applicable.
- Stronger typing used where applicable (e.g. `UUID` and `URI` instead of `String`)
- `playDTMF` renamed to `sendDtmf` for all applicable DTMF endpoints.
- `OpenTok#disableForceMute(String)` replaced by `VideoClient#muteSession(String, boolean, String...)`. You need to set the `active` boolean parameter to `false` to achieve the same effect.
- The `MuteAllProperties` class and parameter in `OpenTok` has been replaced by using the `excludedStreamIds` directly in the method parameter of `VideoClient#muteSession(String, boolean, Collection<String>)` (or `VideoClient#muteSession(String, boolean, String...) for convenience`). These methods replace `OpenTok#forceMuteAll(String, MuteAllProperties)`.
Expand All @@ -62,9 +64,16 @@ Many of these are straightforward and your IDE will help you with auto-completio
- `Caption` replaced with `CaptionsResponse`.
- `CaptionsRequest` uses an enum for the `languageCode` instead of a plain string.
- The `token` and `sessionId` are still required and set on the `CaptionsRequest.Builder` object.
- `OpenTok#connectAudioStream(String sessionId, String token, AudioConnectorProperties properties)` replaced by `VideoClient#connectToWebsocket(ConnectRequest request)`
- `AudioConnectorProperties` replaced with `ConnectRequest`
- `AudioConnector` replaced with `ConnectResponse`
- `OpenTok#connectAudioStream(String, String, AudioConnectorProperties)` replaced by `VideoClient#connectToWebsocket(ConnectRequest)`.
- `AudioConnectorProperties` replaced with `ConnectRequest`.
- `AudioConnector` replaced with `ConnectResponse`.
- `OpenTok#startRender(String, String, RenderProperties)` replaced by `VideoClient#startRender(RenderRequest)`.
- `RenderProperties` replaced by `RenderRequest`.
- `name` parameter in the inner `Properties` class is set on the top-level `RenderRequest.Builder`.
- `Render` replaced by `RenderResponse`.
- `resolution` is now an enum instead of a plain string.
- `OpenTok#listRenders(Integer, Integer)` replaced by `VideoClient#listRenders(ListStreamCompositionsRequest)`.
- This works similarly to the updated `listBroadcasts` and `listArchives` methods (see above).

## Supported Features
The following is a list of Vonage Video API features and whether the Vonage Java SDK currently supports them:
Expand All @@ -78,7 +87,7 @@ The following is a list of Vonage Video API features and whether the Vonage Java
| Archiving ||
| Live Streaming Broadcasts ||
| SIP Interconnect ||
| Experience Composer | |
| Experience Composer | |
| Audio Connector ||
| Live Captions ||
| Account Management ||
Expand Down

0 comments on commit 0e0952d

Please sign in to comment.