/* * 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 CreateComputeQuoteRequest = { /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; computeQuoteRequest: components.ComputeQuoteRequest; }; export type CreateComputeQuoteResponse = | components.ComputeQuote | components.ComputeErrorEnvelope; /** @internal */ export const CreateComputeQuoteRequest$inboundSchema: z.ZodType< CreateComputeQuoteRequest, z.ZodTypeDef, unknown > = z.object({ "X-On-Behalf-Of": z.string().optional(), ComputeQuoteRequest: components.ComputeQuoteRequest$inboundSchema, }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", "ComputeQuoteRequest": "computeQuoteRequest", }); }); /** @internal */ export type CreateComputeQuoteRequest$Outbound = { "X-On-Behalf-Of"?: string | undefined; ComputeQuoteRequest: components.ComputeQuoteRequest$Outbound; }; /** @internal */ export const CreateComputeQuoteRequest$outboundSchema: z.ZodType< CreateComputeQuoteRequest$Outbound, z.ZodTypeDef, CreateComputeQuoteRequest > = z.object({ xOnBehalfOf: z.string().optional(), computeQuoteRequest: components.ComputeQuoteRequest$outboundSchema, }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", computeQuoteRequest: "ComputeQuoteRequest", }); }); export function createComputeQuoteRequestToJSON( createComputeQuoteRequest: CreateComputeQuoteRequest, ): string { return JSON.stringify( CreateComputeQuoteRequest$outboundSchema.parse(createComputeQuoteRequest), ); } export function createComputeQuoteRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateComputeQuoteRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateComputeQuoteRequest' from JSON`, ); } /** @internal */ export const CreateComputeQuoteResponse$inboundSchema: z.ZodType< CreateComputeQuoteResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeQuote$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type CreateComputeQuoteResponse$Outbound = | components.ComputeQuote$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const CreateComputeQuoteResponse$outboundSchema: z.ZodType< CreateComputeQuoteResponse$Outbound, z.ZodTypeDef, CreateComputeQuoteResponse > = z.union([ components.ComputeQuote$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function createComputeQuoteResponseToJSON( createComputeQuoteResponse: CreateComputeQuoteResponse, ): string { return JSON.stringify( CreateComputeQuoteResponse$outboundSchema.parse(createComputeQuoteResponse), ); } export function createComputeQuoteResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateComputeQuoteResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateComputeQuoteResponse' from JSON`, ); }