/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const Severity = { High: "high", Medium: "medium", Low: "low", None: "none", } as const; export type Severity = ClosedEnum; export type SubscribersControllerGetSubscriberNotificationsRequest = { /** * The identifier of the subscriber */ subscriberId: string; limit?: number | undefined; after?: string | undefined; offset?: number | undefined; /** * Filter by read/unread state */ read?: boolean | undefined; /** * Filter by archived state */ archived?: boolean | undefined; /** * Filter by snoozed state */ snoozed?: boolean | undefined; /** * Filter by seen state */ seen?: boolean | undefined; /** * Filter by data attributes (JSON string) */ data?: string | undefined; /** * Filter by severity levels */ severity?: Array | undefined; /** * Filter notifications created on or after this timestamp (Unix timestamp in milliseconds) */ createdGte?: number | undefined; /** * Filter notifications created on or before this timestamp (Unix timestamp in milliseconds) */ createdLte?: number | undefined; /** * Context keys for filtering notifications in multi-context scenarios */ contextKeys?: Array | undefined; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type SubscribersControllerGetSubscriberNotificationsResponse = { headers: { [k: string]: Array }; result: components.GetSubscriberNotificationsResponseDto; }; /** @internal */ export const Severity$outboundSchema: z.ZodNativeEnum = z .nativeEnum(Severity); /** @internal */ export type SubscribersControllerGetSubscriberNotificationsRequest$Outbound = { subscriberId: string; limit: number; after?: string | undefined; offset?: number | undefined; read?: boolean | undefined; archived?: boolean | undefined; snoozed?: boolean | undefined; seen?: boolean | undefined; data?: string | undefined; severity?: Array | undefined; createdGte?: number | undefined; createdLte?: number | undefined; contextKeys?: Array | undefined; "idempotency-key"?: string | undefined; }; /** @internal */ export const SubscribersControllerGetSubscriberNotificationsRequest$outboundSchema: z.ZodType< SubscribersControllerGetSubscriberNotificationsRequest$Outbound, z.ZodTypeDef, SubscribersControllerGetSubscriberNotificationsRequest > = z.object({ subscriberId: z.string(), limit: z.number().default(10), after: z.string().optional(), offset: z.number().optional(), read: z.boolean().optional(), archived: z.boolean().optional(), snoozed: z.boolean().optional(), seen: z.boolean().optional(), data: z.string().optional(), severity: z.array(Severity$outboundSchema).optional(), createdGte: z.number().optional(), createdLte: z.number().optional(), contextKeys: z.array(z.string()).optional(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function subscribersControllerGetSubscriberNotificationsRequestToJSON( subscribersControllerGetSubscriberNotificationsRequest: SubscribersControllerGetSubscriberNotificationsRequest, ): string { return JSON.stringify( SubscribersControllerGetSubscriberNotificationsRequest$outboundSchema.parse( subscribersControllerGetSubscriberNotificationsRequest, ), ); } /** @internal */ export const SubscribersControllerGetSubscriberNotificationsResponse$inboundSchema: z.ZodType< SubscribersControllerGetSubscriberNotificationsResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.GetSubscriberNotificationsResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function subscribersControllerGetSubscriberNotificationsResponseFromJSON( jsonString: string, ): SafeParseResult< SubscribersControllerGetSubscriberNotificationsResponse, SDKValidationError > { return safeParse( jsonString, (x) => SubscribersControllerGetSubscriberNotificationsResponse$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'SubscribersControllerGetSubscriberNotificationsResponse' from JSON`, ); }