|
| 1 | +from fastapi import APIRouter |
| 2 | +from fastapi.routing import APIRoute |
| 3 | + |
| 4 | +from codegate.api import v1_models |
| 5 | + |
| 6 | +v1 = APIRouter() |
| 7 | + |
| 8 | + |
| 9 | +def uniq_name(route: APIRoute): |
| 10 | + return f"v1_{route.name}" |
| 11 | + |
| 12 | + |
| 13 | +@v1.get("/workspaces", tags=["Workspaces"], generate_unique_id_function=uniq_name) |
| 14 | +async def list_workspaces() -> v1_models.ListWorkspacesResponse: |
| 15 | + """List all workspaces.""" |
| 16 | + raise NotImplementedError |
| 17 | + |
| 18 | +@v1.get("/workspaces/active", tags=["Workspaces"], generate_unique_id_function=uniq_name) |
| 19 | +async def list_active_workspaces() -> v1_models.ListActiveWorkspacesResponse: |
| 20 | + """List all active workspaces. |
| 21 | +
|
| 22 | + In it's current form, this function will only return one workspace. That is, |
| 23 | + the globally active workspace.""" |
| 24 | + raise NotImplementedError |
| 25 | + |
| 26 | +@v1.post("/workspaces", tags=["Workspaces"], generate_unique_id_function=uniq_name, status_code=201) |
| 27 | +async def create_workspace(request: v1_models.CreateWorkspaceRequest): |
| 28 | + """Create a new workspace.""" |
| 29 | + raise NotImplementedError |
| 30 | + |
| 31 | +@v1.get("/workspaces/{workspace_name}", tags=["Workspaces"], generate_unique_id_function=uniq_name) |
| 32 | +async def get_workspace(workspace_name: str) -> v1_models.Workspace: |
| 33 | + """Get a workspace by name.""" |
| 34 | + raise NotImplementedError |
| 35 | + |
| 36 | +@v1.delete("/workspaces/{workspace_name}", tags=["Workspaces"], |
| 37 | + generate_unique_id_function=uniq_name, status_code=204) |
| 38 | +async def delete_workspace(workspace_name: str): |
| 39 | + """Delete a workspace by name.""" |
| 40 | + raise NotImplementedError |
0 commit comments