/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import * as models from "../index.js"; import { SupertoneError } from "./supertoneerror.js"; export type InternalServerErrorResponseData = { /** * Response status */ status: string; /** * Internal server error details */ message: models.InternalServerErrorResponseMessage; }; export class InternalServerErrorResponse extends SupertoneError { /** * Response status */ status: string; /** The original data that was passed to this error instance. */ data$: InternalServerErrorResponseData; constructor( err: InternalServerErrorResponseData, 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; this.status = err.status; this.name = "InternalServerErrorResponse"; } } /** @internal */ export const InternalServerErrorResponse$inboundSchema: z.ZodType< InternalServerErrorResponse, z.ZodTypeDef, unknown > = z.object({ status: z.string(), message: z.lazy(() => models.InternalServerErrorResponseMessage$inboundSchema ), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new InternalServerErrorResponse(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type InternalServerErrorResponse$Outbound = { status: string; message: models.InternalServerErrorResponseMessage$Outbound; }; /** @internal */ export const InternalServerErrorResponse$outboundSchema: z.ZodType< InternalServerErrorResponse$Outbound, z.ZodTypeDef, InternalServerErrorResponse > = z.instanceof(InternalServerErrorResponse) .transform(v => v.data$) .pipe(z.object({ status: z.string(), message: z.lazy(() => models.InternalServerErrorResponseMessage$outboundSchema ), })); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace InternalServerErrorResponse$ { /** @deprecated use `InternalServerErrorResponse$inboundSchema` instead. */ export const inboundSchema = InternalServerErrorResponse$inboundSchema; /** @deprecated use `InternalServerErrorResponse$outboundSchema` instead. */ export const outboundSchema = InternalServerErrorResponse$outboundSchema; /** @deprecated use `InternalServerErrorResponse$Outbound` instead. */ export type Outbound = InternalServerErrorResponse$Outbound; }