diff --git a/stream_chat/async_chat/client.py b/stream_chat/async_chat/client.py index b50579b..6e528e7 100644 --- a/stream_chat/async_chat/client.py +++ b/stream_chat/async_chat/client.py @@ -333,6 +333,9 @@ async def update_message_partial( async def delete_message(self, message_id: str, **options: Any) -> StreamResponse: return await self.delete(f"messages/{message_id}", options) + def undelete_message(self, message_id: str, user_id: str) -> StreamResponse: + return await self.post(f"messages/{message_id}/undelete", data={"user": user_id}) + async def get_message(self, message_id: str, **options: Any) -> StreamResponse: return await self.get(f"messages/{message_id}", options) diff --git a/stream_chat/base/client.py b/stream_chat/base/client.py index 2a8db10..126e325 100644 --- a/stream_chat/base/client.py +++ b/stream_chat/base/client.py @@ -515,6 +515,15 @@ def delete_message( """ pass + @abc.abstractmethod + def undelete_message( + self, message_id: str, user_id: str + ) -> Union[StreamResponse, Awaitable[StreamResponse]]: + """ + Undeletes a message. + """ + pass + @abc.abstractmethod def get_message( self, message_id: str, **options: Any diff --git a/stream_chat/client.py b/stream_chat/client.py index 55829bc..e9cfc0a 100644 --- a/stream_chat/client.py +++ b/stream_chat/client.py @@ -322,6 +322,11 @@ def update_message_partial( def delete_message(self, message_id: str, **options: Any) -> StreamResponse: return self.delete(f"messages/{message_id}", options) + def undelete_message(self, message_id: str, user_id: str) -> StreamResponse: + return self.post( + f"messages/{message_id}/undelete", data={"undeleted_by": user_id} + ) + def get_message(self, message_id: str, **options: Any) -> StreamResponse: return self.get(f"messages/{message_id}", options)