/* * 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 SubscribersControllerListSubscriberTopicsQueryParamOrderDirection = { Asc: "ASC", Desc: "DESC", } as const; /** * Direction of sorting */ export type SubscribersControllerListSubscriberTopicsQueryParamOrderDirection = ClosedEnum< typeof SubscribersControllerListSubscriberTopicsQueryParamOrderDirection >; export type SubscribersControllerListSubscriberTopicsRequest = { /** * The identifier of the subscriber */ subscriberId: string; /** * 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?: | SubscribersControllerListSubscriberTopicsQueryParamOrderDirection | undefined; /** * Field to order by */ orderBy?: string | undefined; /** * Include cursor item in response */ includeCursor?: boolean | undefined; /** * Filter by topic key */ key?: 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 SubscribersControllerListSubscriberTopicsResponse = { headers: { [k: string]: Array }; result: components.ListTopicSubscriptionsResponseDto; }; /** @internal */ export const SubscribersControllerListSubscriberTopicsQueryParamOrderDirection$outboundSchema: z.ZodNativeEnum< typeof SubscribersControllerListSubscriberTopicsQueryParamOrderDirection > = z.nativeEnum( SubscribersControllerListSubscriberTopicsQueryParamOrderDirection, ); /** @internal */ export type SubscribersControllerListSubscriberTopicsRequest$Outbound = { subscriberId: string; after?: string | undefined; before?: string | undefined; limit?: number | undefined; orderDirection?: string | undefined; orderBy?: string | undefined; includeCursor?: boolean | undefined; key?: string | undefined; contextKeys?: Array | undefined; "idempotency-key"?: string | undefined; }; /** @internal */ export const SubscribersControllerListSubscriberTopicsRequest$outboundSchema: z.ZodType< SubscribersControllerListSubscriberTopicsRequest$Outbound, z.ZodTypeDef, SubscribersControllerListSubscriberTopicsRequest > = z.object({ subscriberId: z.string(), after: z.string().optional(), before: z.string().optional(), limit: z.number().optional(), orderDirection: SubscribersControllerListSubscriberTopicsQueryParamOrderDirection$outboundSchema .optional(), orderBy: z.string().optional(), includeCursor: z.boolean().optional(), key: z.string().optional(), contextKeys: z.array(z.string()).optional(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function subscribersControllerListSubscriberTopicsRequestToJSON( subscribersControllerListSubscriberTopicsRequest: SubscribersControllerListSubscriberTopicsRequest, ): string { return JSON.stringify( SubscribersControllerListSubscriberTopicsRequest$outboundSchema.parse( subscribersControllerListSubscriberTopicsRequest, ), ); } /** @internal */ export const SubscribersControllerListSubscriberTopicsResponse$inboundSchema: z.ZodType< SubscribersControllerListSubscriberTopicsResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ListTopicSubscriptionsResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function subscribersControllerListSubscriberTopicsResponseFromJSON( jsonString: string, ): SafeParseResult< SubscribersControllerListSubscriberTopicsResponse, SDKValidationError > { return safeParse( jsonString, (x) => SubscribersControllerListSubscriberTopicsResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'SubscribersControllerListSubscriberTopicsResponse' from JSON`, ); }