/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type WebhookSubscription = { /** * The ID of the downstream service */ downstreamId?: string | undefined; /** * The list of Unify Events this connection is subscribed to */ unifyEventTypes?: Array | undefined; /** * The list of downstream Events this connection is subscribed to */ downstreamEventTypes?: Array | undefined; /** * The URL the downstream is sending to when the event is triggered */ executeUrl?: string | undefined; /** * The date and time the webhook subscription was created downstream */ createdAt?: string | undefined; }; /** @internal */ export const WebhookSubscription$inboundSchema: z.ZodType< WebhookSubscription, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ downstream_id: types.optional(types.string()), unify_event_types: types.optional(z.array(types.string())), downstream_event_types: types.optional(z.array(types.string())), execute_url: types.optional(types.string()), created_at: types.optional(types.string()), }).transform((v) => { return remap$(v, { "downstream_id": "downstreamId", "unify_event_types": "unifyEventTypes", "downstream_event_types": "downstreamEventTypes", "execute_url": "executeUrl", "created_at": "createdAt", }); }) ); export function webhookSubscriptionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookSubscription$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookSubscription' from JSON`, ); }