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