evo.workspaces.client.WorkspaceAPIClient
The Workspace Service API client.
from_context
classmethod
from_context(context: IContext) -> WorkspaceAPIClient
Create a WorkspaceAPIClient from the given context.
The context must have a hub_url and org_id set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
IContext
|
The context to create the client from. |
required |
Returns:
| Type | Description |
|---|---|
WorkspaceAPIClient
|
A WorkspaceAPIClient instance. |
get_service_health
async
get_service_health(check_type: HealthCheckType = HealthCheckType.FULL) -> ServiceHealth
Get the health of the workspace service.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
check_type
|
HealthCheckType
|
The type of health check to perform. |
FULL
|
Returns:
| Type | Description |
|---|---|
ServiceHealth
|
A ServiceHealth object. |
Raises:
| Type | Description |
|---|---|
EvoAPIException
|
If the API returns an unexpected status code. |
ClientValueError
|
If the response is not a valid service health check response. |
list_workspaces_summary
async
list_workspaces_summary(
limit: int | None = None,
offset: int | None = None,
order_by: dict[WorkspaceOrderByEnum, OrderByOperatorEnum]
| dict[WorkspaceOrderByLiteral, OrderByOperatorLiteral]
| None = None,
filter_created_by: UUID | None = None,
created_at: str | None = None,
updated_at: str | None = None,
name: str | None = None,
deleted: bool | None = None,
filter_user_id: UUID | None = None,
) -> Page[BasicWorkspace]
Get an optionally paginated list of basic workspaces with optional filtering and sorting.
This method provides faster performance than list_workspaces() or list_all_workspaces() by returning BasicWorkspace objects with minimal data instead of full Workspace objects.
delete_workspace
async
delete_workspace(workspace_id: UUID) -> None
Delete workspaces by workspace id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace_id
|
UUID
|
The workspace id to delete. |
required |
Returns:
| Type | Description |
|---|---|
None
|
An empty response. |
create_workspace
async
create_workspace(
name: str,
bounding_box_coordinates: list[tuple[float, float]] | None = None,
default_coordinate_system: str | None = None,
description: str | None = None,
labels: list[str] | None = None,
) -> Workspace
Create a new workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the workspace. |
required |
bounding_box_coordinates
|
list[tuple[float, float]] | None
|
The coordinates list corresponding to the bounding box of the workspace. The coordinates list should be in the format of [[longitude, latitude], [longitude, latitude], ...] |
None
|
default_coordinate_system
|
str | None
|
The default coordinate system of the workspace. |
None
|
description
|
str | None
|
The description of the workspace. |
None
|
labels
|
list[str] | None
|
The labels of the workspace. |
None
|
Returns:
| Type | Description |
|---|---|
Workspace
|
The created workspace response. |
update_workspace
async
update_workspace(
workspace_id: UUID,
name: str | None = None,
bounding_box_coordinates: list[tuple[float, float]] | None = None,
default_coordinate_system: str | None = None,
description: str | None = None,
labels: list[str] | None = None,
) -> Workspace
Update an existing workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace_id
|
UUID
|
The workspace id to update. |
required |
name
|
str | None
|
The name of the workspace. |
None
|
bounding_box_coordinates
|
list[tuple[float, float]] | None
|
The coordinates list corresponding to the bounding box of the workspace. The coordinates list should be in the format of [[longitude, latitude], [longitude, latitude], ...] |
None
|
default_coordinate_system
|
str | None
|
The default coordinate system of the workspace. |
None
|
description
|
str | None
|
The description of the workspace. |
None
|
labels
|
list[str] | None
|
The labels of the workspace. |
None
|
Returns:
| Type | Description |
|---|---|
Workspace
|
The updated workspace response. |
list_instance_users
async
list_instance_users(limit: int | None = None, offset: int | None = None) -> Page[InstanceUserWithEmail]
Returns a page of the list of instance users.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int | None
|
The maximum number of users to return. |
None
|
offset
|
int | None
|
The offset for pagination. |
None
|
Returns:
| Type | Description |
|---|---|
Page[InstanceUserWithEmail]
|
A page of instance users with email addresses. |
add_users_to_instance
async
add_users_to_instance(users: dict[str, list[UUID]]) -> AddedInstanceUsers
Adds users to the instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
users
|
dict[str, list[UUID]]
|
A dictionary mapping of user emails to their roles. |
required |
Returns:
| Type | Description |
|---|---|
AddedInstanceUsers
|
A list of the users that were added and/or the invitations that were sent. |
list_instance_user_invitations
async
list_instance_user_invitations(limit: int | None = None, offset: int | None = None) -> Page[InstanceUserInvitation]
Returns a page of the list of instance user invitations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int | None
|
The maximum number of invitations to return. |
None
|
offset
|
int | None
|
The offset for pagination. |
None
|
Returns:
| Type | Description |
|---|---|
Page[InstanceUserInvitation]
|
A page of instance user invitations. |
delete_instance_user_invitation
async
delete_instance_user_invitation(invitation_id: UUID) -> None
Deletes an instance user invitation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invitation_id
|
UUID
|
The ID of the invitation to delete. |
required |
list_instance_roles
async
list_instance_roles() -> list[InstanceRoleWithPermissions]
Returns the list of roles available in the instance.
Returns:
| Type | Description |
|---|---|
list[InstanceRoleWithPermissions]
|
A list of instance user roles with their permissions. |
remove_instance_user
async
remove_instance_user(user_id: UUID) -> None
Removes a user from the instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
UUID
|
The ID of the user to remove. |
required |
update_instance_user_roles
async
update_instance_user_roles(user_id: UUID, roles: list[UUID]) -> InstanceUser
Updates the roles of an instance user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
UUID
|
The ID of the user to update. |
required |
roles
|
list[UUID]
|
The new roles to assign to the user. |
required |
Returns:
| Type | Description |
|---|---|
InstanceUser
|
The updated instance user. |