Skip to content

Latest commit

 

History

History
487 lines (347 loc) · 20.2 KB

File metadata and controls

487 lines (347 loc) · 20.2 KB

Schemas

(schemas())

Overview

REST APIs for managing Schema entities

Available Operations

deleteSchema

Delete a particular schema revision for an Api.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.DeleteSchemaRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.DeleteSchemaResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;

public class Application {

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

        RyanTest sdk = RyanTest.builder()
                .security(Security.builder()
                    .apiKey("<YOUR_API_KEY_HERE>")
                    .build())
            .build();

        DeleteSchemaRequest req = DeleteSchemaRequest.builder()
                .apiID("<id>")
                .revisionID("<id>")
                .versionID("<id>")
                .build();

        DeleteSchemaResponse res = sdk.schemas().deleteSchema()
                .request(req)
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description
request DeleteSchemaRequest ✔️ The request object to use for the request.

Response

DeleteSchemaResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

downloadSchema

Download the latest schema for a particular apiID.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.DownloadSchemaRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.DownloadSchemaResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;

public class Application {

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

        RyanTest sdk = RyanTest.builder()
                .security(Security.builder()
                    .apiKey("<YOUR_API_KEY_HERE>")
                    .build())
            .build();

        DownloadSchemaRequest req = DownloadSchemaRequest.builder()
                .apiID("<id>")
                .versionID("<id>")
                .build();

        DownloadSchemaResponse res = sdk.schemas().downloadSchema()
                .request(req)
                .call();

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

Parameters

Parameter Type Required Description
request DownloadSchemaRequest ✔️ The request object to use for the request.

Response

DownloadSchemaResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

downloadSchemaRevision

Download a particular schema revision for an Api.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.DownloadSchemaRevisionRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.DownloadSchemaRevisionResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;

public class Application {

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

        RyanTest sdk = RyanTest.builder()
                .security(Security.builder()
                    .apiKey("<YOUR_API_KEY_HERE>")
                    .build())
            .build();

        DownloadSchemaRevisionRequest req = DownloadSchemaRevisionRequest.builder()
                .apiID("<id>")
                .revisionID("<id>")
                .versionID("<id>")
                .build();

        DownloadSchemaRevisionResponse res = sdk.schemas().downloadSchemaRevision()
                .request(req)
                .call();

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

Parameters

Parameter Type Required Description
request DownloadSchemaRevisionRequest ✔️ The request object to use for the request.

Response

DownloadSchemaRevisionResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

getSchema

Returns information about the last uploaded schema for a particular API version. This won't include the schema itself, that can be retrieved via the downloadSchema operation.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetSchemaRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetSchemaResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;

public class Application {

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

        RyanTest sdk = RyanTest.builder()
                .security(Security.builder()
                    .apiKey("<YOUR_API_KEY_HERE>")
                    .build())
            .build();

        GetSchemaRequest req = GetSchemaRequest.builder()
                .apiID("<id>")
                .versionID("<id>")
                .build();

        GetSchemaResponse res = sdk.schemas().getSchema()
                .request(req)
                .call();

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

Parameters

Parameter Type Required Description
request GetSchemaRequest ✔️ The request object to use for the request.

Response

GetSchemaResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

getSchemaDiff

Get a diff of two schema revisions for an Api.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetSchemaDiffRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetSchemaDiffResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;

public class Application {

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

        RyanTest sdk = RyanTest.builder()
                .security(Security.builder()
                    .apiKey("<YOUR_API_KEY_HERE>")
                    .build())
            .build();

        GetSchemaDiffRequest req = GetSchemaDiffRequest.builder()
                .apiID("<id>")
                .baseRevisionID("<id>")
                .targetRevisionID("<id>")
                .versionID("<id>")
                .build();

        GetSchemaDiffResponse res = sdk.schemas().getSchemaDiff()
                .request(req)
                .call();

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

Parameters

Parameter Type Required Description
request GetSchemaDiffRequest ✔️ The request object to use for the request.

Response

GetSchemaDiffResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

getSchemaRevision

Returns information about the last uploaded schema for a particular schema revision. This won't include the schema itself, that can be retrieved via the downloadSchema operation.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetSchemaRevisionRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetSchemaRevisionResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;

public class Application {

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

        RyanTest sdk = RyanTest.builder()
                .security(Security.builder()
                    .apiKey("<YOUR_API_KEY_HERE>")
                    .build())
            .build();

        GetSchemaRevisionRequest req = GetSchemaRevisionRequest.builder()
                .apiID("<id>")
                .revisionID("<id>")
                .versionID("<id>")
                .build();

        GetSchemaRevisionResponse res = sdk.schemas().getSchemaRevision()
                .request(req)
                .call();

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

Parameters

Parameter Type Required Description
request GetSchemaRevisionRequest ✔️ The request object to use for the request.

Response

GetSchemaRevisionResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

getSchemas

Returns information the schemas associated with a particular apiID. This won't include the schemas themselves, they can be retrieved via the downloadSchema operation.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetSchemasRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetSchemasResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;

public class Application {

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

        RyanTest sdk = RyanTest.builder()
                .security(Security.builder()
                    .apiKey("<YOUR_API_KEY_HERE>")
                    .build())
            .build();

        GetSchemasRequest req = GetSchemasRequest.builder()
                .apiID("<id>")
                .versionID("<id>")
                .build();

        GetSchemasResponse res = sdk.schemas().getSchemas()
                .request(req)
                .call();

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

Parameters

Parameter Type Required Description
request GetSchemasRequest ✔️ The request object to use for the request.

Response

GetSchemasResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

registerSchema

Allows uploading a schema for a particular API version. This will be used to populate ApiEndpoints and used as a base for any schema generation if present.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.File;
import dev.speakeasyapi.javaclientsdk.models.operations.RegisterSchemaRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.RegisterSchemaRequestBody;
import dev.speakeasyapi.javaclientsdk.models.operations.RegisterSchemaResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.Security;
import java.lang.Exception;
import java.nio.charset.StandardCharsets;

public class Application {

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

        RyanTest sdk = RyanTest.builder()
                .security(Security.builder()
                    .apiKey("<YOUR_API_KEY_HERE>")
                    .build())
            .build();

        RegisterSchemaRequest req = RegisterSchemaRequest.builder()
                .requestBody(RegisterSchemaRequestBody.builder()
                    .file(File.builder()
                        .content("0xCFA30D144c".getBytes(StandardCharsets.UTF_8))
                        .fileName("example.file")
                        .build())
                    .build())
                .apiID("<id>")
                .versionID("<id>")
                .build();

        RegisterSchemaResponse res = sdk.schemas().registerSchema()
                .request(req)
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description
request RegisterSchemaRequest ✔️ The request object to use for the request.

Response

RegisterSchemaResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*