diff --git a/pycaprio/core/adapters/http_adapter.py b/pycaprio/core/adapters/http_adapter.py index cb5e7bb..ae39221 100644 --- a/pycaprio/core/adapters/http_adapter.py +++ b/pycaprio/core/adapters/http_adapter.py @@ -101,8 +101,9 @@ def delete_annotation(self, project_id: int, document_id: int, user_name: str): allowed_statuses=(204, 200)) return True - def export_project(self, project_id: int) -> bytes: - response = self.client.get(f"/projects/{project_id}/export.zip", allowed_statuses=(200,)) + def export_project(self, project_id: int, format: str = DocumentFormats.DEFAULT) -> bytes: + response = self.client.get(f"/projects/{project_id}/export.zip", allowed_statuses=(200,), + params={'format': format}) return response.content def import_project(self, zip_stream: IO) -> Project: diff --git a/pycaprio/core/interfaces/adapter.py b/pycaprio/core/interfaces/adapter.py index c4d58a4..c1f89d4 100644 --- a/pycaprio/core/interfaces/adapter.py +++ b/pycaprio/core/interfaces/adapter.py @@ -61,11 +61,13 @@ def annotations(self, project_id: int, document_id: int) -> List[Annotation]: pass # pragma: no cover @abstractmethod - def annotation(self, project_id: int, document_id: int, annotation_id: int) -> bytes: + def annotation(self, project_id: int, document_id: int, annotation_id: int, + format: str = DocumentFormats.DEFAULT) -> bytes: """ Retrieves a Document :param project_id: The project_id of the Project where the Annotation is located :param document_id: The document_id of the Document where the Annotation is located + :param format: Format in which the annotation will be downloaded :return: Content of the Annotation in bytes """ pass # pragma: no cover @@ -98,7 +100,7 @@ def create_document(self, project_id: int, document_name: str, content: IO, @abstractmethod def create_annotation(self, project_id: int, document_id: int, user_name: str, content: IO, - annotation_format: str = DocumentFormats.DEFAULT, state: str = AnnotationStatus): + annotation_format: str = DocumentFormats.DEFAULT, state: str = AnnotationStatus.DEFAULT): """ Creates a Document :param project_id: Id of the Project where the new Document will be created @@ -139,10 +141,11 @@ def delete_annotation(self, project_id: int, document_id: int, user_name: str) - pass # pragma: no cover @abstractmethod - def export_project(self, project_id: int) -> bytes: + def export_project(self, project_id: int, format: str = DocumentFormats.DEFAULT) -> bytes: """ Exports a Project into a .zip file. :param project_id: Project id. + :param format: Format in which the documents and annotations will be exported. :return: Zip file in bytes. """ pass # pragma: no cover