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