/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { GroupPreferenceFilterDto, GroupPreferenceFilterDto$Outbound, GroupPreferenceFilterDto$outboundSchema, } from "./grouppreferencefilterdto.js"; import { TopicSubscriberIdentifierDto, TopicSubscriberIdentifierDto$Outbound, TopicSubscriberIdentifierDto$outboundSchema, } from "./topicsubscriberidentifierdto.js"; import { WorkflowPreferenceRequestDto, WorkflowPreferenceRequestDto$Outbound, WorkflowPreferenceRequestDto$outboundSchema, } from "./workflowpreferencerequestdto.js"; export type Subscriptions = TopicSubscriberIdentifierDto | string; /** * Rich context object with id and optional data */ export type CreateTopicSubscriptionsRequestDtoContext2 = { id: string; /** * Optional additional context data */ data?: { [k: string]: any } | undefined; }; export type CreateTopicSubscriptionsRequestDtoContext = | CreateTopicSubscriptionsRequestDtoContext2 | string; export type Preferences = | WorkflowPreferenceRequestDto | GroupPreferenceFilterDto | string; export type CreateTopicSubscriptionsRequestDto = { /** * List of subscriber IDs to subscribe to the topic (max: 100). @deprecated Use the "subscriptions" property instead. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ subscriberIds?: Array | undefined; /** * List of subscriptions to subscribe to the topic (max: 100). Can be either a string array of subscriber IDs or an array of objects with identifier and subscriberId */ subscriptions?: Array | undefined; /** * The name of the topic */ name?: string | undefined; context?: | { [k: string]: CreateTopicSubscriptionsRequestDtoContext2 | string } | undefined; /** * The preferences of the topic. Can be a simple workflow ID string, workflow preference object, or group filter object */ preferences?: | Array | undefined; }; /** @internal */ export type Subscriptions$Outbound = | TopicSubscriberIdentifierDto$Outbound | string; /** @internal */ export const Subscriptions$outboundSchema: z.ZodType< Subscriptions$Outbound, z.ZodTypeDef, Subscriptions > = z.union([TopicSubscriberIdentifierDto$outboundSchema, z.string()]); export function subscriptionsToJSON(subscriptions: Subscriptions): string { return JSON.stringify(Subscriptions$outboundSchema.parse(subscriptions)); } /** @internal */ export type CreateTopicSubscriptionsRequestDtoContext2$Outbound = { id: string; data?: { [k: string]: any } | undefined; }; /** @internal */ export const CreateTopicSubscriptionsRequestDtoContext2$outboundSchema: z.ZodType< CreateTopicSubscriptionsRequestDtoContext2$Outbound, z.ZodTypeDef, CreateTopicSubscriptionsRequestDtoContext2 > = z.object({ id: z.string(), data: z.record(z.any()).optional(), }); export function createTopicSubscriptionsRequestDtoContext2ToJSON( createTopicSubscriptionsRequestDtoContext2: CreateTopicSubscriptionsRequestDtoContext2, ): string { return JSON.stringify( CreateTopicSubscriptionsRequestDtoContext2$outboundSchema.parse( createTopicSubscriptionsRequestDtoContext2, ), ); } /** @internal */ export type CreateTopicSubscriptionsRequestDtoContext$Outbound = | CreateTopicSubscriptionsRequestDtoContext2$Outbound | string; /** @internal */ export const CreateTopicSubscriptionsRequestDtoContext$outboundSchema: z.ZodType< CreateTopicSubscriptionsRequestDtoContext$Outbound, z.ZodTypeDef, CreateTopicSubscriptionsRequestDtoContext > = z.union([ z.lazy(() => CreateTopicSubscriptionsRequestDtoContext2$outboundSchema), z.string(), ]); export function createTopicSubscriptionsRequestDtoContextToJSON( createTopicSubscriptionsRequestDtoContext: CreateTopicSubscriptionsRequestDtoContext, ): string { return JSON.stringify( CreateTopicSubscriptionsRequestDtoContext$outboundSchema.parse( createTopicSubscriptionsRequestDtoContext, ), ); } /** @internal */ export type Preferences$Outbound = | WorkflowPreferenceRequestDto$Outbound | GroupPreferenceFilterDto$Outbound | string; /** @internal */ export const Preferences$outboundSchema: z.ZodType< Preferences$Outbound, z.ZodTypeDef, Preferences > = z.union([ WorkflowPreferenceRequestDto$outboundSchema, GroupPreferenceFilterDto$outboundSchema, z.string(), ]); export function preferencesToJSON(preferences: Preferences): string { return JSON.stringify(Preferences$outboundSchema.parse(preferences)); } /** @internal */ export type CreateTopicSubscriptionsRequestDto$Outbound = { subscriberIds?: Array | undefined; subscriptions?: | Array | undefined; name?: string | undefined; context?: { [k: string]: CreateTopicSubscriptionsRequestDtoContext2$Outbound | string; } | undefined; preferences?: | Array< | WorkflowPreferenceRequestDto$Outbound | GroupPreferenceFilterDto$Outbound | string > | undefined; }; /** @internal */ export const CreateTopicSubscriptionsRequestDto$outboundSchema: z.ZodType< CreateTopicSubscriptionsRequestDto$Outbound, z.ZodTypeDef, CreateTopicSubscriptionsRequestDto > = z.object({ subscriberIds: z.array(z.string()).optional(), subscriptions: z.array( z.union([TopicSubscriberIdentifierDto$outboundSchema, z.string()]), ).optional(), name: z.string().optional(), context: z.record( z.union([ z.lazy(() => CreateTopicSubscriptionsRequestDtoContext2$outboundSchema), z.string(), ]), ).optional(), preferences: z.array( z.union([ WorkflowPreferenceRequestDto$outboundSchema, GroupPreferenceFilterDto$outboundSchema, z.string(), ]), ).optional(), }); export function createTopicSubscriptionsRequestDtoToJSON( createTopicSubscriptionsRequestDto: CreateTopicSubscriptionsRequestDto, ): string { return JSON.stringify( CreateTopicSubscriptionsRequestDto$outboundSchema.parse( createTopicSubscriptionsRequestDto, ), ); }