This repository was archived by the owner on Jun 28, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,18 @@ class Workspaces(AbstractWorkspaces):
99 def __init__ (self , seam : Seam ):
1010 self .seam = seam
1111
12- def list (self ) -> List [Workspace ]:
13- raise NotImplementedError
12+ def list (self , workspace_id : Optional [str ] = None ) -> List [Workspace ]:
13+ res = requests .get (
14+ f"{ self .seam .api_url } /workspaces/list" ,
15+ params = {"workspace_id" : workspace_id },
16+ headers = {"Authorization" : f"Bearer { self .seam .api_key } " },
17+ )
18+ if res .status_code == 404 :
19+ raise Exception ("workspaces not found" ) # TODO custom exception
20+ if res .status_code != 200 :
21+ raise Exception (res .text )
22+ res_json = res .json ()
23+ return res_json ['workspaces' ]
1424
1525 def get (self , workspace_id : Optional [str ] = None ) -> Workspace :
1626 res = requests .get (
Original file line number Diff line number Diff line change @@ -11,4 +11,5 @@ def test_workspaces(seam: Seam):
1111 reset_sandbox_result = seam .workspaces .reset_sandbox ()
1212 assert reset_sandbox_result is None
1313
14- # seam.workspaces.list() - not implemented
14+ ws_list = seam .workspaces .list ()
15+ assert len (ws_list ) > 0
You can’t perform that action at this time.
0 commit comments