@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
140 lines • 5.1 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import { permissionsCreatePermission } from "../funcs/permissionsCreatePermission.js";
import { permissionsCreateRole } from "../funcs/permissionsCreateRole.js";
import { permissionsDeletePermission } from "../funcs/permissionsDeletePermission.js";
import { permissionsDeleteRole } from "../funcs/permissionsDeleteRole.js";
import { permissionsGetPermission } from "../funcs/permissionsGetPermission.js";
import { permissionsGetRole } from "../funcs/permissionsGetRole.js";
import { permissionsListPermissions } from "../funcs/permissionsListPermissions.js";
import { permissionsListRoles } from "../funcs/permissionsListRoles.js";
import { ClientSDK } from "../lib/sdks.js";
import { unwrapAsync } from "../types/fp.js";
export class Permissions extends ClientSDK {
/**
* Create permission
*
* @remarks
* Create a new permission to define specific actions or capabilities in your RBAC system. Permissions can be assigned directly to API keys or included in roles.
*
* Use hierarchical naming patterns like `documents.read`, `admin.users.delete`, or `billing.invoices.create` for clear organization.
*
* **Important:** Permission names must be unique within the workspace. Once created, permissions are immediately available for assignment.
*
* **Required Permissions**
*
* Your root key must have the following permission:
* - `rbac.*.create_permission`
*/
async createPermission(request, options) {
return unwrapAsync(permissionsCreatePermission(this, request, options));
}
/**
* Create role
*
* @remarks
* Create a new role to group related permissions for easier management. Roles enable consistent permission assignment across multiple API keys.
*
* **Important:** Role names must be unique within the workspace. Once created, roles are immediately available for assignment.
*
* **Required Permissions**
*
* Your root key must have the following permission:
* - `rbac.*.create_role`
*/
async createRole(request, options) {
return unwrapAsync(permissionsCreateRole(this, request, options));
}
/**
* Delete permission
*
* @remarks
* Remove a permission from your workspace. This also removes the permission from all API keys and roles.
*
* **Important:** This operation cannot be undone and immediately affects all API keys and roles that had this permission assigned.
*
* **Required Permissions**
*
* Your root key must have the following permission:
* - `rbac.*.delete_permission`
*/
async deletePermission(request, options) {
return unwrapAsync(permissionsDeletePermission(this, request, options));
}
/**
* Delete role
*
* @remarks
* Remove a role from your workspace. This also removes the role from all assigned API keys.
*
* **Important:** This operation cannot be undone and immediately affects all API keys that had this role assigned.
*
* **Required Permissions**
*
* Your root key must have the following permission:
* - `rbac.*.delete_role`
*/
async deleteRole(request, options) {
return unwrapAsync(permissionsDeleteRole(this, request, options));
}
/**
* Get permission
*
* @remarks
* Retrieve details about a specific permission including its name, description, and metadata.
*
* **Required Permissions**
*
* Your root key must have the following permission:
* - `rbac.*.read_permission`
*/
async getPermission(request, options) {
return unwrapAsync(permissionsGetPermission(this, request, options));
}
/**
* Get role
*
* @remarks
* Retrieve details about a specific role including its assigned permissions.
*
* **Required Permissions**
*
* Your root key must have the following permission:
* - `rbac.*.read_role`
*/
async getRole(request, options) {
return unwrapAsync(permissionsGetRole(this, request, options));
}
/**
* List permissions
*
* @remarks
* Retrieve all permissions in your workspace.
* Results are paginated and sorted by their id.
*
* **Required Permissions**
*
* Your root key must have the following permission:
* - `rbac.*.read_permission`
*/
async listPermissions(request, options) {
return unwrapAsync(permissionsListPermissions(this, request, options));
}
/**
* List roles
*
* @remarks
* Retrieve all roles in your workspace including their assigned permissions.
* Results are paginated and sorted by their id.
*
* **Required Permissions**
*
* Your root key must have the following permission:
* - `rbac.*.read_role`
*/
async listRoles(request, options) {
return unwrapAsync(permissionsListRoles(this, request, options));
}
}
//# sourceMappingURL=permissions.js.map