/* * 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 withdraw mechanism to calculate the balance for. The mechanism determines what account activity will affect the balance. */ export enum Mechanism { MechanismUnspecified = "MECHANISM_UNSPECIFIED", Acat = "ACAT", Ach = "ACH", CashJournal = "CASH_JOURNAL", Check = "CHECK", Credit = "CREDIT", Fee = "FEE", Ict = "ICT", Paypal = "PAYPAL", Rtp = "RTP", Tpj = "TPJ", Wire = "WIRE", ExternalAch = "EXTERNAL_ACH", } export type CashBalancesCalculateCashBalanceRequest = { /** * The account id. */ accountId: string; /** * The withdraw mechanism to calculate the balance for. The mechanism determines what account activity will affect the balance. */ mechanism?: Mechanism | undefined; }; export type CashBalancesCalculateCashBalanceResponse = { httpMeta: components.HTTPMetadata; /** * OK */ calculateCashBalanceResponse?: | components.CalculateCashBalanceResponse | undefined; /** * INVALID_ARGUMENT: The request has an invalid argument. */ status?: components.Status | undefined; }; /** @internal */ export const Mechanism$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Mechanism); /** @internal */ export const Mechanism$outboundSchema: z.ZodNativeEnum = Mechanism$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Mechanism$ { /** @deprecated use `Mechanism$inboundSchema` instead. */ export const inboundSchema = Mechanism$inboundSchema; /** @deprecated use `Mechanism$outboundSchema` instead. */ export const outboundSchema = Mechanism$outboundSchema; } /** @internal */ export const CashBalancesCalculateCashBalanceRequest$inboundSchema: z.ZodType< CashBalancesCalculateCashBalanceRequest, z.ZodTypeDef, unknown > = z.object({ account_id: z.string(), mechanism: Mechanism$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "account_id": "accountId", }); }); /** @internal */ export type CashBalancesCalculateCashBalanceRequest$Outbound = { account_id: string; mechanism?: string | undefined; }; /** @internal */ export const CashBalancesCalculateCashBalanceRequest$outboundSchema: z.ZodType< CashBalancesCalculateCashBalanceRequest$Outbound, z.ZodTypeDef, CashBalancesCalculateCashBalanceRequest > = z.object({ accountId: z.string(), mechanism: Mechanism$outboundSchema.optional(), }).transform((v) => { return remap$(v, { accountId: "account_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CashBalancesCalculateCashBalanceRequest$ { /** @deprecated use `CashBalancesCalculateCashBalanceRequest$inboundSchema` instead. */ export const inboundSchema = CashBalancesCalculateCashBalanceRequest$inboundSchema; /** @deprecated use `CashBalancesCalculateCashBalanceRequest$outboundSchema` instead. */ export const outboundSchema = CashBalancesCalculateCashBalanceRequest$outboundSchema; /** @deprecated use `CashBalancesCalculateCashBalanceRequest$Outbound` instead. */ export type Outbound = CashBalancesCalculateCashBalanceRequest$Outbound; } export function cashBalancesCalculateCashBalanceRequestToJSON( cashBalancesCalculateCashBalanceRequest: CashBalancesCalculateCashBalanceRequest, ): string { return JSON.stringify( CashBalancesCalculateCashBalanceRequest$outboundSchema.parse( cashBalancesCalculateCashBalanceRequest, ), ); } export function cashBalancesCalculateCashBalanceRequestFromJSON( jsonString: string, ): SafeParseResult< CashBalancesCalculateCashBalanceRequest, SDKValidationError > { return safeParse( jsonString, (x) => CashBalancesCalculateCashBalanceRequest$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'CashBalancesCalculateCashBalanceRequest' from JSON`, ); } /** @internal */ export const CashBalancesCalculateCashBalanceResponse$inboundSchema: z.ZodType< CashBalancesCalculateCashBalanceResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, CalculateCashBalanceResponse: components .CalculateCashBalanceResponse$inboundSchema.optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "CalculateCashBalanceResponse": "calculateCashBalanceResponse", "Status": "status", }); }); /** @internal */ export type CashBalancesCalculateCashBalanceResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; CalculateCashBalanceResponse?: | components.CalculateCashBalanceResponse$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const CashBalancesCalculateCashBalanceResponse$outboundSchema: z.ZodType< CashBalancesCalculateCashBalanceResponse$Outbound, z.ZodTypeDef, CashBalancesCalculateCashBalanceResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, calculateCashBalanceResponse: components .CalculateCashBalanceResponse$outboundSchema.optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", calculateCashBalanceResponse: "CalculateCashBalanceResponse", 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 CashBalancesCalculateCashBalanceResponse$ { /** @deprecated use `CashBalancesCalculateCashBalanceResponse$inboundSchema` instead. */ export const inboundSchema = CashBalancesCalculateCashBalanceResponse$inboundSchema; /** @deprecated use `CashBalancesCalculateCashBalanceResponse$outboundSchema` instead. */ export const outboundSchema = CashBalancesCalculateCashBalanceResponse$outboundSchema; /** @deprecated use `CashBalancesCalculateCashBalanceResponse$Outbound` instead. */ export type Outbound = CashBalancesCalculateCashBalanceResponse$Outbound; } export function cashBalancesCalculateCashBalanceResponseToJSON( cashBalancesCalculateCashBalanceResponse: CashBalancesCalculateCashBalanceResponse, ): string { return JSON.stringify( CashBalancesCalculateCashBalanceResponse$outboundSchema.parse( cashBalancesCalculateCashBalanceResponse, ), ); } export function cashBalancesCalculateCashBalanceResponseFromJSON( jsonString: string, ): SafeParseResult< CashBalancesCalculateCashBalanceResponse, SDKValidationError > { return safeParse( jsonString, (x) => CashBalancesCalculateCashBalanceResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'CashBalancesCalculateCashBalanceResponse' from JSON`, ); }