Skip to content

Latest commit

 

History

History
277 lines (189 loc) · 30.4 KB

File metadata and controls

277 lines (189 loc) · 30.4 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

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy();

async function run() {
  const result = await speakeasy.apis.deleteApi({
    apiID: "<value>",
    versionID: "<value>",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.DeleteApiRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<shared.ErrorT>

Errors

Error Object Status Code Content Type
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

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy();

async function run() {
  const result = await speakeasy.apis.generateOpenApiSpec({
    apiID: "<value>",
    versionID: "<value>",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.GenerateOpenApiSpecRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GenerateOpenApiSpecResponse>

Errors

Error Object Status Code Content Type
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

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy();

async function run() {
  const result = await speakeasy.apis.generatePostmanCollection({
    apiID: "<value>",
    versionID: "<value>",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.GeneratePostmanCollectionRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GeneratePostmanCollectionResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

getAllApiVersions

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

Example Usage

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy();

async function run() {
  const result = await speakeasy.apis.getAllApiVersions({
    apiID: "<value>",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.GetAllApiVersionsRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetAllApiVersionsResponse>

Errors

Error Object Status Code Content Type
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.

Example Usage

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy();

async function run() {
  const result = await speakeasy.apis.getApis({});

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.GetApisRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetApisResponse>

Errors

Error Object Status Code Content Type
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

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy();

async function run() {
  const result = await speakeasy.apis.upsertApi({
    apiID: "<value>",
    api: {
      apiId: "<value>",
      description: "Synchronised 5th generation knowledge user",
      versionId: "<value>",
    },
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.UpsertApiRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.UpsertApiResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /