/* * 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 Criticality = { Critical: "critical", NonCritical: "nonCritical", All: "all", } as const; export type Criticality = ClosedEnum; export type SubscribersControllerGetSubscriberPreferencesRequest = { /** * The identifier of the subscriber */ subscriberId: string; criticality?: Criticality | undefined; /** * Context keys for filtering preferences (e.g., ["tenant:acme"]) */ contextKeys?: Array | undefined; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type SubscribersControllerGetSubscriberPreferencesResponse = { headers: { [k: string]: Array }; result: components.GetSubscriberPreferencesDto; }; /** @internal */ export const Criticality$outboundSchema: z.ZodNativeEnum = z .nativeEnum(Criticality); /** @internal */ export type SubscribersControllerGetSubscriberPreferencesRequest$Outbound = { subscriberId: string; criticality: string; contextKeys?: Array | undefined; "idempotency-key"?: string | undefined; }; /** @internal */ export const SubscribersControllerGetSubscriberPreferencesRequest$outboundSchema: z.ZodType< SubscribersControllerGetSubscriberPreferencesRequest$Outbound, z.ZodTypeDef, SubscribersControllerGetSubscriberPreferencesRequest > = z.object({ subscriberId: z.string(), criticality: Criticality$outboundSchema.default("nonCritical"), contextKeys: z.array(z.string()).optional(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function subscribersControllerGetSubscriberPreferencesRequestToJSON( subscribersControllerGetSubscriberPreferencesRequest: SubscribersControllerGetSubscriberPreferencesRequest, ): string { return JSON.stringify( SubscribersControllerGetSubscriberPreferencesRequest$outboundSchema.parse( subscribersControllerGetSubscriberPreferencesRequest, ), ); } /** @internal */ export const SubscribersControllerGetSubscriberPreferencesResponse$inboundSchema: z.ZodType< SubscribersControllerGetSubscriberPreferencesResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.GetSubscriberPreferencesDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function subscribersControllerGetSubscriberPreferencesResponseFromJSON( jsonString: string, ): SafeParseResult< SubscribersControllerGetSubscriberPreferencesResponse, SDKValidationError > { return safeParse( jsonString, (x) => SubscribersControllerGetSubscriberPreferencesResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'SubscribersControllerGetSubscriberPreferencesResponse' from JSON`, ); }