/* * 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 PatchAccountErrorData = { profile?: components.CreateProfileError | undefined; metadata?: string | undefined; termsOfService?: components.TermsOfServiceError | undefined; foreignID?: string | undefined; customerSupport?: components.CustomerSupportError | undefined; settings?: components.CreateAccountSettings | undefined; error?: string | undefined; }; export class PatchAccountError extends MoovError { profile?: components.CreateProfileError | undefined; metadata?: string | undefined; termsOfService?: components.TermsOfServiceError | undefined; foreignID?: string | undefined; customerSupport?: components.CustomerSupportError | undefined; settings?: components.CreateAccountSettings | undefined; error?: string | undefined; /** The original data that was passed to this error instance. */ data$: PatchAccountErrorData; constructor( err: PatchAccountErrorData, 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.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.error != null) this.error = err.error; this.name = "PatchAccountError"; } } /** @internal */ export const PatchAccountError$inboundSchema: z.ZodType< PatchAccountError, z.ZodTypeDef, unknown > = z.object({ 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(), error: z.string().optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new PatchAccountError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type PatchAccountError$Outbound = { 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; error?: string | undefined; }; /** @internal */ export const PatchAccountError$outboundSchema: z.ZodType< PatchAccountError$Outbound, z.ZodTypeDef, PatchAccountError > = z.instanceof(PatchAccountError) .transform(v => v.data$) .pipe(z.object({ 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(), error: z.string().optional(), }));