diff --git a/api/__init__.py b/api/__init__.py index 4ea2a94..408e40e 100644 --- a/api/__init__.py +++ b/api/__init__.py @@ -2,6 +2,8 @@ from .project import have_project, create_project, delete_project from .project import is_project_open, open_project, close_project from .project import copy_project +from .change_set import ChangeSet + from .operation import execute_undo as undo from .operation import execute_redo as redo from .operation import have_snapshot, take_snapshot, pick_snapshot diff --git a/api/change_set.py b/api/change_set.py new file mode 100644 index 0000000..efedeff --- /dev/null +++ b/api/change_set.py @@ -0,0 +1,14 @@ +class ChangeSet: + def __init__(self) -> None: + self.added : list[dict[str, str]] = {} + self.deleted : list[dict[str, str]] = {} + self.updated : list[dict[str, str]] = {} + + def add(self, type: str, id: str) -> None: + self.added.append({ 'type': type, 'id': id }) + + def delete(self, type: str, id: str) -> None: + self.deleted.append({ 'type': type, 'id': id }) + + def update(self, type: str, id: str, property: str) -> None: + self.updated.append({ 'type': type, 'id': id, 'property': property }) \ No newline at end of file diff --git a/tjnetwork_new.py b/tjnetwork_new.py index f7a3845..e3661a8 100644 --- a/tjnetwork_new.py +++ b/tjnetwork_new.py @@ -1,6 +1,13 @@ import api +############################################################ +# ChangeSet +############################################################ + +ChangeSet = api.ChangeSet + + ############################################################ # enum ############################################################