/* * 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 EnvironmentsControllerV1CreateEnvironmentRequest = { /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; createEnvironmentRequestDto: components.CreateEnvironmentRequestDto; }; export type EnvironmentsControllerV1CreateEnvironmentResponse = { headers: { [k: string]: Array }; result: components.EnvironmentResponseDto; }; /** @internal */ export type EnvironmentsControllerV1CreateEnvironmentRequest$Outbound = { "idempotency-key"?: string | undefined; CreateEnvironmentRequestDto: components.CreateEnvironmentRequestDto$Outbound; }; /** @internal */ export const EnvironmentsControllerV1CreateEnvironmentRequest$outboundSchema: z.ZodType< EnvironmentsControllerV1CreateEnvironmentRequest$Outbound, z.ZodTypeDef, EnvironmentsControllerV1CreateEnvironmentRequest > = z.object({ idempotencyKey: z.string().optional(), createEnvironmentRequestDto: components.CreateEnvironmentRequestDto$outboundSchema, }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", createEnvironmentRequestDto: "CreateEnvironmentRequestDto", }); }); export function environmentsControllerV1CreateEnvironmentRequestToJSON( environmentsControllerV1CreateEnvironmentRequest: EnvironmentsControllerV1CreateEnvironmentRequest, ): string { return JSON.stringify( EnvironmentsControllerV1CreateEnvironmentRequest$outboundSchema.parse( environmentsControllerV1CreateEnvironmentRequest, ), ); } /** @internal */ export const EnvironmentsControllerV1CreateEnvironmentResponse$inboundSchema: z.ZodType< EnvironmentsControllerV1CreateEnvironmentResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.EnvironmentResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function environmentsControllerV1CreateEnvironmentResponseFromJSON( jsonString: string, ): SafeParseResult< EnvironmentsControllerV1CreateEnvironmentResponse, SDKValidationError > { return safeParse( jsonString, (x) => EnvironmentsControllerV1CreateEnvironmentResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'EnvironmentsControllerV1CreateEnvironmentResponse' from JSON`, ); }