/* * 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"; /** * Direction of sorting */ export const ChannelConnectionsControllerListChannelConnectionsQueryParamOrderDirection = { Asc: "ASC", Desc: "DESC", } as const; /** * Direction of sorting */ export type ChannelConnectionsControllerListChannelConnectionsQueryParamOrderDirection = ClosedEnum< typeof ChannelConnectionsControllerListChannelConnectionsQueryParamOrderDirection >; /** * Filter by channel type (email, sms, push, chat, etc.). */ export const Channel = { InApp: "in_app", Email: "email", Sms: "sms", Chat: "chat", Push: "push", } as const; /** * Filter by channel type (email, sms, push, chat, etc.). */ export type Channel = ClosedEnum; export type ChannelConnectionsControllerListChannelConnectionsRequest = { /** * Cursor for pagination indicating the starting point after which to fetch results. */ after?: string | undefined; /** * Cursor for pagination indicating the ending point before which to fetch results. */ before?: string | undefined; /** * Limit the number of items to return (max 100) */ limit?: number | undefined; /** * Direction of sorting */ orderDirection?: | ChannelConnectionsControllerListChannelConnectionsQueryParamOrderDirection | undefined; /** * Field to order by */ orderBy?: string | undefined; /** * Include cursor item in response */ includeCursor?: boolean | undefined; /** * The subscriber ID to filter results by */ subscriberId?: string | undefined; /** * Filter by channel type (email, sms, push, chat, etc.). */ channel?: Channel | undefined; /** * Filter by provider identifier (e.g., sendgrid, twilio, slack, etc.). */ providerId?: components.ProvidersIdEnum | undefined; /** * Filter by integration identifier. */ integrationIdentifier?: string | undefined; /** * Filter by exact context keys, order insensitive (format: "type:id") */ contextKeys?: Array | undefined; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type ChannelConnectionsControllerListChannelConnectionsResponse = { headers: { [k: string]: Array }; result: components.ListChannelConnectionsResponseDto; }; /** @internal */ export const ChannelConnectionsControllerListChannelConnectionsQueryParamOrderDirection$outboundSchema: z.ZodNativeEnum< typeof ChannelConnectionsControllerListChannelConnectionsQueryParamOrderDirection > = z.nativeEnum( ChannelConnectionsControllerListChannelConnectionsQueryParamOrderDirection, ); /** @internal */ export const Channel$outboundSchema: z.ZodNativeEnum = z .nativeEnum(Channel); /** @internal */ export type ChannelConnectionsControllerListChannelConnectionsRequest$Outbound = { after?: string | undefined; before?: string | undefined; limit?: number | undefined; orderDirection?: string | undefined; orderBy?: string | undefined; includeCursor?: boolean | undefined; subscriberId?: string | undefined; channel?: string | undefined; providerId?: string | undefined; integrationIdentifier?: string | undefined; contextKeys?: Array | undefined; "idempotency-key"?: string | undefined; }; /** @internal */ export const ChannelConnectionsControllerListChannelConnectionsRequest$outboundSchema: z.ZodType< ChannelConnectionsControllerListChannelConnectionsRequest$Outbound, z.ZodTypeDef, ChannelConnectionsControllerListChannelConnectionsRequest > = z.object({ after: z.string().optional(), before: z.string().optional(), limit: z.number().optional(), orderDirection: ChannelConnectionsControllerListChannelConnectionsQueryParamOrderDirection$outboundSchema .optional(), orderBy: z.string().optional(), includeCursor: z.boolean().optional(), subscriberId: z.string().optional(), channel: Channel$outboundSchema.optional(), providerId: components.ProvidersIdEnum$outboundSchema.optional(), integrationIdentifier: z.string().optional(), contextKeys: z.array(z.string()).optional(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function channelConnectionsControllerListChannelConnectionsRequestToJSON( channelConnectionsControllerListChannelConnectionsRequest: ChannelConnectionsControllerListChannelConnectionsRequest, ): string { return JSON.stringify( ChannelConnectionsControllerListChannelConnectionsRequest$outboundSchema .parse(channelConnectionsControllerListChannelConnectionsRequest), ); } /** @internal */ export const ChannelConnectionsControllerListChannelConnectionsResponse$inboundSchema: z.ZodType< ChannelConnectionsControllerListChannelConnectionsResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ListChannelConnectionsResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function channelConnectionsControllerListChannelConnectionsResponseFromJSON( jsonString: string, ): SafeParseResult< ChannelConnectionsControllerListChannelConnectionsResponse, SDKValidationError > { return safeParse( jsonString, (x) => ChannelConnectionsControllerListChannelConnectionsResponse$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'ChannelConnectionsControllerListChannelConnectionsResponse' from JSON`, ); }