/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ErrorT = { code: string; message: string; }; /** @internal */ export const ErrorT$inboundSchema: z.ZodType = z .object({ code: z.string(), message: z.string(), }); /** @internal */ export type ErrorT$Outbound = { code: string; message: string; }; /** @internal */ export const ErrorT$outboundSchema: z.ZodType< ErrorT$Outbound, z.ZodTypeDef, ErrorT > = z.object({ code: z.string(), message: z.string(), }); export function errorToJSON(errorT: ErrorT): string { return JSON.stringify(ErrorT$outboundSchema.parse(errorT)); } export function errorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ErrorT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ErrorT' from JSON`, ); }