/* * 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"; /** * The view to return. Defaults to `BASIC`. */ export enum View { AccountViewUnspecified = "ACCOUNT_VIEW_UNSPECIFIED", Basic = "BASIC", Full = "FULL", } export type AccountsListAccountsRequest = { /** * The maximum number of accounts to return. The service may return fewer than this value. If unspecified, at most 25 accounts will be returned. The maximum value is 100; values above 100 will be coerced to 100. */ pageSize?: number | undefined; /** * A page token, received from a previous `ListAccounts` call. Provide this to retrieve the subsequent page. * * @remarks * * When paginating, all other parameters provided to `ListAccounts` must match the call that provided the page token. */ pageToken?: string | undefined; /** * The order in which accounts are listed. Can order by: * * @remarks * `account_id` * `account_number` * `title` * `state` * `account_group_id` * `create_time` */ orderBy?: string | undefined; /** * A CEL string to filter results; Use `upperAscii()` for case-insensitive searches; E.g. `parties.exists(parties,parties.legal_natural_person.family_name.upperAscii()=="dOuGh".upperAscii())`; See the [CEL Search](https://developer.apexclearing.com/apex-fintech-solutions/docs/cel-search) page in Guides for more information; Filter options include: * * @remarks * `account_id` * `account_number` * `correspondent_id` * `title` * `state` * `margin_group_id` * `account_group_id` * `registration_type` * `reserve_class` * `parties.legal_natural_person.legal_natural_person_id` * `parties.legal_natural_person.given_name` * `parties.legal_natural_person.family_name` * `parties.legal_natural_person.tax_id_type` * `parties.legal_natural_person.tax_id` * `parties.legal_entity.legal_entity_id` * `parties.legal_entity.entity_name` * `parties.legal_entity.tax_id_type` * `parties.legal_entity.tax_id` * `parties.legal_natural_person.foreign_identification.identification_number` * `parties.legal_natural_person.foreign_identification.type` * `enrollments.enrollment_id` * `enrollments.type` * `enrollments.state` * `identifiers.type` * `identifiers.value` * `create_time` with format of timestamp("2025-08-13T18:31:40Z") */ filter?: string | undefined; /** * The view to return. Defaults to `BASIC`. */ view?: View | undefined; }; export type AccountsListAccountsResponse = { httpMeta: components.HTTPMetadata; /** * OK */ listAccountsResponse?: components.ListAccountsResponse | undefined; /** * INVALID_ARGUMENT: The request is not valid, additional information may be present in the BadRequest details. */ status?: components.Status | undefined; }; /** @internal */ export const View$inboundSchema: z.ZodNativeEnum = z.nativeEnum( View, ); /** @internal */ export const View$outboundSchema: z.ZodNativeEnum = View$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace View$ { /** @deprecated use `View$inboundSchema` instead. */ export const inboundSchema = View$inboundSchema; /** @deprecated use `View$outboundSchema` instead. */ export const outboundSchema = View$outboundSchema; } /** @internal */ export const AccountsListAccountsRequest$inboundSchema: z.ZodType< AccountsListAccountsRequest, z.ZodTypeDef, unknown > = z.object({ page_size: z.number().int().optional(), page_token: z.string().optional(), order_by: z.string().optional(), filter: z.string().optional(), view: View$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "page_size": "pageSize", "page_token": "pageToken", "order_by": "orderBy", }); }); /** @internal */ export type AccountsListAccountsRequest$Outbound = { page_size?: number | undefined; page_token?: string | undefined; order_by?: string | undefined; filter?: string | undefined; view?: string | undefined; }; /** @internal */ export const AccountsListAccountsRequest$outboundSchema: z.ZodType< AccountsListAccountsRequest$Outbound, z.ZodTypeDef, AccountsListAccountsRequest > = z.object({ pageSize: z.number().int().optional(), pageToken: z.string().optional(), orderBy: z.string().optional(), filter: z.string().optional(), view: View$outboundSchema.optional(), }).transform((v) => { return remap$(v, { pageSize: "page_size", pageToken: "page_token", orderBy: "order_by", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountsListAccountsRequest$ { /** @deprecated use `AccountsListAccountsRequest$inboundSchema` instead. */ export const inboundSchema = AccountsListAccountsRequest$inboundSchema; /** @deprecated use `AccountsListAccountsRequest$outboundSchema` instead. */ export const outboundSchema = AccountsListAccountsRequest$outboundSchema; /** @deprecated use `AccountsListAccountsRequest$Outbound` instead. */ export type Outbound = AccountsListAccountsRequest$Outbound; } export function accountsListAccountsRequestToJSON( accountsListAccountsRequest: AccountsListAccountsRequest, ): string { return JSON.stringify( AccountsListAccountsRequest$outboundSchema.parse( accountsListAccountsRequest, ), ); } export function accountsListAccountsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountsListAccountsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountsListAccountsRequest' from JSON`, ); } /** @internal */ export const AccountsListAccountsResponse$inboundSchema: z.ZodType< AccountsListAccountsResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, ListAccountsResponse: components.ListAccountsResponse$inboundSchema .optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "ListAccountsResponse": "listAccountsResponse", "Status": "status", }); }); /** @internal */ export type AccountsListAccountsResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; ListAccountsResponse?: components.ListAccountsResponse$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const AccountsListAccountsResponse$outboundSchema: z.ZodType< AccountsListAccountsResponse$Outbound, z.ZodTypeDef, AccountsListAccountsResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, listAccountsResponse: components.ListAccountsResponse$outboundSchema .optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", listAccountsResponse: "ListAccountsResponse", 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 AccountsListAccountsResponse$ { /** @deprecated use `AccountsListAccountsResponse$inboundSchema` instead. */ export const inboundSchema = AccountsListAccountsResponse$inboundSchema; /** @deprecated use `AccountsListAccountsResponse$outboundSchema` instead. */ export const outboundSchema = AccountsListAccountsResponse$outboundSchema; /** @deprecated use `AccountsListAccountsResponse$Outbound` instead. */ export type Outbound = AccountsListAccountsResponse$Outbound; } export function accountsListAccountsResponseToJSON( accountsListAccountsResponse: AccountsListAccountsResponse, ): string { return JSON.stringify( AccountsListAccountsResponse$outboundSchema.parse( accountsListAccountsResponse, ), ); } export function accountsListAccountsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountsListAccountsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountsListAccountsResponse' from JSON`, ); }