Skip to content

Analyzers #55

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
23 changes: 23 additions & 0 deletions arangoasync/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from arangoasync.connection import Connection
from arangoasync.errno import HTTP_FORBIDDEN, HTTP_NOT_FOUND
from arangoasync.exceptions import (
AnalyzerListError,
AsyncJobClearError,
AsyncJobListError,
CollectionCreateError,
Expand Down Expand Up @@ -1461,6 +1462,28 @@ def response_handler(resp: Response) -> bool:

return await self._executor.execute(request, response_handler)

async def analyzers(self) -> Result[Jsons]:
"""List all analyzers in the database.

Returns:
list: List of analyzers with their properties.

Raises:
AnalyzerListError: If the operation fails.

References:
- `list-all-analyzers <https://docs.arangodb.com/stable/develop/http-api/analyzers/#list-all-analyzers>`__
""" # noqa: E501
request = Request(method=Method.GET, endpoint="/_api/analyzer")

def response_handler(resp: Response) -> Jsons:
if resp.is_success:
result: Jsons = self.deserializer.loads(resp.raw_body)["result"]
return result
raise AnalyzerListError(resp, request)

return await self._executor.execute(request, response_handler)

async def has_user(self, username: str) -> Result[bool]:
"""Check if a user exists.

Expand Down
4 changes: 4 additions & 0 deletions arangoasync/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ class AQLQueryValidateError(ArangoServerError):
"""Failed to parse and validate query."""


class AnalyzerListError(ArangoServerError):
"""Failed to retrieve analyzers."""


class AsyncExecuteError(ArangoServerError):
"""Failed to execute async API request."""

Expand Down
Loading