/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Track, Track$inboundSchema, Track$Outbound, Track$outboundSchema, } from "./track.js"; import { WebhookEventTypeEnum, WebhookEventTypeEnum$inboundSchema, WebhookEventTypeEnum$outboundSchema, } from "./webhookeventtypeenum.js"; /** * Content of the webhook posted to the external URL */ export type WebhookPayloadTrack = { /** * Type of event that triggered the webhook. */ event?: WebhookEventTypeEnum | undefined; /** * Determines whether the webhook is a test webhook or not. */ test?: boolean | undefined; data?: Track | undefined; }; /** @internal */ export const WebhookPayloadTrack$inboundSchema: z.ZodMiniType< WebhookPayloadTrack, unknown > = z.object({ event: z.optional(WebhookEventTypeEnum$inboundSchema), test: z.optional(z.boolean()), data: z.optional(Track$inboundSchema), }); /** @internal */ export type WebhookPayloadTrack$Outbound = { event?: string | undefined; test?: boolean | undefined; data?: Track$Outbound | undefined; }; /** @internal */ export const WebhookPayloadTrack$outboundSchema: z.ZodMiniType< WebhookPayloadTrack$Outbound, WebhookPayloadTrack > = z.object({ event: z.optional(WebhookEventTypeEnum$outboundSchema), test: z.optional(z.boolean()), data: z.optional(Track$outboundSchema), }); export function webhookPayloadTrackToJSON( webhookPayloadTrack: WebhookPayloadTrack, ): string { return JSON.stringify( WebhookPayloadTrack$outboundSchema.parse(webhookPayloadTrack), ); } export function webhookPayloadTrackFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookPayloadTrack$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookPayloadTrack' from JSON`, ); }