Skip to content

Commit ea319f7

Browse files
authored
fix(types): expose nullable inbound route domains (#31)
1 parent 539bcf5 commit ea319f7

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

‎src/lettermint/types.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@
296296
"is_default": "Required[bool]",
297297
"inbound_address": "NotRequired[str | None]",
298298
"inbound_mx_hostname": "NotRequired[str]",
299+
"inbound_route_domain": "NotRequired[str | None]",
299300
"inbound_domain": "NotRequired[str | None]",
300301
"inbound_domain_verified_at": "NotRequired[str | None]",
301302
"inbound_spam_threshold": "NotRequired[float | None]",

‎tests/test_route_contract.py‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""Check the optional, nullable inbound route domain."""
2+
3+
from typing import Any
4+
5+
import pytest
6+
import respx
7+
from httpx import Response
8+
9+
from lettermint import Lettermint
10+
from lettermint.types import RouteData
11+
12+
13+
@pytest.mark.parametrize("domain", ["incoming.example.com", None, ...])
14+
@respx.mock
15+
def test_inbound_route_domain(domain: Any) -> None:
16+
payload: RouteData = {
17+
"id": "route_1",
18+
"project_id": "project_1",
19+
"slug": "incoming",
20+
"name": "Incoming",
21+
"route_type": "inbound",
22+
"is_default": False,
23+
"created_at": "2026-10-01T12:00:00Z",
24+
"updated_at": "2026-10-01T12:00:00Z",
25+
}
26+
if domain is not ...:
27+
payload["inbound_route_domain"] = domain
28+
respx.get("https://api.lettermint.co/v1/routes/route_1").mock(
29+
return_value=Response(200, json=payload)
30+
)
31+
with Lettermint.api("team-token") as api:
32+
result = api.routes.retrieve("route_1")
33+
assert result == payload
34+
assert result.get("inbound_route_domain") == (None if domain is ... else domain)
35+
36+
37+
def test_inbound_route_domain_is_declared() -> None:
38+
assert "inbound_route_domain" in RouteData.__annotations__
39+
assert "NotRequired[str | None]" in str(RouteData.__annotations__["inbound_route_domain"])

0 commit comments

Comments
 (0)