/* * 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"; /** * The type of action (primary or secondary) */ export const ActionType = { Primary: "primary", Secondary: "secondary", } as const; /** * The type of action (primary or secondary) */ export type ActionType = ClosedEnum; export type SubscribersControllerCompleteNotificationActionRequest = { /** * The identifier of the subscriber */ subscriberId: string; /** * The identifier of the notification */ notificationId: string; /** * The type of action (primary or secondary) */ actionType: ActionType; /** * Context keys for filtering */ contextKeys?: Array | undefined; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type SubscribersControllerCompleteNotificationActionResponse = { headers: { [k: string]: Array }; result: components.InboxNotificationDto; }; /** @internal */ export const ActionType$outboundSchema: z.ZodNativeEnum = z .nativeEnum(ActionType); /** @internal */ export type SubscribersControllerCompleteNotificationActionRequest$Outbound = { subscriberId: string; notificationId: string; actionType: string; contextKeys?: Array | undefined; "idempotency-key"?: string | undefined; }; /** @internal */ export const SubscribersControllerCompleteNotificationActionRequest$outboundSchema: z.ZodType< SubscribersControllerCompleteNotificationActionRequest$Outbound, z.ZodTypeDef, SubscribersControllerCompleteNotificationActionRequest > = z.object({ subscriberId: z.string(), notificationId: z.string(), actionType: ActionType$outboundSchema, contextKeys: z.array(z.string()).optional(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function subscribersControllerCompleteNotificationActionRequestToJSON( subscribersControllerCompleteNotificationActionRequest: SubscribersControllerCompleteNotificationActionRequest, ): string { return JSON.stringify( SubscribersControllerCompleteNotificationActionRequest$outboundSchema.parse( subscribersControllerCompleteNotificationActionRequest, ), ); } /** @internal */ export const SubscribersControllerCompleteNotificationActionResponse$inboundSchema: z.ZodType< SubscribersControllerCompleteNotificationActionResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.InboxNotificationDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function subscribersControllerCompleteNotificationActionResponseFromJSON( jsonString: string, ): SafeParseResult< SubscribersControllerCompleteNotificationActionResponse, SDKValidationError > { return safeParse( jsonString, (x) => SubscribersControllerCompleteNotificationActionResponse$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'SubscribersControllerCompleteNotificationActionResponse' from JSON`, ); }