From 5500ea4fcf5958606fad4f757e583f5191be431e Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 15:14:02 +0100 Subject: [PATCH 01/32] feat: added pin, archive and partial member update functions --- stream_chat/async_chat/channel.py | 51 +++++++++++++++++++++++++++++++ stream_chat/base/channel.py | 42 +++++++++++++++++++++++++ stream_chat/channel.py | 51 +++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+) diff --git a/stream_chat/async_chat/channel.py b/stream_chat/async_chat/channel.py index 764a19f..b019283 100644 --- a/stream_chat/async_chat/channel.py +++ b/stream_chat/async_chat/channel.py @@ -209,3 +209,54 @@ async def unmute(self, user_id: str) -> StreamResponse: "channel_cid": self.cid, } return await self.client.post("moderation/unmute/channel", data=params) + + async def pin(self, user_id: str) -> StreamResponse: + if not user_id: + raise StreamChannelException("user_id must not be empty") + + payload = { + "set": { + "pinned": True + } + } + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + + async def unpin(self, user_id: str) -> StreamResponse: + if not user_id: + raise StreamChannelException("user_id must not be empty") + + payload = { + "set": { + "pinned": False + } + } + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + + async def archive(self, user_id: str) -> StreamResponse: + if not user_id: + raise StreamChannelException("user_id must not be empty") + + payload = { + "set": { + "archived": True + } + } + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + + async def unarchive(self, user_id: str) -> StreamResponse: + if not user_id: + raise StreamChannelException("user_id must not be empty") + + payload = { + "set": { + "archived": False + } + } + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + + async def update_member_partial(self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None) -> Union[StreamResponse, Awaitable[StreamResponse]]: + if not user_id: + raise StreamChannelException("user_id must not be empty") + + payload = {"set": to_set or {}, "unset": to_unset or []} + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) diff --git a/stream_chat/base/channel.py b/stream_chat/base/channel.py index 16cc87e..f59f9f3 100644 --- a/stream_chat/base/channel.py +++ b/stream_chat/base/channel.py @@ -440,6 +440,48 @@ def unmute(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse """ pass + @abc.abstractmethod + def pin(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]: + """ + Pins a channel + Allows a user to pin the channel (only for theirselves) + """ + pass + + @abc.abstractmethod + def unpin(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]: + """ + Unpins a channel + Allows a user to unpin the channel (only for theirselves) + """ + pass + + @abc.abstractmethod + def archive(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]: + """ + Pins a channel + Allows a user to archive the channel (only for theirselves) + """ + pass + + @abc.abstractmethod + def unarchive(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]: + """ + Unpins a channel + Allows a user to unpin the channel (only for theirselves) + """ + pass + + @abc.abstractmethod + def update_member_partial(self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None) -> Union[StreamResponse, Awaitable[StreamResponse]]: + """ + Update channel member partially + + :param to_set: a dictionary of key/value pairs to set or to override + :param to_unset: a list of keys to clear + """ + pass + def add_user_id(payload: Dict, user_id: str) -> Dict: return {**payload, "user": {"id": user_id}} diff --git a/stream_chat/channel.py b/stream_chat/channel.py index 776c892..b818357 100644 --- a/stream_chat/channel.py +++ b/stream_chat/channel.py @@ -210,3 +210,54 @@ def unmute(self, user_id: str) -> StreamResponse: "channel_cid": self.cid, } return self.client.post("moderation/unmute/channel", data=params) + + def pin(self, user_id: str) -> StreamResponse: + if not user_id: + raise StreamChannelException("user_id must not be empty") + + payload = { + "set": { + "pinned": True + } + } + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + + def unpin(self, user_id: str) -> StreamResponse: + if not user_id: + raise StreamChannelException("user_id must not be empty") + + payload = { + "set": { + "pinned": False + } + } + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + + def archive(self, user_id: str) -> StreamResponse: + if not user_id: + raise StreamChannelException("user_id must not be empty") + + payload = { + "set": { + "archived": True + } + } + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + + def unarchive(self, user_id: str) -> StreamResponse: + if not user_id: + raise StreamChannelException("user_id must not be empty") + + payload = { + "set": { + "archived": False + } + } + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + + def update_member_partial(self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None) -> Union[StreamResponse, Awaitable[StreamResponse]]: + if not user_id: + raise StreamChannelException("user_id must not be empty") + + payload = {"set": to_set or {}, "unset": to_unset or []} + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) From d000002f928dc30543e11b85721a9014b4221c94 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:20:03 +0100 Subject: [PATCH 02/32] fix: update stream_chat/channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/channel.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/stream_chat/channel.py b/stream_chat/channel.py index b818357..e3346c5 100644 --- a/stream_chat/channel.py +++ b/stream_chat/channel.py @@ -225,12 +225,8 @@ def pin(self, user_id: str) -> StreamResponse: def unpin(self, user_id: str) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") - - payload = { - "set": { - "pinned": False - } - } + + payload = {"set": {"pinned": False}} return self.client.patch(f"{self.url}/member/{user_id}", data=payload) def archive(self, user_id: str) -> StreamResponse: From 7d6478ee9ed56d6d1db56e6cf529ac238f02e448 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:20:48 +0100 Subject: [PATCH 03/32] fix: update stream_chat/async_chat/channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/async_chat/channel.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/stream_chat/async_chat/channel.py b/stream_chat/async_chat/channel.py index b019283..da4060c 100644 --- a/stream_chat/async_chat/channel.py +++ b/stream_chat/async_chat/channel.py @@ -213,12 +213,8 @@ async def unmute(self, user_id: str) -> StreamResponse: async def pin(self, user_id: str) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") - - payload = { - "set": { - "pinned": True - } - } + + payload = {"set": {"pinned": True}} return self.client.patch(f"{self.url}/member/{user_id}", data=payload) async def unpin(self, user_id: str) -> StreamResponse: From 43da753bc1ceadfc4b98468fbccdf9f08cc62b14 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:20:58 +0100 Subject: [PATCH 04/32] fix: update stream_chat/async_chat/channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/async_chat/channel.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/stream_chat/async_chat/channel.py b/stream_chat/async_chat/channel.py index da4060c..0e1f4ed 100644 --- a/stream_chat/async_chat/channel.py +++ b/stream_chat/async_chat/channel.py @@ -220,12 +220,8 @@ async def pin(self, user_id: str) -> StreamResponse: async def unpin(self, user_id: str) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") - - payload = { - "set": { - "pinned": False - } - } + + payload = {"set": {"pinned": False}} return self.client.patch(f"{self.url}/member/{user_id}", data=payload) async def archive(self, user_id: str) -> StreamResponse: From 97cb3ee2bc6707d04a63ab2590d2e46f1cb6bf58 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:21:11 +0100 Subject: [PATCH 05/32] fix: update stream_chat/async_chat/channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/async_chat/channel.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/stream_chat/async_chat/channel.py b/stream_chat/async_chat/channel.py index 0e1f4ed..56c78f0 100644 --- a/stream_chat/async_chat/channel.py +++ b/stream_chat/async_chat/channel.py @@ -238,15 +238,13 @@ async def archive(self, user_id: str) -> StreamResponse: async def unarchive(self, user_id: str) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") - - payload = { - "set": { - "archived": False - } - } + + payload = {"set": {"archived": False}} return self.client.patch(f"{self.url}/member/{user_id}", data=payload) - async def update_member_partial(self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None) -> Union[StreamResponse, Awaitable[StreamResponse]]: + async def update_member_partial( + self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None + ) -> Union[StreamResponse, Awaitable[StreamResponse]]: if not user_id: raise StreamChannelException("user_id must not be empty") From 2a3094cba8ec448f1d1c1d2cbba59c88a5db42b2 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:21:31 +0100 Subject: [PATCH 06/32] fix: update stream_chat/async_chat/channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/async_chat/channel.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/stream_chat/async_chat/channel.py b/stream_chat/async_chat/channel.py index 56c78f0..864bc97 100644 --- a/stream_chat/async_chat/channel.py +++ b/stream_chat/async_chat/channel.py @@ -227,12 +227,8 @@ async def unpin(self, user_id: str) -> StreamResponse: async def archive(self, user_id: str) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") - - payload = { - "set": { - "archived": True - } - } + + payload = {"set": {"archived": True}} return self.client.patch(f"{self.url}/member/{user_id}", data=payload) async def unarchive(self, user_id: str) -> StreamResponse: From e0890c95797fc5e03644a71623e0d3d8b3bf1c63 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:21:45 +0100 Subject: [PATCH 07/32] fix: update stream_chat/channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/channel.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/stream_chat/channel.py b/stream_chat/channel.py index e3346c5..98a487e 100644 --- a/stream_chat/channel.py +++ b/stream_chat/channel.py @@ -214,12 +214,8 @@ def unmute(self, user_id: str) -> StreamResponse: def pin(self, user_id: str) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") - - payload = { - "set": { - "pinned": True - } - } + + payload = {"set": {"pinned": True}} return self.client.patch(f"{self.url}/member/{user_id}", data=payload) def unpin(self, user_id: str) -> StreamResponse: From 0de14013ddf4bd76b9f835e3c9dbd9ef90e610f4 Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 15:22:10 +0100 Subject: [PATCH 08/32] remove commitlint --- .github/workflows/ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5fcc3e..69f9b37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,10 +24,6 @@ jobs: with: fetch-depth: 0 # gives the commit message linter access to all previous commits - - name: Commit lint - if: ${{ matrix.python == '3.8' && github.ref == 'refs/heads/master' }} - uses: wagoid/commitlint-github-action@v4 - - uses: actions/setup-python@v3 with: python-version: ${{ matrix.python }} From ad1d8052c71065840d44e9096bb09149bfb9019c Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 15:23:09 +0100 Subject: [PATCH 09/32] fix: linting --- stream_chat/async_chat/channel.py | 2 +- stream_chat/channel.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stream_chat/async_chat/channel.py b/stream_chat/async_chat/channel.py index 864bc97..213f6a5 100644 --- a/stream_chat/async_chat/channel.py +++ b/stream_chat/async_chat/channel.py @@ -245,4 +245,4 @@ async def update_member_partial( raise StreamChannelException("user_id must not be empty") payload = {"set": to_set or {}, "unset": to_unset or []} - return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) \ No newline at end of file diff --git a/stream_chat/channel.py b/stream_chat/channel.py index 98a487e..dc9d805 100644 --- a/stream_chat/channel.py +++ b/stream_chat/channel.py @@ -252,4 +252,4 @@ def update_member_partial(self, user_id: str, to_set: Dict = None, to_unset: Ite raise StreamChannelException("user_id must not be empty") payload = {"set": to_set or {}, "unset": to_unset or []} - return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) \ No newline at end of file From 3b8b1b23343a0c784e9ed572f9734ef68cd0643e Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 15:25:05 +0100 Subject: [PATCH 10/32] fix: import --- stream_chat/async_chat/channel.py | 1 + stream_chat/channel.py | 1 + 2 files changed, 2 insertions(+) diff --git a/stream_chat/async_chat/channel.py b/stream_chat/async_chat/channel.py index 213f6a5..62328c4 100644 --- a/stream_chat/async_chat/channel.py +++ b/stream_chat/async_chat/channel.py @@ -2,6 +2,7 @@ from typing import Any, Dict, Iterable, List, Union from stream_chat.base.channel import ChannelInterface, add_user_id +from stream_chat.base.exceptions import StreamChannelException from stream_chat.types.stream_response import StreamResponse diff --git a/stream_chat/channel.py b/stream_chat/channel.py index dc9d805..6ec3859 100644 --- a/stream_chat/channel.py +++ b/stream_chat/channel.py @@ -2,6 +2,7 @@ from typing import Any, Dict, Iterable, List, Union from stream_chat.base.channel import ChannelInterface, add_user_id +from stream_chat.base.exceptions import StreamChannelException from stream_chat.types.stream_response import StreamResponse From c15caebd52da80f2e144120309cb7c1c86c1bea0 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:25:36 +0100 Subject: [PATCH 11/32] fix: update stream_chat/channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/channel.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/stream_chat/channel.py b/stream_chat/channel.py index 6ec3859..e6f0f57 100644 --- a/stream_chat/channel.py +++ b/stream_chat/channel.py @@ -229,12 +229,8 @@ def unpin(self, user_id: str) -> StreamResponse: def archive(self, user_id: str) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") - - payload = { - "set": { - "archived": True - } - } + + payload = {"set": {"archived": True}} return self.client.patch(f"{self.url}/member/{user_id}", data=payload) def unarchive(self, user_id: str) -> StreamResponse: From 0a30e024a14f8d419283ba840845c045d2ad2e39 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:26:19 +0100 Subject: [PATCH 12/32] fix: update stream_chat/channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/channel.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/stream_chat/channel.py b/stream_chat/channel.py index e6f0f57..5ff406d 100644 --- a/stream_chat/channel.py +++ b/stream_chat/channel.py @@ -236,15 +236,13 @@ def archive(self, user_id: str) -> StreamResponse: def unarchive(self, user_id: str) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") - - payload = { - "set": { - "archived": False - } - } + + payload = {"set": {"archived": False}} return self.client.patch(f"{self.url}/member/{user_id}", data=payload) - def update_member_partial(self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None) -> Union[StreamResponse, Awaitable[StreamResponse]]: + def update_member_partial( + self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None + ) -> Union[StreamResponse, Awaitable[StreamResponse]]: if not user_id: raise StreamChannelException("user_id must not be empty") From 5999443c9d0aa25e89fdac26a893278ad03813ef Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:28:04 +0100 Subject: [PATCH 13/32] fix: update stream_chat/base/channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/base/channel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stream_chat/base/channel.py b/stream_chat/base/channel.py index f59f9f3..b82d585 100644 --- a/stream_chat/base/channel.py +++ b/stream_chat/base/channel.py @@ -465,7 +465,9 @@ def archive(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamRespons pass @abc.abstractmethod - def unarchive(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]: + def unarchive( + self, user_id: str + ) -> Union[StreamResponse, Awaitable[StreamResponse]]: """ Unpins a channel Allows a user to unpin the channel (only for theirselves) From 1875fd7560826b74f9c6a9acca56b48e6e196d7d Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 15:28:15 +0100 Subject: [PATCH 14/32] fix: update stream_chat/base/channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/base/channel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stream_chat/base/channel.py b/stream_chat/base/channel.py index b82d585..65d5597 100644 --- a/stream_chat/base/channel.py +++ b/stream_chat/base/channel.py @@ -475,7 +475,9 @@ def unarchive( pass @abc.abstractmethod - def update_member_partial(self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None) -> Union[StreamResponse, Awaitable[StreamResponse]]: + def update_member_partial( + self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None + ) -> Union[StreamResponse, Awaitable[StreamResponse]]: """ Update channel member partially From abe3c74ee99555defde65dbfda3860ec47a8845e Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 15:29:12 +0100 Subject: [PATCH 15/32] fix: lint --- stream_chat/async_chat/channel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream_chat/async_chat/channel.py b/stream_chat/async_chat/channel.py index 62328c4..9aaa133 100644 --- a/stream_chat/async_chat/channel.py +++ b/stream_chat/async_chat/channel.py @@ -246,4 +246,4 @@ async def update_member_partial( raise StreamChannelException("user_id must not be empty") payload = {"set": to_set or {}, "unset": to_unset or []} - return self.client.patch(f"{self.url}/member/{user_id}", data=payload) \ No newline at end of file + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) From d13cfd822ce8ba7a59c75dd2b5577429fa09f333 Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 15:31:41 +0100 Subject: [PATCH 16/32] fix: linting --- stream_chat/channel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream_chat/channel.py b/stream_chat/channel.py index 5ff406d..7f8ab05 100644 --- a/stream_chat/channel.py +++ b/stream_chat/channel.py @@ -247,4 +247,4 @@ def update_member_partial( raise StreamChannelException("user_id must not be empty") payload = {"set": to_set or {}, "unset": to_unset or []} - return self.client.patch(f"{self.url}/member/{user_id}", data=payload) \ No newline at end of file + return self.client.patch(f"{self.url}/member/{user_id}", data=payload) From 7e4a6c80b7c3cfedc54922835f23d8804397ab3b Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 15:44:13 +0100 Subject: [PATCH 17/32] fix: stuff --- stream_chat/async_chat/channel.py | 12 ++++++------ stream_chat/channel.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/stream_chat/async_chat/channel.py b/stream_chat/async_chat/channel.py index 9aaa133..18342f0 100644 --- a/stream_chat/async_chat/channel.py +++ b/stream_chat/async_chat/channel.py @@ -216,34 +216,34 @@ async def pin(self, user_id: str) -> StreamResponse: raise StreamChannelException("user_id must not be empty") payload = {"set": {"pinned": True}} - return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + return await self.client.patch(f"{self.url}/member/{user_id}", data=payload) async def unpin(self, user_id: str) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") payload = {"set": {"pinned": False}} - return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + return await self.client.patch(f"{self.url}/member/{user_id}", data=payload) async def archive(self, user_id: str) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") payload = {"set": {"archived": True}} - return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + return await self.client.patch(f"{self.url}/member/{user_id}", data=payload) async def unarchive(self, user_id: str) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") payload = {"set": {"archived": False}} - return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + return await self.client.patch(f"{self.url}/member/{user_id}", data=payload) async def update_member_partial( self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None - ) -> Union[StreamResponse, Awaitable[StreamResponse]]: + ) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") payload = {"set": to_set or {}, "unset": to_unset or []} - return self.client.patch(f"{self.url}/member/{user_id}", data=payload) + return await self.client.patch(f"{self.url}/member/{user_id}", data=payload) diff --git a/stream_chat/channel.py b/stream_chat/channel.py index 7f8ab05..cacfdd6 100644 --- a/stream_chat/channel.py +++ b/stream_chat/channel.py @@ -242,7 +242,7 @@ def unarchive(self, user_id: str) -> StreamResponse: def update_member_partial( self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None - ) -> Union[StreamResponse, Awaitable[StreamResponse]]: + ) -> StreamResponse: if not user_id: raise StreamChannelException("user_id must not be empty") From 2b53100bb32df6a5c516ca2f3cac3dc746c2bf5e Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 15:57:42 +0100 Subject: [PATCH 18/32] feat: added test for pinning / unpinning --- stream_chat/tests/test_channel.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index ceb1911..8d3f8c8 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -377,3 +377,30 @@ def test_export_channel( assert "error" not in resp break time.sleep(0.5) + + def test_pin_channel(self, client: StreamChat, channel: Channel, random_users: List[Dict]): + user_id = random_users[0]["id"] + + # Pin the channel + response = channel.pin(user_id) + assert response is not None + + # Query for pinned channels + response = client.query_channels( + {"pinned": True, "cid": channel.cid}, + user_id=user_id + ) + assert len(response["channels"]) == 1 + assert response["channels"][0]["cid"] == channel.cid + + # Unpin the channel + response = channel.unpin(user_id) + assert response is not None + + # Query for pinned channels + response = client.query_channels( + {"pinned": False, "cid": channel.cid}, + user_id=user_id + ) + assert len(response["channels"]) == 1 + assert response["channels"][0]["cid"] == channel.cid \ No newline at end of file From c1a49f83fb97cf410cd9ce4fd5342a8b81daa312 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:01:11 +0100 Subject: [PATCH 19/32] fix: update stream_chat/tests/test_channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/tests/test_channel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index 8d3f8c8..63f27b0 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -378,7 +378,9 @@ def test_export_channel( break time.sleep(0.5) - def test_pin_channel(self, client: StreamChat, channel: Channel, random_users: List[Dict]): + def test_pin_channel( + self, client: StreamChat, channel: Channel, random_users: List[Dict] + ): user_id = random_users[0]["id"] # Pin the channel From 328dcfcabbac6b1e7ec56201b949c215ff34b95e Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:01:21 +0100 Subject: [PATCH 20/32] fix: update stream_chat/tests/test_channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/tests/test_channel.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index 63f27b0..f31216a 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -389,8 +389,7 @@ def test_pin_channel( # Query for pinned channels response = client.query_channels( - {"pinned": True, "cid": channel.cid}, - user_id=user_id + {"pinned": True, "cid": channel.cid}, user_id=user_id ) assert len(response["channels"]) == 1 assert response["channels"][0]["cid"] == channel.cid From 9b5c2578edeac628d013509b2983473b98de9866 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:01:31 +0100 Subject: [PATCH 21/32] fix: update stream_chat/tests/test_channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/tests/test_channel.py | 1 - 1 file changed, 1 deletion(-) diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index f31216a..f71e137 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -382,7 +382,6 @@ def test_pin_channel( self, client: StreamChat, channel: Channel, random_users: List[Dict] ): user_id = random_users[0]["id"] - # Pin the channel response = channel.pin(user_id) assert response is not None From a80505a107b794025d720b3977976e3049f5e902 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:01:48 +0100 Subject: [PATCH 22/32] fix: update stream_chat/tests/test_channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/tests/test_channel.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index f71e137..864d1ae 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -399,8 +399,7 @@ def test_pin_channel( # Query for pinned channels response = client.query_channels( - {"pinned": False, "cid": channel.cid}, - user_id=user_id + {"pinned": False, "cid": channel.cid}, user_id=user_id ) assert len(response["channels"]) == 1 assert response["channels"][0]["cid"] == channel.cid \ No newline at end of file From f161569588695bd955fffcbab591c154c5f037fa Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 16:02:15 +0100 Subject: [PATCH 23/32] fix: linting --- stream_chat/tests/test_channel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index 8d3f8c8..6bc20b4 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -403,4 +403,4 @@ def test_pin_channel(self, client: StreamChat, channel: Channel, random_users: L user_id=user_id ) assert len(response["channels"]) == 1 - assert response["channels"][0]["cid"] == channel.cid \ No newline at end of file + assert response["channels"][0]["cid"] == channel.cid From 0b5a59494715c2b9777e55ae55e76fcc0edfdc7e Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 16:20:13 +0100 Subject: [PATCH 24/32] fix: test --- stream_chat/tests/test_channel.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index d575cd9..cf133b4 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -382,6 +382,8 @@ def test_pin_channel( self, client: StreamChat, channel: Channel, random_users: List[Dict] ): user_id = random_users[0]["id"] + channel.add_members([user_id]) + # Pin the channel response = channel.pin(user_id) assert response is not None @@ -390,8 +392,9 @@ def test_pin_channel( response = client.query_channels( {"pinned": True, "cid": channel.cid}, user_id=user_id ) + print(response) assert len(response["channels"]) == 1 - assert response["channels"][0]["cid"] == channel.cid + assert response["channels"][0]["channel"]["cid"] == channel.cid # Unpin the channel response = channel.unpin(user_id) @@ -402,4 +405,4 @@ def test_pin_channel( {"pinned": False, "cid": channel.cid}, user_id=user_id ) assert len(response["channels"]) == 1 - assert response["channels"][0]["cid"] == channel.cid + assert response["channels"][0]["channel"]["cid"] == channel.cid From 5713873da9c9bd7c2878901c7f0146ae68c2a306 Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 16:45:20 +0100 Subject: [PATCH 25/32] feat: adding tests --- stream_chat/tests/async_chat/test_channel.py | 56 ++++++++++++++++++++ stream_chat/tests/test_channel.py | 29 +++++++++- 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/stream_chat/tests/async_chat/test_channel.py b/stream_chat/tests/async_chat/test_channel.py index 148f94e..49d4b91 100644 --- a/stream_chat/tests/async_chat/test_channel.py +++ b/stream_chat/tests/async_chat/test_channel.py @@ -380,3 +380,59 @@ async def test_export_channel( assert "error" not in resp break time.sleep(0.5) + + async def test_pin_channel( + self, client: StreamChatAsync, channel: Channel, random_users: List[Dict] + ): + user_id = random_users[0]["id"] + await channel.add_members([user_id]) + + # Pin the channel + response = await channel.pin(user_id) + assert response is not None + + # Query for pinned channels + response = await client.query_channels( + {"pinned": True, "cid": channel.cid}, user_id=user_id + ) + assert len(response["channels"]) == 1 + assert response["channels"][0]["channel"]["cid"] == channel.cid + + # Unpin the channel + response = await channel.unpin(user_id) + assert response is not None + + # Query for pinned channels + response = await client.query_channels( + {"pinned": False, "cid": channel.cid}, user_id=user_id + ) + assert len(response["channels"]) == 1 + assert response["channels"][0]["channel"]["cid"] == channel.cid + + async def test_archive_channel( + self, client: StreamChatAsync, channel: Channel, random_users: List[Dict] + ): + user_id = random_users[0]["id"] + await channel.add_members([user_id]) + + # Archive the channel + response = await channel.archive(user_id) + assert response is not None + + # Query for archived channels + response = await client.query_channels( + {"archived": True, "cid": channel.cid}, user_id=user_id + ) + assert len(response["channels"]) == 1 + assert response["channels"][0]["channel"]["cid"] == channel.cid + + # Unarchive the channel + response = await channel.unarchive(user_id) + assert response is not None + + # Query for archived channels + response = await client.query_channels( + {"archived": False, "cid": channel.cid}, user_id=user_id + ) + assert len(response["channels"]) == 1 + assert response["channels"][0]["channel"]["cid"] == channel.cid diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index cf133b4..366db8b 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -392,7 +392,6 @@ def test_pin_channel( response = client.query_channels( {"pinned": True, "cid": channel.cid}, user_id=user_id ) - print(response) assert len(response["channels"]) == 1 assert response["channels"][0]["channel"]["cid"] == channel.cid @@ -406,3 +405,31 @@ def test_pin_channel( ) assert len(response["channels"]) == 1 assert response["channels"][0]["channel"]["cid"] == channel.cid + + def test_archive_channel( + self, client: StreamChat, channel: Channel, random_users: List[Dict] + ): + user_id = random_users[0]["id"] + channel.add_members([user_id]) + + # Archive the channel + response = channel.archive(user_id) + assert response is not None + + # Query for archived channels + response = client.query_channels( + {"archived": True, "cid": channel.cid}, user_id=user_id + ) + assert len(response["channels"]) == 1 + assert response["channels"][0]["channel"]["cid"] == channel.cid + + # Unarchive the channel + response = channel.unarchive(user_id) + assert response is not None + + # Query for archhived channels + response = client.query_channels( + {"archived": False, "cid": channel.cid}, user_id=user_id + ) + assert len(response["channels"]) == 1 + assert response["channels"][0]["channel"]["cid"] == channel.cid From 50df973b7f29db7653cff53daf601bf98b9fc7d7 Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 16:52:09 +0100 Subject: [PATCH 26/32] feat: add tests for partial member update --- stream_chat/tests/async_chat/test_channel.py | 17 +++++++++++++++++ stream_chat/tests/test_channel.py | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/stream_chat/tests/async_chat/test_channel.py b/stream_chat/tests/async_chat/test_channel.py index 49d4b91..5881e6f 100644 --- a/stream_chat/tests/async_chat/test_channel.py +++ b/stream_chat/tests/async_chat/test_channel.py @@ -436,3 +436,20 @@ async def test_archive_channel( ) assert len(response["channels"]) == 1 assert response["channels"][0]["channel"]["cid"] == channel.cid + + async def test_update_member_partial(self, channel: Channel, random_users: List[Dict]): + user_id = random_users[0]["id"] + await channel.add_members([user_id]) + + # Test setting a custom field + response = await channel.update_member_partial(user_id, set={"hat": "blue"}) + assert response["channel_member"]["hat"] == "blue" + + # Test setting a new field while unsetting the previous one + response = await channel.update_member_partial( + user_id, + set={"color": "red"}, + unset=["hat"] + ) + assert response["channel_member"]["color"] == "red" + assert "hat" not in response["channel_member"] diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index 366db8b..058be63 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -433,3 +433,20 @@ def test_archive_channel( ) assert len(response["channels"]) == 1 assert response["channels"][0]["channel"]["cid"] == channel.cid + + def test_update_member_partial(self, channel: Channel, random_users: List[Dict]): + user_id = random_users[0]["id"] + channel.add_members([user_id]) + + # Test setting a custom field + response = channel.update_member_partial(user_id, set={"hat": "blue"}) + assert response["channel_member"]["hat"] == "blue" + + # Test setting a new field while unsetting the previous one + response = channel.update_member_partial( + user_id, + set={"color": "red"}, + unset=["hat"] + ) + assert response["channel_member"]["color"] == "red" + assert "hat" not in response["channel_member"] From 17389f3720fe6666e4b6bf0938e00e8ef124039b Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:56:27 +0100 Subject: [PATCH 27/32] fix: update stream_chat/tests/async_chat/test_channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/tests/async_chat/test_channel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stream_chat/tests/async_chat/test_channel.py b/stream_chat/tests/async_chat/test_channel.py index 5881e6f..8c52a59 100644 --- a/stream_chat/tests/async_chat/test_channel.py +++ b/stream_chat/tests/async_chat/test_channel.py @@ -437,7 +437,9 @@ async def test_archive_channel( assert len(response["channels"]) == 1 assert response["channels"][0]["channel"]["cid"] == channel.cid - async def test_update_member_partial(self, channel: Channel, random_users: List[Dict]): + async def test_update_member_partial( + self, channel: Channel, random_users: List[Dict] + ): user_id = random_users[0]["id"] await channel.add_members([user_id]) From 42cc3f8ebcd588e40d4b470290991165e40758ce Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:56:37 +0100 Subject: [PATCH 28/32] fix: update stream_chat/tests/async_chat/test_channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/tests/async_chat/test_channel.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stream_chat/tests/async_chat/test_channel.py b/stream_chat/tests/async_chat/test_channel.py index 8c52a59..0986d54 100644 --- a/stream_chat/tests/async_chat/test_channel.py +++ b/stream_chat/tests/async_chat/test_channel.py @@ -449,9 +449,7 @@ async def test_update_member_partial( # Test setting a new field while unsetting the previous one response = await channel.update_member_partial( - user_id, - set={"color": "red"}, - unset=["hat"] + user_id, set={"color": "red"}, unset=["hat"] ) assert response["channel_member"]["color"] == "red" assert "hat" not in response["channel_member"] From e4a2c88fba25c6d504ea801c3b3f2b2dc051b30e Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:56:47 +0100 Subject: [PATCH 29/32] fix: update stream_chat/tests/test_channel.py Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- stream_chat/tests/test_channel.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index 058be63..c29028f 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -444,9 +444,7 @@ def test_update_member_partial(self, channel: Channel, random_users: List[Dict]) # Test setting a new field while unsetting the previous one response = channel.update_member_partial( - user_id, - set={"color": "red"}, - unset=["hat"] + user_id, set={"color": "red"}, unset=["hat"] ) assert response["channel_member"]["color"] == "red" assert "hat" not in response["channel_member"] From a184fe9c94e91a7686e18250cf2bbf5568a0cc86 Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 16:59:55 +0100 Subject: [PATCH 30/32] fix: test --- stream_chat/tests/async_chat/test_channel.py | 6 +++--- stream_chat/tests/test_channel.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stream_chat/tests/async_chat/test_channel.py b/stream_chat/tests/async_chat/test_channel.py index 5881e6f..cb7c43e 100644 --- a/stream_chat/tests/async_chat/test_channel.py +++ b/stream_chat/tests/async_chat/test_channel.py @@ -442,14 +442,14 @@ async def test_update_member_partial(self, channel: Channel, random_users: List[ await channel.add_members([user_id]) # Test setting a custom field - response = await channel.update_member_partial(user_id, set={"hat": "blue"}) + response = await channel.update_member_partial(user_id, to_set={"hat": "blue"}) assert response["channel_member"]["hat"] == "blue" # Test setting a new field while unsetting the previous one response = await channel.update_member_partial( user_id, - set={"color": "red"}, - unset=["hat"] + to_set={"color": "red"}, + to_unset=["hat"] ) assert response["channel_member"]["color"] == "red" assert "hat" not in response["channel_member"] diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index 058be63..bd99fa4 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -439,13 +439,13 @@ def test_update_member_partial(self, channel: Channel, random_users: List[Dict]) channel.add_members([user_id]) # Test setting a custom field - response = channel.update_member_partial(user_id, set={"hat": "blue"}) + response = channel.update_member_partial(user_id, to_unset={"hat": "blue"}) assert response["channel_member"]["hat"] == "blue" # Test setting a new field while unsetting the previous one response = channel.update_member_partial( user_id, - set={"color": "red"}, + to_unset={"color": "red"}, unset=["hat"] ) assert response["channel_member"]["color"] == "red" From c551a1433f0e41d5670d4caf416684e697e2c9f1 Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 17:01:21 +0100 Subject: [PATCH 31/32] fix: test --- stream_chat/tests/async_chat/test_channel.py | 4 ++-- stream_chat/tests/test_channel.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stream_chat/tests/async_chat/test_channel.py b/stream_chat/tests/async_chat/test_channel.py index 0986d54..a266601 100644 --- a/stream_chat/tests/async_chat/test_channel.py +++ b/stream_chat/tests/async_chat/test_channel.py @@ -444,12 +444,12 @@ async def test_update_member_partial( await channel.add_members([user_id]) # Test setting a custom field - response = await channel.update_member_partial(user_id, set={"hat": "blue"}) + response = await channel.update_member_partial(user_id, to_set={"hat": "blue"}) assert response["channel_member"]["hat"] == "blue" # Test setting a new field while unsetting the previous one response = await channel.update_member_partial( - user_id, set={"color": "red"}, unset=["hat"] + user_id, to_set={"color": "red"}, to_unset=["hat"] ) assert response["channel_member"]["color"] == "red" assert "hat" not in response["channel_member"] diff --git a/stream_chat/tests/test_channel.py b/stream_chat/tests/test_channel.py index c29028f..522ea46 100644 --- a/stream_chat/tests/test_channel.py +++ b/stream_chat/tests/test_channel.py @@ -439,12 +439,12 @@ def test_update_member_partial(self, channel: Channel, random_users: List[Dict]) channel.add_members([user_id]) # Test setting a custom field - response = channel.update_member_partial(user_id, set={"hat": "blue"}) + response = channel.update_member_partial(user_id, to_set={"hat": "blue"}) assert response["channel_member"]["hat"] == "blue" # Test setting a new field while unsetting the previous one response = channel.update_member_partial( - user_id, set={"color": "red"}, unset=["hat"] + user_id, to_set={"color": "red"}, to_unset=["hat"] ) assert response["channel_member"]["color"] == "red" assert "hat" not in response["channel_member"] From 7582489eea29175e5189f0b879cd7a4d8bc2f600 Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Fri, 6 Dec 2024 17:25:29 +0100 Subject: [PATCH 32/32] fix: grammar --- stream_chat/base/channel.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stream_chat/base/channel.py b/stream_chat/base/channel.py index 65d5597..a00d329 100644 --- a/stream_chat/base/channel.py +++ b/stream_chat/base/channel.py @@ -444,7 +444,7 @@ def unmute(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse def pin(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]: """ Pins a channel - Allows a user to pin the channel (only for theirselves) + Allows a user to pin the channel (only for themselves) """ pass @@ -452,7 +452,7 @@ def pin(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]: def unpin(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]: """ Unpins a channel - Allows a user to unpin the channel (only for theirselves) + Allows a user to unpin the channel (only for themselves) """ pass @@ -460,7 +460,7 @@ def unpin(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse] def archive(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]: """ Pins a channel - Allows a user to archive the channel (only for theirselves) + Allows a user to archive the channel (only for themselves) """ pass @@ -470,7 +470,7 @@ def unarchive( ) -> Union[StreamResponse, Awaitable[StreamResponse]]: """ Unpins a channel - Allows a user to unpin the channel (only for theirselves) + Allows a user to unpin the channel (only for themselves) """ pass