/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: e8470b4d34a8 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { smartUnion } from "../../types/smartUnion.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Filter by workflow status */ export type GetWorkflowsV1WorkflowsGetStatus = | components.WorkflowExecutionStatus | Array; /** * Filter by deployment activity. active=only active, inactive=only inactive, None=no filter */ export const DeploymentStatus = { Active: "active", Inactive: "inactive", } as const; /** * Filter by deployment activity. active=only active, inactive=only inactive, None=no filter */ export type DeploymentStatus = ClosedEnum; /** * Sort direction */ export const GetWorkflowsV1WorkflowsGetOrder = { Asc: "asc", Desc: "desc", } as const; /** * Sort direction */ export type GetWorkflowsV1WorkflowsGetOrder = ClosedEnum< typeof GetWorkflowsV1WorkflowsGetOrder >; export type GetWorkflowsV1WorkflowsGetRequest = { /** * Filter by workflow status */ status?: | components.WorkflowExecutionStatus | Array | null | undefined; /** * Whether to include shared workflows */ includeShared?: boolean | undefined; /** * Whether to only return workflows available in chat assistant */ availableInChatAssistant?: boolean | null | undefined; /** * Filter by deployment name(s) */ deploymentName?: Array | null | undefined; /** * Filter by deployment activity. active=only active, inactive=only inactive, None=no filter */ deploymentStatus?: DeploymentStatus | null | undefined; /** * Filter by archived state. False=exclude archived, True=only archived, None=include all */ archived?: boolean | null | undefined; /** * Filter to workflows tagged with all listed tags (AND). */ tags?: Array | null | undefined; /** * Field to sort by */ sortBy?: "display_name" | null | undefined; /** * Sort direction */ order?: GetWorkflowsV1WorkflowsGetOrder | undefined; /** * The cursor for pagination */ cursor?: string | null | undefined; /** * The maximum number of workflows to return */ limit?: number | undefined; /** * Deprecated: use deployment_status instead * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ activeOnly?: boolean | undefined; /** * Fuzzy search query for workflow name, display name, description, or ID */ search?: string | null | undefined; }; export type GetWorkflowsV1WorkflowsGetResponse = { result: components.WorkflowListResponse; }; /** @internal */ export type GetWorkflowsV1WorkflowsGetStatus$Outbound = string | Array; /** @internal */ export const GetWorkflowsV1WorkflowsGetStatus$outboundSchema: z.ZodType< GetWorkflowsV1WorkflowsGetStatus$Outbound, GetWorkflowsV1WorkflowsGetStatus > = smartUnion([ components.WorkflowExecutionStatus$outboundSchema, z.array(components.WorkflowExecutionStatus$outboundSchema), ]); export function getWorkflowsV1WorkflowsGetStatusToJSON( getWorkflowsV1WorkflowsGetStatus: GetWorkflowsV1WorkflowsGetStatus, ): string { return JSON.stringify( GetWorkflowsV1WorkflowsGetStatus$outboundSchema.parse( getWorkflowsV1WorkflowsGetStatus, ), ); } /** @internal */ export const DeploymentStatus$outboundSchema: z.ZodEnum< typeof DeploymentStatus > = z.enum(DeploymentStatus); /** @internal */ export const GetWorkflowsV1WorkflowsGetOrder$outboundSchema: z.ZodEnum< typeof GetWorkflowsV1WorkflowsGetOrder > = z.enum(GetWorkflowsV1WorkflowsGetOrder); /** @internal */ export type GetWorkflowsV1WorkflowsGetRequest$Outbound = { status?: string | Array | null | undefined; include_shared: boolean; available_in_chat_assistant?: boolean | null | undefined; deployment_name?: Array | null | undefined; deployment_status?: string | null | undefined; archived?: boolean | null | undefined; tags?: Array | null | undefined; sort_by?: "display_name" | null | undefined; order: string; cursor?: string | null | undefined; limit: number; active_only: boolean; search?: string | null | undefined; }; /** @internal */ export const GetWorkflowsV1WorkflowsGetRequest$outboundSchema: z.ZodType< GetWorkflowsV1WorkflowsGetRequest$Outbound, GetWorkflowsV1WorkflowsGetRequest > = z.object({ status: z.nullable( smartUnion([ components.WorkflowExecutionStatus$outboundSchema, z.array(components.WorkflowExecutionStatus$outboundSchema), ]), ).optional(), includeShared: z.boolean().default(true), availableInChatAssistant: z.nullable(z.boolean()).optional(), deploymentName: z.nullable(z.array(z.string())).optional(), deploymentStatus: z.nullable(DeploymentStatus$outboundSchema).optional(), archived: z.nullable(z.boolean()).optional(), tags: z.nullable(z.array(z.string())).optional(), sortBy: z.nullable(z.literal("display_name")).optional(), order: GetWorkflowsV1WorkflowsGetOrder$outboundSchema.default("asc"), cursor: z.nullable(z.string()).optional(), limit: z.int().default(50), activeOnly: z.boolean().default(false), search: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { includeShared: "include_shared", availableInChatAssistant: "available_in_chat_assistant", deploymentName: "deployment_name", deploymentStatus: "deployment_status", sortBy: "sort_by", activeOnly: "active_only", }); }); export function getWorkflowsV1WorkflowsGetRequestToJSON( getWorkflowsV1WorkflowsGetRequest: GetWorkflowsV1WorkflowsGetRequest, ): string { return JSON.stringify( GetWorkflowsV1WorkflowsGetRequest$outboundSchema.parse( getWorkflowsV1WorkflowsGetRequest, ), ); } /** @internal */ export const GetWorkflowsV1WorkflowsGetResponse$inboundSchema: z.ZodType< GetWorkflowsV1WorkflowsGetResponse, unknown > = z.object({ Result: components.WorkflowListResponse$inboundSchema, }).transform((v) => { return remap$(v, { "Result": "result", }); }); export function getWorkflowsV1WorkflowsGetResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetWorkflowsV1WorkflowsGetResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetWorkflowsV1WorkflowsGetResponse' from JSON`, ); }