/* * 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 RequestCardErrorData = { fundingWalletID?: string | undefined; formFactor?: string | undefined; authorizedUser?: components.CreateAuthorizedUserError | undefined; memo?: string | undefined; expiration?: components.CardExpirationError | undefined; controls?: components.IssuingControlsError | undefined; }; export class RequestCardError extends MoovError { fundingWalletID?: string | undefined; formFactor?: string | undefined; authorizedUser?: components.CreateAuthorizedUserError | undefined; memo?: string | undefined; expiration?: components.CardExpirationError | undefined; controls?: components.IssuingControlsError | undefined; /** The original data that was passed to this error instance. */ data$: RequestCardErrorData; constructor( err: RequestCardErrorData, 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.fundingWalletID != null) this.fundingWalletID = err.fundingWalletID; if (err.formFactor != null) this.formFactor = err.formFactor; if (err.authorizedUser != null) this.authorizedUser = err.authorizedUser; if (err.memo != null) this.memo = err.memo; if (err.expiration != null) this.expiration = err.expiration; if (err.controls != null) this.controls = err.controls; this.name = "RequestCardError"; } } /** @internal */ export const RequestCardError$inboundSchema: z.ZodType< RequestCardError, z.ZodTypeDef, unknown > = z.object({ fundingWalletID: z.string().optional(), formFactor: z.string().optional(), authorizedUser: components.CreateAuthorizedUserError$inboundSchema.optional(), memo: z.string().optional(), expiration: components.CardExpirationError$inboundSchema.optional(), controls: components.IssuingControlsError$inboundSchema.optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new RequestCardError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type RequestCardError$Outbound = { fundingWalletID?: string | undefined; formFactor?: string | undefined; authorizedUser?: components.CreateAuthorizedUserError$Outbound | undefined; memo?: string | undefined; expiration?: components.CardExpirationError$Outbound | undefined; controls?: components.IssuingControlsError$Outbound | undefined; }; /** @internal */ export const RequestCardError$outboundSchema: z.ZodType< RequestCardError$Outbound, z.ZodTypeDef, RequestCardError > = z.instanceof(RequestCardError) .transform(v => v.data$) .pipe(z.object({ fundingWalletID: z.string().optional(), formFactor: z.string().optional(), authorizedUser: components.CreateAuthorizedUserError$outboundSchema .optional(), memo: z.string().optional(), expiration: components.CardExpirationError$outboundSchema.optional(), controls: components.IssuingControlsError$outboundSchema.optional(), }));