/* * 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 { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The bank account type. */ export enum BankAccountCreateType { TypeUnspecified = "TYPE_UNSPECIFIED", Checking = "CHECKING", Savings = "SAVINGS", } /** * The bank account type. */ export type BankAccountCreateTypeOpen = OpenEnum; /** * A representation of a bank account. */ export type BankAccountCreate = { /** * The bank account number. This value will be masked in responses. */ accountNumber: string; /** * The name of the bank account owner. */ owner: string; /** * The bank routing number (either ABA or BIC). */ routingNumber: string; /** * The bank account type. */ type: BankAccountCreateTypeOpen; }; /** @internal */ export const BankAccountCreateType$inboundSchema: z.ZodType< BankAccountCreateTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BankAccountCreateType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BankAccountCreateType$outboundSchema: z.ZodType< BankAccountCreateTypeOpen, z.ZodTypeDef, BankAccountCreateTypeOpen > = z.union([ z.nativeEnum(BankAccountCreateType), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BankAccountCreateType$ { /** @deprecated use `BankAccountCreateType$inboundSchema` instead. */ export const inboundSchema = BankAccountCreateType$inboundSchema; /** @deprecated use `BankAccountCreateType$outboundSchema` instead. */ export const outboundSchema = BankAccountCreateType$outboundSchema; } /** @internal */ export const BankAccountCreate$inboundSchema: z.ZodType< BankAccountCreate, z.ZodTypeDef, unknown > = z.object({ account_number: z.string(), owner: z.string(), routing_number: z.string(), type: BankAccountCreateType$inboundSchema, }).transform((v) => { return remap$(v, { "account_number": "accountNumber", "routing_number": "routingNumber", }); }); /** @internal */ export type BankAccountCreate$Outbound = { account_number: string; owner: string; routing_number: string; type: string; }; /** @internal */ export const BankAccountCreate$outboundSchema: z.ZodType< BankAccountCreate$Outbound, z.ZodTypeDef, BankAccountCreate > = z.object({ accountNumber: z.string(), owner: z.string(), routingNumber: z.string(), type: BankAccountCreateType$outboundSchema, }).transform((v) => { return remap$(v, { accountNumber: "account_number", routingNumber: "routing_number", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BankAccountCreate$ { /** @deprecated use `BankAccountCreate$inboundSchema` instead. */ export const inboundSchema = BankAccountCreate$inboundSchema; /** @deprecated use `BankAccountCreate$outboundSchema` instead. */ export const outboundSchema = BankAccountCreate$outboundSchema; /** @deprecated use `BankAccountCreate$Outbound` instead. */ export type Outbound = BankAccountCreate$Outbound; } export function bankAccountCreateToJSON( bankAccountCreate: BankAccountCreate, ): string { return JSON.stringify( BankAccountCreate$outboundSchema.parse(bankAccountCreate), ); } export function bankAccountCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BankAccountCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BankAccountCreate' from JSON`, ); }