/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; /** * Errors */ export type Errors = {}; /** * Unprocessable Entity */ export type ErrorT = { /** * Error message */ message?: string | undefined; /** * Error code */ code?: number | undefined; /** * Error name */ status?: string | undefined; /** * Errors */ errors?: Errors | undefined; }; /** @internal */ export const Errors$inboundSchema: z.ZodType = z .object({}); /** @internal */ export type Errors$Outbound = {}; /** @internal */ export const Errors$outboundSchema: z.ZodType< Errors$Outbound, z.ZodTypeDef, Errors > = z.object({}); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Errors$ { /** @deprecated use `Errors$inboundSchema` instead. */ export const inboundSchema = Errors$inboundSchema; /** @deprecated use `Errors$outboundSchema` instead. */ export const outboundSchema = Errors$outboundSchema; /** @deprecated use `Errors$Outbound` instead. */ export type Outbound = Errors$Outbound; } export function errorsToJSON(errors: Errors): string { return JSON.stringify(Errors$outboundSchema.parse(errors)); } export function errorsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Errors$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Errors' from JSON`, ); } /** @internal */ export const ErrorT$inboundSchema: z.ZodType = z .object({ message: z.string().optional(), code: z.number().int().optional(), status: z.string().optional(), errors: z.lazy(() => Errors$inboundSchema).optional(), }); /** @internal */ export type ErrorT$Outbound = { message?: string | undefined; code?: number | undefined; status?: string | undefined; errors?: Errors$Outbound | undefined; }; /** @internal */ export const ErrorT$outboundSchema: z.ZodType< ErrorT$Outbound, z.ZodTypeDef, ErrorT > = z.object({ message: z.string().optional(), code: z.number().int().optional(), status: z.string().optional(), errors: z.lazy(() => Errors$outboundSchema).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ErrorT$ { /** @deprecated use `ErrorT$inboundSchema` instead. */ export const inboundSchema = ErrorT$inboundSchema; /** @deprecated use `ErrorT$outboundSchema` instead. */ export const outboundSchema = ErrorT$outboundSchema; /** @deprecated use `ErrorT$Outbound` instead. */ export type Outbound = ErrorT$Outbound; } 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`, ); }