UNPKG

@docusign/iam-sdk

Version:

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

62 lines 2.26 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { IamClientError } from "./iamclienterror.js"; export class OAuthErrorResponse extends 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; if (err.error != null) this.error = err.error; if (err.errorDescription != null) { this.errorDescription = err.errorDescription; } this.name = "OAuthErrorResponse"; } } /** @internal */ export const OAuthErrorResponse$inboundSchema = z.object({ error: z.nullable(z.string()).optional(), error_description: z.nullable(z.string()).optional(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { const remapped = remap$(v, { "error_description": "errorDescription", }); return new OAuthErrorResponse(remapped, { request: v.request$, response: v.response$, body: v.body$, }); }); /** @internal */ export const OAuthErrorResponse$outboundSchema = z.instanceof(OAuthErrorResponse) .transform(v => v.data$) .pipe(z.object({ error: z.nullable(z.string()).optional(), errorDescription: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { errorDescription: "error_description", }); })); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var OAuthErrorResponse$; (function (OAuthErrorResponse$) { /** @deprecated use `OAuthErrorResponse$inboundSchema` instead. */ OAuthErrorResponse$.inboundSchema = OAuthErrorResponse$inboundSchema; /** @deprecated use `OAuthErrorResponse$outboundSchema` instead. */ OAuthErrorResponse$.outboundSchema = OAuthErrorResponse$outboundSchema; })(OAuthErrorResponse$ || (OAuthErrorResponse$ = {})); //# sourceMappingURL=oautherrorresponse.js.map