Skip to content

Latest commit

 

History

History
701 lines (513 loc) · 48.3 KB

File metadata and controls

701 lines (513 loc) · 48.3 KB

ApiEndpoints

(apiEndpoints)

Overview

REST APIs for managing ApiEndpoint entities

Available Operations

deleteApiEndpoint

Delete an ApiEndpoint. This will also delete all associated Request Logs (if using a Postgres datastore).

Example Usage

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

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.apiEndpoints.deleteApiEndpoint({
    apiID: "<id>",
    versionID: "<id>",
    apiEndpointID: "<id>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apiEndpointsDeleteApiEndpoint } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apiEndpointsDeleteApiEndpoint.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await apiEndpointsDeleteApiEndpoint(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
    apiEndpointID: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.DeleteApiEndpointRequest ✔️ 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 Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

findApiEndpoint

Find an ApiEndpoint via its displayName (set by operationId from a registered OpenAPI schema). This is useful for finding the ID of an ApiEndpoint to use in the /v1/apis/{apiID}/version/{versionID}/api_endpoints/{apiEndpointID} endpoints.

Example Usage

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

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.apiEndpoints.findApiEndpoint({
    apiID: "<id>",
    versionID: "<id>",
    displayName: "Don_Kihn39",
  });

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

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apiEndpointsFindApiEndpoint } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apiEndpointsFindApiEndpoint.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await apiEndpointsFindApiEndpoint(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
    displayName: "Don_Kihn39",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.FindApiEndpointRequest ✔️ 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.FindApiEndpointResponse>

Errors

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

generateOpenApiSpecForApiEndpoint

This endpoint will generate a new operation 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({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.apiEndpoints.generateOpenApiSpecForApiEndpoint({
    apiID: "<id>",
    versionID: "<id>",
    apiEndpointID: "<id>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apiEndpointsGenerateOpenApiSpecForApiEndpoint } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apiEndpointsGenerateOpenApiSpecForApiEndpoint.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await apiEndpointsGenerateOpenApiSpecForApiEndpoint(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
    apiEndpointID: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.GenerateOpenApiSpecForApiEndpointRequest ✔️ 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.GenerateOpenApiSpecForApiEndpointResponse>

Errors

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

generatePostmanCollectionForApiEndpoint

Generates a postman collection that allows the endpoint to be called from postman 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({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.apiEndpoints.generatePostmanCollectionForApiEndpoint({
    apiID: "<id>",
    versionID: "<id>",
    apiEndpointID: "<id>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apiEndpointsGeneratePostmanCollectionForApiEndpoint } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apiEndpointsGeneratePostmanCollectionForApiEndpoint.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await apiEndpointsGeneratePostmanCollectionForApiEndpoint(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
    apiEndpointID: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.GeneratePostmanCollectionForApiEndpointRequest ✔️ 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.GeneratePostmanCollectionForApiEndpointResponse>

Errors

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

getAllApiEndpoints

Get all Api endpoints for a particular apiID.

Example Usage

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

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.apiEndpoints.getAllApiEndpoints({
    apiID: "<id>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apiEndpointsGetAllApiEndpoints } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apiEndpointsGetAllApiEndpoints.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await apiEndpointsGetAllApiEndpoints(speakeasy, {
    apiID: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.GetAllApiEndpointsRequest ✔️ 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.GetAllApiEndpointsResponse>

Errors

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

getAllForVersionApiEndpoints

Get all ApiEndpoints for a particular apiID and versionID.

Example Usage

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

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.apiEndpoints.getAllForVersionApiEndpoints({
    apiID: "<id>",
    versionID: "<id>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apiEndpointsGetAllForVersionApiEndpoints } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apiEndpointsGetAllForVersionApiEndpoints.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await apiEndpointsGetAllForVersionApiEndpoints(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.GetAllForVersionApiEndpointsRequest ✔️ 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.GetAllForVersionApiEndpointsResponse>

Errors

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

getApiEndpoint

Get an ApiEndpoint.

Example Usage

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

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.apiEndpoints.getApiEndpoint({
    apiID: "<id>",
    versionID: "<id>",
    apiEndpointID: "<id>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apiEndpointsGetApiEndpoint } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apiEndpointsGetApiEndpoint.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await apiEndpointsGetApiEndpoint(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
    apiEndpointID: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.GetApiEndpointRequest ✔️ 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.GetApiEndpointResponse>

Errors

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

upsertApiEndpoint

Upsert an ApiEndpoint. If the ApiEndpoint does not exist it will be created, otherwise it will be updated.

Example Usage

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

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.apiEndpoints.upsertApiEndpoint({
    apiID: "<id>",
    versionID: "<id>",
    apiEndpointID: "<id>",
    apiEndpoint: {
      apiEndpointId: "<id>",
      description: "commandeer equate pish psst hoot ugh frankly supposing",
      displayName: "Eliseo.Little15",
      method: "<value>",
      path: "/etc/defaults",
      versionId: "<id>",
    },
  });

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

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { apiEndpointsUpsertApiEndpoint } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/apiEndpointsUpsertApiEndpoint.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await apiEndpointsUpsertApiEndpoint(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
    apiEndpointID: "<id>",
    apiEndpoint: {
      apiEndpointId: "<id>",
      description: "commandeer equate pish psst hoot ugh frankly supposing",
      displayName: "Eliseo.Little15",
      method: "<value>",
      path: "/etc/defaults",
      versionId: "<id>",
    },
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.UpsertApiEndpointRequest ✔️ 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.UpsertApiEndpointResponse>

Errors

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