/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import * as components from "../components/index.js"; import { MoovError } from "./mooverror.js"; export type CreateAccountErrorData = { accountType?: string | undefined; profile?: components.CreateProfileError | undefined; metadata?: string | undefined; termsOfService?: components.TermsOfServiceError | undefined; foreignID?: string | undefined; customerSupport?: components.CustomerSupportError | undefined; settings?: components.CreateAccountSettings | undefined; capabilities?: { [k: string]: string } | undefined; }; export class CreateAccountError extends MoovError { accountType?: string | undefined; profile?: components.CreateProfileError | undefined; metadata?: string | undefined; termsOfService?: components.TermsOfServiceError | undefined; foreignID?: string | undefined; customerSupport?: components.CustomerSupportError | undefined; settings?: components.CreateAccountSettings | undefined; capabilities?: { [k: string]: string } | undefined; /** The original data that was passed to this error instance. */ data$: CreateAccountErrorData; constructor( err: CreateAccountErrorData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = "message" in err && typeof err.message === "string" ? err.message : `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; if (err.accountType != null) this.accountType = err.accountType; if (err.profile != null) this.profile = err.profile; if (err.metadata != null) this.metadata = err.metadata; if (err.termsOfService != null) this.termsOfService = err.termsOfService; if (err.foreignID != null) this.foreignID = err.foreignID; if (err.customerSupport != null) this.customerSupport = err.customerSupport; if (err.settings != null) this.settings = err.settings; if (err.capabilities != null) this.capabilities = err.capabilities; this.name = "CreateAccountError"; } } /** @internal */ export const CreateAccountError$inboundSchema: z.ZodType< CreateAccountError, z.ZodTypeDef, unknown > = z.object({ accountType: z.string().optional(), profile: components.CreateProfileError$inboundSchema.optional(), metadata: z.string().optional(), termsOfService: components.TermsOfServiceError$inboundSchema.optional(), foreignID: z.string().optional(), customerSupport: components.CustomerSupportError$inboundSchema.optional(), settings: components.CreateAccountSettings$inboundSchema.optional(), capabilities: z.record(z.string()).optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new CreateAccountError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type CreateAccountError$Outbound = { accountType?: string | undefined; profile?: components.CreateProfileError$Outbound | undefined; metadata?: string | undefined; termsOfService?: components.TermsOfServiceError$Outbound | undefined; foreignID?: string | undefined; customerSupport?: components.CustomerSupportError$Outbound | undefined; settings?: components.CreateAccountSettings$Outbound | undefined; capabilities?: { [k: string]: string } | undefined; }; /** @internal */ export const CreateAccountError$outboundSchema: z.ZodType< CreateAccountError$Outbound, z.ZodTypeDef, CreateAccountError > = z.instanceof(CreateAccountError) .transform(v => v.data$) .pipe(z.object({ accountType: z.string().optional(), profile: components.CreateProfileError$outboundSchema.optional(), metadata: z.string().optional(), termsOfService: components.TermsOfServiceError$outboundSchema.optional(), foreignID: z.string().optional(), customerSupport: components.CustomerSupportError$outboundSchema.optional(), settings: components.CreateAccountSettings$outboundSchema.optional(), capabilities: z.record(z.string()).optional(), }));