-
Notifications
You must be signed in to change notification settings - Fork 64
feat: Add listConnections API (DEVX-10074) #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /** | ||
| * OpenTok Java SDK | ||
| * Copyright (C) 2026 Vonage. | ||
| * http://www.tokbox.com | ||
| * | ||
| * Licensed under The MIT License (MIT). See LICENSE file for more information. | ||
| */ | ||
| package com.opentok; | ||
|
|
||
| import com.fasterxml.jackson.annotation.*; | ||
|
|
||
| /** | ||
| * Represents a connection in an OpenTok session. | ||
| */ | ||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public class Connection { | ||
|
|
||
| /** | ||
| * The state of a connection in a session. | ||
| */ | ||
| public enum ConnectionState { | ||
| CONNECTING, CONNECTED, DISCONNECTED; | ||
|
|
||
| @JsonCreator | ||
| public static ConnectionState fromString(String state) { | ||
| try { | ||
| return ConnectionState.valueOf(state.toUpperCase()); | ||
| } | ||
| catch (NullPointerException | IllegalArgumentException e) { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| @JsonValue | ||
| @Override | ||
| public String toString() { | ||
| return name().charAt(0) + name().substring(1).toLowerCase(); | ||
| } | ||
| } | ||
|
|
||
| @JsonProperty private String connectionId; | ||
| @JsonProperty private long createdAt; | ||
| @JsonProperty private ConnectionState connectionState; | ||
|
|
||
| protected Connection() { | ||
| } | ||
|
|
||
| @JsonCreator | ||
| public static Connection makeConnection() { | ||
| return new Connection(); | ||
| } | ||
|
|
||
| /** | ||
| * The connection ID. | ||
| */ | ||
| public String getConnectionId() { | ||
| return connectionId; | ||
| } | ||
|
|
||
| /** | ||
| * The time at which the client connected, in milliseconds since the Unix epoch. | ||
| */ | ||
| public long getCreatedAt() { | ||
| return createdAt; | ||
| } | ||
|
|
||
| /** | ||
| * The current state of the connection. | ||
| */ | ||
| public ConnectionState getConnectionState() { | ||
| return connectionState; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /** | ||
| * OpenTok Java SDK | ||
| * Copyright (C) 2026 Vonage. | ||
| * http://www.tokbox.com | ||
| * | ||
| * Licensed under The MIT License (MIT). See LICENSE file for more information. | ||
| */ | ||
| package com.opentok; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Represents a list of connections in an OpenTok session. | ||
| */ | ||
| @JsonFormat(shape = JsonFormat.Shape.OBJECT) | ||
| public class ConnectionList extends ArrayList<Connection> { | ||
|
|
||
| private int count; | ||
| private String projectId; | ||
| private String sessionId; | ||
|
|
||
| /** | ||
| * The total number of connections in the session. | ||
| */ | ||
| public int getCount() { | ||
| return count; | ||
| } | ||
|
|
||
| /** | ||
| * The API key (project ID) for the session. | ||
| */ | ||
| public String getProjectId() { | ||
| return projectId; | ||
| } | ||
|
|
||
| /** | ||
| * The session ID. | ||
| */ | ||
| public String getSessionId() { | ||
| return sessionId; | ||
| } | ||
|
|
||
| private void setCount(int count) { | ||
| this.count = count; | ||
| } | ||
|
|
||
| private void setProjectId(String projectId) { | ||
| this.projectId = projectId; | ||
| } | ||
|
|
||
| private void setSessionId(String sessionId) { | ||
| this.sessionId = sessionId; | ||
| } | ||
|
|
||
| private void setItems(List<Connection> connections) { | ||
| this.clear(); | ||
| this.addAll(connections); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.