/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { MoovError } from "./mooverror.js"; export type FileValidationErrorData = { error?: string | undefined; file?: string | undefined; fileName?: string | undefined; filePurpose?: string | undefined; metadata?: string | undefined; }; export class FileValidationError extends MoovError { error?: string | undefined; file?: string | undefined; fileName?: string | undefined; filePurpose?: string | undefined; metadata?: string | undefined; /** The original data that was passed to this error instance. */ data$: FileValidationErrorData; constructor( err: FileValidationErrorData, 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.error != null) this.error = err.error; if (err.file != null) this.file = err.file; if (err.fileName != null) this.fileName = err.fileName; if (err.filePurpose != null) this.filePurpose = err.filePurpose; if (err.metadata != null) this.metadata = err.metadata; this.name = "FileValidationError"; } } /** @internal */ export const FileValidationError$inboundSchema: z.ZodType< FileValidationError, z.ZodTypeDef, unknown > = z.object({ error: z.string().optional(), file: z.string().optional(), FileName: z.string().optional(), filePurpose: z.string().optional(), metadata: z.string().optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { const remapped = remap$(v, { "FileName": "fileName", }); return new FileValidationError(remapped, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type FileValidationError$Outbound = { error?: string | undefined; file?: string | undefined; FileName?: string | undefined; filePurpose?: string | undefined; metadata?: string | undefined; }; /** @internal */ export const FileValidationError$outboundSchema: z.ZodType< FileValidationError$Outbound, z.ZodTypeDef, FileValidationError > = z.instanceof(FileValidationError) .transform(v => v.data$) .pipe( z.object({ error: z.string().optional(), file: z.string().optional(), fileName: z.string().optional(), filePurpose: z.string().optional(), metadata: z.string().optional(), }).transform((v) => { return remap$(v, { fileName: "FileName", }); }), );