Skip to content

Commit a0cb158

Browse files
committed
fix: Add sync alert logs
1 parent 062703f commit a0cb158

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

asknews_sdk/api/chat.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,41 @@ def delete_alert(
407407
headers=http_headers,
408408
)
409409

410+
def list_alert_logs(
411+
self,
412+
alert_id: Union[UUID, str],
413+
page: int = 1,
414+
per_page: int = 10,
415+
all: bool = False,
416+
*,
417+
http_headers: Optional[Dict] = None,
418+
) -> PaginatedResponse[AlertLog]:
419+
"""
420+
List alert logs.
421+
422+
https://docs.asknews.app/en/reference#get-/v1/chat/alerts
423+
424+
:param alert_id: The alert ID.
425+
:type alert_id: Union[UUID, str]
426+
:param page: The page number.
427+
:type page: int
428+
:param per_page: The number of items per page.
429+
:type per_page: int
430+
:param all: Whether to return all alerts.
431+
:type all: bool
432+
:param http_headers: Additional HTTP headers.
433+
:type http_headers: Optional[Dict]
434+
:return: List of alerts.
435+
:rtype: PaginatedResponse[AlertResponse]
436+
"""
437+
response = self.client.request(
438+
method="GET",
439+
endpoint=f"/v1/chat/alerts/{alert_id}/logs",
440+
headers=http_headers,
441+
query={"page": page, "per_page": per_page, "all": all},
442+
)
443+
return PaginatedResponse[AlertLog].model_validate(response.content)
444+
410445

411446
class AsyncChatAPI(BaseAPI):
412447
"""

0 commit comments

Comments
 (0)