Package org.vrspace.server.api
Class Worlds
java.lang.Object
org.vrspace.server.api.ApiBase
org.vrspace.server.api.ClientControllerBase
org.vrspace.server.api.Worlds
@RestController
@RequestMapping("/vrspace/api/worlds")
public class Worlds
extends ClientControllerBase
World controller handles worlds-related operations.
- Author:
- joe
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<String> createWorld(jakarta.servlet.http.HttpSession session, Worlds.CreateWorldOptions params) Create a private world, the user must be authenticated.enterWorld(jakarta.servlet.http.HttpSession session, String worldName, Optional<String> token, Optional<Boolean> async) Enter a world, the client must be authenticated.List worlds available on the server, ones found in the content/worlds directory, that can be created on demand.List worlds currently existing on the server, i.e.users()List worlds, and number users/clients currently in them.Methods inherited from class org.vrspace.server.api.ClientControllerBase
findClient, findClient, getAuthorisedClient, getAuthorisedClient, isAuthenticatedMethods inherited from class org.vrspace.server.api.ApiBase
currentUserName, isAuthenticated
-
Field Details
-
PATH
- See Also:
-
-
Constructor Details
-
Worlds
public Worlds()
-
-
Method Details
-
listExisting
List worlds currently existing on the server, i.e. all worlds in the database.- Returns:
- list of existing worlds
-
listAvailable
List worlds available on the server, ones found in the content/worlds directory, that can be created on demand. Some temporary worlds may be existing at the moment, these have id, while non-existing ones do not.- Returns:
- list of available worlds.
-
users
List worlds, and number users/clients currently in them. Number of clients includes bots etc, totals include disconnected clients that are still in the world.- Returns:
-
createWorld
@PostMapping("/create") public org.springframework.http.ResponseEntity<String> createWorld(jakarta.servlet.http.HttpSession session, @RequestBody(required=true) Worlds.CreateWorldOptions params) Create a private world, the user must be authenticated. If the world already exists, owner may change isPublic or isTemporary parameters. Returns HTTP 201 CREATED for created world, or HTTP 200 OK if world already exists.- Parameters:
session- automatically passed by frameworkparams- world options- Returns:
- token required to enter the world, only for private worlds
-
enterWorld
@PostMapping("/enter") public String enterWorld(jakarta.servlet.http.HttpSession session, String worldName, Optional<String> token, Optional<Boolean> async) Enter a world, the client must be authenticated. REST equivalent of Enter command. This is only valid after the websocket connection has been established.- Parameters:
session- automatically passed by frameworkworldName- Name of the world to entertoken- Optional token required to enter private worldasync- If set, the Welcome answer is sent over the websocket, and this will return null- Returns:
- Welcome message containing only publicly accessible Client attributes
-