Skip to content

Commit

Permalink
feat: distributions API updates
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-bodnar committed Aug 2, 2023
1 parent 59fd03c commit bdd9c39
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 26 deletions.
4 changes: 1 addition & 3 deletions crowdin_api/api_resources/distributions/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 4 additions & 8 deletions crowdin_api/api_resources/distributions/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -62,9 +60,7 @@ def add_distribution(
"exportMode": exportMode,
"name": name,
"fileIds": fileIds,
"format": format,
"exportPattern": exportPattern,
"labelIds": labelIds
"bundleIds": bundleIds
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
),
),
Expand Down

0 comments on commit bdd9c39

Please sign in to comment.