/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 7bc009dd55f0 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { smartUnion } from "../../types/smartUnion.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type MetricValue = number | number; export type AggregationRow = { timeBucket?: Date | null | undefined; dimensions?: { [k: string]: any } | undefined; metricName: string; metricValue?: number | number | null | undefined; }; /** @internal */ export const MetricValue$inboundSchema: z.ZodType = smartUnion([z.number(), z.int()]); export function metricValueFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MetricValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MetricValue' from JSON`, ); } /** @internal */ export const AggregationRow$inboundSchema: z.ZodType = z.object({ time_bucket: z.nullable( z.iso.datetime({ offset: true }).transform(v => new Date(v)), ).optional(), dimensions: z.record(z.string(), z.any()).optional(), metric_name: z.string(), metric_value: z.nullable(smartUnion([z.number(), z.int()])).optional(), }).transform((v) => { return remap$(v, { "time_bucket": "timeBucket", "metric_name": "metricName", "metric_value": "metricValue", }); }); export function aggregationRowFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AggregationRow$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AggregationRow' from JSON`, ); }