diff --git a/crowdin_api/api_resources/glossaries/resource.py b/crowdin_api/api_resources/glossaries/resource.py index 71cda32..0c3d2d7 100644 --- a/crowdin_api/api_resources/glossaries/resource.py +++ b/crowdin_api/api_resources/glossaries/resource.py @@ -38,6 +38,7 @@ def get_glossaries_path(self, glossaryId: Optional[int] = None): def list_glossaries( self, + groupId: Optional[int] = None, page: Optional[int] = None, offset: Optional[int] = None, limit: Optional[int] = None, @@ -49,10 +50,13 @@ def list_glossaries( https://developer.crowdin.com/api/v2/#operation/api.glossaries.getMany """ + params = {"groupId": groupId} + params.update(self.get_page_params(page=page, offset=offset, limit=limit)) + return self._get_entire_data( method="get", path=self.get_glossaries_path(), - params=self.get_page_params(page=page, offset=offset, limit=limit), + params=params, ) def add_glossary(self, name: str, languageId: str): diff --git a/crowdin_api/api_resources/glossaries/tests/test_glossaries_resources.py b/crowdin_api/api_resources/glossaries/tests/test_glossaries_resources.py index b607800..79e9098 100644 --- a/crowdin_api/api_resources/glossaries/tests/test_glossaries_resources.py +++ b/crowdin_api/api_resources/glossaries/tests/test_glossaries_resources.py @@ -34,15 +34,38 @@ def test_get_screenshots_path(self, in_params, path, base_absolut_url): resource = self.get_resource(base_absolut_url) assert resource.get_glossaries_path(**in_params) == path + @pytest.mark.parametrize( + "incoming_data, request_params", + ( + ( + {}, + { + "groupId": None, + "offset": 0, + "limit": 25, + }, + ), + ( + { + "groupId": 1, + }, + { + "groupId": 1, + "offset": 0, + "limit": 25, + }, + ), + ), + ) @mock.patch("crowdin_api.requester.APIRequester.request") - def test_list_glossaries(self, m_request, base_absolut_url): + def test_list_glossaries(self, m_request, incoming_data, request_params, base_absolut_url): m_request.return_value = "response" resource = self.get_resource(base_absolut_url) - assert resource.list_glossaries() == "response" + assert resource.list_glossaries(**incoming_data) == "response" m_request.assert_called_once_with( method="get", - params=resource.get_page_params(), + params=request_params, path=resource.get_glossaries_path(), ) diff --git a/crowdin_api/api_resources/projects/resource.py b/crowdin_api/api_resources/projects/resource.py index 6b953d2..930eb02 100644 --- a/crowdin_api/api_resources/projects/resource.py +++ b/crowdin_api/api_resources/projects/resource.py @@ -46,6 +46,7 @@ def list_projects( page: Optional[int] = None, offset: Optional[int] = None, limit: Optional[int] = None, + groupId: Optional[int] = None, userId: Optional[Union[int, str]] = None, hasManagerAccess: Optional[HasManagerAccess] = None, ): @@ -56,7 +57,7 @@ def list_projects( https://developer.crowdin.com/api/v2/#operation/api.projects.getMany """ - params = {"userId": userId, "hasManagerAccess": hasManagerAccess} + params = {"userId": userId, "hasManagerAccess": hasManagerAccess, "groupId": groupId} params.update(self.get_page_params(page=page, offset=offset, limit=limit)) return self._get_entire_data(method="get", path=self.get_projects_path(), params=params) diff --git a/crowdin_api/api_resources/projects/tests/test_projects_resources.py b/crowdin_api/api_resources/projects/tests/test_projects_resources.py index a664a19..e06df58 100644 --- a/crowdin_api/api_resources/projects/tests/test_projects_resources.py +++ b/crowdin_api/api_resources/projects/tests/test_projects_resources.py @@ -42,12 +42,14 @@ def test_get_projects_path(self, projectId, path, base_absolut_url): "offset": 0, "limit": 10, "userId": 1, + "groupId": 1, "hasManagerAccess": HasManagerAccess.TRUE, }, { "offset": 0, "limit": 10, "userId": 1, + "groupId": 1, "hasManagerAccess": HasManagerAccess.TRUE, }, ), @@ -57,6 +59,7 @@ def test_get_projects_path(self, projectId, path, base_absolut_url): "offset": 0, "limit": 10, "userId": None, + "groupId": None, "hasManagerAccess": None, }, ),