mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: add new "object" and "id" properties to REST entities
parent
67c50862bb
commit
9e957eddf5
|
@ -271,7 +271,9 @@ public class Participant {
|
||||||
|
|
||||||
public JsonObject toJson() {
|
public JsonObject toJson() {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("connectionId", this.participantPublicId);
|
json.addProperty("id", this.participantPublicId);
|
||||||
|
json.addProperty("object", "connection");
|
||||||
|
json.addProperty("connectionId", this.participantPublicId); // TODO: deprecated. Better use only "id"
|
||||||
json.addProperty("sessionId", this.sessionId);
|
json.addProperty("sessionId", this.sessionId);
|
||||||
json.addProperty("createdAt", this.createdAt);
|
json.addProperty("createdAt", this.createdAt);
|
||||||
json.addProperty("location", this.location != null ? this.location.toString() : "unknown");
|
json.addProperty("location", this.location != null ? this.location.toString() : "unknown");
|
||||||
|
|
|
@ -224,8 +224,9 @@ public class Session implements SessionInterface {
|
||||||
|
|
||||||
private JsonObject sharedJson(Function<KurentoParticipant, JsonObject> toJsonFunction) {
|
private JsonObject sharedJson(Function<KurentoParticipant, JsonObject> toJsonFunction) {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("sessionId", this.sessionId);
|
json.addProperty("id", this.sessionId);
|
||||||
json.addProperty("id", this.sessionId); // TODO: deprecated. Better use only "sessionId"
|
json.addProperty("object", "session");
|
||||||
|
json.addProperty("sessionId", this.sessionId); // TODO: deprecated. Better use only "id"
|
||||||
json.addProperty("createdAt", this.startTime);
|
json.addProperty("createdAt", this.startTime);
|
||||||
json.addProperty("mediaMode", this.sessionProperties.mediaMode().name());
|
json.addProperty("mediaMode", this.sessionProperties.mediaMode().name());
|
||||||
json.addProperty("recordingMode", this.sessionProperties.recordingMode().name());
|
json.addProperty("recordingMode", this.sessionProperties.recordingMode().name());
|
||||||
|
|
|
@ -91,8 +91,9 @@ public class Token {
|
||||||
|
|
||||||
public JsonObject toJson() {
|
public JsonObject toJson() {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("token", this.getToken());
|
|
||||||
json.addProperty("id", this.getToken());
|
json.addProperty("id", this.getToken());
|
||||||
|
json.addProperty("object", "token");
|
||||||
|
json.addProperty("token", this.getToken());
|
||||||
json.addProperty("connectionId", this.getConnectionId());
|
json.addProperty("connectionId", this.getConnectionId());
|
||||||
json.addProperty("session", this.sessionId);
|
json.addProperty("session", this.sessionId);
|
||||||
json.addProperty("role", this.getRole().toString());
|
json.addProperty("role", this.getRole().toString());
|
||||||
|
@ -104,6 +105,25 @@ public class Token {
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JsonObject toJsonAsParticipant() {
|
||||||
|
JsonObject json = new JsonObject();
|
||||||
|
json.addProperty("id", this.getConnectionId());
|
||||||
|
json.addProperty("object", "connection");
|
||||||
|
json.addProperty("connectionId", this.getConnectionId()); // DEPRECATED: better use id
|
||||||
|
json.addProperty("sessionId", this.sessionId);
|
||||||
|
json.add("createdAt", null);
|
||||||
|
json.add("location", null);
|
||||||
|
json.add("platform", null);
|
||||||
|
json.addProperty("token", this.getToken());
|
||||||
|
json.addProperty("role", this.getRole().toString());
|
||||||
|
json.addProperty("serverData", this.getServerMetadata());
|
||||||
|
json.addProperty("record", this.record());
|
||||||
|
json.add("clientData", null);
|
||||||
|
json.add("publishers", null);
|
||||||
|
json.add("subscribers", null);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (this.role != null)
|
if (this.role != null)
|
||||||
|
|
|
@ -152,9 +152,9 @@ public class Kms {
|
||||||
public JsonObject toJson() {
|
public JsonObject toJson() {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("id", this.id);
|
json.addProperty("id", this.id);
|
||||||
|
json.addProperty("object", "mediaNode");
|
||||||
json.addProperty("ip", this.ip);
|
json.addProperty("ip", this.ip);
|
||||||
json.addProperty("uri", this.uri);
|
json.addProperty("uri", this.uri);
|
||||||
|
|
||||||
final boolean connected = this.isKurentoClientConnected();
|
final boolean connected = this.isKurentoClientConnected();
|
||||||
json.addProperty("connected", connected);
|
json.addProperty("connected", connected);
|
||||||
json.addProperty("connectionTime", this.getTimeOfKurentoClientConnection());
|
json.addProperty("connectionTime", this.getTimeOfKurentoClientConnection());
|
||||||
|
|
|
@ -191,6 +191,7 @@ public class Recording {
|
||||||
public JsonObject toJson() {
|
public JsonObject toJson() {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("id", this.id);
|
json.addProperty("id", this.id);
|
||||||
|
json.addProperty("object", "recording");
|
||||||
json.addProperty("name", this.recordingProperties.name());
|
json.addProperty("name", this.recordingProperties.name());
|
||||||
json.addProperty("outputMode", this.getOutputMode().name());
|
json.addProperty("outputMode", this.getOutputMode().name());
|
||||||
if (RecordingUtils.IS_COMPOSED(this.recordingProperties.outputMode()) && this.hasVideo) {
|
if (RecordingUtils.IS_COMPOSED(this.recordingProperties.outputMode()) && this.hasVideo) {
|
||||||
|
|
Loading…
Reference in New Issue