@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
39 lines • 1.38 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
/** @internal */
export const BaseError$inboundSchema = z.object({
detail: z.string(),
instance: z.string().optional(),
status: z.number().int(),
title: z.string(),
type: z.string(),
});
/** @internal */
export const BaseError$outboundSchema = z.object({
detail: z.string(),
instance: z.string().optional(),
status: z.number().int(),
title: z.string(),
type: 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 BaseError$;
(function (BaseError$) {
/** @deprecated use `BaseError$inboundSchema` instead. */
BaseError$.inboundSchema = BaseError$inboundSchema;
/** @deprecated use `BaseError$outboundSchema` instead. */
BaseError$.outboundSchema = BaseError$outboundSchema;
})(BaseError$ || (BaseError$ = {}));
export function baseErrorToJSON(baseError) {
return JSON.stringify(BaseError$outboundSchema.parse(baseError));
}
export function baseErrorFromJSON(jsonString) {
return safeParse(jsonString, (x) => BaseError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BaseError' from JSON`);
}
//# sourceMappingURL=baseerror.js.map