Skip to content

Latest commit

 

History

History
361 lines (255 loc) · 15.1 KB

File metadata and controls

361 lines (255 loc) · 15.1 KB

Apis

(apis())

Overview

REST APIs for managing Api entities

Available Operations

deleteApi

Delete a particular version of an Api. The will also delete all associated ApiEndpoints, Metadata, Schemas & Request Logs (if using a Postgres datastore).

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.DeleteApiRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.DeleteApiResponse;
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();

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

        DeleteApiResponse res = sdk.apis().deleteApi()
                .request(req)
                .call();

        // handle response
    }
}

Parameters

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

Response

DeleteApiResponse

Errors

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

generateOpenApiSpec

This endpoint will generate any missing operations in any registered OpenAPI document if the operation does not already exist in the document. Returns the original document and the newly generated document allowing a diff to be performed to see what has changed.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.GenerateOpenApiSpecRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.GenerateOpenApiSpecResponse;
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();

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

        GenerateOpenApiSpecResponse res = sdk.apis().generateOpenApiSpec()
                .request(req)
                .call();

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

Parameters

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

Response

GenerateOpenApiSpecResponse

Errors

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

generatePostmanCollection

Generates a postman collection containing all endpoints for a particular API. Includes variables produced for any path/query/header parameters included in the OpenAPI document.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.GeneratePostmanCollectionRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.GeneratePostmanCollectionResponse;
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();

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

        GeneratePostmanCollectionResponse res = sdk.apis().generatePostmanCollection()
                .request(req)
                .call();

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

Parameters

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

Response

GeneratePostmanCollectionResponse

Errors

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

getAllApiVersions

Get all Api versions for a particular ApiEndpoint. Supports filtering the versions based on metadata attributes.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetAllApiVersionsRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetAllApiVersionsResponse;
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();

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

        GetAllApiVersionsResponse res = sdk.apis().getAllApiVersions()
                .request(req)
                .call();

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

Parameters

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

Response

GetAllApiVersionsResponse

Errors

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

getApis

Get a list of all Apis and their versions for a given workspace. Supports filtering the APIs based on metadata attributes. Abc

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetApisRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.GetApisResponse;
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();

        GetApisRequest req = GetApisRequest.builder()
                .build();

        GetApisResponse res = sdk.apis().getApis()
                .request(req)
                .call();

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

Parameters

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

Response

GetApisResponse

Errors

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

upsertApi

Upsert an Api. If the Api does not exist, it will be created. If the Api exists, it will be updated.

Example Usage

package hello.world;

import dev.speakeasyapi.javaclientsdk.RyanTest;
import dev.speakeasyapi.javaclientsdk.models.operations.UpsertApiRequest;
import dev.speakeasyapi.javaclientsdk.models.operations.UpsertApiResponse;
import dev.speakeasyapi.javaclientsdk.models.shared.ApiInput;
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();

        UpsertApiRequest req = UpsertApiRequest.builder()
                .api(ApiInput.builder()
                    .apiId("<id>")
                    .description("consequently brr happily yowza however gosh investigate joyfully direct")
                    .versionId("<id>")
                    .build())
                .apiID("<id>")
                .build();

        UpsertApiResponse res = sdk.apis().upsertApi()
                .request(req)
                .call();

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

Parameters

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

Response

UpsertApiResponse

Errors

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