Skip to content

Latest commit

 

History

History
394 lines (294 loc) · 18.9 KB

File metadata and controls

394 lines (294 loc) · 18.9 KB

AppsV2

(appsV2())

Overview

Operations that allow you manage your applications.

Available Operations

createApp

Create a new application.

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.CreateAppResponse;
import dev.hathora.cloud_sdk.models.shared.*;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ApiError, Exception {

        HathoraCloud sdk = HathoraCloud.builder()
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
                .security(Security.builder()
                    .hathoraDevToken(System.getenv().getOrDefault("HATHORA_DEV_TOKEN", ""))
                    .build())
            .build();

        CreateAppResponse res = sdk.appsV2().createApp()
                .createAppConfig(CreateAppConfig.builder()
                    .appName("minecraft")
                    .authConfiguration(AuthConfiguration.builder()
                        .build())
                    .build())
                .call();

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

Parameters

Parameter Type Required Description Example
createAppConfig CreateAppConfig ✔️ N/A
orgId Optional<String> N/A org-6f706e83-0ec1-437a-9a46-7d4281eb2f39

Response

CreateAppResponse

Errors

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

deleteApp

Delete an application using appId. Your organization will lose access to this application.

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.DeleteAppResponse;
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()
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .security(Security.builder()
                    .hathoraDevToken(System.getenv().getOrDefault("HATHORA_DEV_TOKEN", ""))
                    .build())
            .build();

        DeleteAppResponse res = sdk.appsV2().deleteApp()
                .call();

        // handle response
    }
}

Parameters

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

Response

DeleteAppResponse

Errors

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

getApp

Get details for an application using appId.

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.GetAppResponse;
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()
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .security(Security.builder()
                    .hathoraDevToken(System.getenv().getOrDefault("HATHORA_DEV_TOKEN", ""))
                    .build())
            .build();

        GetAppResponse res = sdk.appsV2().getApp()
                .call();

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

Parameters

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

Response

GetAppResponse

Errors

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

getApps

Returns an unsorted list of your organization’s applications. An application is uniquely identified by an appId.

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.GetAppsResponse;
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()
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
                .security(Security.builder()
                    .hathoraDevToken(System.getenv().getOrDefault("HATHORA_DEV_TOKEN", ""))
                    .build())
            .build();

        GetAppsResponse res = sdk.appsV2().getApps()
                .call();

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

Parameters

Parameter Type Required Description Example
orgId Optional<String> N/A org-6f706e83-0ec1-437a-9a46-7d4281eb2f39

Response

GetAppsResponse

Errors

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

patchApp

Patch data for an existing application using appId.

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.PatchAppResponse;
import dev.hathora.cloud_sdk.models.shared.*;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws ApiError, Exception {

        HathoraCloud sdk = HathoraCloud.builder()
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .security(Security.builder()
                    .hathoraDevToken(System.getenv().getOrDefault("HATHORA_DEV_TOKEN", ""))
                    .build())
            .build();

        PatchAppResponse res = sdk.appsV2().patchApp()
                .partialAppConfigWithServiceConfig(PartialAppConfigWithServiceConfig.builder()
                    .serviceConfig(ServiceConfigWrite.builder()
                        .staticProcessAllocation(List.of(
                            StaticProcessAllocationConfigWrite.builder()
                                .maxProcesses(3)
                                .minProcesses(1)
                                .region(Region.TOKYO)
                                .targetProcesses(2)
                                .build(),
                            StaticProcessAllocationConfigWrite.builder()
                                .maxProcesses(3)
                                .minProcesses(1)
                                .region(Region.TOKYO)
                                .targetProcesses(2)
                                .build(),
                            StaticProcessAllocationConfigWrite.builder()
                                .maxProcesses(3)
                                .minProcesses(1)
                                .region(Region.TOKYO)
                                .targetProcesses(2)
                                .build()))
                        .build())
                    .build())
                .call();

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

Parameters

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

Response

PatchAppResponse

Errors

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

updateApp

Set application config (will override all fields) for an existing application using appId.

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.UpdateAppResponse;
import dev.hathora.cloud_sdk.models.shared.*;
import java.lang.Exception;
import java.util.List;

public class Application {

    public static void main(String[] args) throws ApiError, Exception {

        HathoraCloud sdk = HathoraCloud.builder()
                .appId("app-af469a92-5b45-4565-b3c4-b79878de67d2")
                .security(Security.builder()
                    .hathoraDevToken(System.getenv().getOrDefault("HATHORA_DEV_TOKEN", ""))
                    .build())
            .build();

        UpdateAppResponse res = sdk.appsV2().updateApp()
                .appConfigWithServiceConfig(AppConfigWithServiceConfig.builder()
                    .appName("minecraft")
                    .authConfiguration(AuthConfiguration.builder()
                        .build())
                    .serviceConfig(ServiceConfigWrite.builder()
                        .staticProcessAllocation(List.of(
                            StaticProcessAllocationConfigWrite.builder()
                                .maxProcesses(3)
                                .minProcesses(1)
                                .region(Region.SAO_PAULO)
                                .targetProcesses(2)
                                .build(),
                            StaticProcessAllocationConfigWrite.builder()
                                .maxProcesses(3)
                                .minProcesses(1)
                                .region(Region.SAO_PAULO)
                                .targetProcesses(2)
                                .build()))
                        .build())
                    .build())
                .call();

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

Parameters

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

Response

UpdateAppResponse

Errors

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