/* * 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 PayloadTooLargeErrorResponseData = { /** * Response status */ status: string; /** * Payload too large error details */ message: models.PayloadTooLargeErrorResponseMessage; }; export class PayloadTooLargeErrorResponse extends SupertoneError { /** * Response status */ status: string; /** The original data that was passed to this error instance. */ data$: PayloadTooLargeErrorResponseData; constructor( err: PayloadTooLargeErrorResponseData, 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 = "PayloadTooLargeErrorResponse"; } } /** @internal */ export const PayloadTooLargeErrorResponse$inboundSchema: z.ZodType< PayloadTooLargeErrorResponse, z.ZodTypeDef, unknown > = z.object({ status: z.string(), message: z.lazy(() => models.PayloadTooLargeErrorResponseMessage$inboundSchema ), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new PayloadTooLargeErrorResponse(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type PayloadTooLargeErrorResponse$Outbound = { status: string; message: models.PayloadTooLargeErrorResponseMessage$Outbound; }; /** @internal */ export const PayloadTooLargeErrorResponse$outboundSchema: z.ZodType< PayloadTooLargeErrorResponse$Outbound, z.ZodTypeDef, PayloadTooLargeErrorResponse > = z.instanceof(PayloadTooLargeErrorResponse) .transform(v => v.data$) .pipe(z.object({ status: z.string(), message: z.lazy(() => models.PayloadTooLargeErrorResponseMessage$outboundSchema ), })); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PayloadTooLargeErrorResponse$ { /** @deprecated use `PayloadTooLargeErrorResponse$inboundSchema` instead. */ export const inboundSchema = PayloadTooLargeErrorResponse$inboundSchema; /** @deprecated use `PayloadTooLargeErrorResponse$outboundSchema` instead. */ export const outboundSchema = PayloadTooLargeErrorResponse$outboundSchema; /** @deprecated use `PayloadTooLargeErrorResponse$Outbound` instead. */ export type Outbound = PayloadTooLargeErrorResponse$Outbound; }