/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import * as components from "../components/index.js"; import { ApexascendError } from "./apexascenderror.js"; /** * The status message serves as the general-purpose service error message. Each status message includes a gRPC error code, error message, and error details. */ export type StatusData = { /** * The code field contains an enum value of google.rpc.Code. */ code?: number | undefined; /** * The details field contains one or more technical error details. */ details?: Array | undefined; /** * The message field contains human-friendly messages about the error. */ message?: string | undefined; }; /** * The status message serves as the general-purpose service error message. Each status message includes a gRPC error code, error message, and error details. */ export class Status extends ApexascendError { /** * The code field contains an enum value of google.rpc.Code. */ code?: number | undefined; /** * The details field contains one or more technical error details. */ details?: Array | undefined; /** The original data that was passed to this error instance. */ data$: StatusData; constructor( err: StatusData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = err.message || `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; if (err.code != null) this.code = err.code; if (err.details != null) this.details = err.details; this.name = "Status"; } } /** @internal */ export const Status$inboundSchema: z.ZodType = z .object({ code: z.number().int().optional(), details: z.array(components.Any$inboundSchema).optional(), message: z.string().optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { return new Status(v, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export type Status$Outbound = { code?: number | undefined; details?: Array | undefined; message?: string | undefined; }; /** @internal */ export const Status$outboundSchema: z.ZodType< Status$Outbound, z.ZodTypeDef, Status > = z.instanceof(Status) .transform(v => v.data$) .pipe(z.object({ code: z.number().int().optional(), details: z.array(components.Any$outboundSchema).optional(), message: z.string().optional(), })); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Status$ { /** @deprecated use `Status$inboundSchema` instead. */ export const inboundSchema = Status$inboundSchema; /** @deprecated use `Status$outboundSchema` instead. */ export const outboundSchema = Status$outboundSchema; /** @deprecated use `Status$Outbound` instead. */ export type Outbound = Status$Outbound; }