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