/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { EventSource, EventSource$inboundSchema } from "./eventsource.js"; export type EventTypeWithStats = { /** * The ID of the event type. Null for system event types. */ id?: string | null | undefined; /** * Creation timestamp of the event type. Null for system event types. */ createdAt?: Date | null | undefined; /** * Last modification timestamp of the event type. Null for system event types. */ modifiedAt?: Date | null | undefined; /** * The name of the event type. */ name: string; /** * The label for the event type. */ label: string; /** * Property path to extract dynamic label from event metadata. */ labelPropertySelector?: string | null | undefined; /** * The ID of the organization owning the event type. */ organizationId: string; source: EventSource; /** * Number of times the event has occurred. */ occurrences: number; /** * The first time the event occurred. */ firstSeen: Date; /** * The last time the event occurred. */ lastSeen: Date; }; /** @internal */ export const EventTypeWithStats$inboundSchema: z.ZodMiniType< EventTypeWithStats, unknown > = z.pipe( z.object({ id: z.optional(z.nullable(z.string())), created_at: z.optional( z.nullable(z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), )), ), modified_at: z.optional( z.nullable(z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), )), ), name: z.string(), label: z.string(), label_property_selector: z.optional(z.nullable(z.string())), organization_id: z.string(), source: EventSource$inboundSchema, occurrences: z.int(), first_seen: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), last_seen: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), }), z.transform((v) => { return remap$(v, { "created_at": "createdAt", "modified_at": "modifiedAt", "label_property_selector": "labelPropertySelector", "organization_id": "organizationId", "first_seen": "firstSeen", "last_seen": "lastSeen", }); }), ); export function eventTypeWithStatsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EventTypeWithStats$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EventTypeWithStats' from JSON`, ); }