/* * 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 RunCodeRequest = { sessionId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; codeRequest: components.CodeRequest; }; /** @internal */ export const RunCodeRequest$inboundSchema: z.ZodType< RunCodeRequest, z.ZodTypeDef, unknown > = z.object({ session_id: z.string(), "X-On-Behalf-Of": z.string().optional(), CodeRequest: components.CodeRequest$inboundSchema, }).transform((v) => { return remap$(v, { "session_id": "sessionId", "X-On-Behalf-Of": "xOnBehalfOf", "CodeRequest": "codeRequest", }); }); /** @internal */ export type RunCodeRequest$Outbound = { session_id: string; "X-On-Behalf-Of"?: string | undefined; CodeRequest: components.CodeRequest$Outbound; }; /** @internal */ export const RunCodeRequest$outboundSchema: z.ZodType< RunCodeRequest$Outbound, z.ZodTypeDef, RunCodeRequest > = z.object({ sessionId: z.string(), xOnBehalfOf: z.string().optional(), codeRequest: components.CodeRequest$outboundSchema, }).transform((v) => { return remap$(v, { sessionId: "session_id", xOnBehalfOf: "X-On-Behalf-Of", codeRequest: "CodeRequest", }); }); export function runCodeRequestToJSON(runCodeRequest: RunCodeRequest): string { return JSON.stringify(RunCodeRequest$outboundSchema.parse(runCodeRequest)); } export function runCodeRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RunCodeRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RunCodeRequest' from JSON`, ); }