Skip to content

Latest commit

 

History

History
317 lines (229 loc) · 14.7 KB

File metadata and controls

317 lines (229 loc) · 14.7 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";

async function run() {
  const sdk = new Speakeasy({
    security: {
      apiKey: "<YOUR_API_KEY_HERE>",
    },
  });

  const res = await sdk.apis.deleteApi({
    apiID: "<value>",
    versionID: "<value>",
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.DeleteApiRequest ✔️ The request object to use for the request.
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.DeleteApiResponse>

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";

async function run() {
  const sdk = new Speakeasy({
    security: {
      apiKey: "<YOUR_API_KEY_HERE>",
    },
  });

  const res = await sdk.apis.generateOpenApiSpec({
    apiID: "<value>",
    versionID: "<value>",
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GenerateOpenApiSpecRequest ✔️ The request object to use for the request.
config AxiosRequestConfig Available config options for making requests.

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";

async function run() {
  const sdk = new Speakeasy({
    security: {
      apiKey: "<YOUR_API_KEY_HERE>",
    },
  });

  const res = await sdk.apis.generatePostmanCollection({
    apiID: "<value>",
    versionID: "<value>",
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GeneratePostmanCollectionRequest ✔️ The request object to use for the request.
config AxiosRequestConfig Available config options for making requests.

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";

async function run() {
  const sdk = new Speakeasy({
    security: {
      apiKey: "<YOUR_API_KEY_HERE>",
    },
  });

  const res = await sdk.apis.getAllApiVersions({
    apiID: "<value>",
    metadata: {
      "key": [
        "<value>",
      ],
    },
    op: {
      and: false,
    },
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetAllApiVersionsRequest ✔️ The request object to use for the request.
config AxiosRequestConfig Available config options for making requests.

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";

async function run() {
  const sdk = new Speakeasy({
    security: {
      apiKey: "<YOUR_API_KEY_HERE>",
    },
  });

  const res = await sdk.apis.getApis({
    metadata: {
      "key": [
        "<value>",
      ],
    },
    op: {
      and: false,
    },
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.GetApisRequest ✔️ The request object to use for the request.
config AxiosRequestConfig Available config options for making requests.

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";

async function run() {
  const sdk = new Speakeasy({
    security: {
      apiKey: "<YOUR_API_KEY_HERE>",
    },
  });

  const res = await sdk.apis.upsertApi({
    api: {
      apiId: "<value>",
      description: "Synchronised 5th generation knowledge user",
      metaData: {
        "key": [
          "<value>",
        ],
      },
      versionId: "<value>",
    },
    apiID: "<value>",
  });

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
request operations.UpsertApiRequest ✔️ The request object to use for the request.
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.UpsertApiResponse>

Errors

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