UNPKG

unstructured-client

Version:

<h3 align="center"> <img src="https://raw.githubusercontent.com/Unstructured-IO/unstructured/main/img/unstructured_logo.png" height="200" > </h3>

69 lines 2.73 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../../lib/schemas.js"; import * as shared from "../shared/index.js"; export class HTTPValidationError extends Error { constructor(err) { const message = "message" in err && typeof err.message === "string" ? err.message : `API error occurred: ${JSON.stringify(err)}`; super(message); this.data$ = err; if (err.detail != null) this.detail = err.detail; this.name = "HTTPValidationError"; } } /** @internal */ export const Detail$inboundSchema = z .union([z.array(shared.ValidationError$inboundSchema), z.string()]); /** @internal */ export const Detail$outboundSchema = z.union([z.array(shared.ValidationError$outboundSchema), z.string()]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var Detail$; (function (Detail$) { /** @deprecated use `Detail$inboundSchema` instead. */ Detail$.inboundSchema = Detail$inboundSchema; /** @deprecated use `Detail$outboundSchema` instead. */ Detail$.outboundSchema = Detail$outboundSchema; })(Detail$ || (Detail$ = {})); export function detailToJSON(detail) { return JSON.stringify(Detail$outboundSchema.parse(detail)); } export function detailFromJSON(jsonString) { return safeParse(jsonString, (x) => Detail$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Detail' from JSON`); } /** @internal */ export const HTTPValidationError$inboundSchema = z.object({ detail: z.union([z.array(shared.ValidationError$inboundSchema), z.string()]) .optional(), }) .transform((v) => { return new HTTPValidationError(v); }); /** @internal */ export const HTTPValidationError$outboundSchema = z.instanceof(HTTPValidationError) .transform(v => v.data$) .pipe(z.object({ detail: z.union([ z.array(shared.ValidationError$outboundSchema), 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 var HTTPValidationError$; (function (HTTPValidationError$) { /** @deprecated use `HTTPValidationError$inboundSchema` instead. */ HTTPValidationError$.inboundSchema = HTTPValidationError$inboundSchema; /** @deprecated use `HTTPValidationError$outboundSchema` instead. */ HTTPValidationError$.outboundSchema = HTTPValidationError$outboundSchema; })(HTTPValidationError$ || (HTTPValidationError$ = {})); //# sourceMappingURL=httpvalidationerror.js.map