/* * 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"; import { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { BankFeedAccountHolder, BankFeedAccountHolder$inboundSchema, BankFeedAccountHolder$Outbound, BankFeedAccountHolder$outboundSchema, } from "./bankfeedaccountholder.js"; import { Currency, Currency$inboundSchema, Currency$outboundSchema, } from "./currency.js"; import { CustomField, CustomField$inboundSchema, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { Email, Email$inboundSchema, Email$Outbound, Email$outboundSchema, } from "./email.js"; import { PhoneNumber, PhoneNumber$inboundSchema, PhoneNumber$Outbound, PhoneNumber$outboundSchema, } from "./phonenumber.js"; /** * Type of the bank account. */ export const BankAccountType = { Bank: "bank", CreditCard: "credit_card", } as const; /** * Type of the bank account. */ export type BankAccountType = OpenEnum; /** * Current status of the bank feed. */ export const FeedStatus = { Pending: "pending", Rejected: "rejected", } as const; /** * Current status of the bank feed. */ export type FeedStatus = OpenEnum; /** * Whether the data consumer may see this account. `revoked` hides it from the consumer without deleting it; `active` restores it. Unrelated to `feed_status`. Only connectors that list it support it; others ignore the field, so setting it there changes nothing. */ export const BankFeedAccountStatus = { Active: "active", Revoked: "revoked", } as const; /** * Whether the data consumer may see this account. `revoked` hides it from the consumer without deleting it; `active` restores it. Unrelated to `feed_status`. Only connectors that list it support it; others ignore the field, so setting it there changes nothing. */ export type BankFeedAccountStatus = OpenEnum; export type BankFeedAccount = { /** * A unique identifier for an object. */ id: string; /** * Type of the bank account. */ bankAccountType?: BankAccountType | undefined; /** * The source account's unique identifier. */ sourceAccountId?: string | undefined; /** * Bank routing number (US) */ sourceRoutingNumber?: string | null | undefined; /** * The bank account number */ sourceAccountNumber?: string | null | undefined; /** * The target account's unique identifier in the accounting connector. */ targetAccountId?: string | undefined; /** * Name associated with the target account. */ targetAccountName?: string | undefined; /** * Account number of the destination bank account. */ targetAccountNumber?: string | undefined; /** * The current balance of the source bank account. */ balance?: number | null | undefined; /** * The available balance of the source bank account (considering pending transactions and overdraft). */ availableBalance?: number | null | undefined; /** * When `balance` was true, as an ISO 8601 date-time with a UTC offset. Connectors that record it stamp the time they received the balance when it is omitted. */ balanceAsOf?: Date | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * Current status of the bank feed. */ feedStatus?: FeedStatus | undefined; /** * Whether the data consumer may see this account. `revoked` hides it from the consumer without deleting it; `active` restores it. Unrelated to `feed_status`. Only connectors that list it support it; others ignore the field, so setting it there changes nothing. */ status?: BankFeedAccountStatus | undefined; /** * Country code according to ISO 3166-1 alpha-2. */ country?: string | null | undefined; /** * The people or businesses that hold the source bank account. Optional; `intuit-bank-feeds` and `plaid-exchange` require at least one. */ accountHolders?: Array | undefined; /** * Email addresses of the account holders. Optional; `intuit-bank-feeds` and `plaid-exchange` require at least one. */ emails?: Array | undefined; /** * Addresses of the account holders. Optional; `intuit-bank-feeds` and `plaid-exchange` require at least one. */ addresses?: Array
| undefined; /** * Phone numbers of the account holders. Optional; `intuit-bank-feeds` and `plaid-exchange` require at least one. */ phoneNumbers?: Array | undefined; customFields?: Array | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The user who last updated the object. */ updatedBy?: string | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; }; export type BankFeedAccountInput = { /** * Type of the bank account. */ bankAccountType?: BankAccountType | undefined; /** * The source account's unique identifier. */ sourceAccountId?: string | undefined; /** * Bank routing number (US) */ sourceRoutingNumber?: string | null | undefined; /** * The bank account number */ sourceAccountNumber?: string | null | undefined; /** * The target account's unique identifier in the accounting connector. */ targetAccountId?: string | undefined; /** * Name associated with the target account. */ targetAccountName?: string | undefined; /** * Account number of the destination bank account. */ targetAccountNumber?: string | undefined; /** * The current balance of the source bank account. */ balance?: number | null | undefined; /** * The available balance of the source bank account (considering pending transactions and overdraft). */ availableBalance?: number | null | undefined; /** * When `balance` was true, as an ISO 8601 date-time with a UTC offset. Connectors that record it stamp the time they received the balance when it is omitted. */ balanceAsOf?: Date | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * Current status of the bank feed. */ feedStatus?: FeedStatus | undefined; /** * Whether the data consumer may see this account. `revoked` hides it from the consumer without deleting it; `active` restores it. Unrelated to `feed_status`. Only connectors that list it support it; others ignore the field, so setting it there changes nothing. */ status?: BankFeedAccountStatus | undefined; /** * Country code according to ISO 3166-1 alpha-2. */ country?: string | null | undefined; /** * The people or businesses that hold the source bank account. Optional; `intuit-bank-feeds` and `plaid-exchange` require at least one. */ accountHolders?: Array | undefined; /** * Email addresses of the account holders. Optional; `intuit-bank-feeds` and `plaid-exchange` require at least one. */ emails?: Array | undefined; /** * Addresses of the account holders. Optional; `intuit-bank-feeds` and `plaid-exchange` require at least one. */ addresses?: Array
| undefined; /** * Phone numbers of the account holders. Optional; `intuit-bank-feeds` and `plaid-exchange` require at least one. */ phoneNumbers?: Array | undefined; customFields?: Array | undefined; }; /** @internal */ export const BankAccountType$inboundSchema: z.ZodType< BankAccountType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(BankAccountType)); /** @internal */ export const BankAccountType$outboundSchema: z.ZodType< string, z.ZodTypeDef, BankAccountType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(BankAccountType) ); /** @internal */ export const FeedStatus$inboundSchema: z.ZodType< FeedStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(FeedStatus)); /** @internal */ export const FeedStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, FeedStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(FeedStatus)); /** @internal */ export const BankFeedAccountStatus$inboundSchema: z.ZodType< BankFeedAccountStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(BankFeedAccountStatus) ); /** @internal */ export const BankFeedAccountStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, BankFeedAccountStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(BankFeedAccountStatus) ); /** @internal */ export const BankFeedAccount$inboundSchema: z.ZodType< BankFeedAccount, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.string(), bank_account_type: types.optional(BankAccountType$inboundSchema), source_account_id: types.optional(types.string()), source_routing_number: z.nullable(types.string()).optional(), source_account_number: z.nullable(types.string()).optional(), target_account_id: types.optional(types.string()), target_account_name: types.optional(types.string()), target_account_number: types.optional(types.string()), balance: z.nullable(types.number()).optional(), available_balance: z.nullable(types.number()).optional(), balance_as_of: z.nullable(types.date()).optional(), currency: z.nullable(Currency$inboundSchema).optional(), feed_status: types.optional(FeedStatus$inboundSchema), status: types.optional(BankFeedAccountStatus$inboundSchema), country: z.nullable(types.string()).optional(), account_holders: types.optional( z.array(BankFeedAccountHolder$inboundSchema), ), emails: types.optional(z.array(Email$inboundSchema)), addresses: types.optional(z.array(Address$inboundSchema)), phone_numbers: types.optional(z.array(PhoneNumber$inboundSchema)), custom_fields: types.optional(z.array(CustomField$inboundSchema)), custom_mappings: z.nullable(z.record(z.any())).optional(), created_at: z.nullable(types.date()).optional(), updated_at: z.nullable(types.date()).optional(), updated_by: z.nullable(types.string()).optional(), created_by: z.nullable(types.string()).optional(), }).transform((v) => { return remap$(v, { "bank_account_type": "bankAccountType", "source_account_id": "sourceAccountId", "source_routing_number": "sourceRoutingNumber", "source_account_number": "sourceAccountNumber", "target_account_id": "targetAccountId", "target_account_name": "targetAccountName", "target_account_number": "targetAccountNumber", "available_balance": "availableBalance", "balance_as_of": "balanceAsOf", "feed_status": "feedStatus", "account_holders": "accountHolders", "phone_numbers": "phoneNumbers", "custom_fields": "customFields", "custom_mappings": "customMappings", "created_at": "createdAt", "updated_at": "updatedAt", "updated_by": "updatedBy", "created_by": "createdBy", }); }) ); export function bankFeedAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BankFeedAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BankFeedAccount' from JSON`, ); } /** @internal */ export type BankFeedAccountInput$Outbound = { bank_account_type?: string | undefined; source_account_id?: string | undefined; source_routing_number?: string | null | undefined; source_account_number?: string | null | undefined; target_account_id?: string | undefined; target_account_name?: string | undefined; target_account_number?: string | undefined; balance?: number | null | undefined; available_balance?: number | null | undefined; balance_as_of?: string | null | undefined; currency?: string | null | undefined; feed_status?: string | undefined; status?: string | undefined; country?: string | null | undefined; account_holders?: Array | undefined; emails?: Array | undefined; addresses?: Array | undefined; phone_numbers?: Array | undefined; custom_fields?: Array | undefined; }; /** @internal */ export const BankFeedAccountInput$outboundSchema: z.ZodType< BankFeedAccountInput$Outbound, z.ZodTypeDef, BankFeedAccountInput > = /* @__PURE__ */ lazySchema$(() => z.object({ bankAccountType: BankAccountType$outboundSchema.optional(), sourceAccountId: z.string().optional(), sourceRoutingNumber: z.nullable(z.string()).optional(), sourceAccountNumber: z.nullable(z.string()).optional(), targetAccountId: z.string().optional(), targetAccountName: z.string().optional(), targetAccountNumber: z.string().optional(), balance: z.nullable(z.number()).optional(), availableBalance: z.nullable(z.number()).optional(), balanceAsOf: z.nullable(z.date().transform(v => v.toISOString())) .optional(), currency: z.nullable(Currency$outboundSchema).optional(), feedStatus: FeedStatus$outboundSchema.optional(), status: BankFeedAccountStatus$outboundSchema.optional(), country: z.nullable(z.string()).optional(), accountHolders: z.array(BankFeedAccountHolder$outboundSchema).optional(), emails: z.array(Email$outboundSchema).optional(), addresses: z.array(Address$outboundSchema).optional(), phoneNumbers: z.array(PhoneNumber$outboundSchema).optional(), customFields: z.array(CustomField$outboundSchema).optional(), }).transform((v) => { return remap$(v, { bankAccountType: "bank_account_type", sourceAccountId: "source_account_id", sourceRoutingNumber: "source_routing_number", sourceAccountNumber: "source_account_number", targetAccountId: "target_account_id", targetAccountName: "target_account_name", targetAccountNumber: "target_account_number", availableBalance: "available_balance", balanceAsOf: "balance_as_of", feedStatus: "feed_status", accountHolders: "account_holders", phoneNumbers: "phone_numbers", customFields: "custom_fields", }); }) ); export function bankFeedAccountInputToJSON( bankFeedAccountInput: BankFeedAccountInput, ): string { return JSON.stringify( BankFeedAccountInput$outboundSchema.parse(bankFeedAccountInput), ); }