/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { StatsMetricPeriodEntity, StatsMetricPeriodEntity$inboundSchema, StatsMetricPeriodEntity$Outbound, StatsMetricPeriodEntity$outboundSchema, } from "./statsmetricperiodentity.js"; import { StatsMetricTotalsEntity, StatsMetricTotalsEntity$inboundSchema, StatsMetricTotalsEntity$Outbound, StatsMetricTotalsEntity$outboundSchema, } from "./statsmetrictotalsentity.js"; export type StatsSummaryEntity = { /** * Aggregated totals for the queried date range */ totals: StatsMetricTotalsEntity; /** * Time-series data points grouped by the requested interval. Only present when interval, startDate, and endDate are provided. */ periods?: Array | undefined; }; /** @internal */ export const StatsSummaryEntity$inboundSchema: z.ZodType< StatsSummaryEntity, z.ZodTypeDef, unknown > = z.object({ totals: StatsMetricTotalsEntity$inboundSchema, periods: z.array(StatsMetricPeriodEntity$inboundSchema).optional(), }); /** @internal */ export type StatsSummaryEntity$Outbound = { totals: StatsMetricTotalsEntity$Outbound; periods?: Array | undefined; }; /** @internal */ export const StatsSummaryEntity$outboundSchema: z.ZodType< StatsSummaryEntity$Outbound, z.ZodTypeDef, StatsSummaryEntity > = z.object({ totals: StatsMetricTotalsEntity$outboundSchema, periods: z.array(StatsMetricPeriodEntity$outboundSchema).optional(), }); export function statsSummaryEntityToJSON( statsSummaryEntity: StatsSummaryEntity, ): string { return JSON.stringify( StatsSummaryEntity$outboundSchema.parse(statsSummaryEntity), ); } export function statsSummaryEntityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => StatsSummaryEntity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'StatsSummaryEntity' from JSON`, ); }