Skip to content

Role

Roles resource for user and permission role management.

SyncRoles

SyncRoles(client: SyncClient)

Bases: BaseResource['SyncClient']

Roles resource for RBAC role management.

Methods:

  • create

    Create a new role.

  • delete

    Delete role.

  • get

    Get role by ID.

  • get_all

    List all roles.

  • patch

    Partially update role.

  • update

    Update role (full replacement).

create

create(data: RoleCreate) -> str

Create a new role.

delete

delete(role_id: str) -> None

Delete role.

get

get(role_id: str) -> RoleInstance

Get role by ID.

get_all

get_all() -> list[RoleInstance]

List all roles.

patch

patch(role_id: str, data: RolePatch) -> bool

Partially update role.

update

update(role_id: str, data: RoleUpdate) -> bool

Update role (full replacement).

AsyncRoles

AsyncRoles(client: AsyncClient)

Bases: BaseResource['AsyncClient']

Async roles resource for RBAC role management.

Methods:

  • create

    Create a new role.

  • delete

    Delete role by ID.

  • get

    Get role by ID.

  • get_all

    List all roles.

  • patch

    Partially update a role.

  • update

    Fully update a role.

create async

create(data: RoleCreate) -> str

Create a new role.

Parameters:

Returns: The ID of the created role.

delete async

delete(role_id: str) -> None

Delete role by ID.

Parameters:

  • role_id

    (str) –

    The unique identifier of the role to delete.

get async

Get role by ID.

Parameters:

  • role_id

    (str) –

    The unique identifier of the role to retrieve.

Returns: The role instance corresponding to the provided ID.

get_all async

get_all() -> list[RoleInstance]

List all roles.

patch async

patch(role_id: str, data: RolePatch) -> bool

Partially update a role.

Parameters:

  • role_id

    (str) –

    The unique identifier of the role to patch.

  • data

    (RolePatch) –

    The partial role data to update.

Returns:

  • bool ( bool ) –

    True if the patch was successful, False otherwise.

update async

update(role_id: str, data: RoleUpdate) -> bool

Fully update a role.

Parameters:

  • role_id

    (str) –

    The unique identifier of the role to update.

  • data

    (RoleUpdate) –

    The complete role data for replacement.

Returns:

  • bool ( bool ) –

    True if the update was successful, False otherwise.

Request and response types: Role models.