/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type WorkflowControllerSearchWorkflowsRequest = { /** * Number of items to return per page */ limit?: number | undefined; /** * Number of items to skip before starting to return results */ offset?: number | undefined; /** * Direction of sorting */ orderDirection?: components.DirectionEnum | undefined; /** * Field to sort the results by */ orderBy?: components.WorkflowResponseDtoSortField | undefined; /** * Search query to filter workflows */ query?: string | undefined; /** * Filter workflows by tags */ tags?: Array | undefined; /** * Filter workflows by status */ status?: Array | undefined; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type WorkflowControllerSearchWorkflowsResponse = { headers: { [k: string]: Array }; result: components.ListWorkflowResponse; }; /** @internal */ export type WorkflowControllerSearchWorkflowsRequest$Outbound = { limit?: number | undefined; offset?: number | undefined; orderDirection?: string | undefined; orderBy?: string | undefined; query?: string | undefined; tags?: Array | undefined; status?: Array | undefined; "idempotency-key"?: string | undefined; }; /** @internal */ export const WorkflowControllerSearchWorkflowsRequest$outboundSchema: z.ZodType< WorkflowControllerSearchWorkflowsRequest$Outbound, z.ZodTypeDef, WorkflowControllerSearchWorkflowsRequest > = z.object({ limit: z.number().optional(), offset: z.number().optional(), orderDirection: components.DirectionEnum$outboundSchema.optional(), orderBy: components.WorkflowResponseDtoSortField$outboundSchema.optional(), query: z.string().optional(), tags: z.array(z.string()).optional(), status: z.array(components.WorkflowStatusEnum$outboundSchema).optional(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function workflowControllerSearchWorkflowsRequestToJSON( workflowControllerSearchWorkflowsRequest: WorkflowControllerSearchWorkflowsRequest, ): string { return JSON.stringify( WorkflowControllerSearchWorkflowsRequest$outboundSchema.parse( workflowControllerSearchWorkflowsRequest, ), ); } /** @internal */ export const WorkflowControllerSearchWorkflowsResponse$inboundSchema: z.ZodType< WorkflowControllerSearchWorkflowsResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ListWorkflowResponse$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function workflowControllerSearchWorkflowsResponseFromJSON( jsonString: string, ): SafeParseResult< WorkflowControllerSearchWorkflowsResponse, SDKValidationError > { return safeParse( jsonString, (x) => WorkflowControllerSearchWorkflowsResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'WorkflowControllerSearchWorkflowsResponse' from JSON`, ); }