/* * 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 NotAuthorizedForScopeCode = { NotAuthorizedForScope: "not_authorized_for_scope", } as const; export type NotAuthorizedForScopeCode = ClosedEnum< typeof NotAuthorizedForScopeCode >; export type NotAuthorizedForScopeData = { status: number; code: NotAuthorizedForScopeCode; message: string; }; export class NotAuthorizedForScope extends VercelError { status: number; code: NotAuthorizedForScopeCode; /** The original data that was passed to this error instance. */ data$: NotAuthorizedForScopeData; constructor( err: NotAuthorizedForScopeData, 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 = "NotAuthorizedForScope"; } } /** @internal */ export const NotAuthorizedForScopeCode$inboundSchema: z.ZodNativeEnum< typeof NotAuthorizedForScopeCode > = z.nativeEnum(NotAuthorizedForScopeCode); /** @internal */ export const NotAuthorizedForScopeCode$outboundSchema: z.ZodNativeEnum< typeof NotAuthorizedForScopeCode > = NotAuthorizedForScopeCode$inboundSchema; /** @internal */ export const NotAuthorizedForScope$inboundSchema: z.ZodType< NotAuthorizedForScope, z.ZodTypeDef, unknown > = z.object({ status: types.number(), code: NotAuthorizedForScopeCode$inboundSchema, message: types.string(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new NotAuthorizedForScope(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type NotAuthorizedForScope$Outbound = { status: number; code: string; message: string; }; /** @internal */ export const NotAuthorizedForScope$outboundSchema: z.ZodType< NotAuthorizedForScope$Outbound, z.ZodTypeDef, NotAuthorizedForScope > = z.instanceof(NotAuthorizedForScope) .transform(v => v.data$) .pipe(z.object({ status: z.number(), code: NotAuthorizedForScopeCode$outboundSchema, message: z.string(), }));