@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
64 lines (59 loc) • 2 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
export type Permission = {
/**
* The unique identifier for this permission within Unkey's system.
*
* @remarks
* Generated automatically when the permission is created and used to reference this permission in API operations.
* Always begins with 'perm_' followed by alphanumeric characters and underscores.
*/
id: string;
/**
* The human-readable name for this permission that describes its purpose.
*
* @remarks
* Should be descriptive enough for developers to understand what access it grants.
* Use clear, semantic names that reflect the resources or actions being permitted.
* Names must be unique within your workspace to avoid confusion and conflicts.
*/
name: string;
/**
* The unique URL-safe identifier for this permission.
*/
slug: string;
/**
* Optional detailed explanation of what this permission grants access to.
*
* @remarks
* Helps team members understand the scope and implications of granting this permission.
* Include information about what resources can be accessed and what actions can be performed.
* Not visible to end users - this is for internal documentation and team clarity.
*/
description?: string | undefined;
};
/** @internal */
export const Permission$inboundSchema: z.ZodType<
Permission,
z.ZodTypeDef,
unknown
> = z.object({
id: z.string(),
name: z.string(),
slug: z.string(),
description: z.string().optional(),
});
export function permissionFromJSON(
jsonString: string,
): SafeParseResult<Permission, SDKValidationError> {
return safeParse(
jsonString,
(x) => Permission$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Permission' from JSON`,
);
}