From 5dac853a602bf6508b130e1d5fa05376c541ce88 Mon Sep 17 00:00:00 2001 From: Felipe Freitag Date: Thu, 15 Oct 2026 14:51:58 -0300 Subject: [PATCH] fix(broadcasts): add topic_id to the Broadcast response type The API returns topic_id when you get a broadcast, but the Broadcast TypedDict did not declare it, so strict mypy rejected the key. --- resend/broadcasts/_broadcast.py | 4 ++++ tests/broadcasts_async_test.py | 2 ++ tests/broadcasts_test.py | 2 ++ 3 files changed, 8 insertions(+) diff --git a/resend/broadcasts/_broadcast.py b/resend/broadcasts/_broadcast.py index 085bc2f..7a87528 100644 --- a/resend/broadcasts/_broadcast.py +++ b/resend/broadcasts/_broadcast.py @@ -71,3 +71,7 @@ class Broadcast(_FromParam): """ The plain text content of the broadcast. """ + topic_id: Union[str, None] + """ + The topic ID that the broadcast is scoped to. + """ diff --git a/tests/broadcasts_async_test.py b/tests/broadcasts_async_test.py index 5436d92..c7e7bb2 100644 --- a/tests/broadcasts_async_test.py +++ b/tests/broadcasts_async_test.py @@ -79,6 +79,7 @@ async def test_broadcasts_get_async(self) -> None: "created_at": "2024-12-01 19:32:22.98+00", "scheduled_at": None, "sent_at": None, + "topic_id": None, } ) @@ -96,6 +97,7 @@ async def test_broadcasts_get_async(self) -> None: assert broadcast["created_at"] == "2024-12-01 19:32:22.98+00" assert broadcast["scheduled_at"] is None assert broadcast["sent_at"] is None + assert broadcast["topic_id"] is None async def test_should_get_broadcasts_async_raise_exception_when_no_content( self, diff --git a/tests/broadcasts_test.py b/tests/broadcasts_test.py index ec17ecf..d20d456 100644 --- a/tests/broadcasts_test.py +++ b/tests/broadcasts_test.py @@ -51,6 +51,7 @@ def test_broadcasts_get(self) -> None: "sent_at": None, "html": "

Hello World

", "text": "Hello World", + "topic_id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e", } ) @@ -68,6 +69,7 @@ def test_broadcasts_get(self) -> None: assert broadcast["sent_at"] is None assert broadcast["html"] == "

Hello World

" assert broadcast["text"] == "Hello World" + assert broadcast["topic_id"] == "b6d24b8e-af0b-4c3c-be0c-359bbd97381e" def test_broadcasts_send(self) -> None: self.set_mock_json({"id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e791"})