(roomsV2() )
Create a new room for an existing application . Poll the GetConnectionInfo()
endpoint to get connection details for an active room.
package hello .world ;
import dev .hathora .cloud_sdk .HathoraCloud ;
import dev .hathora .cloud_sdk .models .errors .ApiError ;
import dev .hathora .cloud_sdk .models .operations .CreateRoomResponse ;
import dev .hathora .cloud_sdk .models .shared .CreateRoomParams ;
import dev .hathora .cloud_sdk .models .shared .Region ;
import dev .hathora .cloud_sdk .models .shared .Security ;
import java .lang .Exception ;
import java .util .List ;
public class Application {
public static void main (String [] args ) throws ApiError , Exception {
HathoraCloud sdk = HathoraCloud .builder ()
.security (Security .builder ()
.hathoraDevToken ("<YOUR_BEARER_TOKEN_HERE>" )
.build ())
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.orgId ("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39" )
.build ();
CreateRoomResponse res = sdk .roomsV2 ().createRoom ()
.createRoomParams (CreateRoomParams .builder ()
.region (Region .SAO_PAULO )
.clientIPs (List .of (
"123.123.123.123" ))
.deploymentId ("dep-6d4c6a71-2d75-4b42-94e1-f312f57f33c5" )
.roomConfig ("{\" name\" :\" my-room\" }" )
.build ())
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.roomId ("2swovpy1fnunu" )
.call ();
if (res .roomConnectionData ().isPresent ()) {
// handle response
}
}
}
Parameter
Type
Required
Description
Example
createRoomParams
CreateRoomParams
✔️
N/A
appId
Optional<String>
➖
N/A
app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId
Optional<String>
➖
N/A
2swovpy1fnunu
CreateRoomResponse
Error Type
Status Code
Content Type
models/errors/ApiError
400, 401, 402, 404, 422, 429, 500
application/json
models/errors/SDKError
4XX, 5XX
*/*
Destroy a room . All associated metadata is deleted.
package hello .world ;
import dev .hathora .cloud_sdk .HathoraCloud ;
import dev .hathora .cloud_sdk .models .errors .ApiError ;
import dev .hathora .cloud_sdk .models .operations .DestroyRoomResponse ;
import dev .hathora .cloud_sdk .models .shared .Security ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ApiError , Exception {
HathoraCloud sdk = HathoraCloud .builder ()
.security (Security .builder ()
.hathoraDevToken ("<YOUR_BEARER_TOKEN_HERE>" )
.build ())
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.orgId ("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39" )
.build ();
DestroyRoomResponse res = sdk .roomsV2 ().destroyRoom ()
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.roomId ("2swovpy1fnunu" )
.call ();
// handle response
}
}
Parameter
Type
Required
Description
Example
appId
Optional<String>
➖
N/A
app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId
String
✔️
N/A
2swovpy1fnunu
DestroyRoomResponse
Error Type
Status Code
Content Type
models/errors/ApiError
401, 404, 429, 500
application/json
models/errors/SDKError
4XX, 5XX
*/*
Get all active rooms for a given process .
package hello .world ;
import dev .hathora .cloud_sdk .HathoraCloud ;
import dev .hathora .cloud_sdk .models .errors .ApiError ;
import dev .hathora .cloud_sdk .models .operations .GetActiveRoomsForProcessResponse ;
import dev .hathora .cloud_sdk .models .shared .Security ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ApiError , Exception {
HathoraCloud sdk = HathoraCloud .builder ()
.security (Security .builder ()
.hathoraDevToken ("<YOUR_BEARER_TOKEN_HERE>" )
.build ())
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.orgId ("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39" )
.build ();
GetActiveRoomsForProcessResponse res = sdk .roomsV2 ().getActiveRoomsForProcess ()
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.processId ("cbfcddd2-0006-43ae-996c-995fff7bed2e" )
.call ();
if (res .classes ().isPresent ()) {
// handle response
}
}
}
Parameter
Type
Required
Description
Example
appId
Optional<String>
➖
N/A
app-af469a92-5b45-4565-b3c4-b79878de67d2
processId
String
✔️
N/A
cbfcddd2-0006-43ae-996c-995fff7bed2e
GetActiveRoomsForProcessResponse
Error Type
Status Code
Content Type
models/errors/ApiError
401, 404, 429
application/json
models/errors/SDKError
4XX, 5XX
*/*
Poll this endpoint to get connection details to a room . Clients can call this endpoint without authentication.
package hello .world ;
import dev .hathora .cloud_sdk .HathoraCloud ;
import dev .hathora .cloud_sdk .models .errors .ApiError ;
import dev .hathora .cloud_sdk .models .operations .GetConnectionInfoResponse ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ApiError , Exception {
HathoraCloud sdk = HathoraCloud .builder ()
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.orgId ("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39" )
.build ();
GetConnectionInfoResponse res = sdk .roomsV2 ().getConnectionInfo ()
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.roomId ("2swovpy1fnunu" )
.call ();
if (res .connectionInfoV2 ().isPresent ()) {
// handle response
}
}
}
Parameter
Type
Required
Description
Example
appId
Optional<String>
➖
N/A
app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId
String
✔️
N/A
2swovpy1fnunu
GetConnectionInfoResponse
Error Type
Status Code
Content Type
models/errors/ApiError
400, 402, 404, 422, 429, 500
application/json
models/errors/SDKError
4XX, 5XX
*/*
getInactiveRoomsForProcess
Get all inactive rooms for a given process .
package hello .world ;
import dev .hathora .cloud_sdk .HathoraCloud ;
import dev .hathora .cloud_sdk .models .errors .ApiError ;
import dev .hathora .cloud_sdk .models .operations .GetInactiveRoomsForProcessResponse ;
import dev .hathora .cloud_sdk .models .shared .Security ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ApiError , Exception {
HathoraCloud sdk = HathoraCloud .builder ()
.security (Security .builder ()
.hathoraDevToken ("<YOUR_BEARER_TOKEN_HERE>" )
.build ())
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.orgId ("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39" )
.build ();
GetInactiveRoomsForProcessResponse res = sdk .roomsV2 ().getInactiveRoomsForProcess ()
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.processId ("cbfcddd2-0006-43ae-996c-995fff7bed2e" )
.call ();
if (res .classes ().isPresent ()) {
// handle response
}
}
}
Parameter
Type
Required
Description
Example
appId
Optional<String>
➖
N/A
app-af469a92-5b45-4565-b3c4-b79878de67d2
processId
String
✔️
N/A
cbfcddd2-0006-43ae-996c-995fff7bed2e
GetInactiveRoomsForProcessResponse
Error Type
Status Code
Content Type
models/errors/ApiError
401, 404, 429
application/json
models/errors/SDKError
4XX, 5XX
*/*
Retreive current and historical allocation data for a room .
package hello .world ;
import dev .hathora .cloud_sdk .HathoraCloud ;
import dev .hathora .cloud_sdk .models .errors .ApiError ;
import dev .hathora .cloud_sdk .models .operations .GetRoomInfoResponse ;
import dev .hathora .cloud_sdk .models .shared .Security ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ApiError , Exception {
HathoraCloud sdk = HathoraCloud .builder ()
.security (Security .builder ()
.hathoraDevToken ("<YOUR_BEARER_TOKEN_HERE>" )
.build ())
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.orgId ("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39" )
.build ();
GetRoomInfoResponse res = sdk .roomsV2 ().getRoomInfo ()
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.roomId ("2swovpy1fnunu" )
.call ();
if (res .room ().isPresent ()) {
// handle response
}
}
}
Parameter
Type
Required
Description
Example
appId
Optional<String>
➖
N/A
app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId
String
✔️
N/A
2swovpy1fnunu
GetRoomInfoResponse
Error Type
Status Code
Content Type
models/errors/ApiError
401, 404, 422, 429
application/json
models/errors/SDKError
4XX, 5XX
*/*
ResumeRoom
package hello .world ;
import dev .hathora .cloud_sdk .HathoraCloud ;
import dev .hathora .cloud_sdk .models .errors .ApiError ;
import dev .hathora .cloud_sdk .models .operations .ResumeRoomResponse ;
import dev .hathora .cloud_sdk .models .shared .Security ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ApiError , Exception {
HathoraCloud sdk = HathoraCloud .builder ()
.security (Security .builder ()
.hathoraDevToken ("<YOUR_BEARER_TOKEN_HERE>" )
.build ())
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.orgId ("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39" )
.build ();
ResumeRoomResponse res = sdk .roomsV2 ().resumeRoom ()
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.roomId ("2swovpy1fnunu" )
.call ();
if (res .roomAllocationData ().isPresent ()) {
// handle response
}
}
}
Parameter
Type
Required
Description
Example
appId
Optional<String>
➖
N/A
app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId
String
✔️
N/A
2swovpy1fnunu
ResumeRoomResponse
Error Type
Status Code
Content Type
models/errors/ApiError
400, 401, 402, 404, 422, 429, 500
application/json
models/errors/SDKError
4XX, 5XX
*/*
Suspend a room . The room is unallocated from the process but can be rescheduled later using the same roomId
.
⚠️ DEPRECATED : This will be removed in a future release, please migrate away from it as soon as possible.
package hello .world ;
import dev .hathora .cloud_sdk .HathoraCloud ;
import dev .hathora .cloud_sdk .models .errors .ApiError ;
import dev .hathora .cloud_sdk .models .operations .SuspendRoomV2DeprecatedResponse ;
import dev .hathora .cloud_sdk .models .shared .Security ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ApiError , Exception {
HathoraCloud sdk = HathoraCloud .builder ()
.security (Security .builder ()
.hathoraDevToken ("<YOUR_BEARER_TOKEN_HERE>" )
.build ())
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.orgId ("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39" )
.build ();
SuspendRoomV2DeprecatedResponse res = sdk .roomsV2 ().suspendRoomV2Deprecated ()
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.roomId ("2swovpy1fnunu" )
.call ();
// handle response
}
}
Parameter
Type
Required
Description
Example
appId
Optional<String>
➖
N/A
app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId
String
✔️
N/A
2swovpy1fnunu
SuspendRoomV2DeprecatedResponse
Error Type
Status Code
Content Type
models/errors/ApiError
401, 404, 429, 500
application/json
models/errors/SDKError
4XX, 5XX
*/*
UpdateRoomConfig
package hello .world ;
import dev .hathora .cloud_sdk .HathoraCloud ;
import dev .hathora .cloud_sdk .models .errors .ApiError ;
import dev .hathora .cloud_sdk .models .operations .UpdateRoomConfigResponse ;
import dev .hathora .cloud_sdk .models .shared .Security ;
import dev .hathora .cloud_sdk .models .shared .UpdateRoomConfigParams ;
import java .lang .Exception ;
public class Application {
public static void main (String [] args ) throws ApiError , Exception {
HathoraCloud sdk = HathoraCloud .builder ()
.security (Security .builder ()
.hathoraDevToken ("<YOUR_BEARER_TOKEN_HERE>" )
.build ())
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.orgId ("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39" )
.build ();
UpdateRoomConfigResponse res = sdk .roomsV2 ().updateRoomConfig ()
.updateRoomConfigParams (UpdateRoomConfigParams .builder ()
.roomConfig ("{\" name\" :\" my-room\" }" )
.build ())
.appId ("app-af469a92-5b45-4565-b3c4-b79878de67d2" )
.roomId ("2swovpy1fnunu" )
.call ();
// handle response
}
}
Parameter
Type
Required
Description
Example
updateRoomConfigParams
UpdateRoomConfigParams
✔️
N/A
appId
Optional<String>
➖
N/A
app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId
String
✔️
N/A
2swovpy1fnunu
UpdateRoomConfigResponse
Error Type
Status Code
Content Type
models/errors/ApiError
401, 404, 422, 429, 500
application/json
models/errors/SDKError
4XX, 5XX
*/*