User Group
- class labelbox.schema.user_group.UserGroup(client: Client, id: str = '', name: str = '', color: UserGroupColor = UserGroupColor.BLUE, users: Set[User] = {}, projects: Set[Project] = {})[source]
Bases:
BaseModelRepresents a user group in Labelbox.
- id
The ID of the user group.
- Type:
str
- name
The name of the user group.
- Type:
str
- color
The color of the user group.
- Type:
- users
The set of users in the user group.
- Type:
Set[UserGroupUser]
- projects
The set of projects associated with the user group.
- Type:
Set[UserGroupProject]
- __init__(self, client
Client)
- get_user_groups(client
Client) -> Iterator[“UserGroup”]
- create() UserGroup[source]
Creates a new user group.
- Raises:
ResourceCreationError – If the group already exists.
ValueError – If the group name is not provided.
- Returns:
The created user group.
- Return type:
- delete() bool[source]
Deletes the user group from Labelbox.
This method sends a mutation request to the Labelbox API to delete the user group with the specified ID. If the deletion is successful, it returns True. Otherwise, it raises an UnprocessableEntityError and returns False.
- Returns:
True if the user group was successfully deleted, False otherwise.
- Return type:
bool
- Raises:
ResourceNotFoundError – If the deletion of the user group fails due to not existing
ValueError – If the group ID is not provided.
- get() UserGroup[source]
Reloads the user group information from the server.
This method sends a GraphQL query to the server to fetch the latest information about the user group, including its name, color, projects, and members. The fetched information is then used to update the corresponding attributes of the Group object.
- Returns:
The updated UserGroup object.
- Return type:
- Raises:
ResourceNotFoundError – If the query fails to fetch the group information.
ValueError – If the group ID is not provided.
- update() UserGroup[source]
Updates the group in Labelbox.
- Returns:
The updated UserGroup object. (self)
- Return type:
- Raises:
ResourceNotFoundError – If the update fails due to unknown user group
UnprocessableEntityError – If the update fails due to a malformed input
ValueError – If the group id or name is not provided
- class labelbox.schema.user_group.UserGroupColor(value)[source]
Bases:
EnumEnum representing the colors available for a group.
- BLUE
Hex color code for blue (#9EC5FF).
- Type:
str
- PURPLE
Hex color code for purple (#CEB8FF).
- Type:
str
- ORANGE
Hex color code for orange (#FFB35F).
- Type:
str
- CYAN
Hex color code for cyan (#4ED2F9).
- Type:
str
- PINK
Hex color code for pink (#FFAEA9).
- Type:
str
- LIGHT_PINK
Hex color code for light pink (#FFA9D5).
- Type:
str
- GREEN
Hex color code for green (#3FDC9A).
- Type:
str
- YELLOW
Hex color code for yellow (#E7BF00).
- Type:
str
- GRAY
Hex color code for gray (#B8C4D3).
- Type:
str