Skip to content

Developer-friendly & type-safe TypeScript SDK specifically catered to leverage the Speakeasy API.

Notifications You must be signed in to change notification settings

speakeasy-api/speakeasy-client-sdk-typescript

Repository files navigation

speakeasy-client-sdk-typescript

This is the Speakeasy API Client SDK for Typescript. It is generated from our OpenAPI spec found at https://docs.speakeasyapi.dev/openapi.yaml and used for interacting with the Speakeasy API.

This SDK was generated using Speakeasy's SDK Generator. For more information on how to use the generator to generate your own SDKs, please see the Speakeasy Client SDK Generator Docs.

SDK Installation

NPM

npm add @speakeasy-api/speakeasy-client-sdk-typescript

Yarn

yarn add @speakeasy-api/speakeasy-client-sdk-typescript

Example usage

// Replace relative paths below with npm module once it's published 
import {
    SDK,
    WithSecurity,
} from "speakeasy-client-sdk-typescript";
import {
    Security,
    SchemeApiKey,
} from "speakeasy-client-sdk-typescript/src/sdk/models/shared";
import {
    GetApisResponse,
    GetApisRequest,
    GetApisQueryParams,
    GetApisOp,
} from "speakeasy-client-sdk-typescript/src/sdk/models/operations";
import { AxiosError } from "axios";

const security: Security = new Security(new SchemeApiKey("YOUR_API_KEY")); // Replace with your API key from your Speakeasy Workspace
const sdk: SDK = new SDK(WithSecurity(security));

const metadata: Map<string, string[]> = new Map([["label", ["1"]]]);
const op: GetApisOp = new GetApisOp(true);

const request: GetApisRequest = new GetApisRequest(
    new GetApisQueryParams(metadata, op)
);
sdk.Apis.getApis(request).then((res: GetApisResponse | AxiosError) => {
    console.log(res);
});

SDK Available Operations

ApiEndpoints

  • deleteApiEndpoint - Delete an ApiEndpoint.
  • findApiEndpoint - Find an ApiEndpoint via its displayName.
  • generateOpenApiSpecForApiEndpoint - Generate an OpenAPI specification for a particular ApiEndpoint.
  • generatePostmanCollectionForApiEndpoint - Generate a Postman collection for a particular ApiEndpoint.
  • getAllApiEndpoints - Get all Api endpoints for a particular apiID.
  • getAllForVersionApiEndpoints - Get all ApiEndpoints for a particular apiID and versionID.
  • getApiEndpoint - Get an ApiEndpoint.
  • upsertApiEndpoint - Upsert an ApiEndpoint.

Apis

  • deleteApi - Delete an Api.
  • generateOpenApiSpec - Generate an OpenAPI specification for a particular Api.
  • generatePostmanCollection - Generate a Postman collection for a particular Api.
  • getAllApiVersions - Get all Api versions for a particular ApiEndpoint.
  • getApis - Get a list of Apis for a given workspace
  • upsertApi - Upsert an Api

Embeds

  • getEmbedAccessToken - Get an embed access token for the current workspace.
  • getValidEmbedAccessTokens - Get all valid embed access tokens for the current workspace.
  • revokeEmbedAccessToken - Revoke an embed access EmbedToken.

Metadata

  • deleteVersionMetadata - Delete metadata for a particular apiID and versionID.
  • getVersionMetadata - Get all metadata for a particular apiID and versionID.
  • insertVersionMetadata - Insert metadata for a particular apiID and versionID.

Requests

  • generateRequestPostmanCollection - Generate a Postman collection for a particular request.
  • getRequestFromEventLog - Get information about a particular request.
  • queryEventLog - Query the event log to retrieve a list of requests.

Schemas

  • deleteSchema - Delete a particular schema revision for an Api.
  • downloadSchema - Download the latest schema for a particular apiID.
  • downloadSchemaRevision - Download a particular schema revision for an Api.
  • getSchema - Get information about the latest schema.
  • getSchemaDiff - Get a diff of two schema revisions for an Api.
  • getSchemaRevision - Get information about a particular schema revision for an Api.
  • getSchemas - Get information about all schemas associated with a particular apiID.
  • registerSchema - Register a schema.

SDK Generated by Speakeasy