/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { ClosedEnum } from "../types/enums.js"; import * as types from "../types/primitives.js"; import { VercelError } from "./vercelerror.js"; export const NotFoundCode = { NotFound: "not_found", } as const; export type NotFoundCode = ClosedEnum; export type NotFoundData = { status: number; code: NotFoundCode; message: string; }; export class NotFound extends VercelError { status: number; code: NotFoundCode; /** The original data that was passed to this error instance. */ data$: NotFoundData; constructor( err: NotFoundData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = err.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.status = err.status; this.code = err.code; this.name = "NotFound"; } } /** @internal */ export const NotFoundCode$inboundSchema: z.ZodNativeEnum = z.nativeEnum(NotFoundCode); /** @internal */ export const NotFoundCode$outboundSchema: z.ZodNativeEnum = NotFoundCode$inboundSchema; /** @internal */ export const NotFound$inboundSchema: z.ZodType< NotFound, z.ZodTypeDef, unknown > = z.object({ status: types.number(), code: NotFoundCode$inboundSchema, message: types.string(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new NotFound(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type NotFound$Outbound = { status: number; code: string; message: string; }; /** @internal */ export const NotFound$outboundSchema: z.ZodType< NotFound$Outbound, z.ZodTypeDef, NotFound > = z.instanceof(NotFound) .transform(v => v.data$) .pipe(z.object({ status: z.number(), code: NotFoundCode$outboundSchema, message: z.string(), }));