/* * 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 WorkflowControllerPatchWorkflowRequest = { workflowId: string; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; /** * Workflow patch details */ patchWorkflowDto: components.PatchWorkflowDto; }; export type WorkflowControllerPatchWorkflowResponse = { headers: { [k: string]: Array }; result: components.WorkflowResponseDto; }; /** @internal */ export type WorkflowControllerPatchWorkflowRequest$Outbound = { workflowId: string; "idempotency-key"?: string | undefined; PatchWorkflowDto: components.PatchWorkflowDto$Outbound; }; /** @internal */ export const WorkflowControllerPatchWorkflowRequest$outboundSchema: z.ZodType< WorkflowControllerPatchWorkflowRequest$Outbound, z.ZodTypeDef, WorkflowControllerPatchWorkflowRequest > = z.object({ workflowId: z.string(), idempotencyKey: z.string().optional(), patchWorkflowDto: components.PatchWorkflowDto$outboundSchema, }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", patchWorkflowDto: "PatchWorkflowDto", }); }); export function workflowControllerPatchWorkflowRequestToJSON( workflowControllerPatchWorkflowRequest: WorkflowControllerPatchWorkflowRequest, ): string { return JSON.stringify( WorkflowControllerPatchWorkflowRequest$outboundSchema.parse( workflowControllerPatchWorkflowRequest, ), ); } /** @internal */ export const WorkflowControllerPatchWorkflowResponse$inboundSchema: z.ZodType< WorkflowControllerPatchWorkflowResponse, 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 workflowControllerPatchWorkflowResponseFromJSON( jsonString: string, ): SafeParseResult< WorkflowControllerPatchWorkflowResponse, SDKValidationError > { return safeParse( jsonString, (x) => WorkflowControllerPatchWorkflowResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'WorkflowControllerPatchWorkflowResponse' from JSON`, ); }