/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ChannelTypeEnum, ChannelTypeEnum$inboundSchema, } from "./channeltypeenum.js"; import { InboxActionDto, InboxActionDto$inboundSchema, } from "./inboxactiondto.js"; import { InboxSubscriberResponseDto, InboxSubscriberResponseDto$inboundSchema, } from "./inboxsubscriberresponsedto.js"; import { NotificationWorkflowDto, NotificationWorkflowDto$inboundSchema, } from "./notificationworkflowdto.js"; import { RedirectDto, RedirectDto$inboundSchema } from "./redirectdto.js"; import { SeverityLevelEnum, SeverityLevelEnum$inboundSchema, } from "./severitylevelenum.js"; export type InboxNotificationDto = { /** * Unique identifier of the notification */ id: string; /** * Transaction identifier of the notification */ transactionId: string; /** * Subject of the notification */ subject?: string | undefined; /** * Body content of the notification */ body: string; /** * Subscriber this notification was sent to */ to: InboxSubscriberResponseDto; /** * Whether the notification has been read */ isRead: boolean; /** * Whether the notification has been seen */ isSeen: boolean; /** * Whether the notification has been archived */ isArchived: boolean; /** * Whether the notification is snoozed */ isSnoozed: boolean; /** * ISO timestamp when the notification will be unsnoozed */ snoozedUntil?: string | null | undefined; /** * Timestamps when the notification was delivered */ deliveredAt?: Array | undefined; /** * ISO timestamp when the notification was created */ createdAt: string; /** * ISO timestamp when the notification was read */ readAt?: string | null | undefined; /** * ISO timestamp when the notification was first seen */ firstSeenAt?: string | null | undefined; /** * ISO timestamp when the notification was archived */ archivedAt?: string | null | undefined; /** * Avatar URL for the notification */ avatar?: string | undefined; /** * Primary action button for the notification */ primaryAction?: InboxActionDto | undefined; /** * Secondary action button for the notification */ secondaryAction?: InboxActionDto | undefined; /** * Channel type through which the message is sent */ channelType: ChannelTypeEnum; /** * Tags associated with the notification */ tags?: Array | undefined; /** * Custom data payload of the notification */ data?: { [k: string]: any } | undefined; /** * Redirect configuration for the notification */ redirect?: RedirectDto | undefined; /** * Workflow associated with the notification */ workflow?: NotificationWorkflowDto | undefined; /** * Severity of the workflow */ severity: SeverityLevelEnum; }; /** @internal */ export const InboxNotificationDto$inboundSchema: z.ZodType< InboxNotificationDto, z.ZodTypeDef, unknown > = z.object({ id: z.string(), transactionId: z.string(), subject: z.string().optional(), body: z.string(), to: InboxSubscriberResponseDto$inboundSchema, isRead: z.boolean(), isSeen: z.boolean(), isArchived: z.boolean(), isSnoozed: z.boolean(), snoozedUntil: z.nullable(z.string()).optional(), deliveredAt: z.array(z.string()).optional(), createdAt: z.string(), readAt: z.nullable(z.string()).optional(), firstSeenAt: z.nullable(z.string()).optional(), archivedAt: z.nullable(z.string()).optional(), avatar: z.string().optional(), primaryAction: InboxActionDto$inboundSchema.optional(), secondaryAction: InboxActionDto$inboundSchema.optional(), channelType: ChannelTypeEnum$inboundSchema, tags: z.array(z.string()).optional(), data: z.record(z.any()).optional(), redirect: RedirectDto$inboundSchema.optional(), workflow: NotificationWorkflowDto$inboundSchema.optional(), severity: SeverityLevelEnum$inboundSchema, }); export function inboxNotificationDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InboxNotificationDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InboxNotificationDto' from JSON`, ); }