UNPKG

@docusign/iam-sdk

Version:

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.

99 lines 3.68 kB
"use strict"; /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.ErrDetails$inboundSchema = exports.ErrDetails = void 0; const z = __importStar(require("zod/v3")); const primitives_js_1 = require("../../lib/primitives.js"); const types = __importStar(require("../../types/primitives.js")); const components = __importStar(require("../components/index.js")); const iamclienterror_js_1 = require("./iamclienterror.js"); /** * Error response conforming to RFC 9457 (Problem Details for HTTP APIs). * * @remarks * See: https://www.rfc-editor.org/rfc/rfc9457.html */ class ErrDetails extends iamclienterror_js_1.IamClientError { constructor(err, httpMeta) { const message = "message" in err && typeof err.message === "string" ? err.message : `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; this.type = err.type; this.title = err.title; this.status = err.status; if (err.detail != null) this.detail = err.detail; if (err.instance != null) this.instance = err.instance; if (err.errors != null) this.errors = err.errors; if (err.requestId != null) this.requestId = err.requestId; if (err.timestamp != null) this.timestamp = err.timestamp; this.name = "ErrDetails"; } } exports.ErrDetails = ErrDetails; /** @internal */ exports.ErrDetails$inboundSchema = z.object({ type: types.string(), title: types.string(), status: types.number(), detail: types.optional(types.string()), instance: types.optional(types.string()), errors: types.optional(z.array(components.ValidationError$inboundSchema)), request_id: types.optional(types.string()), timestamp: types.optional(types.date()), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { const remapped = (0, primitives_js_1.remap)(v, { "request_id": "requestId", }); return new ErrDetails(remapped, { request: v.request$, response: v.response$, body: v.body$, }); }); //# sourceMappingURL=errdetails.js.map