Skip to content

Commit 192ac0d

Browse files
authored
feat: add addToTm parameter support for Add Translation API (#197)
1 parent 8252114 commit 192ac0d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

crowdin_api/api_resources/string_translations/resource.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,14 @@ def add_translation(
249249
text: str,
250250
projectId: Optional[int] = None,
251251
pluralCategoryName: Optional[PluralCategoryName] = None,
252+
addToTm: Optional[bool] = None,
252253
):
253254
"""
254255
Add Translation.
255256
256257
Link to documentation:
257258
https://developer.crowdin.com/api/v2/#operation/api.projects.translations.post
258259
"""
259-
260260
projectId = projectId or self.get_project_id()
261261

262262
return self.requester.request(
@@ -267,6 +267,7 @@ def add_translation(
267267
"languageId": languageId,
268268
"text": text,
269269
"pluralCategoryName": pluralCategoryName,
270+
"addToTm": addToTm,
270271
},
271272
)
272273

crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba
339339
"languageId": "ua",
340340
"text": "text",
341341
"pluralCategoryName": None,
342+
"addToTm": None,
342343
},
343344
),
344345
(
@@ -353,6 +354,7 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba
353354
"languageId": "ua",
354355
"text": "text",
355356
"pluralCategoryName": "some name",
357+
"addToTm": None,
356358
},
357359
),
358360
),
@@ -362,7 +364,7 @@ def test_add_translation(self, m_request, in_params, request_data, base_absolut_
362364
m_request.return_value = "response"
363365

364366
resource = self.get_resource(base_absolut_url)
365-
assert resource.add_translation(projectId=1, **request_data) == "response"
367+
assert resource.add_translation(projectId=1, **in_params) == "response"
366368
m_request.assert_called_once_with(
367369
method="post",
368370
path=resource.get_translations_path(projectId=1),

0 commit comments

Comments
 (0)