/* * 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"; export type PerformanceMetricResult = { metric: string; date?: string | null | undefined; horizon: number; value: number; }; /** @internal */ export const PerformanceMetricResult$inboundSchema: z.ZodType< PerformanceMetricResult, z.ZodTypeDef, unknown > = z.object({ metric: z.string(), date: z.nullable(z.string()).optional(), horizon: z.number().int(), value: z.number(), }); /** @internal */ export type PerformanceMetricResult$Outbound = { metric: string; date?: string | null | undefined; horizon: number; value: number; }; /** @internal */ export const PerformanceMetricResult$outboundSchema: z.ZodType< PerformanceMetricResult$Outbound, z.ZodTypeDef, PerformanceMetricResult > = z.object({ metric: z.string(), date: z.nullable(z.string()).optional(), horizon: z.number().int(), value: z.number(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PerformanceMetricResult$ { /** @deprecated use `PerformanceMetricResult$inboundSchema` instead. */ export const inboundSchema = PerformanceMetricResult$inboundSchema; /** @deprecated use `PerformanceMetricResult$outboundSchema` instead. */ export const outboundSchema = PerformanceMetricResult$outboundSchema; /** @deprecated use `PerformanceMetricResult$Outbound` instead. */ export type Outbound = PerformanceMetricResult$Outbound; } export function performanceMetricResultToJSON( performanceMetricResult: PerformanceMetricResult, ): string { return JSON.stringify( PerformanceMetricResult$outboundSchema.parse(performanceMetricResult), ); } export function performanceMetricResultFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PerformanceMetricResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PerformanceMetricResult' from JSON`, ); }