/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CapabilityID, CapabilityID$inboundSchema, CapabilityID$outboundSchema, } from "./capabilityid.js"; import { CreateAccountType, CreateAccountType$inboundSchema, CreateAccountType$outboundSchema, } from "./createaccounttype.js"; import { CreateProfile, CreateProfile$inboundSchema, CreateProfile$Outbound, CreateProfile$outboundSchema, } from "./createprofile.js"; import { CustomerSupport, CustomerSupport$inboundSchema, CustomerSupport$Outbound, CustomerSupport$outboundSchema, } from "./customersupport.js"; import { Mode, Mode$inboundSchema, Mode$outboundSchema } from "./mode.js"; import { Settings, Settings$inboundSchema, Settings$Outbound, Settings$outboundSchema, } from "./settings.js"; import { TermsOfServicePayload, TermsOfServicePayload$inboundSchema, TermsOfServicePayload$Outbound, TermsOfServicePayload$outboundSchema, } from "./termsofservicepayload.js"; export type CreateAccount = { accountType: CreateAccountType; profile: CreateProfile; /** * Free-form key-value pair list. Useful for storing information that is not captured elsewhere. */ metadata?: { [k: string]: string } | undefined; termsOfService?: TermsOfServicePayload | undefined; /** * Optional alias from a foreign/external system which can be used to reference this resource. */ foreignID?: string | undefined; /** * User-provided information that can be displayed on credit card transactions for customers to use when * * @remarks * contacting a customer support team. This data is only allowed on a business account. */ customerSupport?: CustomerSupport | undefined; /** * User provided settings to manage an account. */ settings?: Settings | undefined; capabilities?: Array | undefined; /** * The operating mode for an account. */ mode?: Mode | undefined; }; /** @internal */ export const CreateAccount$inboundSchema: z.ZodType< CreateAccount, z.ZodTypeDef, unknown > = z.object({ accountType: CreateAccountType$inboundSchema, profile: CreateProfile$inboundSchema, metadata: z.record(z.string()).optional(), termsOfService: TermsOfServicePayload$inboundSchema.optional(), foreignID: z.string().optional(), customerSupport: CustomerSupport$inboundSchema.optional(), settings: Settings$inboundSchema.optional(), capabilities: z.array(CapabilityID$inboundSchema).optional(), mode: Mode$inboundSchema.optional(), }); /** @internal */ export type CreateAccount$Outbound = { accountType: string; profile: CreateProfile$Outbound; metadata?: { [k: string]: string } | undefined; termsOfService?: TermsOfServicePayload$Outbound | undefined; foreignID?: string | undefined; customerSupport?: CustomerSupport$Outbound | undefined; settings?: Settings$Outbound | undefined; capabilities?: Array | undefined; mode?: string | undefined; }; /** @internal */ export const CreateAccount$outboundSchema: z.ZodType< CreateAccount$Outbound, z.ZodTypeDef, CreateAccount > = z.object({ accountType: CreateAccountType$outboundSchema, profile: CreateProfile$outboundSchema, metadata: z.record(z.string()).optional(), termsOfService: TermsOfServicePayload$outboundSchema.optional(), foreignID: z.string().optional(), customerSupport: CustomerSupport$outboundSchema.optional(), settings: Settings$outboundSchema.optional(), capabilities: z.array(CapabilityID$outboundSchema).optional(), mode: Mode$outboundSchema.optional(), }); export function createAccountToJSON(createAccount: CreateAccount): string { return JSON.stringify(CreateAccount$outboundSchema.parse(createAccount)); } export function createAccountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAccount' from JSON`, ); }