/* * 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 { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { AlertState, AlertState$inboundSchema } from "./alert-state.js"; import { AlertType, AlertType$inboundSchema } from "./alert-type.js"; import { SDKValidationError } from "./sdk-validation-error.js"; import { WebhookDtoSubscription, WebhookDtoSubscription$inboundSchema, } from "./webhook-dto-subscription.js"; export type WebhookDtoSpendAlertEvent = { alertStatus?: AlertState | undefined; alertType?: AlertType | undefined; currentSpend?: string | undefined; groupId?: string | undefined; subscription?: WebhookDtoSubscription | undefined; subscriptionLineItemId?: string | undefined; threshold?: string | undefined; triggeredAt?: Date | undefined; }; /** @internal */ export const WebhookDtoSpendAlertEvent$inboundSchema: z.ZodMiniType< WebhookDtoSpendAlertEvent, unknown > = z.pipe( z.object({ alert_status: types.optional(AlertState$inboundSchema), alert_type: types.optional(AlertType$inboundSchema), current_spend: types.optional(types.string()), group_id: types.optional(types.string()), subscription: types.optional(WebhookDtoSubscription$inboundSchema), subscription_line_item_id: types.optional(types.string()), threshold: types.optional(types.string()), triggered_at: types.optional(types.date()), }), z.transform((v) => { return remap$(v, { "alert_status": "alertStatus", "alert_type": "alertType", "current_spend": "currentSpend", "group_id": "groupId", "subscription_line_item_id": "subscriptionLineItemId", "triggered_at": "triggeredAt", }); }), ); export function webhookDtoSpendAlertEventFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookDtoSpendAlertEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookDtoSpendAlertEvent' from JSON`, ); }