/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { smartUnion } from "../../types/smartUnion.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Contains parameter or domain specific information related to the error and why it occurred. */ export type Detail = string | { [k: string]: any }; /** * Unexpected error */ export type UnexpectedErrorResponse = { /** * HTTP status code */ statusCode?: number | undefined; /** * Contains an explanation of the status_code as defined in HTTP/1.1 standard (RFC 7231) */ error?: string | undefined; /** * The type of error returned */ typeName?: string | undefined; /** * A human-readable message providing more details about the error. */ message?: string | undefined; /** * Contains parameter or domain specific information related to the error and why it occurred. */ detail?: string | { [k: string]: any } | undefined; /** * Link to documentation of error type */ ref?: string | undefined; }; /** @internal */ export const Detail$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => smartUnion([types.string(), z.record(z.any())]) ); export function detailFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Detail$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Detail' from JSON`, ); } /** @internal */ export const UnexpectedErrorResponse$inboundSchema: z.ZodType< UnexpectedErrorResponse, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ status_code: types.optional(types.number()), error: types.optional(types.string()), type_name: types.optional(types.string()), message: types.optional(types.string()), detail: types.optional(smartUnion([types.string(), z.record(z.any())])), ref: types.optional(types.string()), }).transform((v) => { return remap$(v, { "status_code": "statusCode", "type_name": "typeName", }); }) ); export function unexpectedErrorResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UnexpectedErrorResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UnexpectedErrorResponse' from JSON`, ); }