/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreatePromptVersionRequestBody = { /** * The prompt template text */ template: string; }; export type CreatePromptVersionRequest = { id: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; requestBody: CreatePromptVersionRequestBody; }; /** @internal */ export const CreatePromptVersionRequestBody$inboundSchema: z.ZodType< CreatePromptVersionRequestBody, z.ZodTypeDef, unknown > = z.object({ template: z.string(), }); /** @internal */ export type CreatePromptVersionRequestBody$Outbound = { template: string; }; /** @internal */ export const CreatePromptVersionRequestBody$outboundSchema: z.ZodType< CreatePromptVersionRequestBody$Outbound, z.ZodTypeDef, CreatePromptVersionRequestBody > = z.object({ template: z.string(), }); export function createPromptVersionRequestBodyToJSON( createPromptVersionRequestBody: CreatePromptVersionRequestBody, ): string { return JSON.stringify( CreatePromptVersionRequestBody$outboundSchema.parse( createPromptVersionRequestBody, ), ); } export function createPromptVersionRequestBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreatePromptVersionRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreatePromptVersionRequestBody' from JSON`, ); } /** @internal */ export const CreatePromptVersionRequest$inboundSchema: z.ZodType< CreatePromptVersionRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), "X-On-Behalf-Of": z.string().optional(), RequestBody: z.lazy(() => CreatePromptVersionRequestBody$inboundSchema), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", "RequestBody": "requestBody", }); }); /** @internal */ export type CreatePromptVersionRequest$Outbound = { id: string; "X-On-Behalf-Of"?: string | undefined; RequestBody: CreatePromptVersionRequestBody$Outbound; }; /** @internal */ export const CreatePromptVersionRequest$outboundSchema: z.ZodType< CreatePromptVersionRequest$Outbound, z.ZodTypeDef, CreatePromptVersionRequest > = z.object({ id: z.string(), xOnBehalfOf: z.string().optional(), requestBody: z.lazy(() => CreatePromptVersionRequestBody$outboundSchema), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", requestBody: "RequestBody", }); }); export function createPromptVersionRequestToJSON( createPromptVersionRequest: CreatePromptVersionRequest, ): string { return JSON.stringify( CreatePromptVersionRequest$outboundSchema.parse(createPromptVersionRequest), ); } export function createPromptVersionRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreatePromptVersionRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreatePromptVersionRequest' from JSON`, ); }