Skip to content

Commit 460e9ec

Browse files
authored
Feature/workspaces (#2)
* feat(codesphere/workspace): add workspace resources * bump: version 0.1.1 → 0.2.0
1 parent 4c44c6b commit 460e9ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+287
-102
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v0.2.0 (2025-07-16)
2+
3+
### Feat
4+
5+
- **codesphere/workspace**: add workspace resources
6+
17
## v0.1.1 (2025-07-16)
28

39
### Fix
File renamed without changes.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ commit: ## Starts Commitizen for a guided commit message
2727

2828
lint: ## Checks code quality with ruff
2929
@echo ">>> Checking code quality with ruff..."
30-
uv run ruff check src
30+
uv run ruff check src --fix
3131

3232
format: ## Formats code with ruff
3333
@echo ">>> Formatting code with ruff..."
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import asyncio
2+
import pprint
3+
from codesphere import CodesphereSDK, WorkspaceCreate
4+
5+
6+
async def main():
7+
"""Creates a new workspace in a specific team."""
8+
team_id = 12345
9+
10+
async with CodesphereSDK() as sdk:
11+
print(f"--- Creating a new workspace in team {team_id} ---")
12+
13+
workspace_data = WorkspaceCreate(
14+
name="my-new-sdk-workspace-3",
15+
planId=8,
16+
teamId=int(team_id),
17+
isPrivateRepo=True,
18+
replicas=1,
19+
)
20+
21+
created_workspace = await sdk.workspaces.create(data=workspace_data)
22+
23+
print("\n--- Details of successfully created workspace ---")
24+
pprint.pprint(created_workspace.model_dump())
25+
26+
27+
if __name__ == "__main__":
28+
asyncio.run(main())
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import asyncio
2+
from codesphere import CodesphereSDK
3+
4+
5+
async def main():
6+
"""Deletes a specific workspace."""
7+
8+
workspace_id_to_delete = 12345
9+
10+
async with CodesphereSDK() as sdk:
11+
print(f"--- Fetching workspace with ID: {workspace_id_to_delete} ---")
12+
workspace_to_delete = await sdk.workspaces.get(
13+
workspace_id=workspace_id_to_delete
14+
)
15+
16+
print(f"\n--- Deleting workspace: '{workspace_to_delete.name}' ---")
17+
18+
# This is a destructive action!
19+
await workspace_to_delete.delete()
20+
21+
print(f"Workspace '{workspace_to_delete.name}' has been successfully deleted.")
22+
23+
24+
if __name__ == "__main__":
25+
asyncio.run(main())
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)