/* * 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 LayoutsControllerCreateRequest = { /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; /** * Layout creation details */ createLayoutDto: components.CreateLayoutDto; }; export type LayoutsControllerCreateResponse = { headers: { [k: string]: Array }; result: components.LayoutResponseDto; }; /** @internal */ export type LayoutsControllerCreateRequest$Outbound = { "idempotency-key"?: string | undefined; CreateLayoutDto: components.CreateLayoutDto$Outbound; }; /** @internal */ export const LayoutsControllerCreateRequest$outboundSchema: z.ZodType< LayoutsControllerCreateRequest$Outbound, z.ZodTypeDef, LayoutsControllerCreateRequest > = z.object({ idempotencyKey: z.string().optional(), createLayoutDto: components.CreateLayoutDto$outboundSchema, }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", createLayoutDto: "CreateLayoutDto", }); }); export function layoutsControllerCreateRequestToJSON( layoutsControllerCreateRequest: LayoutsControllerCreateRequest, ): string { return JSON.stringify( LayoutsControllerCreateRequest$outboundSchema.parse( layoutsControllerCreateRequest, ), ); } /** @internal */ export const LayoutsControllerCreateResponse$inboundSchema: z.ZodType< LayoutsControllerCreateResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.LayoutResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function layoutsControllerCreateResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LayoutsControllerCreateResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LayoutsControllerCreateResponse' from JSON`, ); }