Skip to content

Latest commit

 

History

History
459 lines (337 loc) · 33.9 KB

README.md

File metadata and controls

459 lines (337 loc) · 33.9 KB

LobbiesV2

(lobbiesV2())

Overview

Available Operations

createLobbyDeprecated

Create a new lobby for an application. A lobby object is a wrapper around a room object. With a lobby, you get additional functionality like configuring the visibility of the room, managing the state of a match, and retrieving a list of public lobbies to display to players.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package hello.world;

import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.CreateLobbyDeprecatedResponse;
import dev.hathora.cloud_sdk.models.operations.CreateLobbyDeprecatedSecurity;
import dev.hathora.cloud_sdk.models.shared.CreateLobbyParams;
import dev.hathora.cloud_sdk.models.shared.LobbyVisibility;
import dev.hathora.cloud_sdk.models.shared.Region;
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();

        CreateLobbyDeprecatedResponse res = sdk.lobbiesV2().createLobbyDeprecated()
                .security(CreateLobbyDeprecatedSecurity.builder()
                    .playerAuth("<YOUR_BEARER_TOKEN_HERE>")
                    .build())
                .createLobbyParams(CreateLobbyParams.builder()
                    .initialConfig("<value>")
                    .region(Region.TOKYO)
                    .visibility(LobbyVisibility.PRIVATE)
                    .build())
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .roomId("2swovpy1fnunu")
                .call();

        if (res.lobby().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
security dev.hathora.cloud_sdk.models.operations.CreateLobbyDeprecatedSecurity ✔️ The security requirements to use for the request.
createLobbyParams CreateLobbyParams ✔️ N/A
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId Optional<String> N/A 2swovpy1fnunu

Response

CreateLobbyDeprecatedResponse

Errors

Error Type Status Code Content Type
models/errors/ApiError 400, 401, 402, 404, 422, 429, 500 application/json
models/errors/SDKError 4XX, 5XX */*

createLocalLobby

CreateLocalLobby

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package hello.world;

import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.CreateLocalLobbyRequestBody;
import dev.hathora.cloud_sdk.models.operations.CreateLocalLobbyResponse;
import dev.hathora.cloud_sdk.models.operations.CreateLocalLobbySecurity;
import dev.hathora.cloud_sdk.models.shared.Region;
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();

        CreateLocalLobbyResponse res = sdk.lobbiesV2().createLocalLobby()
                .security(CreateLocalLobbySecurity.builder()
                    .playerAuth("<YOUR_BEARER_TOKEN_HERE>")
                    .build())
                .requestBody(CreateLocalLobbyRequestBody.builder()
                    .initialConfig("<value>")
                    .region(Region.SAO_PAULO)
                    .build())
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .roomId("2swovpy1fnunu")
                .call();

        if (res.lobby().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
security dev.hathora.cloud_sdk.models.operations.CreateLocalLobbySecurity ✔️ The security requirements to use for the request.
requestBody CreateLocalLobbyRequestBody ✔️ N/A
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId Optional<String> N/A 2swovpy1fnunu

Response

CreateLocalLobbyResponse

Errors

Error Type Status Code Content Type
models/errors/ApiError 400, 401, 402, 404, 422, 429, 500 application/json
models/errors/SDKError 4XX, 5XX */*

createPrivateLobby

CreatePrivateLobby

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package hello.world;

import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.CreatePrivateLobbyRequestBody;
import dev.hathora.cloud_sdk.models.operations.CreatePrivateLobbyResponse;
import dev.hathora.cloud_sdk.models.operations.CreatePrivateLobbySecurity;
import dev.hathora.cloud_sdk.models.shared.Region;
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();

        CreatePrivateLobbyResponse res = sdk.lobbiesV2().createPrivateLobby()
                .security(CreatePrivateLobbySecurity.builder()
                    .playerAuth("<YOUR_BEARER_TOKEN_HERE>")
                    .build())
                .requestBody(CreatePrivateLobbyRequestBody.builder()
                    .initialConfig("<value>")
                    .region(Region.CHICAGO)
                    .build())
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .roomId("2swovpy1fnunu")
                .call();

        if (res.lobby().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
security dev.hathora.cloud_sdk.models.operations.CreatePrivateLobbySecurity ✔️ The security requirements to use for the request.
requestBody CreatePrivateLobbyRequestBody ✔️ N/A
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId Optional<String> N/A 2swovpy1fnunu

Response

CreatePrivateLobbyResponse

Errors

Error Type Status Code Content Type
models/errors/ApiError 400, 401, 402, 404, 422, 429, 500 application/json
models/errors/SDKError 4XX, 5XX */*

createPublicLobby

CreatePublicLobby

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package hello.world;

import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.CreatePublicLobbyRequestBody;
import dev.hathora.cloud_sdk.models.operations.CreatePublicLobbyResponse;
import dev.hathora.cloud_sdk.models.operations.CreatePublicLobbySecurity;
import dev.hathora.cloud_sdk.models.shared.Region;
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();

        CreatePublicLobbyResponse res = sdk.lobbiesV2().createPublicLobby()
                .security(CreatePublicLobbySecurity.builder()
                    .playerAuth("<YOUR_BEARER_TOKEN_HERE>")
                    .build())
                .requestBody(CreatePublicLobbyRequestBody.builder()
                    .initialConfig("<value>")
                    .region(Region.SAO_PAULO)
                    .build())
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .roomId("2swovpy1fnunu")
                .call();

        if (res.lobby().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
security dev.hathora.cloud_sdk.models.operations.CreatePublicLobbySecurity ✔️ The security requirements to use for the request.
requestBody CreatePublicLobbyRequestBody ✔️ N/A
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId Optional<String> N/A 2swovpy1fnunu

Response

CreatePublicLobbyResponse

Errors

Error Type Status Code Content Type
models/errors/ApiError 400, 401, 402, 404, 422, 429, 500 application/json
models/errors/SDKError 4XX, 5XX */*

getLobbyInfo

Get details for a lobby.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package hello.world;

import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.GetLobbyInfoResponse;
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();

        GetLobbyInfoResponse res = sdk.lobbiesV2().getLobbyInfo()
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .roomId("2swovpy1fnunu")
                .call();

        if (res.lobby().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId String ✔️ N/A 2swovpy1fnunu

Response

GetLobbyInfoResponse

Errors

Error Type Status Code Content Type
models/errors/ApiError 404, 429 application/json
models/errors/SDKError 4XX, 5XX */*

listActivePublicLobbiesDeprecatedV2

Get all active lobbies for a an application. Filter by optionally passing in a region. Use this endpoint to display all public lobbies that a player can join in the game client.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package hello.world;

import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.ListActivePublicLobbiesDeprecatedV2Response;
import dev.hathora.cloud_sdk.models.shared.Region;
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();

        ListActivePublicLobbiesDeprecatedV2Response res = sdk.lobbiesV2().listActivePublicLobbiesDeprecatedV2()
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .region(Region.MUMBAI)
                .call();

        if (res.classes().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2
region Optional<Region> Region to filter by. If omitted, active public lobbies in all regions will be returned.

Response

ListActivePublicLobbiesDeprecatedV2Response

Errors

Error Type Status Code Content Type
models/errors/ApiError 401, 429 application/json
models/errors/SDKError 4XX, 5XX */*

setLobbyState

Set the state of a lobby. State is intended to be set by the server and must be smaller than 1MB. Use this endpoint to store match data like live player count to enforce max number of clients or persist end-game data (i.e. winner or final scores).

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

package hello.world;

import dev.hathora.cloud_sdk.HathoraCloud;
import dev.hathora.cloud_sdk.models.errors.ApiError;
import dev.hathora.cloud_sdk.models.operations.SetLobbyStateResponse;
import dev.hathora.cloud_sdk.models.shared.Security;
import dev.hathora.cloud_sdk.models.shared.SetLobbyStateParams;
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();

        SetLobbyStateResponse res = sdk.lobbiesV2().setLobbyState()
                .setLobbyStateParams(SetLobbyStateParams.builder()
                    .state("South Dakota")
                    .build())
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .roomId("2swovpy1fnunu")
                .call();

        if (res.lobby().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
setLobbyStateParams SetLobbyStateParams ✔️ N/A
appId Optional<String> N/A app-af469a92-5b45-4565-b3c4-b79878de67d2
roomId String ✔️ N/A 2swovpy1fnunu

Response

SetLobbyStateResponse

Errors

Error Type Status Code Content Type
models/errors/ApiError 401, 404, 422, 429 application/json
models/errors/SDKError 4XX, 5XX */*