/* * 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"; import { HealthCheckResult, HealthCheckResult$inboundSchema, HealthCheckResult$outboundSchema, } from "./healthcheckresult.js"; export type HealthResource = { id?: number | undefined; source?: string | null | undefined; type?: HealthCheckResult | undefined; message?: string | null | undefined; wikiUrl?: string | null | undefined; }; /** @internal */ export const HealthResource$inboundSchema: z.ZodType< HealthResource, z.ZodTypeDef, unknown > = z.object({ id: z.number().int().optional(), source: z.nullable(z.string()).optional(), type: HealthCheckResult$inboundSchema.optional(), message: z.nullable(z.string()).optional(), wikiUrl: z.nullable(z.string()).optional(), }); /** @internal */ export type HealthResource$Outbound = { id?: number | undefined; source?: string | null | undefined; type?: string | undefined; message?: string | null | undefined; wikiUrl?: string | null | undefined; }; /** @internal */ export const HealthResource$outboundSchema: z.ZodType< HealthResource$Outbound, z.ZodTypeDef, HealthResource > = z.object({ id: z.number().int().optional(), source: z.nullable(z.string()).optional(), type: HealthCheckResult$outboundSchema.optional(), message: z.nullable(z.string()).optional(), wikiUrl: z.nullable(z.string()).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace HealthResource$ { /** @deprecated use `HealthResource$inboundSchema` instead. */ export const inboundSchema = HealthResource$inboundSchema; /** @deprecated use `HealthResource$outboundSchema` instead. */ export const outboundSchema = HealthResource$outboundSchema; /** @deprecated use `HealthResource$Outbound` instead. */ export type Outbound = HealthResource$Outbound; } export function healthResourceToJSON(healthResource: HealthResource): string { return JSON.stringify(HealthResource$outboundSchema.parse(healthResource)); } export function healthResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => HealthResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'HealthResource' from JSON`, ); }