@@ -1285,6 +1285,15 @@ def has_editor_support(self):
12851285 """
12861286 return is_version_acceptable (self .server_version (), "2024.4.0" )
12871287
1288+ def check_collaborators_members_support (self ):
1289+ """
1290+ Check if the server is compatible with v2 endpoints for project collaborators and workspace members
1291+ https://github.com/MerginMaps/server-private/releases/tag/2025.1.0
1292+ """
1293+ min_version = "2025.1.0"
1294+ if not is_version_acceptable (self .server_version (), f"{ min_version } " ):
1295+ raise NotImplementedError (f"This needs server at version { min_version } or later" )
1296+
12881297 def create_user (
12891298 self ,
12901299 email : str ,
@@ -1304,6 +1313,7 @@ def create_user(
13041313 param username: username - will be autogenerated from the email if not provided
13051314 param notify_user: flag for email notifications - confirmation email will be sent
13061315 """
1316+ self .check_collaborators_members_support ()
13071317 params = {
13081318 "email" : email ,
13091319 "password" : password ,
@@ -1320,13 +1330,15 @@ def get_workspace_member(self, workspace_id: int, user_id: int) -> dict:
13201330 """
13211331 Get a workspace member detail
13221332 """
1333+ self .check_collaborators_members_support ()
13231334 resp = self .get (f"v2/workspaces/{ workspace_id } /members/{ user_id } " )
13241335 return json .load (resp )
13251336
13261337 def list_workspace_members (self , workspace_id : int ) -> List [dict ]:
13271338 """
13281339 Get a list of workspace members
13291340 """
1341+ self .check_collaborators_members_support ()
13301342 resp = self .get (f"v2/workspaces/{ workspace_id } /members" )
13311343 return json .load (resp )
13321344
@@ -1338,6 +1350,7 @@ def update_workspace_member(
13381350
13391351 param reset_projects_roles: all project specific roles will be removed
13401352 """
1353+ self .check_collaborators_members_support ()
13411354 params = {
13421355 "reset_projects_roles" : reset_projects_roles ,
13431356 "workspace_role" : workspace_role .value ,
@@ -1349,12 +1362,14 @@ def remove_workspace_member(self, workspace_id: int, user_id: int):
13491362 """
13501363 Remove a user from workspace members
13511364 """
1365+ self .check_collaborators_members_support ()
13521366 self .delete (f"v2/workspaces/{ workspace_id } /members/{ user_id } " )
13531367
13541368 def list_project_collaborators (self , project_id : str ) -> List [dict ]:
13551369 """
13561370 Get a list of project collaborators
13571371 """
1372+ self .check_collaborators_members_support ()
13581373 project_collaborators = self .get (f"v2/projects/{ project_id } /collaborators" )
13591374 return json .load (project_collaborators )
13601375
@@ -1365,6 +1380,7 @@ def add_project_collaborator(self, project_id: str, user: str, project_role: Pro
13651380
13661381 param user: login (username or email) of the user
13671382 """
1383+ self .check_collaborators_members_support ()
13681384 params = {"role" : project_role .value , "user" : user }
13691385 project_collaborator = self .post (f"v2/projects/{ project_id } /collaborators" , params , json_headers )
13701386 return json .load (project_collaborator )
@@ -1374,6 +1390,7 @@ def update_project_collaborator(self, project_id: str, user_id: int, project_rol
13741390 Update project role of the existing project collaborator.
13751391 Fails if user is not a member of the project yet.
13761392 """
1393+ self .check_collaborators_members_support ()
13771394 params = {"role" : project_role .value }
13781395 project_collaborator = self .patch (f"v2/projects/{ project_id } /collaborators/{ user_id } " , params , json_headers )
13791396 return json .load (project_collaborator )
@@ -1382,6 +1399,7 @@ def remove_project_collaborator(self, project_id: str, user_id: int):
13821399 """
13831400 Remove a user from project collaborators
13841401 """
1402+ self .check_collaborators_members_support ()
13851403 self .delete (f"v2/projects/{ project_id } /collaborators/{ user_id } " )
13861404
13871405 def server_config (self ) -> dict :
0 commit comments