@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
144 lines • 5.67 kB
JavaScript
;
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Permissions = void 0;
const permissionsCreatePermission_js_1 = require("../funcs/permissionsCreatePermission.js");
const permissionsCreateRole_js_1 = require("../funcs/permissionsCreateRole.js");
const permissionsDeletePermission_js_1 = require("../funcs/permissionsDeletePermission.js");
const permissionsDeleteRole_js_1 = require("../funcs/permissionsDeleteRole.js");
const permissionsGetPermission_js_1 = require("../funcs/permissionsGetPermission.js");
const permissionsGetRole_js_1 = require("../funcs/permissionsGetRole.js");
const permissionsListPermissions_js_1 = require("../funcs/permissionsListPermissions.js");
const permissionsListRoles_js_1 = require("../funcs/permissionsListRoles.js");
const sdks_js_1 = require("../lib/sdks.js");
const fp_js_1 = require("../types/fp.js");
class Permissions extends sdks_js_1.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 (0, fp_js_1.unwrapAsync)((0, permissionsCreatePermission_js_1.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 (0, fp_js_1.unwrapAsync)((0, permissionsCreateRole_js_1.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 (0, fp_js_1.unwrapAsync)((0, permissionsDeletePermission_js_1.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 (0, fp_js_1.unwrapAsync)((0, permissionsDeleteRole_js_1.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 (0, fp_js_1.unwrapAsync)((0, permissionsGetPermission_js_1.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 (0, fp_js_1.unwrapAsync)((0, permissionsGetRole_js_1.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 (0, fp_js_1.unwrapAsync)((0, permissionsListPermissions_js_1.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 (0, fp_js_1.unwrapAsync)((0, permissionsListRoles_js_1.permissionsListRoles)(this, request, options));
}
}
exports.Permissions = Permissions;
//# sourceMappingURL=permissions.js.map