/* * 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"; /** * The base or virtual document referred to by the URL path. If the path is undefined, this key will be omitted. */ export type Result = boolean | string | number | Array | { [k: string]: any; }; /** @internal */ export const Result$inboundSchema: z.ZodType = z .union([ z.boolean(), z.string(), z.number(), z.array(z.any()), z.record(z.any()), ]); /** @internal */ export type Result$Outbound = boolean | string | number | Array | { [k: string]: any; }; /** @internal */ export const Result$outboundSchema: z.ZodType< Result$Outbound, z.ZodTypeDef, Result > = z.union([ z.boolean(), z.string(), z.number(), z.array(z.any()), z.record(z.any()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Result$ { /** @deprecated use `Result$inboundSchema` instead. */ export const inboundSchema = Result$inboundSchema; /** @deprecated use `Result$outboundSchema` instead. */ export const outboundSchema = Result$outboundSchema; /** @deprecated use `Result$Outbound` instead. */ export type Outbound = Result$Outbound; } export function resultToJSON(result: Result): string { return JSON.stringify(Result$outboundSchema.parse(result)); } export function resultFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Result$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Result' from JSON`, ); }