/* * 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 CreateComputeSecretRequest = { /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; computeSecretCreate: components.ComputeSecretCreate; }; export type CreateComputeSecretResponse = | components.ComputeSecret | components.ComputeErrorEnvelope; /** @internal */ export const CreateComputeSecretRequest$inboundSchema: z.ZodType< CreateComputeSecretRequest, z.ZodTypeDef, unknown > = z.object({ "X-On-Behalf-Of": z.string().optional(), ComputeSecretCreate: components.ComputeSecretCreate$inboundSchema, }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", "ComputeSecretCreate": "computeSecretCreate", }); }); /** @internal */ export type CreateComputeSecretRequest$Outbound = { "X-On-Behalf-Of"?: string | undefined; ComputeSecretCreate: components.ComputeSecretCreate$Outbound; }; /** @internal */ export const CreateComputeSecretRequest$outboundSchema: z.ZodType< CreateComputeSecretRequest$Outbound, z.ZodTypeDef, CreateComputeSecretRequest > = z.object({ xOnBehalfOf: z.string().optional(), computeSecretCreate: components.ComputeSecretCreate$outboundSchema, }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", computeSecretCreate: "ComputeSecretCreate", }); }); export function createComputeSecretRequestToJSON( createComputeSecretRequest: CreateComputeSecretRequest, ): string { return JSON.stringify( CreateComputeSecretRequest$outboundSchema.parse(createComputeSecretRequest), ); } export function createComputeSecretRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateComputeSecretRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateComputeSecretRequest' from JSON`, ); } /** @internal */ export const CreateComputeSecretResponse$inboundSchema: z.ZodType< CreateComputeSecretResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeSecret$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type CreateComputeSecretResponse$Outbound = | components.ComputeSecret$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const CreateComputeSecretResponse$outboundSchema: z.ZodType< CreateComputeSecretResponse$Outbound, z.ZodTypeDef, CreateComputeSecretResponse > = z.union([ components.ComputeSecret$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function createComputeSecretResponseToJSON( createComputeSecretResponse: CreateComputeSecretResponse, ): string { return JSON.stringify( CreateComputeSecretResponse$outboundSchema.parse( createComputeSecretResponse, ), ); } export function createComputeSecretResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateComputeSecretResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateComputeSecretResponse' from JSON`, ); }