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