/* * 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"; /** * Whether the cash journal is considered first party or third party */ export enum CheckPartyTypeResponsePartyType { PartyTypeUnspecified = "PARTY_TYPE_UNSPECIFIED", FirstParty = "FIRST_PARTY", ThirdParty = "THIRD_PARTY", } /** * Whether the cash journal is considered first party or third party */ export type CheckPartyTypeResponsePartyTypeOpen = OpenEnum< typeof CheckPartyTypeResponsePartyType >; /** * Returns whether a potential cash journal will be considered first party or third party */ export type CheckPartyTypeResponse = { /** * Whether the cash journal is considered first party or third party */ partyType?: CheckPartyTypeResponsePartyTypeOpen | undefined; /** * If cash journal is considered third party, reason for why it is considered third party */ reason?: string | undefined; }; /** @internal */ export const CheckPartyTypeResponsePartyType$inboundSchema: z.ZodType< CheckPartyTypeResponsePartyTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(CheckPartyTypeResponsePartyType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const CheckPartyTypeResponsePartyType$outboundSchema: z.ZodType< CheckPartyTypeResponsePartyTypeOpen, z.ZodTypeDef, CheckPartyTypeResponsePartyTypeOpen > = z.union([ z.nativeEnum(CheckPartyTypeResponsePartyType), 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 CheckPartyTypeResponsePartyType$ { /** @deprecated use `CheckPartyTypeResponsePartyType$inboundSchema` instead. */ export const inboundSchema = CheckPartyTypeResponsePartyType$inboundSchema; /** @deprecated use `CheckPartyTypeResponsePartyType$outboundSchema` instead. */ export const outboundSchema = CheckPartyTypeResponsePartyType$outboundSchema; } /** @internal */ export const CheckPartyTypeResponse$inboundSchema: z.ZodType< CheckPartyTypeResponse, z.ZodTypeDef, unknown > = z.object({ party_type: CheckPartyTypeResponsePartyType$inboundSchema.optional(), reason: z.string().optional(), }).transform((v) => { return remap$(v, { "party_type": "partyType", }); }); /** @internal */ export type CheckPartyTypeResponse$Outbound = { party_type?: string | undefined; reason?: string | undefined; }; /** @internal */ export const CheckPartyTypeResponse$outboundSchema: z.ZodType< CheckPartyTypeResponse$Outbound, z.ZodTypeDef, CheckPartyTypeResponse > = z.object({ partyType: CheckPartyTypeResponsePartyType$outboundSchema.optional(), reason: z.string().optional(), }).transform((v) => { return remap$(v, { partyType: "party_type", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CheckPartyTypeResponse$ { /** @deprecated use `CheckPartyTypeResponse$inboundSchema` instead. */ export const inboundSchema = CheckPartyTypeResponse$inboundSchema; /** @deprecated use `CheckPartyTypeResponse$outboundSchema` instead. */ export const outboundSchema = CheckPartyTypeResponse$outboundSchema; /** @deprecated use `CheckPartyTypeResponse$Outbound` instead. */ export type Outbound = CheckPartyTypeResponse$Outbound; } export function checkPartyTypeResponseToJSON( checkPartyTypeResponse: CheckPartyTypeResponse, ): string { return JSON.stringify( CheckPartyTypeResponse$outboundSchema.parse(checkPartyTypeResponse), ); } export function checkPartyTypeResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CheckPartyTypeResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CheckPartyTypeResponse' from JSON`, ); }