Workspaces
Overview
The Workspaces
module provides methods to interact with workspaces in the BuiltAPI platform. This module allows you to list, retrieve, create, update, and remove workspaces.
Methods
list
List workspaces with optional pagination and search filters.
Parameters
skip
(Optional[int]): Number of workspaces to skip. Default is 0.take
(Optional[int]): Number of workspaces to take. Default is 100.search
(Optional[WorkspaceSearchSchema]): Search criteria for filtering workspaces.
Returns
WorkspacesList
: A list of workspaces.
Example
from builtapi import BuiltAPI
client = BuiltAPI()
workspaces = client.workspaces.list(search={"name": "My workspace"}, skip=0, take=50)
print(workspaces)
get_current
Retrieve the current workspace.
Returns
Workspace
: The current workspace.
Example
from builtapi import BuiltAPI
client = BuiltAPI()
current_workspace = client.workspaces.get_current()
print(current_workspace)
create
Create a new workspace.
Parameters
name
(str): The name of the new workspace.
Returns
Workspace
: The newly created workspace.
Example
from builtapi import BuiltAPI
client = BuiltAPI()
new_workspace = client.workspaces.create(name='new_workspace')
print(new_workspace)
update
Update the current workspace.
Parameters
name
(str): The new name of the workspace.
Returns
Workspace
: The updated workspace.
Example
from builtapi import BuiltAPI
client = BuiltAPI()
updated_workspace = client.workspaces.update(name='updated_workspace')
print(updated_workspace)
remove
Remove the current workspace.
Returns
Workspace
: The removed workspace.
Example
from builtapi import BuiltAPI
client = BuiltAPI()
removed_workspace = client.workspaces.remove()
print(removed_workspace)
leave
Leave the current workspace. You can only leave a workspace if you are not the last OWNER.
Returns
Workspace
: The workspace that was left.
Example
from builtapi import BuiltAPI
client = BuiltAPI()
left_workspace = client.workspaces.leave()
print(left_workspace)
Schemas
Workspace
class Workspace(BaseModel):
"""
Dataclass describes Workspace in BuiltAPI
"""
id: Optional[str] = None
created_at: Optional[str] = None
updated_at: Optional[str] = None
name: str
WorkspacesList
class WorkspacesList(BaseModel):
"""
Dataclass describes Workspaces as list
"""
take: Optional[int] = None
count: Optional[int] = None
total: Optional[int] = None
items: Optional[List[Workspace]] = None
WorkspaceSearchSchema
class WorkspaceSearchSchema(BaseModel):
"""
Dataclass describes Workspace search criteria
"""
name: Optional[str] = None