/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type LedgerListPositionsRequest = { /** * The account id. */ accountId: string; /** * The maximum number of positions to return. The service may return fewer than this value Default is 100 (subject to change) The maximum is 1000, values exceeding this will be set to 1000 (subject to change) */ pageSize?: number | undefined; /** * This page token comes from a previous `ListPositions` call; provide this token to retrieve the subsequent page When paginating, all other parameters you include in `ListPositions` must match the call that includes the page token to maintain a stable result set */ pageToken?: string | undefined; /** * A CEL string to filter results; See the [CEL Search](https://developer.apexclearing.com/apex-fintech-solutions/docs/cel-search) page in Guides for more information; */ filter?: string | undefined; }; export type LedgerListPositionsResponse = { httpMeta: components.HTTPMetadata; /** * OK */ listPositionsResponse?: components.ListPositionsResponse | undefined; /** * INVALID_ARGUMENT: The request is not valid, additional information may be present in the BadRequest details. */ status?: components.Status | undefined; }; /** @internal */ export const LedgerListPositionsRequest$inboundSchema: z.ZodType< LedgerListPositionsRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), page_size: z.number().int().optional(), page_token: z.string().optional(), filter: z.string().optional(), }).transform((v) => { return remap$(v, { "account_id": "accountId", "page_size": "pageSize", "page_token": "pageToken", }); }); /** @internal */ export type LedgerListPositionsRequest$Outbound = { account_id: string; page_size?: number | undefined; page_token?: string | undefined; filter?: string | undefined; }; /** @internal */ export const LedgerListPositionsRequest$outboundSchema: z.ZodType< LedgerListPositionsRequest$Outbound, z.ZodTypeDef, LedgerListPositionsRequest > = z.object({ accountId: z.string(), pageSize: z.number().int().optional(), pageToken: z.string().optional(), filter: z.string().optional(), }).transform((v) => { return remap$(v, { accountId: "account_id", pageSize: "page_size", pageToken: "page_token", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LedgerListPositionsRequest$ { /** @deprecated use `LedgerListPositionsRequest$inboundSchema` instead. */ export const inboundSchema = LedgerListPositionsRequest$inboundSchema; /** @deprecated use `LedgerListPositionsRequest$outboundSchema` instead. */ export const outboundSchema = LedgerListPositionsRequest$outboundSchema; /** @deprecated use `LedgerListPositionsRequest$Outbound` instead. */ export type Outbound = LedgerListPositionsRequest$Outbound; } export function ledgerListPositionsRequestToJSON( ledgerListPositionsRequest: LedgerListPositionsRequest, ): string { return JSON.stringify( LedgerListPositionsRequest$outboundSchema.parse(ledgerListPositionsRequest), ); } export function ledgerListPositionsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LedgerListPositionsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LedgerListPositionsRequest' from JSON`, ); } /** @internal */ export const LedgerListPositionsResponse$inboundSchema: z.ZodType< LedgerListPositionsResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, ListPositionsResponse: components.ListPositionsResponse$inboundSchema .optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "ListPositionsResponse": "listPositionsResponse", "Status": "status", }); }); /** @internal */ export type LedgerListPositionsResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; ListPositionsResponse?: components.ListPositionsResponse$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const LedgerListPositionsResponse$outboundSchema: z.ZodType< LedgerListPositionsResponse$Outbound, z.ZodTypeDef, LedgerListPositionsResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, listPositionsResponse: components.ListPositionsResponse$outboundSchema .optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", listPositionsResponse: "ListPositionsResponse", status: "Status", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LedgerListPositionsResponse$ { /** @deprecated use `LedgerListPositionsResponse$inboundSchema` instead. */ export const inboundSchema = LedgerListPositionsResponse$inboundSchema; /** @deprecated use `LedgerListPositionsResponse$outboundSchema` instead. */ export const outboundSchema = LedgerListPositionsResponse$outboundSchema; /** @deprecated use `LedgerListPositionsResponse$Outbound` instead. */ export type Outbound = LedgerListPositionsResponse$Outbound; } export function ledgerListPositionsResponseToJSON( ledgerListPositionsResponse: LedgerListPositionsResponse, ): string { return JSON.stringify( LedgerListPositionsResponse$outboundSchema.parse( ledgerListPositionsResponse, ), ); } export function ledgerListPositionsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LedgerListPositionsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LedgerListPositionsResponse' from JSON`, ); }