Skip to content

Latest commit

 

History

History
695 lines (507 loc) · 47.1 KB

File metadata and controls

695 lines (507 loc) · 47.1 KB

Schemas

(schemas)

Overview

REST APIs for managing Schema entities

Available Operations

deleteSchema

Delete a particular schema revision for an Api.

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.schemas.deleteSchema({
    apiID: "<id>",
    versionID: "<id>",
    revisionID: "<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 { schemasDeleteSchema } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/schemasDeleteSchema.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 schemasDeleteSchema(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
    revisionID: "<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.DeleteSchemaRequest ✔️ 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 */*

downloadSchema

Download the latest schema 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.schemas.downloadSchema({
    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 { schemasDownloadSchema } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/schemasDownloadSchema.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 schemasDownloadSchema(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.DownloadSchemaRequest ✔️ 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.DownloadSchemaResponse>

Errors

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

downloadSchemaRevision

Download a particular schema revision for an Api.

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.schemas.downloadSchemaRevision({
    apiID: "<id>",
    versionID: "<id>",
    revisionID: "<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 { schemasDownloadSchemaRevision } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/schemasDownloadSchemaRevision.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 schemasDownloadSchemaRevision(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
    revisionID: "<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.DownloadSchemaRevisionRequest ✔️ 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.DownloadSchemaRevisionResponse>

Errors

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

getSchema

Returns information about the last uploaded schema for a particular API version. This won't include the schema itself, that can be retrieved via the downloadSchema operation.

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.schemas.getSchema({
    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 { schemasGetSchema } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/schemasGetSchema.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 schemasGetSchema(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.GetSchemaRequest ✔️ 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.GetSchemaResponse>

Errors

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

getSchemaDiff

Get a diff of two schema revisions for an Api.

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.schemas.getSchemaDiff({
    apiID: "<id>",
    versionID: "<id>",
    baseRevisionID: "<id>",
    targetRevisionID: "<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 { schemasGetSchemaDiff } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/schemasGetSchemaDiff.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 schemasGetSchemaDiff(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
    baseRevisionID: "<id>",
    targetRevisionID: "<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.GetSchemaDiffRequest ✔️ 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.GetSchemaDiffResponse>

Errors

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

getSchemaRevision

Returns information about the last uploaded schema for a particular schema revision. This won't include the schema itself, that can be retrieved via the downloadSchema operation.

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.schemas.getSchemaRevision({
    apiID: "<id>",
    versionID: "<id>",
    revisionID: "<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 { schemasGetSchemaRevision } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/schemasGetSchemaRevision.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 schemasGetSchemaRevision(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
    revisionID: "<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.GetSchemaRevisionRequest ✔️ 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.GetSchemaRevisionResponse>

Errors

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

getSchemas

Returns information the schemas associated with a particular apiID. This won't include the schemas themselves, they can be retrieved via the downloadSchema operation.

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.schemas.getSchemas({
    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 { schemasGetSchemas } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/schemasGetSchemas.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 schemasGetSchemas(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.GetSchemasRequest ✔️ 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.GetSchemasResponse>

Errors

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

registerSchema

Allows uploading a schema for a particular API version. This will be used to populate ApiEndpoints and used as a base for any schema generation if present.

Example Usage

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";
import { openAsBlob } from "node:fs";

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

async function run() {
  const result = await speakeasy.schemas.registerSchema({
    apiID: "<id>",
    versionID: "<id>",
    requestBody: {
      file: await openAsBlob("example.file"),
    },
  });

  // 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 { schemasRegisterSchema } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/schemasRegisterSchema.js";
import { openAsBlob } from "node:fs";

// 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 schemasRegisterSchema(speakeasy, {
    apiID: "<id>",
    versionID: "<id>",
    requestBody: {
      file: await openAsBlob("example.file"),
    },
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.RegisterSchemaRequest ✔️ 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 */*