Skip to content

Commit

Permalink
Add limit to AplOptions (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjessome authored Dec 12, 2024
1 parent 6282e0d commit dd9ff01
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/axiom_py/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ class AplOptions:
# IncludeCursor will return the Cursor as part of the query result, if set
# to true.
includeCursor: bool = field(default=False)
# The query limit.
limit: Optional[int] = field(default=None)


class AxiomError(Exception):
Expand Down Expand Up @@ -368,11 +370,13 @@ def _prepare_apl_options(
self, opts: Optional[AplOptions]
) -> Dict[str, object]:
"""Prepare the apl query options for the request."""
params = {"format": AplResultFormat.Legacy.value}
params: Dict[str, object] = {"format": AplResultFormat.Legacy.value}

if opts is not None:
if opts.format:
params["format"] = opts.format.value
if opts.limit is not None:
params["request"] = {"limit": opts.limit}

return params

Expand Down

0 comments on commit dd9ff01

Please sign in to comment.