BackstageClient.roles
BackstageClient.roles in @ticketlayer/backstage.
@ticketlayer/backstage / BackstageClient / roles
roles: {
create: (request: {
description?: string;
name: string;
permissions: string[];
}, requestOptions?: RequestOptions) => Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}>;
delete: (id: string, requestOptions?: RequestOptions) => Promise<{
id: string;
success: boolean;
}>;
get: (id: string, requestOptions?: RequestOptions) => Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}>;
list: (requestOptions?: RequestOptions) => Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}[]>;
update: (id: string, request: {
description?: string;
name?: string;
permissions?: string[];
}, requestOptions?: RequestOptions) => Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}>;
};Defined in: client.ts:2213
Roles methods
create()#
create: (request: {
description?: string;
name: string;
permissions: string[];
}, requestOptions?: RequestOptions) => Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}>;Create role Create a new custom role with specified permissions. Permissions use format: resource.action:scope (e.g., events.create, events.read:all, events.*:acc_123)
Parameters#
| Parameter | Type | Description |
|---|---|---|
request | { description?: string; name: string; permissions: string[]; } | - |
request.description? | string | Description Optional description of the role Example Manages events and related resources |
request.name? | string | Description The name of the role Example Event Manager |
request.permissions? | string[] | Description Array of permission strings Example [ "events.*", "venues.read:all", "orders.read" ] |
requestOptions? | RequestOptions | - |
Returns#
Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}>
Operation Id#
createRole
delete()#
delete: (id: string, requestOptions?: RequestOptions) => Promise<{
id: string;
success: boolean;
}>;Delete role Delete a custom role (soft delete). System roles cannot be deleted.
Parameters#
| Parameter | Type |
|---|---|
id | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
id: string;
success: boolean;
}>
Operation Id#
deleteRole
get()#
get: (id: string, requestOptions?: RequestOptions) => Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}>;Get role Get a specific role by ID
Parameters#
| Parameter | Type |
|---|---|
id | string |
requestOptions? | RequestOptions |
Returns#
Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}>
Operation Id#
getRole
list()#
list: (requestOptions?: RequestOptions) => Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}[]>;List roles List all roles for the organisation. Returns both system-defined and custom roles.
Parameters#
| Parameter | Type |
|---|---|
requestOptions? | RequestOptions |
Returns#
Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}[]>
Operation Id#
listRoles
update()#
update: (id: string, request: {
description?: string;
name?: string;
permissions?: string[];
}, requestOptions?: RequestOptions) => Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}>;Update role Update an existing custom role. System roles cannot be modified.
Parameters#
| Parameter | Type | Description |
|---|---|---|
id | string | - |
request | { description?: string; name?: string; permissions?: string[]; } | - |
request.description? | string | Description Optional description of the role Example Manages events and related resources |
request.name? | string | Description The name of the role Example Event Manager |
request.permissions? | string[] | Description Array of permission strings Example [ "events.*", "venues.read:all", "orders.read" ] |
requestOptions? | RequestOptions | - |
Returns#
Promise<{
createdAt: string;
description: string | null;
id: string;
isDeleted: boolean;
isSystemRole: boolean;
name: string;
organisationId: string;
permissions: string[];
updatedAt: string;
}>
Operation Id#
updateRole