UNPKG

@unkey/api

Version:

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.

45 lines 1.69 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import * as components from "../components/index.js"; import { UnkeyError } from "./unkeyerror.js"; /** * Error response when the client has sent too many requests in a given time period. This occurs when you've exceeded a rate limit or quota for the resource you're accessing. * * @remarks * * The rate limit resets automatically after the time window expires. To avoid this error: * - Implement exponential backoff when retrying requests * - Cache results where appropriate to reduce request frequency * - Check the error detail message for specific quota information * - Contact support if you need a higher quota for your use case */ export class TooManyRequestsErrorResponse extends UnkeyError { constructor(err, httpMeta) { const message = "message" in err && typeof err.message === "string" ? err.message : `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.meta = err.meta; this.error = err.error; this.name = "TooManyRequestsErrorResponse"; } } /** @internal */ export const TooManyRequestsErrorResponse$inboundSchema = z.object({ meta: components.Meta$inboundSchema, error: components.BaseError$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$, }); }); //# sourceMappingURL=toomanyrequestserrorresponse.js.map