stream-chat 4.25.0__py3-none-any.whl → 4.26.0__py3-none-any.whl

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.
stream_chat/__pkg__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  __author__ = "Tommaso Barbugli"
2
2
  __copyright__ = "Copyright 2019-2022, Stream.io, Inc"
3
- __version__ = "4.25.0"
3
+ __version__ = "4.26.0"
4
4
  __maintainer__ = "Tommaso Barbugli"
5
5
  __email__ = "support@getstream.io"
6
6
  __status__ = "Production"
@@ -29,6 +29,7 @@ from stream_chat.types.segment import (
29
29
  SegmentType,
30
30
  SegmentUpdatableFields,
31
31
  )
32
+ from stream_chat.types.shared_locations import SharedLocationsOptions
32
33
 
33
34
  if sys.version_info >= (3, 8):
34
35
  from typing import Literal
@@ -859,16 +860,12 @@ class StreamChatAsync(StreamChatInterface, AsyncContextManager):
859
860
  data: Dict[str, Union[str, Dict[str, Any], List[SortParam]]] = {
860
861
  "user_id": user_id
861
862
  }
862
-
863
863
  if filter is not None:
864
864
  data["filter"] = cast(dict, filter)
865
-
866
865
  if sort is not None:
867
866
  data["sort"] = cast(dict, sort)
868
-
869
867
  if options is not None:
870
868
  data.update(cast(dict, options))
871
-
872
869
  return await self.post("drafts/query", data=data)
873
870
 
874
871
  async def create_reminder(
@@ -956,6 +953,22 @@ class StreamChatAsync(StreamChatInterface, AsyncContextManager):
956
953
  params["user_id"] = user_id
957
954
  return await self.post("reminders/query", data=params)
958
955
 
956
+ async def get_user_locations(self, user_id: str, **options: Any) -> StreamResponse:
957
+ params = {"user_id": user_id, **options}
958
+ return await self.get("users/live_locations", params=params)
959
+
960
+ async def update_user_location(
961
+ self,
962
+ user_id: str,
963
+ message_id: str,
964
+ options: Optional[SharedLocationsOptions] = None,
965
+ ) -> StreamResponse:
966
+ data = {"message_id": message_id}
967
+ if options is not None:
968
+ data.update(cast(dict, options))
969
+ params = {"user_id": user_id, **options}
970
+ return await self.put("users/live_locations", data=data, params=params)
971
+
959
972
  async def close(self) -> None:
960
973
  await self.session.close()
961
974
 
@@ -17,6 +17,7 @@ from stream_chat.types.segment import (
17
17
  SegmentType,
18
18
  SegmentUpdatableFields,
19
19
  )
20
+ from stream_chat.types.shared_locations import SharedLocationsOptions
20
21
 
21
22
  if sys.version_info >= (3, 8):
22
23
  from typing import Literal
@@ -1505,6 +1506,27 @@ class StreamChatInterface(abc.ABC):
1505
1506
  """
1506
1507
  pass
1507
1508
 
1509
+ @abc.abstractmethod
1510
+ def get_user_locations(
1511
+ self, user_id: str, **options: Any
1512
+ ) -> Union[StreamResponse, Awaitable[StreamResponse]]:
1513
+ """
1514
+ Get the locations of a user.
1515
+ """
1516
+ pass
1517
+
1518
+ @abc.abstractmethod
1519
+ def update_user_location(
1520
+ self,
1521
+ user_id: str,
1522
+ message_id: str,
1523
+ options: Optional[SharedLocationsOptions] = None,
1524
+ ) -> Union[StreamResponse, Awaitable[StreamResponse]]:
1525
+ """
1526
+ Update the location of a user.
1527
+ """
1528
+ pass
1529
+
1508
1530
  #####################
1509
1531
  # Private methods #
1510
1532
  #####################
stream_chat/client.py CHANGED
@@ -18,6 +18,7 @@ from stream_chat.types.segment import (
18
18
  SegmentType,
19
19
  SegmentUpdatableFields,
20
20
  )
21
+ from stream_chat.types.shared_locations import SharedLocationsOptions
21
22
 
22
23
  if sys.version_info >= (3, 8):
23
24
  from typing import Literal
@@ -898,3 +899,19 @@ class StreamChat(StreamChatInterface):
898
899
  params["sort"] = sort or [{"field": "remind_at", "direction": 1}]
899
900
  params["user_id"] = user_id
900
901
  return self.post("reminders/query", data=params)
902
+
903
+ def get_user_locations(self, user_id: str, **options: Any) -> StreamResponse:
904
+ params = {"user_id": user_id, **options}
905
+ return self.get("users/live_locations", params=params)
906
+
907
+ def update_user_location(
908
+ self,
909
+ user_id: str,
910
+ message_id: str,
911
+ options: Optional[SharedLocationsOptions] = None,
912
+ ) -> StreamResponse:
913
+ data = {"message_id": message_id}
914
+ if options is not None:
915
+ data.update(cast(dict, options))
916
+ params = {"user_id": user_id, **options}
917
+ return self.put("users/live_locations", data=data, params=params)
@@ -0,0 +1,8 @@
1
+ from datetime import datetime
2
+ from typing import Optional, TypedDict
3
+
4
+
5
+ class SharedLocationsOptions(TypedDict):
6
+ longitude: Optional[int]
7
+ latitude: Optional[int]
8
+ end_at: Optional[datetime]
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stream-chat
3
- Version: 4.25.0
3
+ Version: 4.26.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.25.0
10
+ Project-URL: Release Notes, https://github.com/GetStream/stream-chat-python/releases/tag/v4.26.0
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Intended Audience :: System Administrators
13
13
  Classifier: Operating System :: OS Independent
@@ -1,20 +1,20 @@
1
1
  stream_chat/__init__.py,sha256=xYQuC8xcPLJxJnFWzaNaO-sVUc7IJZYe13OIPRaDBEA,116
2
- stream_chat/__pkg__.py,sha256=WwppLHryS6nJerG5x3TNJ-ETXWjeMTqzKIs4cJCEaWY,206
2
+ stream_chat/__pkg__.py,sha256=WBnBeASAZkPIdtP-mtFIDmizXhGSF3Y9221LiaWXQBM,206
3
3
  stream_chat/campaign.py,sha256=Z7bBo2rGMs02JkA1k9_206J0spcSLecjdhQuRnrc2Eo,2156
4
4
  stream_chat/channel.py,sha256=KP8aSKFMG8iE_YUR1VwVp0-rNLmufETQRriWJ18Omc4,10328
5
- stream_chat/client.py,sha256=dBC4J_z-kfey8G8HahsCAd84TT0qjTkn2-sDmKy1EE0,33768
5
+ stream_chat/client.py,sha256=YzZanTE_fQm9xLMkR1KpnrWwDtu9MrmJ-ogsNtD9S_k,34450
6
6
  stream_chat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  stream_chat/query_threads.py,sha256=zz0w7DnTq0FR8OAvNkPH7Q1CSYaWOtoP_NAa8JgsKtE,542
8
8
  stream_chat/segment.py,sha256=MD1de83rVsaqxcyPy8wTXDudFjxz5Mvr70z4pTkW3P0,2691
9
9
  stream_chat/async_chat/__init__.py,sha256=V6x7yDCdXbP3vMuSan6Xm7RE_njZUvflImqOxfKRt4Y,67
10
10
  stream_chat/async_chat/campaign.py,sha256=Bc3iHZigxserUycZK4wDuXU0wXVH2G6fIDiYNVYPkeE,1885
11
11
  stream_chat/async_chat/channel.py,sha256=R7r8kIJ3SjQN-jlF27Sp49ZGYRJl7ebh1pJ1cSIbSsg,10770
12
- stream_chat/async_chat/client.py,sha256=dMwlzK7eAGQpfwLB3GU9a7rmTFlM54mRpofpFr08ko0,36454
12
+ stream_chat/async_chat/client.py,sha256=1vMEWsnwPeOY0ereMH5aAW_nvT7sx4szIhey1nHtcyo,37156
13
13
  stream_chat/async_chat/segment.py,sha256=G_YEwW2SXIE7huTW3Zu_rim2XkYcuFNYekLZZGDjFkA,2777
14
14
  stream_chat/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  stream_chat/base/campaign.py,sha256=dAVkTYyirEpgyOPn8JyDebNMKeJu02vTuqgmPvdQoWU,1449
16
16
  stream_chat/base/channel.py,sha256=FSYnKbfPPPpjYO8ODGw3E3udRwaV-phngsEoMgV1T9o,16986
17
- stream_chat/base/client.py,sha256=jvNHiNtLDn7ErYysSDsDzsHC8IMovCRwgV8V3QpeHlM,46360
17
+ stream_chat/base/client.py,sha256=3wty1PSXacU_lLqUC27jt8fiar1vtdywiqZ9UU4w008,46968
18
18
  stream_chat/base/exceptions.py,sha256=eh1qW5d6zjUrlgsHNEBebAr0jVH2UupZ06w8sp2cseI,819
19
19
  stream_chat/base/query_threads.py,sha256=LfC09Atsw6cwL98MJjL-cGzQU4V1r7CRbRLitgBV-x8,934
20
20
  stream_chat/base/segment.py,sha256=X82DX8Y-cERJ1OvF2tz9iIM4CBNW6tx8HGaTEXBva9I,2364
@@ -24,9 +24,10 @@ stream_chat/types/campaign.py,sha256=JyAn08oMaEsxPSqmVTdsfJK4xpfErPQV7Xr7zLQm99M
24
24
  stream_chat/types/draft.py,sha256=EJP1JkCtDFnz-DTC8p7WFWXfTazA8x5XKE7ghag7gJM,288
25
25
  stream_chat/types/rate_limit.py,sha256=v3Z4Ur0yoEdFLiHa1CNABEej2nxPlHQ6Bpy2XxW-TYQ,165
26
26
  stream_chat/types/segment.py,sha256=KzOi5N-VzLfj0m4zeZ9U_29ey9dxDtewtcNv9g4Aums,1273
27
+ stream_chat/types/shared_locations.py,sha256=2rO4e0G1RX9DXGHcg3HJt5gp33G-LRKox62hfc0skGA,200
27
28
  stream_chat/types/stream_response.py,sha256=jWKPrOU7u6dZ2SyOK53uQCXTstrL1HshO9fA7R6Bt_A,2391
28
- stream_chat-4.25.0.dist-info/LICENSE,sha256=H66SBDuPWSRHzKPEdyjAk3C0THQRcGPfqqve4naQuu0,14424
29
- stream_chat-4.25.0.dist-info/METADATA,sha256=YBaA1MwUQDzJt8QakLoPZhB3kgFMX7xGQ9EZeaOQvI8,7405
30
- stream_chat-4.25.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
31
- stream_chat-4.25.0.dist-info/top_level.txt,sha256=26uTfg4bWcEaFrVKlzGGgfONH1p5DDe21G07EKfYSvo,12
32
- stream_chat-4.25.0.dist-info/RECORD,,
29
+ stream_chat-4.26.0.dist-info/LICENSE,sha256=H66SBDuPWSRHzKPEdyjAk3C0THQRcGPfqqve4naQuu0,14424
30
+ stream_chat-4.26.0.dist-info/METADATA,sha256=nu30qax59vfLVQN-1bJm3sf-hMEVOaRrQOWlbTXR8Ag,7405
31
+ stream_chat-4.26.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
32
+ stream_chat-4.26.0.dist-info/top_level.txt,sha256=26uTfg4bWcEaFrVKlzGGgfONH1p5DDe21G07EKfYSvo,12
33
+ stream_chat-4.26.0.dist-info/RECORD,,