Skip to content

Commit f433b61

Browse files
committed
fix(translations): add missing branchIds parameter to apply_pre_translation
- Added branchIds: Optional[Iterable[int]] = None parameter - Updated method signature and request data - Added comprehensive tests for the new parameter - Maintains backward compatibility - Resolves validation error when calling apply_pre_translation Closes #211
1 parent de987df commit f433b61

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

crowdin_api/api_resources/translations/resource.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def apply_pre_translation(
9191
fallbackLanguages: Optional[Iterable[FallbackLanguages]] = None,
9292
labelIds: Optional[Iterable[int]] = None,
9393
excludeLabelIds: Optional[Iterable[int]] = None,
94+
branchIds: Optional[Iterable[int]] = None,
9495
):
9596
"""
9697
Apply Pre-Translation.
@@ -107,6 +108,9 @@ def apply_pre_translation(
107108
if excludeLabelIds is None:
108109
excludeLabelIds = []
109110

111+
if branchIds is None:
112+
branchIds = []
113+
110114
projectId = projectId or self.get_project_id()
111115

112116
return self.requester.request(
@@ -126,6 +130,7 @@ def apply_pre_translation(
126130
"fallbackLanguages": fallbackLanguages,
127131
"labelIds": labelIds,
128132
"excludeLabelIds": excludeLabelIds,
133+
"branchIds": branchIds,
129134
},
130135
)
131136

crowdin_api/api_resources/translations/tests/test_translations_resources.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def test_list_pre_translations(self, m_request, base_absolut_url):
7171
"fallbackLanguages": [],
7272
"labelIds": [],
7373
"excludeLabelIds": [],
74+
"branchIds": [],
7475
},
7576
),
7677
(
@@ -103,6 +104,7 @@ def test_list_pre_translations(self, m_request, base_absolut_url):
103104
"fallbackLanguages": ["lang"],
104105
"labelIds": [1],
105106
"excludeLabelIds": [1],
107+
"branchIds": [],
106108
},
107109
),
108110
),

0 commit comments

Comments
 (0)