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