/* * 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 { CustomerSeat, CustomerSeat$inboundSchema, CustomerSeat$Outbound, CustomerSeat$outboundSchema, } from "./customerseat.js"; /** * Sent when a customer seat is revoked. * * @remarks * * This event is triggered when access to a seat is revoked, either manually by the organization or automatically when a subscription is canceled. */ export type WebhookCustomerSeatRevokedPayload = { type: "customer_seat.revoked"; timestamp: Date; data: CustomerSeat; }; /** @internal */ export const WebhookCustomerSeatRevokedPayload$inboundSchema: z.ZodMiniType< WebhookCustomerSeatRevokedPayload, unknown > = z.object({ type: z.literal("customer_seat.revoked"), timestamp: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), data: CustomerSeat$inboundSchema, }); /** @internal */ export type WebhookCustomerSeatRevokedPayload$Outbound = { type: "customer_seat.revoked"; timestamp: string; data: CustomerSeat$Outbound; }; /** @internal */ export const WebhookCustomerSeatRevokedPayload$outboundSchema: z.ZodMiniType< WebhookCustomerSeatRevokedPayload$Outbound, WebhookCustomerSeatRevokedPayload > = z.object({ type: z.literal("customer_seat.revoked"), timestamp: z.pipe(z.date(), z.transform(v => v.toISOString())), data: CustomerSeat$outboundSchema, }); export function webhookCustomerSeatRevokedPayloadToJSON( webhookCustomerSeatRevokedPayload: WebhookCustomerSeatRevokedPayload, ): string { return JSON.stringify( WebhookCustomerSeatRevokedPayload$outboundSchema.parse( webhookCustomerSeatRevokedPayload, ), ); } export function webhookCustomerSeatRevokedPayloadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WebhookCustomerSeatRevokedPayload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WebhookCustomerSeatRevokedPayload' from JSON`, ); }