/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { ClosedEnum } from "../../types/enums.js"; import { AuthDto, AuthDto$Outbound, AuthDto$outboundSchema, } from "./authdto.js"; import { WorkspaceDto, WorkspaceDto$Outbound, WorkspaceDto$outboundSchema, } from "./workspacedto.js"; /** * Rich context object with id and optional data */ export type CreateChannelConnectionRequestDtoContext2 = { id: string; /** * Optional additional context data */ data?: { [k: string]: any } | undefined; }; export type CreateChannelConnectionRequestDtoContext = | CreateChannelConnectionRequestDtoContext2 | string; /** * Connection mode that determines how the channel connection is scoped. Use "subscriber" (default) to associate the connection with a specific subscriber. Use "shared" to associate the connection with a context instead of a subscriber — subscriberId will not be stored on the connection. */ export const ConnectionMode = { Subscriber: "subscriber", Shared: "shared", } as const; /** * Connection mode that determines how the channel connection is scoped. Use "subscriber" (default) to associate the connection with a specific subscriber. Use "shared" to associate the connection with a context instead of a subscriber — subscriberId will not be stored on the connection. */ export type ConnectionMode = ClosedEnum; export type CreateChannelConnectionRequestDto = { /** * The unique identifier for the channel connection. If not provided, one will be generated automatically. */ identifier?: string | undefined; /** * The subscriber ID to link the channel connection to */ subscriberId?: string | undefined; context?: | { [k: string]: CreateChannelConnectionRequestDtoContext2 | string } | undefined; /** * Connection mode that determines how the channel connection is scoped. Use "subscriber" (default) to associate the connection with a specific subscriber. Use "shared" to associate the connection with a context instead of a subscriber — subscriberId will not be stored on the connection. */ connectionMode?: ConnectionMode | undefined; /** * The identifier of the integration to use for this channel connection. */ integrationIdentifier: string; workspace: WorkspaceDto; auth: AuthDto; }; /** @internal */ export type CreateChannelConnectionRequestDtoContext2$Outbound = { id: string; data?: { [k: string]: any } | undefined; }; /** @internal */ export const CreateChannelConnectionRequestDtoContext2$outboundSchema: z.ZodType< CreateChannelConnectionRequestDtoContext2$Outbound, z.ZodTypeDef, CreateChannelConnectionRequestDtoContext2 > = z.object({ id: z.string(), data: z.record(z.any()).optional(), }); export function createChannelConnectionRequestDtoContext2ToJSON( createChannelConnectionRequestDtoContext2: CreateChannelConnectionRequestDtoContext2, ): string { return JSON.stringify( CreateChannelConnectionRequestDtoContext2$outboundSchema.parse( createChannelConnectionRequestDtoContext2, ), ); } /** @internal */ export type CreateChannelConnectionRequestDtoContext$Outbound = | CreateChannelConnectionRequestDtoContext2$Outbound | string; /** @internal */ export const CreateChannelConnectionRequestDtoContext$outboundSchema: z.ZodType< CreateChannelConnectionRequestDtoContext$Outbound, z.ZodTypeDef, CreateChannelConnectionRequestDtoContext > = z.union([ z.lazy(() => CreateChannelConnectionRequestDtoContext2$outboundSchema), z.string(), ]); export function createChannelConnectionRequestDtoContextToJSON( createChannelConnectionRequestDtoContext: CreateChannelConnectionRequestDtoContext, ): string { return JSON.stringify( CreateChannelConnectionRequestDtoContext$outboundSchema.parse( createChannelConnectionRequestDtoContext, ), ); } /** @internal */ export const ConnectionMode$outboundSchema: z.ZodNativeEnum< typeof ConnectionMode > = z.nativeEnum(ConnectionMode); /** @internal */ export type CreateChannelConnectionRequestDto$Outbound = { identifier?: string | undefined; subscriberId?: string | undefined; context?: { [k: string]: CreateChannelConnectionRequestDtoContext2$Outbound | string; } | undefined; connectionMode?: string | undefined; integrationIdentifier: string; workspace: WorkspaceDto$Outbound; auth: AuthDto$Outbound; }; /** @internal */ export const CreateChannelConnectionRequestDto$outboundSchema: z.ZodType< CreateChannelConnectionRequestDto$Outbound, z.ZodTypeDef, CreateChannelConnectionRequestDto > = z.object({ identifier: z.string().optional(), subscriberId: z.string().optional(), context: z.record( z.union([ z.lazy(() => CreateChannelConnectionRequestDtoContext2$outboundSchema), z.string(), ]), ).optional(), connectionMode: ConnectionMode$outboundSchema.optional(), integrationIdentifier: z.string(), workspace: WorkspaceDto$outboundSchema, auth: AuthDto$outboundSchema, }); export function createChannelConnectionRequestDtoToJSON( createChannelConnectionRequestDto: CreateChannelConnectionRequestDto, ): string { return JSON.stringify( CreateChannelConnectionRequestDto$outboundSchema.parse( createChannelConnectionRequestDto, ), ); }