From a489a8164960219f93b47a811916f1e572135a0b Mon Sep 17 00:00:00 2001 From: "Yohan R." <7434196+groyoh@users.noreply.github.com> Date: Wed, 21 Oct 2026 19:44:25 +0200 Subject: [PATCH] feat(alerts): Add notify_on to alert thresholds ## Context The alert threshold contract gained a `notify_on` field, an array of `triggered`/`resolved` that selects which transitions a threshold notifies on. It applies to subscription and wallet alerts and is not available on recurring thresholds. ## Description `notify_on` was added to the `AlertThreshold` request model and the `AlertThresholdResponse` response model. The wallet alert fixture and test were updated to cover it. The `alert.resolved` webhook event is not modeled: the Python client does not model webhook payloads. --- lago_python_client/models/alert.py | 2 ++ tests/fixtures/wallet_alert.json | 3 ++- tests/test_customer_wallet_alert_client.py | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lago_python_client/models/alert.py b/lago_python_client/models/alert.py index eacd1845..f7b8fb92 100644 --- a/lago_python_client/models/alert.py +++ b/lago_python_client/models/alert.py @@ -8,6 +8,7 @@ class AlertThreshold(BaseModel): code: Optional[str] value: str recurring: Optional[bool] + notify_on: Optional[List[str]] class AlertThresholdList(BaseModel): @@ -30,6 +31,7 @@ class AlertThresholdResponse(BaseResponseModel): code: Optional[str] value: str recurring: bool + notify_on: Optional[List[str]] class AlertThresholdResponseList(BaseResponseModel): diff --git a/tests/fixtures/wallet_alert.json b/tests/fixtures/wallet_alert.json index ab7e76c2..3246d60a 100644 --- a/tests/fixtures/wallet_alert.json +++ b/tests/fixtures/wallet_alert.json @@ -15,7 +15,8 @@ { "code": "warn", "value": 10000, - "recurring": false + "recurring": false, + "notify_on": ["triggered", "resolved"] } ], "billable_metric": null, diff --git a/tests/test_customer_wallet_alert_client.py b/tests/test_customer_wallet_alert_client.py index ed6a0320..22243123 100644 --- a/tests/test_customer_wallet_alert_client.py +++ b/tests/test_customer_wallet_alert_client.py @@ -14,7 +14,7 @@ def alert_object(): - threshold = AlertThreshold(code="warn", value=10000) + threshold = AlertThreshold(code="warn", value=10000, notify_on=["triggered", "resolved"]) return Alert( alert_type="wallet_balance_amount", @@ -45,7 +45,7 @@ def test_valid_create_customer_wallet_alert_request(httpx_mock: HTTPXMock): assert response.direction == "increasing" assert response.previous_value == "1000" assert response.thresholds == AlertThresholdList( - __root__=[AlertThreshold(code="warn", value=10000, recurring=False)] + __root__=[AlertThreshold(code="warn", value=10000, recurring=False, notify_on=["triggered", "resolved"])] ) assert response.billable_metric is None