Skip to content

Commit

Permalink
Add before_lt parameter to get_traces methods. #33
Browse files Browse the repository at this point in the history
  • Loading branch information
nessshon committed Nov 22, 2024
1 parent c41fd3b commit a32a616
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pytonapi/async_tonapi/methods/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,19 @@ async def get_event(

return AccountEvent(**response)

async def get_traces(self, account_id: str, limit: int = 100) -> TraceIds:
async def get_traces(self, account_id: str, limit: int = 100, before_lt: Optional[int] = None) -> TraceIds:
"""
Get traces for account.
:param account_id: account ID
:param limit: Default value: 100
:param before_lt: omit this parameter to get last events
:return: :class:`TraceIds`
"""
method = f"v2/accounts/{account_id}/traces"
params = {"limit": limit}
if before_lt is not None:
params["before_lt"] = before_lt
response = await self._get(method=method, params=params)

return TraceIds(**response)
Expand Down
5 changes: 4 additions & 1 deletion pytonapi/tonapi/methods/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,19 @@ def get_event(

return AccountEvent(**response)

def get_traces(self, account_id: str, limit: int = 100) -> TraceIds:
def get_traces(self, account_id: str, limit: int = 100, before_lt: Optional[int] = None) -> TraceIds:
"""
Get traces for account.
:param account_id: account ID
:param limit: Default value: 100
:param before_lt: omit this parameter to get last events
:return: :class:`TraceIds`
"""
method = f"v2/accounts/{account_id}/traces"
params = {"limit": limit}
if before_lt is not None:
params["before_lt"] = before_lt
response = self._get(method=method, params=params)

return TraceIds(**response)
Expand Down

0 comments on commit a32a616

Please sign in to comment.