From 0a335a62526896c9340ae4d65acf4bb063345e63 Mon Sep 17 00:00:00 2001 From: Andrii Bodnar Date: Wed, 2 Aug 2023 11:46:39 +0300 Subject: [PATCH] feat: distributions API updates (#95) --- .../api_resources/distributions/enums.py | 4 +--- .../api_resources/distributions/resource.py | 12 ++++------ .../tests/test_distributions_resources.py | 24 +++++++------------ 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/crowdin_api/api_resources/distributions/enums.py b/crowdin_api/api_resources/distributions/enums.py index b71a45e..e0a5044 100644 --- a/crowdin_api/api_resources/distributions/enums.py +++ b/crowdin_api/api_resources/distributions/enums.py @@ -5,9 +5,7 @@ class DistributionPatchPath(Enum): EXPORT_MODE = "/exportMode" NAME = "/name" FILE_IDS = "/fileIds" - FORMAT = "/format" - EXPORT_PATTERN = "/exportPattern" - LABEL_IDS = "/labelIds" + BUNDLE_IDS = "/bundleIds" class ExportMode(Enum): diff --git a/crowdin_api/api_resources/distributions/resource.py b/crowdin_api/api_resources/distributions/resource.py index cd0931a..26b9267 100644 --- a/crowdin_api/api_resources/distributions/resource.py +++ b/crowdin_api/api_resources/distributions/resource.py @@ -42,11 +42,9 @@ def add_distribution( self, projectId: int, name: str, - fileIds: Iterable[int], - exportMode: Optional[ExportMode] = ExportMode.DEFAULT, - format: Optional[str] = None, - exportPattern: Optional[str] = None, - labelIds: Optional[Iterable[int]] = None + fileIds: Optional[Iterable[int]] = None, + bundleIds: Optional[Iterable[int]] = None, + exportMode: Optional[ExportMode] = ExportMode.DEFAULT ): """ Add Distribution. @@ -62,9 +60,7 @@ def add_distribution( "exportMode": exportMode, "name": name, "fileIds": fileIds, - "format": format, - "exportPattern": exportPattern, - "labelIds": labelIds + "bundleIds": bundleIds }, ) diff --git a/crowdin_api/api_resources/distributions/tests/test_distributions_resources.py b/crowdin_api/api_resources/distributions/tests/test_distributions_resources.py index 1a3f77f..0bb7fd1 100644 --- a/crowdin_api/api_resources/distributions/tests/test_distributions_resources.py +++ b/crowdin_api/api_resources/distributions/tests/test_distributions_resources.py @@ -43,33 +43,27 @@ def test_list_distributions(self, m_request, base_absolut_url): { "name": "test", "fileIds": [1, 2, 3], + "bundleIds": None, }, { "name": "test", "fileIds": [1, 2, 3], - "exportMode": ExportMode.DEFAULT, - "format": None, - "exportPattern": None, - "labelIds": None - + "bundleIds": None, + "exportMode": ExportMode.DEFAULT }, ), ( { "name": "test", - "fileIds": [1, 2, 3], - "exportMode": ExportMode.BUNDLE, - "format": "crowdin-resx", - "exportPattern": "strings-%two_letter_code%.resx", - "labelIds": [1, 2, 3, 4], + "bundleIds": [1], + "fileIds": None, + "exportMode": ExportMode.BUNDLE }, { "name": "test", - "fileIds": [1, 2, 3], - "exportMode": ExportMode.BUNDLE, - "format": "crowdin-resx", - "exportPattern": "strings-%two_letter_code%.resx", - "labelIds": [1, 2, 3, 4], + "bundleIds": [1], + "fileIds": None, + "exportMode": ExportMode.BUNDLE }, ), ),