Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): Add croql parameter support to List Terms API #188

Merged
merged 2 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crowdin_api/api_resources/glossaries/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def list_terms(
userId: Optional[int] = None,
languageId: Optional[str] = None,
conceptId: Optional[int] = None,
croql: Optional[str] = None,
offset: Optional[int] = None,
limit: Optional[int] = None,
):
Expand All @@ -256,6 +257,7 @@ def list_terms(
"userId": userId,
"languageId": languageId,
"conceptId": conceptId,
"croql": croql,
}

params.update(self.get_page_params(offset=offset, limit=limit))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ def test_get_terms_path(self, in_params, path, base_absolut_url):
"userId": None,
"languageId": None,
"conceptId": None,
"croql": None,
"offset": 0,
"limit": 25,
},
Expand All @@ -281,11 +282,13 @@ def test_get_terms_path(self, in_params, path, base_absolut_url):
"userId": 1,
"languageId": "ua",
"conceptId": 2,
"croql": "status = 'preferred'",
},
{
"userId": 1,
"languageId": "ua",
"conceptId": 2,
"croql": "status = 'preferred'",
"offset": 0,
"limit": 25,
},
Expand All @@ -295,7 +298,6 @@ def test_get_terms_path(self, in_params, path, base_absolut_url):
@mock.patch("crowdin_api.requester.APIRequester.request")
def test_list_terms(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_terms(glossaryId=1, **incoming_data) == "response"
m_request.assert_called_once_with(
Expand Down