/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { smartUnion } from "../../types/smartUnion.js"; import { ListResourceDownloadableRead, ListResourceDownloadableRead$inboundSchema, } from "../components/listresourcedownloadableread.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CustomerPortalDownloadablesListSecurity = { customerSession?: string | undefined; memberSession?: string | undefined; }; /** * Filter by benefit ID. */ export type CustomerPortalDownloadablesListQueryParamBenefitIDFilter = | string | Array; export type CustomerPortalDownloadablesListRequest = { /** * Filter by benefit ID. */ benefitId?: string | Array | null | undefined; /** * Page number, defaults to 1. */ page?: number | undefined; /** * Size of a page, defaults to 10. Maximum is 100. */ limit?: number | undefined; }; export type CustomerPortalDownloadablesListResponse = { result: ListResourceDownloadableRead; }; /** @internal */ export type CustomerPortalDownloadablesListSecurity$Outbound = { customer_session?: string | undefined; member_session?: string | undefined; }; /** @internal */ export const CustomerPortalDownloadablesListSecurity$outboundSchema: z.ZodMiniType< CustomerPortalDownloadablesListSecurity$Outbound, CustomerPortalDownloadablesListSecurity > = z.pipe( z.object({ customerSession: z.optional(z.string()), memberSession: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { customerSession: "customer_session", memberSession: "member_session", }); }), ); export function customerPortalDownloadablesListSecurityToJSON( customerPortalDownloadablesListSecurity: CustomerPortalDownloadablesListSecurity, ): string { return JSON.stringify( CustomerPortalDownloadablesListSecurity$outboundSchema.parse( customerPortalDownloadablesListSecurity, ), ); } /** @internal */ export type CustomerPortalDownloadablesListQueryParamBenefitIDFilter$Outbound = | string | Array; /** @internal */ export const CustomerPortalDownloadablesListQueryParamBenefitIDFilter$outboundSchema: z.ZodMiniType< CustomerPortalDownloadablesListQueryParamBenefitIDFilter$Outbound, CustomerPortalDownloadablesListQueryParamBenefitIDFilter > = smartUnion([z.string(), z.array(z.string())]); export function customerPortalDownloadablesListQueryParamBenefitIDFilterToJSON( customerPortalDownloadablesListQueryParamBenefitIDFilter: CustomerPortalDownloadablesListQueryParamBenefitIDFilter, ): string { return JSON.stringify( CustomerPortalDownloadablesListQueryParamBenefitIDFilter$outboundSchema .parse(customerPortalDownloadablesListQueryParamBenefitIDFilter), ); } /** @internal */ export type CustomerPortalDownloadablesListRequest$Outbound = { benefit_id?: string | Array | null | undefined; page: number; limit: number; }; /** @internal */ export const CustomerPortalDownloadablesListRequest$outboundSchema: z.ZodMiniType< CustomerPortalDownloadablesListRequest$Outbound, CustomerPortalDownloadablesListRequest > = z.pipe( z.object({ benefitId: z.optional( z.nullable(smartUnion([z.string(), z.array(z.string())])), ), page: z._default(z.int(), 1), limit: z._default(z.int(), 10), }), z.transform((v) => { return remap$(v, { benefitId: "benefit_id", }); }), ); export function customerPortalDownloadablesListRequestToJSON( customerPortalDownloadablesListRequest: CustomerPortalDownloadablesListRequest, ): string { return JSON.stringify( CustomerPortalDownloadablesListRequest$outboundSchema.parse( customerPortalDownloadablesListRequest, ), ); } /** @internal */ export const CustomerPortalDownloadablesListResponse$inboundSchema: z.ZodMiniType = z.pipe( z.object({ Result: ListResourceDownloadableRead$inboundSchema, }), z.transform((v) => { return remap$(v, { "Result": "result", }); }), ); export function customerPortalDownloadablesListResponseFromJSON( jsonString: string, ): SafeParseResult< CustomerPortalDownloadablesListResponse, SDKValidationError > { return safeParse( jsonString, (x) => CustomerPortalDownloadablesListResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'CustomerPortalDownloadablesListResponse' from JSON`, ); }