/* * 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 ChannelEndpointsControllerListChannelEndpointsQueryParamOrderDirection = { Asc: "ASC", Desc: "DESC", } as const; /** * Direction of sorting */ export type ChannelEndpointsControllerListChannelEndpointsQueryParamOrderDirection = ClosedEnum< typeof ChannelEndpointsControllerListChannelEndpointsQueryParamOrderDirection >; /** * Channel type to filter results. */ export const QueryParamChannel = { InApp: "in_app", Email: "email", Sms: "sms", Chat: "chat", Push: "push", } as const; /** * Channel type to filter results. */ export type QueryParamChannel = ClosedEnum; export type ChannelEndpointsControllerListChannelEndpointsRequest = { /** * 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?: | ChannelEndpointsControllerListChannelEndpointsQueryParamOrderDirection | 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 exact context keys, order insensitive (format: "type:id") */ contextKeys?: Array | undefined; /** * Channel type to filter results. */ channel?: QueryParamChannel | undefined; /** * Filter by provider identifier (e.g., sendgrid, twilio, slack, etc.). */ providerId?: components.ProvidersIdEnum | undefined; /** * Integration identifier to filter results. */ integrationIdentifier?: string | undefined; /** * Connection identifier to filter results. */ connectionIdentifier?: string | undefined; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type ChannelEndpointsControllerListChannelEndpointsResponse = { headers: { [k: string]: Array }; result: components.ListChannelEndpointsResponseDto; }; /** @internal */ export const ChannelEndpointsControllerListChannelEndpointsQueryParamOrderDirection$outboundSchema: z.ZodNativeEnum< typeof ChannelEndpointsControllerListChannelEndpointsQueryParamOrderDirection > = z.nativeEnum( ChannelEndpointsControllerListChannelEndpointsQueryParamOrderDirection, ); /** @internal */ export const QueryParamChannel$outboundSchema: z.ZodNativeEnum< typeof QueryParamChannel > = z.nativeEnum(QueryParamChannel); /** @internal */ export type ChannelEndpointsControllerListChannelEndpointsRequest$Outbound = { after?: string | undefined; before?: string | undefined; limit?: number | undefined; orderDirection?: string | undefined; orderBy?: string | undefined; includeCursor?: boolean | undefined; subscriberId?: string | undefined; contextKeys?: Array | undefined; channel?: string | undefined; providerId?: string | undefined; integrationIdentifier?: string | undefined; connectionIdentifier?: string | undefined; "idempotency-key"?: string | undefined; }; /** @internal */ export const ChannelEndpointsControllerListChannelEndpointsRequest$outboundSchema: z.ZodType< ChannelEndpointsControllerListChannelEndpointsRequest$Outbound, z.ZodTypeDef, ChannelEndpointsControllerListChannelEndpointsRequest > = z.object({ after: z.string().optional(), before: z.string().optional(), limit: z.number().optional(), orderDirection: ChannelEndpointsControllerListChannelEndpointsQueryParamOrderDirection$outboundSchema .optional(), orderBy: z.string().optional(), includeCursor: z.boolean().optional(), subscriberId: z.string().optional(), contextKeys: z.array(z.string()).optional(), channel: QueryParamChannel$outboundSchema.optional(), providerId: components.ProvidersIdEnum$outboundSchema.optional(), integrationIdentifier: z.string().optional(), connectionIdentifier: z.string().optional(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function channelEndpointsControllerListChannelEndpointsRequestToJSON( channelEndpointsControllerListChannelEndpointsRequest: ChannelEndpointsControllerListChannelEndpointsRequest, ): string { return JSON.stringify( ChannelEndpointsControllerListChannelEndpointsRequest$outboundSchema.parse( channelEndpointsControllerListChannelEndpointsRequest, ), ); } /** @internal */ export const ChannelEndpointsControllerListChannelEndpointsResponse$inboundSchema: z.ZodType< ChannelEndpointsControllerListChannelEndpointsResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ListChannelEndpointsResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function channelEndpointsControllerListChannelEndpointsResponseFromJSON( jsonString: string, ): SafeParseResult< ChannelEndpointsControllerListChannelEndpointsResponse, SDKValidationError > { return safeParse( jsonString, (x) => ChannelEndpointsControllerListChannelEndpointsResponse$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'ChannelEndpointsControllerListChannelEndpointsResponse' from JSON`, ); }