1616import re
1717import typing
1818import warnings
19+ from enum import Enum
20+ from typing import Optional , Type , Union
1921
2022from .common import (
2123 ClientError ,
@@ -1319,7 +1321,7 @@ def create_user(
13191321 email : str ,
13201322 password : str ,
13211323 workspace_id : int ,
1322- workspace_role : str | WorkspaceRole ,
1324+ workspace_role : Union [ str , WorkspaceRole ] ,
13231325 username : str = None ,
13241326 notify_user : bool = False ,
13251327 ) -> dict :
@@ -1367,7 +1369,11 @@ def list_workspace_members(self, workspace_id: int) -> typing.List[dict]:
13671369 return json .load (resp )
13681370
13691371 def update_workspace_member (
1370- self , workspace_id : int , user_id : int , workspace_role : str | WorkspaceRole , reset_projects_roles : bool = False
1372+ self ,
1373+ workspace_id : int ,
1374+ user_id : int ,
1375+ workspace_role : Union [str , WorkspaceRole ],
1376+ reset_projects_roles : bool = False ,
13711377 ) -> dict :
13721378 """
13731379 Update workspace role of a workspace member, optionally resets the projects role
@@ -1402,7 +1408,7 @@ def list_project_collaborators(self, project_id: str) -> typing.List[dict]:
14021408 project_collaborators = self .get (f"v2/projects/{ project_id } /collaborators" )
14031409 return json .load (project_collaborators )
14041410
1405- def add_project_collaborator (self , project_id : str , user : str , project_role : ProjectRole | str ) -> dict :
1411+ def add_project_collaborator (self , project_id : str , user : str , project_role : Union [ str , ProjectRole ] ) -> dict :
14061412 """
14071413 Add a user to project collaborators and grant them a project role.
14081414 Fails if user is already a member of the project.
@@ -1419,7 +1425,7 @@ def add_project_collaborator(self, project_id: str, user: str, project_role: Pro
14191425 project_collaborator = self .post (f"v2/projects/{ project_id } /collaborators" , params , json_headers )
14201426 return json .load (project_collaborator )
14211427
1422- def update_project_collaborator (self , project_id : str , user_id : int , project_role : ProjectRole | str ) -> dict :
1428+ def update_project_collaborator (self , project_id : str , user_id : int , project_role : Union [ str , ProjectRole ] ) -> dict :
14231429 """
14241430 Update project role of the existing project collaborator.
14251431 Fails if user is not a member of the project yet.
@@ -1506,7 +1512,7 @@ def send_logs(
15061512 request = urllib .request .Request (url , data = payload , headers = header )
15071513 return self ._do_request (request )
15081514
1509- def create_invitation (self , workspace_id : int , email : str , workspace_role : str | WorkspaceRole ):
1515+ def create_invitation (self , workspace_id : int , email : str , workspace_role : Union [ str , WorkspaceRole ] ):
15101516 """
15111517 Create invitation to workspace for specific role
15121518 """
0 commit comments