/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 999eb6ff3923 */ 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 { Period, Period$inboundSchema, Period$Outbound, Period$outboundSchema, } from "./period.js"; export type CountInfo = { /** * The counter value */ count: number; period?: Period | undefined; /** * The unit of organization over which we did the count aggregation, e.g. org (department) or company */ org?: string | undefined; }; /** @internal */ export const CountInfo$inboundSchema: z.ZodType< CountInfo, z.ZodTypeDef, unknown > = z.object({ count: z.number().int(), period: Period$inboundSchema.optional(), org: z.string().optional(), }); /** @internal */ export type CountInfo$Outbound = { count: number; period?: Period$Outbound | undefined; org?: string | undefined; }; /** @internal */ export const CountInfo$outboundSchema: z.ZodType< CountInfo$Outbound, z.ZodTypeDef, CountInfo > = z.object({ count: z.number().int(), period: Period$outboundSchema.optional(), org: z.string().optional(), }); export function countInfoToJSON(countInfo: CountInfo): string { return JSON.stringify(CountInfo$outboundSchema.parse(countInfo)); } export function countInfoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CountInfo$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CountInfo' from JSON`, ); }