From dd43f419e6617c1a427ee64a557df9c897db55ea Mon Sep 17 00:00:00 2001 From: hriteshMaikap Date: Wed, 30 Oct 2024 00:20:15 +0530 Subject: [PATCH 1/5] Added taskId parameter --- crowdin_api/api_resources/string_translations/resource.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crowdin_api/api_resources/string_translations/resource.py b/crowdin_api/api_resources/string_translations/resource.py index ccc3f99..dc963d6 100644 --- a/crowdin_api/api_resources/string_translations/resource.py +++ b/crowdin_api/api_resources/string_translations/resource.py @@ -210,6 +210,7 @@ def list_string_translations( stringId: Optional[int] = None, languageId: Optional[str] = None, denormalizePlaceholders: Optional[DenormalizePlaceholders] = None, + taskId: Optional[int] = None, page: Optional[int] = None, offset: Optional[int] = None, limit: Optional[int] = None, @@ -226,6 +227,7 @@ def list_string_translations( "stringId": stringId, "languageId": languageId, "denormalizePlaceholders": denormalizePlaceholders, + "taskId": taskId, } params.update(self.get_page_params(page=page, offset=offset, limit=limit)) From 789f563cbd1136643905262bf2bf022e4a92ead2 Mon Sep 17 00:00:00 2001 From: hriteshMaikap Date: Wed, 30 Oct 2024 00:30:43 +0530 Subject: [PATCH 2/5] Added taskId parameter --- .../tests/test_string_translations_resources.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py b/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py index 309a02c..1fd1b76 100644 --- a/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py +++ b/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py @@ -284,6 +284,7 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba "languageId": "ua", "text": "text", "pluralCategoryName": None, + "taskId": None, }, ), ( @@ -292,12 +293,14 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba "languageId": "ua", "text": "text", "pluralCategoryName": "some name", + "taskId": 12, }, { "stringId": 1, "languageId": "ua", "text": "text", "pluralCategoryName": "some name", + "taskId": 13, }, ), ), From 95183880dc8d1617fa05107c704a62b040cdbd0f Mon Sep 17 00:00:00 2001 From: hriteshMaikap Date: Wed, 30 Oct 2024 09:01:40 +0530 Subject: [PATCH 3/5] Modified Test String Translation --- .../tests/test_string_translations_resources.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py b/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py index 1fd1b76..2b52d1e 100644 --- a/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py +++ b/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py @@ -262,6 +262,9 @@ def test_get_translations_path(self, in_params, path, base_absolut_url): def test_list_string_translations(self, m_request, in_params, request_params, base_absolut_url): m_request.return_value = "response" + in_params.setdefault("taskId", None) + request_params.setdefault("taskId", None) + resource = self.get_resource(base_absolut_url) assert resource.list_string_translations(projectId=1, **in_params) == "response" m_request.assert_called_once_with( @@ -278,6 +281,7 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba "stringId": 1, "languageId": "ua", "text": "text", + "taskId": None, }, { "stringId": 1, @@ -300,7 +304,7 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba "languageId": "ua", "text": "text", "pluralCategoryName": "some name", - "taskId": 13, + "taskId": 12, }, ), ), @@ -310,7 +314,7 @@ def test_add_translation(self, m_request, in_params, request_data, base_absolut_ m_request.return_value = "response" resource = self.get_resource(base_absolut_url) - assert resource.add_translation(projectId=1, **request_data) == "response" + assert resource.add_translation(projectId=1, **in_params) == "response" m_request.assert_called_once_with( method="post", path=resource.get_translations_path(projectId=1), From a1b05a77e722566497d47297981755fa848a44b0 Mon Sep 17 00:00:00 2001 From: hriteshMaikap Date: Wed, 30 Oct 2024 15:58:05 +0530 Subject: [PATCH 4/5] New taskId param in List Strings --- crowdin_api/api_resources/source_strings/resource.py | 2 ++ .../tests/test_source_strings_resources.py | 3 +++ .../api_resources/string_translations/resource.py | 2 -- .../tests/test_string_translations_resources.py | 9 +-------- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/crowdin_api/api_resources/source_strings/resource.py b/crowdin_api/api_resources/source_strings/resource.py index 282e887..4222513 100644 --- a/crowdin_api/api_resources/source_strings/resource.py +++ b/crowdin_api/api_resources/source_strings/resource.py @@ -37,6 +37,7 @@ def list_strings( branchId: Optional[int] = None, denormalizePlaceholders: Optional[DenormalizePlaceholders] = None, labelIds: Optional[Iterable[int]] = None, + taskId: Optional[int] = None, croql: Optional[str] = None, filter: Optional[str] = None, scope: Optional[ScopeFilter] = None, @@ -57,6 +58,7 @@ def list_strings( "fileId": fileId, "denormalizePlaceholders": denormalizePlaceholders, "labelIds": None if labelIds is None else ",".join(str(item) for item in labelIds), + "taskId": taskId, "filter": filter, "croql": croql, "scope": scope, diff --git a/crowdin_api/api_resources/source_strings/tests/test_source_strings_resources.py b/crowdin_api/api_resources/source_strings/tests/test_source_strings_resources.py index 8960d32..716acd1 100644 --- a/crowdin_api/api_resources/source_strings/tests/test_source_strings_resources.py +++ b/crowdin_api/api_resources/source_strings/tests/test_source_strings_resources.py @@ -106,6 +106,7 @@ def test_list_strings(self, m_request, in_params, request_params, base_absolut_u "isHidden": None, "maxLength": None, "labelIds": None, + "taskId": None, "branchId": None }, ), @@ -118,6 +119,7 @@ def test_list_strings(self, m_request, in_params, request_params, base_absolut_u "isHidden": True, "maxLength": 2, "labelIds": [1, 2, 3], + "taskId": None, "branchId": None }, { @@ -128,6 +130,7 @@ def test_list_strings(self, m_request, in_params, request_params, base_absolut_u "isHidden": True, "maxLength": 2, "labelIds": [1, 2, 3], + "taskId": None, "branchId": None }, ), diff --git a/crowdin_api/api_resources/string_translations/resource.py b/crowdin_api/api_resources/string_translations/resource.py index dc963d6..ccc3f99 100644 --- a/crowdin_api/api_resources/string_translations/resource.py +++ b/crowdin_api/api_resources/string_translations/resource.py @@ -210,7 +210,6 @@ def list_string_translations( stringId: Optional[int] = None, languageId: Optional[str] = None, denormalizePlaceholders: Optional[DenormalizePlaceholders] = None, - taskId: Optional[int] = None, page: Optional[int] = None, offset: Optional[int] = None, limit: Optional[int] = None, @@ -227,7 +226,6 @@ def list_string_translations( "stringId": stringId, "languageId": languageId, "denormalizePlaceholders": denormalizePlaceholders, - "taskId": taskId, } params.update(self.get_page_params(page=page, offset=offset, limit=limit)) diff --git a/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py b/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py index 2b52d1e..309a02c 100644 --- a/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py +++ b/crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py @@ -262,9 +262,6 @@ def test_get_translations_path(self, in_params, path, base_absolut_url): def test_list_string_translations(self, m_request, in_params, request_params, base_absolut_url): m_request.return_value = "response" - in_params.setdefault("taskId", None) - request_params.setdefault("taskId", None) - resource = self.get_resource(base_absolut_url) assert resource.list_string_translations(projectId=1, **in_params) == "response" m_request.assert_called_once_with( @@ -281,14 +278,12 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba "stringId": 1, "languageId": "ua", "text": "text", - "taskId": None, }, { "stringId": 1, "languageId": "ua", "text": "text", "pluralCategoryName": None, - "taskId": None, }, ), ( @@ -297,14 +292,12 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba "languageId": "ua", "text": "text", "pluralCategoryName": "some name", - "taskId": 12, }, { "stringId": 1, "languageId": "ua", "text": "text", "pluralCategoryName": "some name", - "taskId": 12, }, ), ), @@ -314,7 +307,7 @@ def test_add_translation(self, m_request, in_params, request_data, base_absolut_ m_request.return_value = "response" resource = self.get_resource(base_absolut_url) - assert resource.add_translation(projectId=1, **in_params) == "response" + assert resource.add_translation(projectId=1, **request_data) == "response" m_request.assert_called_once_with( method="post", path=resource.get_translations_path(projectId=1), From 582eb89583ee47fa1deafa35cfed27c08e316323 Mon Sep 17 00:00:00 2001 From: hriteshMaikap Date: Wed, 30 Oct 2024 16:45:10 +0530 Subject: [PATCH 5/5] Updated the code for passing taskId param --- .../source_strings/tests/test_source_strings_resources.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crowdin_api/api_resources/source_strings/tests/test_source_strings_resources.py b/crowdin_api/api_resources/source_strings/tests/test_source_strings_resources.py index 716acd1..247d96e 100644 --- a/crowdin_api/api_resources/source_strings/tests/test_source_strings_resources.py +++ b/crowdin_api/api_resources/source_strings/tests/test_source_strings_resources.py @@ -51,6 +51,7 @@ def test_get_source_strings_path(self, in_params, path, base_absolut_url): "filter": None, "scope": None, "branchId": None, + "taskId": None, }, ), ( @@ -64,6 +65,7 @@ def test_get_source_strings_path(self, in_params, path, base_absolut_url): "filter": "some", "scope": ScopeFilter.CONTEXT, "branchId": 2, + "taskId": 5, }, { "offset": 0, @@ -75,6 +77,7 @@ def test_get_source_strings_path(self, in_params, path, base_absolut_url): "filter": "some", "scope": ScopeFilter.CONTEXT, "branchId": 2, + "taskId": 5, }, ), ), @@ -106,7 +109,6 @@ def test_list_strings(self, m_request, in_params, request_params, base_absolut_u "isHidden": None, "maxLength": None, "labelIds": None, - "taskId": None, "branchId": None }, ), @@ -119,7 +121,6 @@ def test_list_strings(self, m_request, in_params, request_params, base_absolut_u "isHidden": True, "maxLength": 2, "labelIds": [1, 2, 3], - "taskId": None, "branchId": None }, { @@ -130,7 +131,6 @@ def test_list_strings(self, m_request, in_params, request_params, base_absolut_u "isHidden": True, "maxLength": 2, "labelIds": [1, 2, 3], - "taskId": None, "branchId": None }, ),