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