/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Status of the event */ export const Status = { Opened: "opened", Rejected: "rejected", Sent: "sent", Deferred: "deferred", Delivered: "delivered", Bounced: "bounced", Dropped: "dropped", Clicked: "clicked", Blocked: "blocked", Spam: "spam", Unsubscribed: "unsubscribed", Delayed: "delayed", Complaint: "complaint", Created: "created", Accepted: "accepted", Queued: "queued", Sending: "sending", Failed: "failed", Undelivered: "undelivered", Dismissed: "dismissed", } as const; /** * Status of the event */ export type Status = ClosedEnum; export type EventBody = { /** * Status of the event */ status: Status; /** * Date of the event */ date: string; /** * External ID from the provider */ externalId?: string | undefined; /** * Number of attempts */ attempts?: number | undefined; /** * Response from the provider */ response?: string | undefined; /** * Raw content from the provider webhook */ row?: string | undefined; }; /** @internal */ export const Status$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Status); /** @internal */ export const EventBody$inboundSchema: z.ZodType< EventBody, z.ZodTypeDef, unknown > = z.object({ status: Status$inboundSchema, date: z.string(), externalId: z.string().optional(), attempts: z.number().optional(), response: z.string().optional(), row: z.string().optional(), }); export function eventBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EventBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EventBody' from JSON`, ); }