Skip to content

Latest commit

 

History

History
304 lines (220 loc) · 14 KB

README.md

File metadata and controls

304 lines (220 loc) · 14 KB

BuildsV3

(buildsV3())

Overview

Operations that allow you create and manage your builds.

Available Operations

createBuild

Creates a new build with optional multipartUploadUrls that can be used to upload larger builds in parts before calling runBuild. Responds with a buildId that you must pass to RunBuild() to build the game server artifact. You can optionally pass in a buildTag to associate an external version with a build.

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.CreateBuildResponse;
import dev.hathora.cloud_sdk.models.shared.CreateMultipartBuildParams;
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();

        CreateBuildResponse res = sdk.buildsV3().createBuild()
                .createMultipartBuildParams(CreateMultipartBuildParams.builder()
                    .buildSizeInBytes(5387.85d)
                    .buildId("bld-6d4c6a71-2d75-4b42-94e1-f312f57f33c5")
                    .buildTag("0.1.14-14c793")
                    .build())
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
                .call();

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

Parameters

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

Response

CreateBuildResponse

Errors

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

deleteBuild

Delete a build. All associated metadata is deleted. Be careful which builds you delete. This endpoint does not prevent you from deleting actively used builds. Deleting a build that is actively build used by an app's deployment will cause failures when creating rooms.

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.DeleteBuildResponse;
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();

        DeleteBuildResponse res = sdk.buildsV3().deleteBuild()
                .buildId("bld-6d4c6a71-2d75-4b42-94e1-f312f57f33c5")
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
                .call();

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

Parameters

Parameter Type Required Description Example
buildId String ✔️ N/A bld-6d4c6a71-2d75-4b42-94e1-f312f57f33c5
orgId Optional<String> N/A org-6f706e83-0ec1-437a-9a46-7d4281eb2f39

Response

DeleteBuildResponse

Errors

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

getBuild

Get details for a build.

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.GetBuildResponse;
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();

        GetBuildResponse res = sdk.buildsV3().getBuild()
                .buildId("bld-6d4c6a71-2d75-4b42-94e1-f312f57f33c5")
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
                .call();

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

Parameters

Parameter Type Required Description Example
buildId String ✔️ N/A bld-6d4c6a71-2d75-4b42-94e1-f312f57f33c5
orgId Optional<String> N/A org-6f706e83-0ec1-437a-9a46-7d4281eb2f39

Response

GetBuildResponse

Errors

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

getBuilds

Returns an array of builds for an 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.GetBuildsResponse;
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();

        GetBuildsResponse res = sdk.buildsV3().getBuilds()
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
                .call();

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

Parameters

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

Response

GetBuildsResponse

Errors

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

runBuild

Builds a game server artifact from a tarball you provide. Pass in the buildId generated from CreateBuild().

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.RunBuildResponse;
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();

        RunBuildResponse res = sdk.buildsV3().runBuild()
                .buildId("bld-6d4c6a71-2d75-4b42-94e1-f312f57f33c5")
                .orgId("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39")
                .call();

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

Parameters

Parameter Type Required Description Example
buildId String ✔️ N/A bld-6d4c6a71-2d75-4b42-94e1-f312f57f33c5
orgId Optional<String> N/A org-6f706e83-0ec1-437a-9a46-7d4281eb2f39

Response

RunBuildResponse

Errors

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