/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type NotificationsControllerListNotificationsRequest = { /** * Array of channel types */ channels?: Array | undefined; /** * Array of template IDs or a single template ID */ templates?: Array | undefined; /** * Array of email addresses or a single email address */ emails?: Array | undefined; /** * Search term (deprecated) * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ search?: string | undefined; /** * Array of subscriber IDs or a single subscriber ID */ subscriberIds?: Array | undefined; /** * Array of severity levels or a single severity level */ severity?: Array | undefined; /** * Page number for pagination */ page?: number | undefined; /** * Limit for pagination */ limit?: number | undefined; /** * The transaction ID to filter by */ transactionId?: string | undefined; /** * Topic Key for filtering notifications by topic */ topicKey?: string | undefined; /** * Subscription ID for filtering notifications by subscription */ subscriptionId?: string | undefined; /** * Filter by exact context keys, order insensitive (format: "type:id") */ contextKeys?: Array | undefined; /** * Date filter for records after this timestamp. Defaults to earliest date allowed by subscription plan */ after?: string | undefined; /** * Date filter for records before this timestamp. Defaults to current time of request (now) */ before?: string | undefined; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type NotificationsControllerListNotificationsResponse = { headers: { [k: string]: Array }; result: components.ActivitiesResponseDto; }; /** @internal */ export type NotificationsControllerListNotificationsRequest$Outbound = { channels?: Array | undefined; templates?: Array | undefined; emails?: Array | undefined; search?: string | undefined; subscriberIds?: Array | undefined; severity?: Array | undefined; page: number; limit: number; transactionId?: string | undefined; topicKey?: string | undefined; subscriptionId?: string | undefined; contextKeys?: Array | undefined; after?: string | undefined; before?: string | undefined; "idempotency-key"?: string | undefined; }; /** @internal */ export const NotificationsControllerListNotificationsRequest$outboundSchema: z.ZodType< NotificationsControllerListNotificationsRequest$Outbound, z.ZodTypeDef, NotificationsControllerListNotificationsRequest > = z.object({ channels: z.array(components.ChannelTypeEnum$outboundSchema).optional(), templates: z.array(z.string()).optional(), emails: z.array(z.string()).optional(), search: z.string().optional(), subscriberIds: z.array(z.string()).optional(), severity: z.array(z.string()).optional(), page: z.number().default(0), limit: z.number().default(10), transactionId: z.string().optional(), topicKey: z.string().optional(), subscriptionId: z.string().optional(), contextKeys: z.array(z.string()).optional(), after: z.string().optional(), before: z.string().optional(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function notificationsControllerListNotificationsRequestToJSON( notificationsControllerListNotificationsRequest: NotificationsControllerListNotificationsRequest, ): string { return JSON.stringify( NotificationsControllerListNotificationsRequest$outboundSchema.parse( notificationsControllerListNotificationsRequest, ), ); } /** @internal */ export const NotificationsControllerListNotificationsResponse$inboundSchema: z.ZodType< NotificationsControllerListNotificationsResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ActivitiesResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function notificationsControllerListNotificationsResponseFromJSON( jsonString: string, ): SafeParseResult< NotificationsControllerListNotificationsResponse, SDKValidationError > { return safeParse( jsonString, (x) => NotificationsControllerListNotificationsResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'NotificationsControllerListNotificationsResponse' from JSON`, ); }