SDK: docs and improvements (#4310)

This commit is contained in:
Stanislav Novosad
2025-12-17 14:11:39 -07:00
committed by GitHub
parent 0d6a070a80
commit 5d2bb07371
32 changed files with 1274 additions and 291 deletions

View File

@@ -9,6 +9,7 @@ import type * as Skyvern from "../../index.js";
* page_size: 1,
* only_saved_tasks: true,
* only_workflows: true,
* only_templates: true,
* search_key: "search_key",
* title: "title",
* folder_id: "folder_id",
@@ -20,6 +21,7 @@ export interface GetWorkflowsRequest {
page_size?: number;
only_saved_tasks?: boolean;
only_workflows?: boolean;
only_templates?: boolean;
/** Unified search across workflow title, folder name, and parameter metadata (key, description, default_value). */
search_key?: string;
/** Deprecated: use search_key instead. */

View File

@@ -1 +1,3 @@
export * as scripts from "./scripts/index.js";
export * from "./workflows/client/requests/index.js";
export * as workflows from "./workflows/index.js";

View File

@@ -0,0 +1,112 @@
// This file was auto-generated by Fern from our API Definition.
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js";
import * as core from "../../../../core/index.js";
import * as environments from "../../../../environments.js";
import * as errors from "../../../../errors/index.js";
import * as Skyvern from "../../../index.js";
export declare namespace Workflows {
export interface Options extends BaseClientOptions {}
export interface RequestOptions extends BaseRequestOptions {}
}
export class Workflows {
protected readonly _options: Workflows.Options;
constructor(_options: Workflows.Options = {}) {
this._options = _options;
}
/**
* Set or unset a workflow as a template.
*
* Template status is stored at the workflow_permanent_id level (not per-version),
* meaning all versions of a workflow share the same template status.
*
* @param {string} workflowPermanentId
* @param {Skyvern.SetWorkflowTemplateStatusV1WorkflowsWorkflowPermanentIdTemplatePutRequest} request
* @param {Workflows.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Skyvern.UnprocessableEntityError}
*
* @example
* await client.workflows.setWorkflowTemplateStatus("workflow_permanent_id", {
* is_template: true
* })
*/
public setWorkflowTemplateStatus(
workflowPermanentId: string,
request: Skyvern.SetWorkflowTemplateStatusV1WorkflowsWorkflowPermanentIdTemplatePutRequest,
requestOptions?: Workflows.RequestOptions,
): core.HttpResponsePromise<Record<string, unknown>> {
return core.HttpResponsePromise.fromPromise(
this.__setWorkflowTemplateStatus(workflowPermanentId, request, requestOptions),
);
}
private async __setWorkflowTemplateStatus(
workflowPermanentId: string,
request: Skyvern.SetWorkflowTemplateStatusV1WorkflowsWorkflowPermanentIdTemplatePutRequest,
requestOptions?: Workflows.RequestOptions,
): Promise<core.WithRawResponse<Record<string, unknown>>> {
const { is_template: isTemplate } = request;
const _queryParams: Record<string, string | string[] | object | object[] | null> = {};
_queryParams.is_template = isTemplate.toString();
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
requestOptions?.headers,
);
const _response = await core.fetcher({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
(await core.Supplier.get(this._options.environment)) ??
environments.SkyvernEnvironment.Cloud,
`v1/workflows/${core.url.encodePathParam(workflowPermanentId)}/template`,
),
method: "PUT",
headers: _headers,
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
if (_response.ok) {
return { data: _response.body as Record<string, unknown>, rawResponse: _response.rawResponse };
}
if (_response.error.reason === "status-code") {
switch (_response.error.statusCode) {
case 422:
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
default:
throw new errors.SkyvernError({
statusCode: _response.error.statusCode,
body: _response.error.body,
rawResponse: _response.rawResponse,
});
}
}
switch (_response.error.reason) {
case "non-json":
throw new errors.SkyvernError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
rawResponse: _response.rawResponse,
});
case "timeout":
throw new errors.SkyvernTimeoutError(
"Timeout exceeded when calling PUT /v1/workflows/{workflow_permanent_id}/template.",
);
case "unknown":
throw new errors.SkyvernError({
message: _response.error.errorMessage,
rawResponse: _response.rawResponse,
});
}
}
}

View File

@@ -0,0 +1 @@
export * from "./requests/index.js";

View File

@@ -0,0 +1,11 @@
// This file was auto-generated by Fern from our API Definition.
/**
* @example
* {
* is_template: true
* }
*/
export interface SetWorkflowTemplateStatusV1WorkflowsWorkflowPermanentIdTemplatePutRequest {
is_template: boolean;
}

View File

@@ -0,0 +1 @@
export type { SetWorkflowTemplateStatusV1WorkflowsWorkflowPermanentIdTemplatePutRequest } from "./SetWorkflowTemplateStatusV1WorkflowsWorkflowPermanentIdTemplatePutRequest.js";

View File

@@ -0,0 +1 @@
export * from "./client/index.js";

View File

@@ -36,6 +36,7 @@ export interface Action {
verified?: boolean;
click_context?: Skyvern.ClickContext;
totp_timing_info?: Record<string, unknown>;
has_mini_agent?: boolean;
created_at?: string;
modified_at?: string;
created_by?: string;

View File

@@ -14,6 +14,7 @@ export interface Artifact {
step_id?: string;
workflow_run_id?: string;
workflow_run_block_id?: string;
run_id?: string;
observer_cruise_id?: string;
observer_thought_id?: string;
ai_suggestion_id?: string;

View File

@@ -9,6 +9,7 @@ export interface Workflow {
workflow_permanent_id: string;
version: number;
is_saved_task: boolean;
is_template?: boolean;
description?: string;
workflow_definition: Skyvern.WorkflowDefinition;
proxy_location?: Workflow.ProxyLocation;