/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; export type PublishResponse = { /** * The ID of the event that was accepted for publishing. This will be the ID provided in the request's `id` field if present, otherwise it's a server-generated UUID. */ id: string; /** * Whether this event was already processed (idempotency hit). If true, the event was not queued again. */ duplicate: boolean; /** * The IDs of destinations that matched this event. Empty array if no destinations matched. */ destinationIds: Array; }; /** @internal */ export const PublishResponse$inboundSchema: z.ZodType< PublishResponse, z.ZodTypeDef, unknown > = z.object({ id: z.string(), duplicate: z.boolean(), destination_ids: z.array(z.string()), }).transform((v) => { return remap$(v, { "destination_ids": "destinationIds", }); }); /** @internal */ export type PublishResponse$Outbound = { id: string; duplicate: boolean; destination_ids: Array; }; /** @internal */ export const PublishResponse$outboundSchema: z.ZodType< PublishResponse$Outbound, z.ZodTypeDef, PublishResponse > = z.object({ id: z.string(), duplicate: z.boolean(), destinationIds: z.array(z.string()), }).transform((v) => { return remap$(v, { destinationIds: "destination_ids", }); }); export function publishResponseToJSON( publishResponse: PublishResponse, ): string { return JSON.stringify(PublishResponse$outboundSchema.parse(publishResponse)); } export function publishResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PublishResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PublishResponse' from JSON`, ); }