/* * 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 { collectExtraKeys as collectExtraKeys$ } from "../../lib/schemas.js"; import { OutpostError } from "./outposterror.js"; /** * A collection of status codes that generally mean the server failed in an unexpected way */ export type InternalServerErrorData = { message?: string | undefined; additionalProperties: { [k: string]: any }; }; /** * A collection of status codes that generally mean the server failed in an unexpected way */ export class InternalServerError extends OutpostError { additionalProperties: { [k: string]: any } = {}; /** The original data that was passed to this error instance. */ data$: InternalServerErrorData; constructor( err: InternalServerErrorData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = err.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; if (err.additionalProperties != null) { this.additionalProperties = err.additionalProperties; } this.name = "InternalServerError"; } } /** @internal */ export const InternalServerError$inboundSchema: z.ZodType< InternalServerError, z.ZodTypeDef, unknown > = collectExtraKeys$( z.object({ message: z.string().optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .catchall(z.any()), "additionalProperties", false, ) .transform((v) => { return new InternalServerError(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type InternalServerError$Outbound = { message?: string | undefined; [additionalProperties: string]: unknown; }; /** @internal */ export const InternalServerError$outboundSchema: z.ZodType< InternalServerError$Outbound, z.ZodTypeDef, InternalServerError > = z.instanceof(InternalServerError) .transform(v => v.data$) .pipe( z.object({ message: z.string().optional(), additionalProperties: z.record(z.any()), }).transform((v) => { return { ...v.additionalProperties, ...remap$(v, { additionalProperties: null, }), }; }), );