From da13b9313d1b6c3c0ebfb56a69c63393ae3074cd Mon Sep 17 00:00:00 2001 From: Vitalii Bulyzhyn Date: Thu, 16 Feb 2023 11:12:20 -0500 Subject: [PATCH 1/3] Add file type to creating compound file --- sdk/diffgram/file/compound_file.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/diffgram/file/compound_file.py b/sdk/diffgram/file/compound_file.py index 716b22e..3622400 100644 --- a/sdk/diffgram/file/compound_file.py +++ b/sdk/diffgram/file/compound_file.py @@ -108,11 +108,12 @@ class CompoundFile: parent_file_data: dict child_files: List[CompoundChildFile] - def __init__(self, project: Project, name: str, directory_id: int): + def __init__(self, project: Project, name: str, directory_id: int, type: str = 'compound'): self.project = project self.name = name self.directory_id = directory_id self.child_files = [] + self.type = type @staticmethod def from_dict(project: Project, dir_id: int, dict_data: dict): @@ -162,7 +163,8 @@ def __create_compound_parent_file(self): url = f'/api/v1/project/{self.project.project_string_id}/file/new-compound' data = { 'name': self.name, - 'directory_id': self.directory_id + 'directory_id': self.directory_id, + 'type': self.type } response = self.project.session.post(url = self.project.host + url, json = data) From 0cf3cd8c31c4fb0e7598e7f55e82315bb632039b Mon Sep 17 00:00:00 2001 From: Vitalii Bulyzhyn Date: Thu, 16 Feb 2023 11:14:51 -0500 Subject: [PATCH 2/3] Rename type to file type --- sdk/diffgram/file/compound_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/diffgram/file/compound_file.py b/sdk/diffgram/file/compound_file.py index 3622400..d90c37a 100644 --- a/sdk/diffgram/file/compound_file.py +++ b/sdk/diffgram/file/compound_file.py @@ -108,12 +108,12 @@ class CompoundFile: parent_file_data: dict child_files: List[CompoundChildFile] - def __init__(self, project: Project, name: str, directory_id: int, type: str = 'compound'): + def __init__(self, project: Project, name: str, directory_id: int, file_type: str = 'compound'): self.project = project self.name = name self.directory_id = directory_id self.child_files = [] - self.type = type + self.type = file_type @staticmethod def from_dict(project: Project, dir_id: int, dict_data: dict): From f897c59dc66b03f8303f1c1fcfabe64cbf7d833f Mon Sep 17 00:00:00 2001 From: PJEstrada Date: Fri, 17 Feb 2023 07:25:06 -0600 Subject: [PATCH 3/3] feat: add instance list to compound root file. (#57) --- sdk/diffgram/file/compound_file.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sdk/diffgram/file/compound_file.py b/sdk/diffgram/file/compound_file.py index 716b22e..c94524c 100644 --- a/sdk/diffgram/file/compound_file.py +++ b/sdk/diffgram/file/compound_file.py @@ -107,12 +107,14 @@ class CompoundFile: project: Project parent_file_data: dict child_files: List[CompoundChildFile] + instance_list: List[dict] - def __init__(self, project: Project, name: str, directory_id: int): + def __init__(self, project: Project, name: str, directory_id: int, instance_list: List[dict] = []): self.project = project self.name = name self.directory_id = directory_id self.child_files = [] + self.instance_list = instance_list @staticmethod def from_dict(project: Project, dir_id: int, dict_data: dict): @@ -162,7 +164,8 @@ def __create_compound_parent_file(self): url = f'/api/v1/project/{self.project.project_string_id}/file/new-compound' data = { 'name': self.name, - 'directory_id': self.directory_id + 'directory_id': self.directory_id, + 'instance_list': self.instance_list } response = self.project.session.post(url = self.project.host + url, json = data)