Skip to content

Commit aba9c85

Browse files
committed
Make the alias use the thirdparty id - not the search function
1 parent a154885 commit aba9c85

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ def create_alert(self, title: str, description: Optional[str] = None,
6868
return response.json()
6969

7070
def list_alerts(self, limit: int = 10, offset: int = 0,
71-
status: Optional[str] = None, search: Optional[str] = None) -> Dict[str, Any]:
71+
status: Optional[str] = None, search: Optional[str] = None, alias: Optional[str] = None) -> Dict[str, Any]:
7272
"""List all alerts in PagerTree."""
73-
params = {k: v for k, v in {"limit": limit, "offset": offset, "status": status, "q": search}.items()
73+
params = {k: v for k, v in {"limit": limit, "offset": offset, "status": status, "q": search, "thirdparty_id": alias}.items()
7474
if v is not None}
7575
response = self.session.get(f"{self.base_url}/alerts", params=params)
7676
response.raise_for_status()

commands/alerts.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def acknowledge_alert_cmd(ctx, alert_id, alias):
107107

108108
# If alias is provided, resolve it to alert_id
109109
if alias:
110-
alias_result = client.list_alerts(search=alias, limit=1, offset=0)
110+
alias_result = client.list_alerts(alias=alias, limit=1, offset=0)
111111
if alias_result["total"] == 0:
112112
click.echo(f"No alert found with alias: {alias}")
113113
return
@@ -139,7 +139,7 @@ def reject_alert_cmd(ctx, alert_id, alias):
139139

140140
# If alias is provided, resolve it to alert_id
141141
if alias:
142-
alias_result = client.list_alerts(search=alias, limit=1, offset=0, status="open")
142+
alias_result = client.list_alerts(alias=alias, limit=1, offset=0, status="open")
143143
if alias_result["total"] == 0:
144144
click.echo(f"No alert found with alias: {alias}")
145145
return
@@ -171,7 +171,7 @@ def resolve_alert_cmd(ctx, alert_id, alias):
171171

172172
# If alias is provided, resolve it to alert_id
173173
if alias:
174-
alias_result = client.list_alerts(search=alias, limit=1, offset=0)
174+
alias_result = client.list_alerts(alias=alias, limit=1, offset=0)
175175
if alias_result["total"] == 0:
176176
click.echo(f"No alert found with alias: {alias}")
177177
return
@@ -205,7 +205,7 @@ def list_alert_comment_cmd(ctx, alert_id, alias, limit, offset):
205205

206206
# If alias is provided, resolve it to alert_id
207207
if alias:
208-
alias_result = client.list_alerts(search=alias, limit=1, offset=0)
208+
alias_result = client.list_alerts(alias=alias, limit=1, offset=0)
209209
if alias_result["total"] == 0:
210210
click.echo(f"No alert found with alias: {alias}")
211211
return
@@ -243,7 +243,7 @@ def create_alert_comment_cmd(ctx, alert_id, alias, comment):
243243

244244
# If alias is provided, resolve it to alert_id
245245
if alias:
246-
alias_result = client.list_alerts(search=alias, limit=1, offset=0)
246+
alias_result = client.list_alerts(alias=alias, limit=1, offset=0)
247247
if alias_result["total"] == 0:
248248
click.echo(f"No alert found with alias: {alias}")
249249
return

0 commit comments

Comments
 (0)