stream-chat 4.19.0__tar.gz → 4.21.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {stream-chat-4.19.0/stream_chat.egg-info → stream-chat-4.21.0}/PKG-INFO +2 -2
  2. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/__pkg__.py +1 -1
  3. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/async_chat/channel.py +38 -0
  4. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/base/channel.py +46 -0
  5. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/channel.py +38 -0
  6. {stream-chat-4.19.0 → stream-chat-4.21.0/stream_chat.egg-info}/PKG-INFO +2 -2
  7. {stream-chat-4.19.0 → stream-chat-4.21.0}/LICENSE +0 -0
  8. {stream-chat-4.19.0 → stream-chat-4.21.0}/MANIFEST.in +0 -0
  9. {stream-chat-4.19.0 → stream-chat-4.21.0}/README.md +0 -0
  10. {stream-chat-4.19.0 → stream-chat-4.21.0}/pyproject.toml +0 -0
  11. {stream-chat-4.19.0 → stream-chat-4.21.0}/setup.cfg +0 -0
  12. {stream-chat-4.19.0 → stream-chat-4.21.0}/setup.py +0 -0
  13. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/__init__.py +0 -0
  14. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/async_chat/__init__.py +0 -0
  15. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/async_chat/campaign.py +0 -0
  16. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/async_chat/client.py +0 -0
  17. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/async_chat/segment.py +0 -0
  18. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/base/__init__.py +0 -0
  19. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/base/campaign.py +0 -0
  20. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/base/client.py +0 -0
  21. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/base/exceptions.py +0 -0
  22. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/base/segment.py +0 -0
  23. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/campaign.py +0 -0
  24. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/client.py +0 -0
  25. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/py.typed +0 -0
  26. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/segment.py +0 -0
  27. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/types/__init__.py +0 -0
  28. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/types/base.py +0 -0
  29. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/types/campaign.py +0 -0
  30. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/types/rate_limit.py +0 -0
  31. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/types/segment.py +0 -0
  32. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat/types/stream_response.py +0 -0
  33. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat.egg-info/SOURCES.txt +0 -0
  34. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat.egg-info/dependency_links.txt +0 -0
  35. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat.egg-info/not-zip-safe +0 -0
  36. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat.egg-info/requires.txt +0 -0
  37. {stream-chat-4.19.0 → stream-chat-4.21.0}/stream_chat.egg-info/top_level.txt +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stream-chat
3
- Version: 4.19.0
3
+ Version: 4.21.0
4
4
  Summary: Client for Stream Chat.
5
5
  Home-page: https://github.com/GetStream/stream-chat-python
6
6
  Author: Tommaso Barbugli
7
7
  Author-email: support@getstream.io
8
8
  Project-URL: Bug Tracker, https://github.com/GetStream/stream-chat-python/issues
9
9
  Project-URL: Documentation, https://getstream.io/activity-feeds/docs/python/?language=python
10
- Project-URL: Release Notes, https://github.com/GetStream/stream-chat-python/releases/tag/v4.19.0
10
+ Project-URL: Release Notes, https://github.com/GetStream/stream-chat-python/releases/tag/v4.21.0
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Intended Audience :: System Administrators
13
13
  Classifier: Operating System :: OS Independent
@@ -1,6 +1,6 @@
1
1
  __author__ = "Tommaso Barbugli"
2
2
  __copyright__ = "Copyright 2019-2022, Stream.io, Inc"
3
- __version__ = "4.19.0"
3
+ __version__ = "4.21.0"
4
4
  __maintainer__ = "Tommaso Barbugli"
5
5
  __email__ = "support@getstream.io"
6
6
  __status__ = "Production"
@@ -2,6 +2,7 @@ import json
2
2
  from typing import Any, Dict, Iterable, List, Union
3
3
 
4
4
  from stream_chat.base.channel import ChannelInterface, add_user_id
5
+ from stream_chat.base.exceptions import StreamChannelException
5
6
  from stream_chat.types.stream_response import StreamResponse
6
7
 
7
8
 
@@ -209,3 +210,40 @@ class Channel(ChannelInterface):
209
210
  "channel_cid": self.cid,
210
211
  }
211
212
  return await self.client.post("moderation/unmute/channel", data=params)
213
+
214
+ async def pin(self, user_id: str) -> StreamResponse:
215
+ if not user_id:
216
+ raise StreamChannelException("user_id must not be empty")
217
+
218
+ payload = {"set": {"pinned": True}}
219
+ return await self.client.patch(f"{self.url}/member/{user_id}", data=payload)
220
+
221
+ async def unpin(self, user_id: str) -> StreamResponse:
222
+ if not user_id:
223
+ raise StreamChannelException("user_id must not be empty")
224
+
225
+ payload = {"set": {"pinned": False}}
226
+ return await self.client.patch(f"{self.url}/member/{user_id}", data=payload)
227
+
228
+ async def archive(self, user_id: str) -> StreamResponse:
229
+ if not user_id:
230
+ raise StreamChannelException("user_id must not be empty")
231
+
232
+ payload = {"set": {"archived": True}}
233
+ return await self.client.patch(f"{self.url}/member/{user_id}", data=payload)
234
+
235
+ async def unarchive(self, user_id: str) -> StreamResponse:
236
+ if not user_id:
237
+ raise StreamChannelException("user_id must not be empty")
238
+
239
+ payload = {"set": {"archived": False}}
240
+ return await self.client.patch(f"{self.url}/member/{user_id}", data=payload)
241
+
242
+ async def update_member_partial(
243
+ self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None
244
+ ) -> StreamResponse:
245
+ if not user_id:
246
+ raise StreamChannelException("user_id must not be empty")
247
+
248
+ payload = {"set": to_set or {}, "unset": to_unset or []}
249
+ return await self.client.patch(f"{self.url}/member/{user_id}", data=payload)
@@ -440,6 +440,52 @@ class ChannelInterface(abc.ABC):
440
440
  """
441
441
  pass
442
442
 
443
+ @abc.abstractmethod
444
+ def pin(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]:
445
+ """
446
+ Pins a channel
447
+ Allows a user to pin the channel (only for themselves)
448
+ """
449
+ pass
450
+
451
+ @abc.abstractmethod
452
+ def unpin(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]:
453
+ """
454
+ Unpins a channel
455
+ Allows a user to unpin the channel (only for themselves)
456
+ """
457
+ pass
458
+
459
+ @abc.abstractmethod
460
+ def archive(self, user_id: str) -> Union[StreamResponse, Awaitable[StreamResponse]]:
461
+ """
462
+ Pins a channel
463
+ Allows a user to archive the channel (only for themselves)
464
+ """
465
+ pass
466
+
467
+ @abc.abstractmethod
468
+ def unarchive(
469
+ self, user_id: str
470
+ ) -> Union[StreamResponse, Awaitable[StreamResponse]]:
471
+ """
472
+ Unpins a channel
473
+ Allows a user to unpin the channel (only for themselves)
474
+ """
475
+ pass
476
+
477
+ @abc.abstractmethod
478
+ def update_member_partial(
479
+ self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None
480
+ ) -> Union[StreamResponse, Awaitable[StreamResponse]]:
481
+ """
482
+ Update channel member partially
483
+
484
+ :param to_set: a dictionary of key/value pairs to set or to override
485
+ :param to_unset: a list of keys to clear
486
+ """
487
+ pass
488
+
443
489
 
444
490
  def add_user_id(payload: Dict, user_id: str) -> Dict:
445
491
  return {**payload, "user": {"id": user_id}}
@@ -2,6 +2,7 @@ import json
2
2
  from typing import Any, Dict, Iterable, List, Union
3
3
 
4
4
  from stream_chat.base.channel import ChannelInterface, add_user_id
5
+ from stream_chat.base.exceptions import StreamChannelException
5
6
  from stream_chat.types.stream_response import StreamResponse
6
7
 
7
8
 
@@ -210,3 +211,40 @@ class Channel(ChannelInterface):
210
211
  "channel_cid": self.cid,
211
212
  }
212
213
  return self.client.post("moderation/unmute/channel", data=params)
214
+
215
+ def pin(self, user_id: str) -> StreamResponse:
216
+ if not user_id:
217
+ raise StreamChannelException("user_id must not be empty")
218
+
219
+ payload = {"set": {"pinned": True}}
220
+ return self.client.patch(f"{self.url}/member/{user_id}", data=payload)
221
+
222
+ def unpin(self, user_id: str) -> StreamResponse:
223
+ if not user_id:
224
+ raise StreamChannelException("user_id must not be empty")
225
+
226
+ payload = {"set": {"pinned": False}}
227
+ return self.client.patch(f"{self.url}/member/{user_id}", data=payload)
228
+
229
+ def archive(self, user_id: str) -> StreamResponse:
230
+ if not user_id:
231
+ raise StreamChannelException("user_id must not be empty")
232
+
233
+ payload = {"set": {"archived": True}}
234
+ return self.client.patch(f"{self.url}/member/{user_id}", data=payload)
235
+
236
+ def unarchive(self, user_id: str) -> StreamResponse:
237
+ if not user_id:
238
+ raise StreamChannelException("user_id must not be empty")
239
+
240
+ payload = {"set": {"archived": False}}
241
+ return self.client.patch(f"{self.url}/member/{user_id}", data=payload)
242
+
243
+ def update_member_partial(
244
+ self, user_id: str, to_set: Dict = None, to_unset: Iterable[str] = None
245
+ ) -> StreamResponse:
246
+ if not user_id:
247
+ raise StreamChannelException("user_id must not be empty")
248
+
249
+ payload = {"set": to_set or {}, "unset": to_unset or []}
250
+ return self.client.patch(f"{self.url}/member/{user_id}", data=payload)
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stream-chat
3
- Version: 4.19.0
3
+ Version: 4.21.0
4
4
  Summary: Client for Stream Chat.
5
5
  Home-page: https://github.com/GetStream/stream-chat-python
6
6
  Author: Tommaso Barbugli
7
7
  Author-email: support@getstream.io
8
8
  Project-URL: Bug Tracker, https://github.com/GetStream/stream-chat-python/issues
9
9
  Project-URL: Documentation, https://getstream.io/activity-feeds/docs/python/?language=python
10
- Project-URL: Release Notes, https://github.com/GetStream/stream-chat-python/releases/tag/v4.19.0
10
+ Project-URL: Release Notes, https://github.com/GetStream/stream-chat-python/releases/tag/v4.21.0
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Intended Audience :: System Administrators
13
13
  Classifier: Operating System :: OS Independent
File without changes
File without changes
File without changes
File without changes
File without changes