From bdd9c399c09b2e98eba2bf88e8954c8d56c169c4 Mon Sep 17 00:00:00 2001 From: Andrii Bodnar Date: Wed, 2 Aug 2023 11:35:07 +0300 Subject: [PATCH 1/2] feat: distributions API updates --- .../api_resources/distributions/enums.py | 4 +--- .../api_resources/distributions/resource.py | 12 ++++------- .../tests/test_distributions_resources.py | 20 +++++-------------- 3 files changed, 10 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..b5ae81c 100644 --- a/crowdin_api/api_resources/distributions/tests/test_distributions_resources.py +++ b/crowdin_api/api_resources/distributions/tests/test_distributions_resources.py @@ -47,29 +47,19 @@ def test_list_distributions(self, m_request, base_absolut_url): { "name": "test", "fileIds": [1, 2, 3], - "exportMode": ExportMode.DEFAULT, - "format": None, - "exportPattern": None, - "labelIds": 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], + "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": [2], + "exportMode": ExportMode.BUNDLE }, ), ), From 6442d4ff00d15bfc49d243d8570f107bd0296dd3 Mon Sep 17 00:00:00 2001 From: Andrii Bodnar Date: Wed, 2 Aug 2023 11:42:10 +0300 Subject: [PATCH 2/2] test --- .../distributions/tests/test_distributions_resources.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 b5ae81c..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,10 +43,12 @@ def test_list_distributions(self, m_request, base_absolut_url): { "name": "test", "fileIds": [1, 2, 3], + "bundleIds": None, }, { "name": "test", "fileIds": [1, 2, 3], + "bundleIds": None, "exportMode": ExportMode.DEFAULT }, ), @@ -54,11 +56,13 @@ def test_list_distributions(self, m_request, base_absolut_url): { "name": "test", "bundleIds": [1], + "fileIds": None, "exportMode": ExportMode.BUNDLE }, { "name": "test", - "bundleIds": [2], + "bundleIds": [1], + "fileIds": None, "exportMode": ExportMode.BUNDLE }, ),