/* * 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 { EventMetadataInput, EventMetadataInput$Outbound, EventMetadataInput$outboundSchema, } from "./eventmetadatainput.js"; export type EventCreateCustomer = { /** * The timestamp of the event. */ timestamp?: Date | undefined; /** * The name of the event. */ name: string; /** * The ID of the organization owning the event. **Required unless you use an organization token.** */ organizationId?: string | null | undefined; /** * Your unique identifier for this event. Useful for deduplication and parent-child relationships. */ externalId?: string | null | undefined; /** * The ID of the parent event. Can be either a Polar event ID (UUID) or an external event ID. */ parentId?: string | null | undefined; metadata?: { [k: string]: EventMetadataInput } | undefined; /** * ID of the customer in your Polar organization associated with the event. */ customerId: string; /** * ID of the member within the customer's organization who performed the action. Used for member-level attribution in B2B. */ memberId?: string | null | undefined; }; /** @internal */ export type EventCreateCustomer$Outbound = { timestamp?: string | undefined; name: string; organization_id?: string | null | undefined; external_id?: string | null | undefined; parent_id?: string | null | undefined; metadata?: { [k: string]: EventMetadataInput$Outbound } | undefined; customer_id: string; member_id?: string | null | undefined; }; /** @internal */ export const EventCreateCustomer$outboundSchema: z.ZodMiniType< EventCreateCustomer$Outbound, EventCreateCustomer > = z.pipe( z.object({ timestamp: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))), name: z.string(), organizationId: z.optional(z.nullable(z.string())), externalId: z.optional(z.nullable(z.string())), parentId: z.optional(z.nullable(z.string())), metadata: z.optional( z.record(z.string(), EventMetadataInput$outboundSchema), ), customerId: z.string(), memberId: z.optional(z.nullable(z.string())), }), z.transform((v) => { return remap$(v, { organizationId: "organization_id", externalId: "external_id", parentId: "parent_id", customerId: "customer_id", memberId: "member_id", }); }), ); export function eventCreateCustomerToJSON( eventCreateCustomer: EventCreateCustomer, ): string { return JSON.stringify( EventCreateCustomer$outboundSchema.parse(eventCreateCustomer), ); }