diff --git a/stream_chat/async_chat/client.py b/stream_chat/async_chat/client.py index fddfb1d..75b073b 100644 --- a/stream_chat/async_chat/client.py +++ b/stream_chat/async_chat/client.py @@ -965,7 +965,7 @@ async def query_reminders( :return: API response with reminders """ params = options.copy() - params["filter_conditions"] = filter_conditions or {} + params["filter"] = filter_conditions or {} params["sort"] = sort or [{"field": "remind_at", "direction": 1}] params["user_id"] = user_id return await self.post("reminders/query", data=params) diff --git a/stream_chat/client.py b/stream_chat/client.py index 7d57c95..20681bf 100644 --- a/stream_chat/client.py +++ b/stream_chat/client.py @@ -919,7 +919,7 @@ def query_reminders( :return: API response with reminders """ params = options.copy() - params["filter_conditions"] = filter_conditions or {} + params["filter"] = filter_conditions or {} params["sort"] = sort or [{"field": "remind_at", "direction": 1}] params["user_id"] = user_id return self.post("reminders/query", data=params) diff --git a/stream_chat/tests/async_chat/test_reminders.py b/stream_chat/tests/async_chat/test_reminders.py index 8417262..0398a7a 100644 --- a/stream_chat/tests/async_chat/test_reminders.py +++ b/stream_chat/tests/async_chat/test_reminders.py @@ -158,11 +158,30 @@ async def test_query_reminders(self, client: StreamChatAsync, channel, random_us random_user["id"], filter_conditions ) assert response is not None + assert "reminders" in response + # Verify all returned reminders match the filter + for reminder in response["reminders"]: + assert reminder["message_id"] in [message_ids[0]] - # Test case 3: Query reminders by channel CID + # Test case 3: Query reminders by single message ID + filter_conditions = {"message_id": message_ids[0]} + response = await client.query_reminders(random_user["id"], filter_conditions) + assert response is not None + assert "reminders" in response + assert len(response["reminders"]) >= 1 + # Verify all returned reminders have the exact message_id + for reminder in response["reminders"]: + assert reminder["message_id"] == message_ids[0] + + # Test case 4: Query reminders by channel CID filter_conditions = {"channel_cid": channel_cid} response = await client.query_reminders(random_user["id"], filter_conditions) assert response is not None + assert "reminders" in response + assert len(response["reminders"]) >= 3 + # Verify all returned reminders belong to the channel + for reminder in response["reminders"]: + assert reminder["channel_cid"] == channel_cid # Clean up - try to delete the reminders for message_id in message_ids: diff --git a/stream_chat/tests/test_reminders.py b/stream_chat/tests/test_reminders.py index 728a574..3f6ed4f 100644 --- a/stream_chat/tests/test_reminders.py +++ b/stream_chat/tests/test_reminders.py @@ -146,11 +146,30 @@ def test_query_reminders(self, client: StreamChat, channel, random_user): filter_conditions = {"message_id": {"$in": [message_ids[0]]}} response = client.query_reminders(random_user["id"], filter_conditions) assert response is not None + assert "reminders" in response + # Verify all returned reminders match the filter + for reminder in response["reminders"]: + assert reminder["message_id"] in [message_ids[0]] - # Test case 3: Query reminders by channel CID + # Test case 3: Query reminders by single message ID + filter_conditions = {"message_id": message_ids[0]} + response = client.query_reminders(random_user["id"], filter_conditions) + assert response is not None + assert "reminders" in response + assert len(response["reminders"]) >= 1 + # Verify all returned reminders have the exact message_id + for reminder in response["reminders"]: + assert reminder["message_id"] == message_ids[0] + + # Test case 4: Query reminders by channel CID filter_conditions = {"channel_cid": channel_cid} response = client.query_reminders(random_user["id"], filter_conditions) assert response is not None + assert "reminders" in response + assert len(response["reminders"]) >= 3 + # Verify all returned reminders belong to the channel + for reminder in response["reminders"]: + assert reminder["channel_cid"] == channel_cid # Clean up - try to delete the reminders for message_id in message_ids: