diff --git a/stream_chat/async_chat/client.py b/stream_chat/async_chat/client.py index e57c144..a855554 100644 --- a/stream_chat/async_chat/client.py +++ b/stream_chat/async_chat/client.py @@ -472,8 +472,8 @@ async def send_file( ) as response: return await self._parse_response(response) - async def create_blocklist(self, name: str, words: Iterable[str]) -> StreamResponse: - return await self.post("blocklists", data={"name": name, "words": words}) + async def create_blocklist(self, name: str, words: Iterable[str], blocklist_type: str = None) -> StreamResponse: + return await self.post("blocklists", data={"name": name, "words": words, "type": blocklist_type}) async def list_blocklists(self) -> StreamResponse: return await self.get("blocklists") diff --git a/stream_chat/base/client.py b/stream_chat/base/client.py index e325b60..44f0446 100644 --- a/stream_chat/base/client.py +++ b/stream_chat/base/client.py @@ -753,13 +753,14 @@ def send_file( @abc.abstractmethod def create_blocklist( - self, name: str, words: Iterable[str] + self, name: str, words: Iterable[str], blocklist_type: str = None ) -> Union[StreamResponse, Awaitable[StreamResponse]]: """ Create a blocklist :param name: the name of the blocklist :param words: list of blocked words + :param blocklist_type: blocklist type :return: """ pass diff --git a/stream_chat/client.py b/stream_chat/client.py index badaf4c..c90feb4 100644 --- a/stream_chat/client.py +++ b/stream_chat/client.py @@ -456,8 +456,8 @@ def send_file( ) return self._parse_response(response) - def create_blocklist(self, name: str, words: Iterable[str]) -> StreamResponse: - return self.post("blocklists", data={"name": name, "words": words}) + def create_blocklist(self, name: str, words: Iterable[str], blocklist_type: str = None) -> StreamResponse: + return self.post("blocklists", data={"name": name, "words": words, "type": blocklist_type}) def list_blocklists(self) -> StreamResponse: return self.get("blocklists") diff --git a/stream_chat/tests/test_client.py b/stream_chat/tests/test_client.py index f3b0564..21db613 100644 --- a/stream_chat/tests/test_client.py +++ b/stream_chat/tests/test_client.py @@ -549,7 +549,7 @@ def test_query_channels_members_in( assert len(response["channels"][0]["members"]) == 9 def test_create_blocklist(self, client: StreamChat): - client.create_blocklist(name="Foo", words=["fudge", "heck"]) + client.create_blocklist(name="Foo", words=["fudge", "heck"], blocklist_type="regular") def test_list_blocklists(self, client: StreamChat): response = client.list_blocklists()