GroupsClient
Methods
__init__()
find()
Search for groups by name.
Parameters
| Name | Type | Description |
|---|---|---|
| query | str | Search query to match against group names |
Returns
| Type | Description |
|---|---|
| List[Group] | List of Group instances matching the search query |
get()
Get detailed information about a specific group.
Parameters
| Name | Type | Description |
|---|---|---|
| id | str | ID or name of the group to retrieve |
Returns
| Type | Description |
|---|---|
| Group | Group instance with detailed information |
save()
Save or update a group.
Parameters
| Name | Type | Description |
|---|---|---|
| group | Group | The group to save or update |
| save_relations | bool | Whether to save group relations (members and memberships) |
Returns
| Type | Description |
|---|---|
| Group | The saved group instance |
delete()
Deletes a group.
Parameters
| Name | Type | Description |
|---|---|---|
| group | Group or str | The group to delete or (group name or group id) |
list()
List groups from Datagrok with optional filtering and inclusion of related data.
Parameters
| Name | Type | Description |
|---|---|---|
| smart_filter | Optional[str] | Optional smart search filter to apply |
| include_personal | bool | Whether to include personal groups in the results |
| include_members | bool | Whether to include group members in the results |
| include_memberships | bool | Whether to include group memberships in the results |
Returns
| Type | Description |
|---|---|
| List[Group] | List of Group instances matching the criteria |
add_member()
Adds a child group or user as a member of a parent group.
Parameters
| Name | Type | Description |
|---|---|---|
| parent | Group or str | The parent group or its name. |
| child | Group, User, or str | The group, user, or their name to be added to the parent group. |
| is_admin | bool, optional | Whether the child should be granted admin privileges (default is False). |
Returns
| Type | Description |
|---|---|
| Group | The updated parent group with the new member added. |
get_members()
Get members of a specific group.
Parameters
| Name | Type | Description |
|---|---|---|
| group_id | str | ID of the group to get members for |
| admin | Optional[bool] | If True, returns only admin members. If False, returns only non-admin members. If None, returns all members. |
Returns
| Type | Description |
|---|---|
| List[Group] | List of Group instances representing the members |
get_memberships()
Get memberships of a specific group.
Parameters
| Name | Type | Description |
|---|---|---|
| group | Group | The group to get memberships for |
| admin | Optional[bool] | If True, returns only admin memberships. If False, returns only non-admin memberships. If None, returns all memberships. |
Returns
| Type | Description |
|---|---|
| List[Group] | List of Group instances representing the memberships |
current()
Returns the group associated with the current authenticated user.
Returns
| Type | Description |
|---|---|
| Group | Group instance representing the current user's group |