/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import * as types from "../types/primitives.js"; import { VercelError } from "./vercelerror.js"; export type ForbiddenData = { status: number; code: "forbidden"; message: string; }; export class Forbidden extends VercelError { status: number; code: "forbidden"; /** The original data that was passed to this error instance. */ data$: ForbiddenData; constructor( err: ForbiddenData, 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 = "Forbidden"; } } /** @internal */ export const Forbidden$inboundSchema: z.ZodType< Forbidden, z.ZodTypeDef, unknown > = z.object({ status: types.number(), code: types.literal("forbidden"), message: types.string(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new Forbidden(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type Forbidden$Outbound = { status: number; code: "forbidden"; message: string; }; /** @internal */ export const Forbidden$outboundSchema: z.ZodType< Forbidden$Outbound, z.ZodTypeDef, Forbidden > = z.instanceof(Forbidden) .transform(v => v.data$) .pipe(z.object({ status: z.number(), code: z.literal("forbidden"), message: z.string(), }));