/* * 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 WorkflowControllerSyncRequest = { workflowId: string; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; /** * Sync workflow details */ syncWorkflowDto: components.SyncWorkflowDto; }; export type WorkflowControllerSyncResponse = { headers: { [k: string]: Array }; result: components.WorkflowResponseDto; }; /** @internal */ export type WorkflowControllerSyncRequest$Outbound = { workflowId: string; "idempotency-key"?: string | undefined; SyncWorkflowDto: components.SyncWorkflowDto$Outbound; }; /** @internal */ export const WorkflowControllerSyncRequest$outboundSchema: z.ZodType< WorkflowControllerSyncRequest$Outbound, z.ZodTypeDef, WorkflowControllerSyncRequest > = z.object({ workflowId: z.string(), idempotencyKey: z.string().optional(), syncWorkflowDto: components.SyncWorkflowDto$outboundSchema, }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", syncWorkflowDto: "SyncWorkflowDto", }); }); export function workflowControllerSyncRequestToJSON( workflowControllerSyncRequest: WorkflowControllerSyncRequest, ): string { return JSON.stringify( WorkflowControllerSyncRequest$outboundSchema.parse( workflowControllerSyncRequest, ), ); } /** @internal */ export const WorkflowControllerSyncResponse$inboundSchema: z.ZodType< WorkflowControllerSyncResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.WorkflowResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function workflowControllerSyncResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WorkflowControllerSyncResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WorkflowControllerSyncResponse' from JSON`, ); }