@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
44 lines • 1.63 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import * as components from "../components/index.js";
import { UnkeyError } from "./unkeyerror.js";
/**
* Error response when the provided credentials are valid but lack sufficient permissions for the requested operation. This occurs when:
*
* @remarks
* - The root key doesn't have the required permissions for this endpoint
* - The operation requires elevated privileges that the current key lacks
* - Access to the requested resource is restricted based on workspace settings
*
* To resolve this error, ensure your root key has the necessary permissions or contact your workspace administrator.
*/
export class ForbiddenErrorResponse extends UnkeyError {
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.meta = err.meta;
this.error = err.error;
this.name = "ForbiddenErrorResponse";
}
}
/** @internal */
export const ForbiddenErrorResponse$inboundSchema = z.object({
meta: components.Meta$inboundSchema,
error: components.BaseError$inboundSchema,
request$: z.instanceof(Request),
response$: z.instanceof(Response),
body$: z.string(),
})
.transform((v) => {
return new ForbiddenErrorResponse(v, {
request: v.request$,
response: v.response$,
body: v.body$,
});
});
//# sourceMappingURL=forbiddenerrorresponse.js.map