Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add file type to creating compound file #58

Merged
merged 4 commits into from
Feb 22, 2023
Merged
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
9 changes: 7 additions & 2 deletions sdk/diffgram/file/compound_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,15 @@ 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] = [], file_type: str = 'compound'):
self.project = project
self.name = name
self.directory_id = directory_id
self.child_files = []
self.instance_list = instance_list
self.type = file_type

@staticmethod
def from_dict(project: Project, dir_id: int, dict_data: dict):
Expand Down Expand Up @@ -162,7 +165,9 @@ 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,
'type': self.type
}
response = self.project.session.post(url = self.project.host + url,
json = data)
Expand Down