/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The type of account being referenced. Use `ledger_account` for GL accounts from the chart of accounts, or `bank_account` for bank account entities. When not specified, the connector will use its default behavior. */ export const LinkedFinancialAccountAccountType = { LedgerAccount: "ledger_account", BankAccount: "bank_account", Employee: "employee", } as const; /** * The type of account being referenced. Use `ledger_account` for GL accounts from the chart of accounts, or `bank_account` for bank account entities. When not specified, the connector will use its default behavior. */ export type LinkedFinancialAccountAccountType = OpenEnum< typeof LinkedFinancialAccountAccountType >; /** * A flexible account reference that can represent a ledger account (GL account), a bank account, or an employee payable account, depending on the connector's requirements. */ export type LinkedFinancialAccount = { /** * The unique identifier for the account. This can be a ledger account ID or bank account ID depending on the `type` field. */ id?: string | undefined; /** * The type of account being referenced. Use `ledger_account` for GL accounts from the chart of accounts, or `bank_account` for bank account entities. When not specified, the connector will use its default behavior. */ type?: LinkedFinancialAccountAccountType | null | undefined; /** * The account code of the account */ code?: string | undefined; /** * Id to be displayed. */ displayId?: string | null | undefined; /** * The bank account number */ accountNumber?: string | null | undefined; /** * The name of the account. */ name?: string | undefined; /** * The third-party API ID of original entity */ downstreamId?: string | null | undefined; }; /** * A flexible account reference that can represent a ledger account (GL account), a bank account, or an employee payable account, depending on the connector's requirements. */ export type LinkedFinancialAccountInput = { /** * The unique identifier for the account. This can be a ledger account ID or bank account ID depending on the `type` field. */ id?: string | undefined; /** * The type of account being referenced. Use `ledger_account` for GL accounts from the chart of accounts, or `bank_account` for bank account entities. When not specified, the connector will use its default behavior. */ type?: LinkedFinancialAccountAccountType | null | undefined; /** * The account code of the account */ code?: string | undefined; /** * Id to be displayed. */ displayId?: string | null | undefined; /** * The bank account number */ accountNumber?: string | null | undefined; }; /** @internal */ export const LinkedFinancialAccountAccountType$inboundSchema: z.ZodType< LinkedFinancialAccountAccountType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(LinkedFinancialAccountAccountType) ); /** @internal */ export const LinkedFinancialAccountAccountType$outboundSchema: z.ZodType< string, z.ZodTypeDef, LinkedFinancialAccountAccountType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(LinkedFinancialAccountAccountType) ); /** @internal */ export const LinkedFinancialAccount$inboundSchema: z.ZodType< LinkedFinancialAccount, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), type: z.nullable(LinkedFinancialAccountAccountType$inboundSchema) .optional(), code: types.optional(types.string()), display_id: z.nullable(types.string()).optional(), account_number: z.nullable(types.string()).optional(), name: types.optional(types.string()), downstream_id: z.nullable(types.string()).optional(), }).transform((v) => { return remap$(v, { "display_id": "displayId", "account_number": "accountNumber", "downstream_id": "downstreamId", }); }) ); export function linkedFinancialAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LinkedFinancialAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkedFinancialAccount' from JSON`, ); } /** @internal */ export type LinkedFinancialAccountInput$Outbound = { id?: string | undefined; type?: string | null | undefined; code?: string | undefined; display_id?: string | null | undefined; account_number?: string | null | undefined; }; /** @internal */ export const LinkedFinancialAccountInput$outboundSchema: z.ZodType< LinkedFinancialAccountInput$Outbound, z.ZodTypeDef, LinkedFinancialAccountInput > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), type: z.nullable(LinkedFinancialAccountAccountType$outboundSchema) .optional(), code: z.string().optional(), displayId: z.nullable(z.string()).optional(), accountNumber: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { displayId: "display_id", accountNumber: "account_number", }); }) ); export function linkedFinancialAccountInputToJSON( linkedFinancialAccountInput: LinkedFinancialAccountInput, ): string { return JSON.stringify( LinkedFinancialAccountInput$outboundSchema.parse( linkedFinancialAccountInput, ), ); }