Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion polyanalyst6api/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,35 @@ def save(self) -> None:
"""Initiates saving of all changes that have been made in the project."""
self.api.post('project/save', json={'prjUUID': self.uuid})

def spaces(self) -> List[Dict]:
"""This operation returns a list of project spaces.

:return: project spaces
"""
return self.api.get('project/spaces')

def rename(self, new_name: Optional[str] = None, new_description: Optional[str] = None) -> None:
"""
:raises: ValueError if no parameter is set

This operation allows users to rename a project and to give it a new description.
The operation is available only for project owners and administrators and can not be undone.
"""
if not new_name and not new_description:
raise ValueError("Must be specify one of the 'name' or 'description' parameters'")

payload = {'prjUUID': self.uuid}

if new_name:
payload['name'] = new_name
if new_description:
payload['description'] = new_description

self.api.post('project/rename', json=payload)

def get_project_list(self) -> List[Dict[str, Any]]:
return self.api.get('projects')

def abort(self) -> None:
"""Aborts the execution of all nodes in the project."""
self.api.post('project/global-abort', json={'prjUUID': self.uuid})
Expand Down Expand Up @@ -285,7 +314,6 @@ def info(self):
"""
return self.api.get('project/info', params={'prjUUID': self.uuid})


def unload(self, force_unload: bool = False) -> None:
"""
Unload the project from the memory.
Expand Down