/* * 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 QueryParamOrderDirection = { Asc: "ASC", Desc: "DESC", } as const; /** * Direction of sorting */ export type QueryParamOrderDirection = ClosedEnum< typeof QueryParamOrderDirection >; export type SubscribersControllerSearchSubscribersRequest = { /** * 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 */ limit?: number | undefined; /** * Direction of sorting */ orderDirection?: QueryParamOrderDirection | undefined; /** * Field to order by */ orderBy?: string | undefined; /** * Include cursor item in response */ includeCursor?: boolean | undefined; /** * Email address of the subscriber to filter results. */ email?: string | undefined; /** * Name of the subscriber to filter results. */ name?: string | undefined; /** * Phone number of the subscriber to filter results. */ phone?: string | undefined; /** * Unique identifier of the subscriber to filter results. */ subscriberId?: string | undefined; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type SubscribersControllerSearchSubscribersResponse = { headers: { [k: string]: Array }; result: components.ListSubscribersResponseDto; }; /** @internal */ export const QueryParamOrderDirection$outboundSchema: z.ZodNativeEnum< typeof QueryParamOrderDirection > = z.nativeEnum(QueryParamOrderDirection); /** @internal */ export type SubscribersControllerSearchSubscribersRequest$Outbound = { after?: string | undefined; before?: string | undefined; limit?: number | undefined; orderDirection?: string | undefined; orderBy?: string | undefined; includeCursor?: boolean | undefined; email?: string | undefined; name?: string | undefined; phone?: string | undefined; subscriberId?: string | undefined; "idempotency-key"?: string | undefined; }; /** @internal */ export const SubscribersControllerSearchSubscribersRequest$outboundSchema: z.ZodType< SubscribersControllerSearchSubscribersRequest$Outbound, z.ZodTypeDef, SubscribersControllerSearchSubscribersRequest > = z.object({ after: z.string().optional(), before: z.string().optional(), limit: z.number().optional(), orderDirection: QueryParamOrderDirection$outboundSchema.optional(), orderBy: z.string().optional(), includeCursor: z.boolean().optional(), email: z.string().optional(), name: z.string().optional(), phone: z.string().optional(), subscriberId: z.string().optional(), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function subscribersControllerSearchSubscribersRequestToJSON( subscribersControllerSearchSubscribersRequest: SubscribersControllerSearchSubscribersRequest, ): string { return JSON.stringify( SubscribersControllerSearchSubscribersRequest$outboundSchema.parse( subscribersControllerSearchSubscribersRequest, ), ); } /** @internal */ export const SubscribersControllerSearchSubscribersResponse$inboundSchema: z.ZodType< SubscribersControllerSearchSubscribersResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.ListSubscribersResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function subscribersControllerSearchSubscribersResponseFromJSON( jsonString: string, ): SafeParseResult< SubscribersControllerSearchSubscribersResponse, SDKValidationError > { return safeParse( jsonString, (x) => SubscribersControllerSearchSubscribersResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'SubscribersControllerSearchSubscribersResponse' from JSON`, ); }