From 5520412adb9ec26fefa88711afac352e7b13e786 Mon Sep 17 00:00:00 2001 From: javierdfm Date: Mon, 23 Feb 2026 13:40:14 +0100 Subject: [PATCH 1/5] feat: remove filterTags from channel batch update API --- .../async_chat/channel_batch_updater.py | 33 ------------------- stream_chat/channel_batch_updater.py | 33 ------------------- stream_chat/types/channel_batch.py | 6 ---- 3 files changed, 72 deletions(-) diff --git a/stream_chat/async_chat/channel_batch_updater.py b/stream_chat/async_chat/channel_batch_updater.py index ea8ef45..40540e6 100644 --- a/stream_chat/async_chat/channel_batch_updater.py +++ b/stream_chat/async_chat/channel_batch_updater.py @@ -207,36 +207,3 @@ async def update_data( } return await self.client.update_channels_batch(options) - async def add_filter_tags( - self, filter: ChannelsBatchFilters, tags: List[str] - ) -> StreamResponse: - """ - Adds filter tags to channels matching the filter. - - :param filter: The filter to match channels. - :param tags: List of filter tags to add. - :return: StreamResponse containing task_id. - """ - options: ChannelsBatchOptions = { - "operation": "addFilterTags", - "filter": filter, - "filter_tags_update": tags, - } - return await self.client.update_channels_batch(options) - - async def remove_filter_tags( - self, filter: ChannelsBatchFilters, tags: List[str] - ) -> StreamResponse: - """ - Removes filter tags from channels matching the filter. - - :param filter: The filter to match channels. - :param tags: List of filter tags to remove. - :return: StreamResponse containing task_id. - """ - options: ChannelsBatchOptions = { - "operation": "removeFilterTags", - "filter": filter, - "filter_tags_update": tags, - } - return await self.client.update_channels_batch(options) diff --git a/stream_chat/channel_batch_updater.py b/stream_chat/channel_batch_updater.py index 32cae70..30f36ac 100644 --- a/stream_chat/channel_batch_updater.py +++ b/stream_chat/channel_batch_updater.py @@ -207,36 +207,3 @@ def update_data( } return self.client.update_channels_batch(options) - def add_filter_tags( - self, filter: ChannelsBatchFilters, tags: List[str] - ) -> StreamResponse: - """ - Adds filter tags to channels matching the filter. - - :param filter: The filter to match channels. - :param tags: List of filter tags to add. - :return: StreamResponse containing task_id. - """ - options: ChannelsBatchOptions = { - "operation": "addFilterTags", - "filter": filter, - "filter_tags_update": tags, - } - return self.client.update_channels_batch(options) - - def remove_filter_tags( - self, filter: ChannelsBatchFilters, tags: List[str] - ) -> StreamResponse: - """ - Removes filter tags from channels matching the filter. - - :param filter: The filter to match channels. - :param tags: List of filter tags to remove. - :return: StreamResponse containing task_id. - """ - options: ChannelsBatchOptions = { - "operation": "removeFilterTags", - "filter": filter, - "filter_tags_update": tags, - } - return self.client.update_channels_batch(options) diff --git a/stream_chat/types/channel_batch.py b/stream_chat/types/channel_batch.py index a3db484..d9f1244 100644 --- a/stream_chat/types/channel_batch.py +++ b/stream_chat/types/channel_batch.py @@ -18,8 +18,6 @@ "archive", "unarchive", "updateData", - "addFilterTags", - "removeFilterTags", ] @@ -66,12 +64,10 @@ class ChannelsBatchFilters(TypedDict, total=False): Parameters: cids: Filter by channel CIDs (can be a dict with operators like $in). types: Filter by channel types (can be a dict with operators like $in). - filter_tags: Filter by filter tags (can be a dict with operators like $in). """ cids: Optional[Any] types: Optional[Any] - filter_tags: Optional[Any] class ChannelsBatchOptions(TypedDict, total=False): @@ -83,11 +79,9 @@ class ChannelsBatchOptions(TypedDict, total=False): filter: The filter to match channels (required). members: List of members for member-related operations (optional). data: Channel data updates for updateData operation (optional). - filter_tags_update: List of filter tags for filter tag operations (optional). """ operation: ChannelBatchOperation filter: ChannelsBatchFilters members: Optional[List[ChannelBatchMemberRequest]] data: Optional[ChannelDataUpdate] - filter_tags_update: Optional[List[str]] From 5f0a1d79f7acf4abbec2d7977fb7bd7b5710388c Mon Sep 17 00:00:00 2001 From: javierdfm Date: Mon, 23 Feb 2026 13:46:58 +0100 Subject: [PATCH 2/5] Update stream_chat/async_chat/channel_batch_updater.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/async_chat/channel_batch_updater.py | 1 - 1 file changed, 1 deletion(-) diff --git a/stream_chat/async_chat/channel_batch_updater.py b/stream_chat/async_chat/channel_batch_updater.py index 40540e6..ed09fb8 100644 --- a/stream_chat/async_chat/channel_batch_updater.py +++ b/stream_chat/async_chat/channel_batch_updater.py @@ -206,4 +206,3 @@ async def update_data( "data": data, } return await self.client.update_channels_batch(options) - From 81c17e6b1b6d4bf74af616957fb8dae38a62c5f1 Mon Sep 17 00:00:00 2001 From: javierdfm Date: Mon, 23 Feb 2026 15:25:10 +0100 Subject: [PATCH 3/5] Update stream_chat/channel_batch_updater.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/channel_batch_updater.py | 1 - 1 file changed, 1 deletion(-) diff --git a/stream_chat/channel_batch_updater.py b/stream_chat/channel_batch_updater.py index 30f36ac..8d5a14b 100644 --- a/stream_chat/channel_batch_updater.py +++ b/stream_chat/channel_batch_updater.py @@ -206,4 +206,3 @@ def update_data( "data": data, } return self.client.update_channels_batch(options) - From 12572bfa51ba25a38807f1d1cb28e2c8386a34cc Mon Sep 17 00:00:00 2001 From: javierdfm Date: Thu, 26 Feb 2026 15:02:10 +0100 Subject: [PATCH 4/5] fix: attempt to fix tests --- stream_chat/tests/async_chat/conftest.py | 20 +++++++++++++++++++- stream_chat/tests/async_chat/test_client.py | 9 +++++---- stream_chat/tests/conftest.py | 20 +++++++++++++++++++- stream_chat/tests/test_client.py | 4 ++-- 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/stream_chat/tests/async_chat/conftest.py b/stream_chat/tests/async_chat/conftest.py index 425cee0..a6c9af9 100644 --- a/stream_chat/tests/async_chat/conftest.py +++ b/stream_chat/tests/async_chat/conftest.py @@ -93,13 +93,27 @@ async def channel(client: StreamChatAsync, random_user: Dict): @pytest.fixture(scope="function") async def command(client: StreamChatAsync): + try: + commands = await client.list_commands() + for cmd in commands.get("commands", []): + if cmd.get("name") not in ("giphy", "imgur", "flag", "ban", "unban", "mute", "unmute"): + try: + await client.delete_command(cmd["name"]) + except Exception: + pass + except Exception: + pass + response = await client.create_command( dict(name=str(uuid.uuid4()), description="My command") ) yield response["command"] - await client.delete_command(response["command"]["name"]) + try: + await client.delete_command(response["command"]["name"]) + except Exception: + pass @pytest.fixture(scope="function") @@ -121,6 +135,10 @@ async def fellowship_of_the_ring(client: StreamChatAsync): }, {"id": "peregrin-took", "name": "Peregrin Took", "race": "Hobbit", "age": 28}, ] + try: + await client.restore_users([m["id"] for m in members]) + except Exception: + pass await client.upsert_users(members) channel = client.channel( "team", "fellowship-of-the-ring", {"members": [m["id"] for m in members]} diff --git a/stream_chat/tests/async_chat/test_client.py b/stream_chat/tests/async_chat/test_client.py index 76503e5..94a6efa 100644 --- a/stream_chat/tests/async_chat/test_client.py +++ b/stream_chat/tests/async_chat/test_client.py @@ -1,3 +1,4 @@ +import asyncio import json import os import sys @@ -173,14 +174,14 @@ async def test_delete_users(self, client: StreamChatAsync, random_user: Dict): ) assert "task_id" in response - for _ in range(20): + for _ in range(60): response = await client.get_task(response["task_id"]) if response["status"] == "completed" and response["result"][ random_user["id"] ] == {"status": "ok"}: return - time.sleep(1) + await asyncio.sleep(1) pytest.fail("task did not succeed") @@ -810,14 +811,14 @@ async def test_delete_channels(self, client: StreamChatAsync, channel: Channel): response = await client.delete_channels([channel.cid]) assert "task_id" in response - for _ in range(20): + for _ in range(60): response = await client.get_task(response["task_id"]) if response["status"] == "completed" and response["result"][ channel.cid ] == {"status": "ok"}: return - time.sleep(1) + await asyncio.sleep(1) pytest.fail("task did not succeed") diff --git a/stream_chat/tests/conftest.py b/stream_chat/tests/conftest.py index 3fe5e7a..b03a9b8 100644 --- a/stream_chat/tests/conftest.py +++ b/stream_chat/tests/conftest.py @@ -84,13 +84,27 @@ def channel(client: StreamChat, random_user: Dict): @pytest.fixture(scope="function") def command(client: StreamChat): + try: + commands = client.list_commands() + for cmd in commands.get("commands", []): + if cmd.get("name") not in ("giphy", "imgur", "flag", "ban", "unban", "mute", "unmute"): + try: + client.delete_command(cmd["name"]) + except Exception: + pass + except Exception: + pass + response = client.create_command( dict(name=str(uuid.uuid4()), description="My command") ) yield response["command"] - client.delete_command(response["command"]["name"]) + try: + client.delete_command(response["command"]["name"]) + except Exception: + pass @pytest.fixture(scope="module") @@ -111,6 +125,10 @@ def fellowship_of_the_ring(client: StreamChat): }, {"id": "peregrin-took", "name": "Peregrin Took", "race": "Hobbit", "age": 28}, ] + try: + client.restore_users([m["id"] for m in members]) + except Exception: + pass client.upsert_users(members) channel = client.channel( "team", "fellowship-of-the-ring", {"members": [m["id"] for m in members]} diff --git a/stream_chat/tests/test_client.py b/stream_chat/tests/test_client.py index 1b09412..74802ff 100644 --- a/stream_chat/tests/test_client.py +++ b/stream_chat/tests/test_client.py @@ -229,7 +229,7 @@ def test_delete_users(self, client: StreamChat, random_user: Dict): ) assert "task_id" in response - for _ in range(20): + for _ in range(60): response = client.get_task(response["task_id"]) if response["status"] == "completed" and response["result"][ random_user["id"] @@ -818,7 +818,7 @@ def test_delete_channels(self, client: StreamChat, channel: Channel): response = client.delete_channels([channel.cid]) assert "task_id" in response - for _ in range(20): + for _ in range(60): response = client.get_task(response["task_id"]) if response["status"] == "completed" and response["result"][ channel.cid From 360e90f7aa5faf3e659d8a1dcf9699eeaa953a32 Mon Sep 17 00:00:00 2001 From: javierdfm Date: Thu, 26 Feb 2026 15:05:51 +0100 Subject: [PATCH 5/5] fix: lint fix --- stream_chat/tests/async_chat/conftest.py | 10 +++++++++- stream_chat/tests/conftest.py | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/stream_chat/tests/async_chat/conftest.py b/stream_chat/tests/async_chat/conftest.py index a6c9af9..ddb4486 100644 --- a/stream_chat/tests/async_chat/conftest.py +++ b/stream_chat/tests/async_chat/conftest.py @@ -96,7 +96,15 @@ async def command(client: StreamChatAsync): try: commands = await client.list_commands() for cmd in commands.get("commands", []): - if cmd.get("name") not in ("giphy", "imgur", "flag", "ban", "unban", "mute", "unmute"): + if cmd.get("name") not in ( + "giphy", + "imgur", + "flag", + "ban", + "unban", + "mute", + "unmute", + ): try: await client.delete_command(cmd["name"]) except Exception: diff --git a/stream_chat/tests/conftest.py b/stream_chat/tests/conftest.py index b03a9b8..b18ebda 100644 --- a/stream_chat/tests/conftest.py +++ b/stream_chat/tests/conftest.py @@ -87,7 +87,15 @@ def command(client: StreamChat): try: commands = client.list_commands() for cmd in commands.get("commands", []): - if cmd.get("name") not in ("giphy", "imgur", "flag", "ban", "unban", "mute", "unmute"): + if cmd.get("name") not in ( + "giphy", + "imgur", + "flag", + "ban", + "unban", + "mute", + "unmute", + ): try: client.delete_command(cmd["name"]) except Exception: