Skip to content

Latest commit

 

History

History
92 lines (65 loc) · 6.15 KB

File metadata and controls

92 lines (65 loc) · 6.15 KB

Engines

(version1.engines)

Overview

Enumerate engines that work with 'Version 1' REST API endpoints.

Available Operations

fetchList

List all engines available to your organization/user

Example Usage

import { StabilityAIClient } from "stabilityai-client-typescript";

const stabilityAIClient = new StabilityAIClient({
  stabilityApiKey: process.env["STABILITYAICLIENT_STABILITY_API_KEY"] ?? "",
});

async function run() {
  const result = await stabilityAIClient.version1.engines.fetchList({
    organization: "org-123456",
    stabilityClientID: "my-great-plugin",
    stabilityClientVersion: "1.2.1",
  });

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

run();

Standalone function

The standalone function version of this method:

import { StabilityAIClientCore } from "stabilityai-client-typescript/core.js";
import { version1EnginesFetchList } from "stabilityai-client-typescript/funcs/version1EnginesFetchList.js";

// Use `StabilityAIClientCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const stabilityAIClient = new StabilityAIClientCore({
  stabilityApiKey: process.env["STABILITYAICLIENT_STABILITY_API_KEY"] ?? "",
});

async function run() {
  const res = await version1EnginesFetchList(stabilityAIClient, {
    organization: "org-123456",
    stabilityClientID: "my-great-plugin",
    stabilityClientVersion: "1.2.1",
  });

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

  const { value: result } = res;

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

run();

Parameters

Parameter Type Required Description
request operations.FetchListRequest ✔️ 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<components.Engine[]>

Errors

Error Type Status Code Content Type
errors.ErrorT 401 application/json
errors.ErrorT 500 application/json
errors.APIError 4XX, 5XX */*