stream-chat 4.14.0__py3-none-any.whl → 4.16.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 +1 -1
- stream_chat/async_chat/client.py +14 -1
- stream_chat/async_chat/segment.py +13 -2
- stream_chat/base/client.py +11 -1
- stream_chat/base/segment.py +9 -1
- stream_chat/client.py +11 -1
- stream_chat/segment.py +13 -2
- stream_chat/types/segment.py +15 -2
- {stream_chat-4.14.0.dist-info → stream_chat-4.16.0.dist-info}/METADATA +3 -3
- {stream_chat-4.14.0.dist-info → stream_chat-4.16.0.dist-info}/RECORD +13 -13
- {stream_chat-4.14.0.dist-info → stream_chat-4.16.0.dist-info}/LICENSE +0 -0
- {stream_chat-4.14.0.dist-info → stream_chat-4.16.0.dist-info}/WHEEL +0 -0
- {stream_chat-4.14.0.dist-info → stream_chat-4.16.0.dist-info}/top_level.txt +0 -0
stream_chat/__pkg__.py
CHANGED
stream_chat/async_chat/client.py
CHANGED
|
@@ -26,6 +26,7 @@ from stream_chat.types.segment import (
|
|
|
26
26
|
QuerySegmentTargetsOptions,
|
|
27
27
|
SegmentData,
|
|
28
28
|
SegmentType,
|
|
29
|
+
SegmentUpdatableFields,
|
|
29
30
|
)
|
|
30
31
|
|
|
31
32
|
if sys.version_info >= (3, 8):
|
|
@@ -335,6 +336,18 @@ class StreamChatAsync(StreamChatInterface, AsyncContextManager):
|
|
|
335
336
|
async def get_message(self, message_id: str, **options: Any) -> StreamResponse:
|
|
336
337
|
return await self.get(f"messages/{message_id}", options)
|
|
337
338
|
|
|
339
|
+
async def query_message_history(
|
|
340
|
+
self, filter: Dict = None, sort: List[Dict] = None, **options: Any
|
|
341
|
+
) -> StreamResponse:
|
|
342
|
+
params = options.copy()
|
|
343
|
+
params.update(
|
|
344
|
+
{
|
|
345
|
+
"filter": filter,
|
|
346
|
+
"sort": self.normalize_sort(sort),
|
|
347
|
+
}
|
|
348
|
+
)
|
|
349
|
+
return await self.post("messages/history", data=params)
|
|
350
|
+
|
|
338
351
|
async def query_users(
|
|
339
352
|
self, filter_conditions: Dict, sort: List[Dict] = None, **options: Any
|
|
340
353
|
) -> StreamResponse:
|
|
@@ -591,7 +604,7 @@ class StreamChatAsync(StreamChatInterface, AsyncContextManager):
|
|
|
591
604
|
return await self.post("segments/query", data=payload)
|
|
592
605
|
|
|
593
606
|
async def update_segment(
|
|
594
|
-
self, segment_id: str, data:
|
|
607
|
+
self, segment_id: str, data: SegmentUpdatableFields
|
|
595
608
|
) -> StreamResponse:
|
|
596
609
|
return await self.put(f"segments/{segment_id}", data=data)
|
|
597
610
|
|
|
@@ -2,7 +2,11 @@ from typing import Dict, List, Optional
|
|
|
2
2
|
|
|
3
3
|
from stream_chat.base.segment import SegmentInterface
|
|
4
4
|
from stream_chat.types.base import SortParam
|
|
5
|
-
from stream_chat.types.segment import
|
|
5
|
+
from stream_chat.types.segment import (
|
|
6
|
+
QuerySegmentTargetsOptions,
|
|
7
|
+
SegmentData,
|
|
8
|
+
SegmentUpdatableFields,
|
|
9
|
+
)
|
|
6
10
|
from stream_chat.types.stream_response import StreamResponse
|
|
7
11
|
|
|
8
12
|
|
|
@@ -24,24 +28,29 @@ class Segment(SegmentInterface):
|
|
|
24
28
|
return state
|
|
25
29
|
|
|
26
30
|
async def get(self) -> StreamResponse:
|
|
31
|
+
super().verify_segment_id()
|
|
27
32
|
return await self.client.get_segment(segment_id=self.segment_id) # type: ignore
|
|
28
33
|
|
|
29
|
-
async def update(self, data:
|
|
34
|
+
async def update(self, data: SegmentUpdatableFields) -> StreamResponse:
|
|
35
|
+
super().verify_segment_id()
|
|
30
36
|
return await self.client.update_segment( # type: ignore
|
|
31
37
|
segment_id=self.segment_id, data=data
|
|
32
38
|
)
|
|
33
39
|
|
|
34
40
|
async def delete(self) -> StreamResponse:
|
|
41
|
+
super().verify_segment_id()
|
|
35
42
|
return await self.client.delete_segment( # type: ignore
|
|
36
43
|
segment_id=self.segment_id
|
|
37
44
|
)
|
|
38
45
|
|
|
39
46
|
async def target_exists(self, target_id: str) -> StreamResponse:
|
|
47
|
+
super().verify_segment_id()
|
|
40
48
|
return await self.client.segment_target_exists( # type: ignore
|
|
41
49
|
segment_id=self.segment_id, target_id=target_id
|
|
42
50
|
)
|
|
43
51
|
|
|
44
52
|
async def add_targets(self, target_ids: list) -> StreamResponse:
|
|
53
|
+
super().verify_segment_id()
|
|
45
54
|
return await self.client.add_segment_targets( # type: ignore
|
|
46
55
|
segment_id=self.segment_id, target_ids=target_ids
|
|
47
56
|
)
|
|
@@ -52,6 +61,7 @@ class Segment(SegmentInterface):
|
|
|
52
61
|
sort: Optional[List[SortParam]] = None,
|
|
53
62
|
options: Optional[QuerySegmentTargetsOptions] = None,
|
|
54
63
|
) -> StreamResponse:
|
|
64
|
+
super().verify_segment_id()
|
|
55
65
|
return await self.client.query_segment_targets( # type: ignore
|
|
56
66
|
segment_id=self.segment_id,
|
|
57
67
|
filter_conditions=filter_conditions,
|
|
@@ -60,6 +70,7 @@ class Segment(SegmentInterface):
|
|
|
60
70
|
)
|
|
61
71
|
|
|
62
72
|
async def remove_targets(self, target_ids: list) -> StreamResponse:
|
|
73
|
+
super().verify_segment_id()
|
|
63
74
|
return await self.client.remove_segment_targets( # type: ignore
|
|
64
75
|
segment_id=self.segment_id, target_ids=target_ids
|
|
65
76
|
)
|
stream_chat/base/client.py
CHANGED
|
@@ -14,6 +14,7 @@ from stream_chat.types.segment import (
|
|
|
14
14
|
QuerySegmentTargetsOptions,
|
|
15
15
|
SegmentData,
|
|
16
16
|
SegmentType,
|
|
17
|
+
SegmentUpdatableFields,
|
|
17
18
|
)
|
|
18
19
|
|
|
19
20
|
if sys.version_info >= (3, 8):
|
|
@@ -524,6 +525,15 @@ class StreamChatInterface(abc.ABC):
|
|
|
524
525
|
"""
|
|
525
526
|
pass
|
|
526
527
|
|
|
528
|
+
@abc.abstractmethod
|
|
529
|
+
def query_message_history(
|
|
530
|
+
self, filter: Dict = None, sort: List[Dict] = None, **options: Any
|
|
531
|
+
) -> Union[StreamResponse, Awaitable[StreamResponse]]:
|
|
532
|
+
"""
|
|
533
|
+
Queries message history.
|
|
534
|
+
"""
|
|
535
|
+
pass
|
|
536
|
+
|
|
527
537
|
@abc.abstractmethod
|
|
528
538
|
def query_users(
|
|
529
539
|
self, filter_conditions: Dict, sort: List[Dict] = None, **options: Any
|
|
@@ -982,7 +992,7 @@ class StreamChatInterface(abc.ABC):
|
|
|
982
992
|
|
|
983
993
|
@abc.abstractmethod
|
|
984
994
|
def update_segment(
|
|
985
|
-
self, segment_id: str, data:
|
|
995
|
+
self, segment_id: str, data: SegmentUpdatableFields
|
|
986
996
|
) -> Union[StreamResponse, Awaitable[StreamResponse]]:
|
|
987
997
|
"""
|
|
988
998
|
Update a segment by id
|
stream_chat/base/segment.py
CHANGED
|
@@ -7,6 +7,7 @@ from stream_chat.types.segment import (
|
|
|
7
7
|
QuerySegmentTargetsOptions,
|
|
8
8
|
SegmentData,
|
|
9
9
|
SegmentType,
|
|
10
|
+
SegmentUpdatableFields,
|
|
10
11
|
)
|
|
11
12
|
from stream_chat.types.stream_response import StreamResponse
|
|
12
13
|
|
|
@@ -36,7 +37,7 @@ class SegmentInterface(abc.ABC):
|
|
|
36
37
|
|
|
37
38
|
@abc.abstractmethod
|
|
38
39
|
def update(
|
|
39
|
-
self, data:
|
|
40
|
+
self, data: SegmentUpdatableFields
|
|
40
41
|
) -> Union[StreamResponse, Awaitable[StreamResponse]]:
|
|
41
42
|
pass
|
|
42
43
|
|
|
@@ -70,3 +71,10 @@ class SegmentInterface(abc.ABC):
|
|
|
70
71
|
self, target_ids: List[str]
|
|
71
72
|
) -> Union[StreamResponse, Awaitable[StreamResponse]]:
|
|
72
73
|
pass
|
|
74
|
+
|
|
75
|
+
def verify_segment_id(self) -> None:
|
|
76
|
+
if not self.segment_id:
|
|
77
|
+
raise ValueError(
|
|
78
|
+
"Segment id is missing. Either create the segment using segment.create() "
|
|
79
|
+
"or set the id during instantiation - segment = Segment(segment_id=segment_id)"
|
|
80
|
+
)
|
stream_chat/client.py
CHANGED
|
@@ -15,6 +15,7 @@ from stream_chat.types.segment import (
|
|
|
15
15
|
QuerySegmentTargetsOptions,
|
|
16
16
|
SegmentData,
|
|
17
17
|
SegmentType,
|
|
18
|
+
SegmentUpdatableFields,
|
|
18
19
|
)
|
|
19
20
|
|
|
20
21
|
if sys.version_info >= (3, 8):
|
|
@@ -324,6 +325,13 @@ class StreamChat(StreamChatInterface):
|
|
|
324
325
|
def get_message(self, message_id: str, **options: Any) -> StreamResponse:
|
|
325
326
|
return self.get(f"messages/{message_id}", options)
|
|
326
327
|
|
|
328
|
+
def query_message_history(
|
|
329
|
+
self, filter: Dict = None, sort: List[Dict] = None, **options: Any
|
|
330
|
+
) -> StreamResponse:
|
|
331
|
+
params = options.copy()
|
|
332
|
+
params.update({"filter": filter, "sort": self.normalize_sort(sort)})
|
|
333
|
+
return self.post("messages/history", data=params)
|
|
334
|
+
|
|
327
335
|
def query_users(
|
|
328
336
|
self, filter_conditions: Dict, sort: List[Dict] = None, **options: Any
|
|
329
337
|
) -> StreamResponse:
|
|
@@ -569,7 +577,9 @@ class StreamChat(StreamChatInterface):
|
|
|
569
577
|
payload.update(cast(dict, options))
|
|
570
578
|
return self.post("segments/query", data=payload)
|
|
571
579
|
|
|
572
|
-
def update_segment(
|
|
580
|
+
def update_segment(
|
|
581
|
+
self, segment_id: str, data: SegmentUpdatableFields
|
|
582
|
+
) -> StreamResponse:
|
|
573
583
|
return self.put(f"segments/{segment_id}", data=data)
|
|
574
584
|
|
|
575
585
|
def delete_segment(self, segment_id: str) -> StreamResponse:
|
stream_chat/segment.py
CHANGED
|
@@ -2,7 +2,11 @@ from typing import Dict, List, Optional
|
|
|
2
2
|
|
|
3
3
|
from stream_chat.base.segment import SegmentInterface
|
|
4
4
|
from stream_chat.types.base import SortParam
|
|
5
|
-
from stream_chat.types.segment import
|
|
5
|
+
from stream_chat.types.segment import (
|
|
6
|
+
QuerySegmentTargetsOptions,
|
|
7
|
+
SegmentData,
|
|
8
|
+
SegmentUpdatableFields,
|
|
9
|
+
)
|
|
6
10
|
from stream_chat.types.stream_response import StreamResponse
|
|
7
11
|
|
|
8
12
|
|
|
@@ -24,22 +28,27 @@ class Segment(SegmentInterface):
|
|
|
24
28
|
return state # type: ignore
|
|
25
29
|
|
|
26
30
|
def get(self) -> StreamResponse:
|
|
31
|
+
super().verify_segment_id()
|
|
27
32
|
return self.client.get_segment(segment_id=self.segment_id) # type: ignore
|
|
28
33
|
|
|
29
|
-
def update(self, data:
|
|
34
|
+
def update(self, data: SegmentUpdatableFields) -> StreamResponse:
|
|
35
|
+
super().verify_segment_id()
|
|
30
36
|
return self.client.update_segment( # type: ignore
|
|
31
37
|
segment_id=self.segment_id, data=data
|
|
32
38
|
)
|
|
33
39
|
|
|
34
40
|
def delete(self) -> StreamResponse:
|
|
41
|
+
super().verify_segment_id()
|
|
35
42
|
return self.client.delete_segment(segment_id=self.segment_id) # type: ignore
|
|
36
43
|
|
|
37
44
|
def target_exists(self, target_id: str) -> StreamResponse:
|
|
45
|
+
super().verify_segment_id()
|
|
38
46
|
return self.client.segment_target_exists( # type: ignore
|
|
39
47
|
segment_id=self.segment_id, target_id=target_id
|
|
40
48
|
)
|
|
41
49
|
|
|
42
50
|
def add_targets(self, target_ids: list) -> StreamResponse:
|
|
51
|
+
super().verify_segment_id()
|
|
43
52
|
return self.client.add_segment_targets( # type: ignore
|
|
44
53
|
segment_id=self.segment_id, target_ids=target_ids
|
|
45
54
|
)
|
|
@@ -50,6 +59,7 @@ class Segment(SegmentInterface):
|
|
|
50
59
|
sort: Optional[List[SortParam]] = None,
|
|
51
60
|
options: Optional[QuerySegmentTargetsOptions] = None,
|
|
52
61
|
) -> StreamResponse:
|
|
62
|
+
super().verify_segment_id()
|
|
53
63
|
return self.client.query_segment_targets( # type: ignore
|
|
54
64
|
segment_id=self.segment_id,
|
|
55
65
|
sort=sort,
|
|
@@ -58,6 +68,7 @@ class Segment(SegmentInterface):
|
|
|
58
68
|
)
|
|
59
69
|
|
|
60
70
|
def remove_targets(self, target_ids: list) -> StreamResponse:
|
|
71
|
+
super().verify_segment_id()
|
|
61
72
|
return self.client.remove_segment_targets( # type: ignore
|
|
62
73
|
segment_id=self.segment_id, target_ids=target_ids
|
|
63
74
|
)
|
stream_chat/types/segment.py
CHANGED
|
@@ -23,9 +23,9 @@ class SegmentType(Enum):
|
|
|
23
23
|
USER = "user"
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
class
|
|
26
|
+
class SegmentUpdatableFields(TypedDict, total=False):
|
|
27
27
|
"""
|
|
28
|
-
Represents the data structure for a segment.
|
|
28
|
+
Represents the updatable data structure for a segment.
|
|
29
29
|
|
|
30
30
|
Parameters:
|
|
31
31
|
name: The name of the segment.
|
|
@@ -38,6 +38,19 @@ class SegmentData(TypedDict, total=False):
|
|
|
38
38
|
filter: Optional[Dict]
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
class SegmentData(SegmentUpdatableFields, total=False):
|
|
42
|
+
"""
|
|
43
|
+
Represents the data structure for a segment.
|
|
44
|
+
|
|
45
|
+
Parameters:
|
|
46
|
+
all_users: Whether to target all users.
|
|
47
|
+
all_sender_channels: Whether to target all sender channels.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
all_users: Optional[bool]
|
|
51
|
+
all_sender_channels: Optional[bool]
|
|
52
|
+
|
|
53
|
+
|
|
41
54
|
class QuerySegmentsOptions(Pager, total=False):
|
|
42
55
|
pass
|
|
43
56
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: stream-chat
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.16.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.
|
|
10
|
+
Project-URL: Release Notes, https://github.com/GetStream/stream-chat-python/releases/tag/v4.16.0
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: Intended Audience :: System Administrators
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
@@ -39,7 +39,7 @@ Requires-Dist: pytest-cov ; extra == 'ci'
|
|
|
39
39
|
Requires-Dist: mypy ; extra == 'ci'
|
|
40
40
|
Requires-Dist: types-requests ; extra == 'ci'
|
|
41
41
|
Provides-Extra: test
|
|
42
|
-
Requires-Dist: pytest ; extra == 'test'
|
|
42
|
+
Requires-Dist: pytest (==8.1.1) ; extra == 'test'
|
|
43
43
|
Requires-Dist: pytest-asyncio (<=0.21.1) ; extra == 'test'
|
|
44
44
|
|
|
45
45
|
# Official Python SDK for [Stream Chat](https://getstream.io/chat/)
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
stream_chat/__init__.py,sha256=xYQuC8xcPLJxJnFWzaNaO-sVUc7IJZYe13OIPRaDBEA,116
|
|
2
|
-
stream_chat/__pkg__.py,sha256=-
|
|
2
|
+
stream_chat/__pkg__.py,sha256=-SVKUWD2I2HdMWMOyVsa9eNsgpWCHMZDPnE7qENOTv0,206
|
|
3
3
|
stream_chat/campaign.py,sha256=Z7bBo2rGMs02JkA1k9_206J0spcSLecjdhQuRnrc2Eo,2156
|
|
4
4
|
stream_chat/channel.py,sha256=SxlnRM8U1yo_k3wDBC4azz3_LDRPclDV5GBmGCfqB8U,7766
|
|
5
|
-
stream_chat/client.py,sha256=
|
|
5
|
+
stream_chat/client.py,sha256=hQ_O_9iRfGQotU79ZB94RhRoKEsHe6ETq69WAgq6SRo,28807
|
|
6
6
|
stream_chat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
stream_chat/segment.py,sha256=
|
|
7
|
+
stream_chat/segment.py,sha256=MD1de83rVsaqxcyPy8wTXDudFjxz5Mvr70z4pTkW3P0,2691
|
|
8
8
|
stream_chat/async_chat/__init__.py,sha256=V6x7yDCdXbP3vMuSan6Xm7RE_njZUvflImqOxfKRt4Y,67
|
|
9
9
|
stream_chat/async_chat/campaign.py,sha256=Bc3iHZigxserUycZK4wDuXU0wXVH2G6fIDiYNVYPkeE,1885
|
|
10
10
|
stream_chat/async_chat/channel.py,sha256=yn9P7u1lJdwoCVw9gKotadq6s1rdYSM_wnxhdaZpnTI,8124
|
|
11
|
-
stream_chat/async_chat/client.py,sha256=
|
|
12
|
-
stream_chat/async_chat/segment.py,sha256=
|
|
11
|
+
stream_chat/async_chat/client.py,sha256=_Dz-FA8KLNpCpczuW5bxWBkn35JeaRRFCqm6QiTdwGk,31052
|
|
12
|
+
stream_chat/async_chat/segment.py,sha256=G_YEwW2SXIE7huTW3Zu_rim2XkYcuFNYekLZZGDjFkA,2777
|
|
13
13
|
stream_chat/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
stream_chat/base/campaign.py,sha256=dAVkTYyirEpgyOPn8JyDebNMKeJu02vTuqgmPvdQoWU,1449
|
|
15
15
|
stream_chat/base/channel.py,sha256=G6thUgND74z0gvI-N3b3vEsrDJ-D4MrAfW2um_E4x9w,13788
|
|
16
|
-
stream_chat/base/client.py,sha256=
|
|
16
|
+
stream_chat/base/client.py,sha256=0INKl5FkF9o7xZyxy2BDn2fTOSrN3eOkEPG66GiRAH0,41114
|
|
17
17
|
stream_chat/base/exceptions.py,sha256=eh1qW5d6zjUrlgsHNEBebAr0jVH2UupZ06w8sp2cseI,819
|
|
18
|
-
stream_chat/base/segment.py,sha256=
|
|
18
|
+
stream_chat/base/segment.py,sha256=X82DX8Y-cERJ1OvF2tz9iIM4CBNW6tx8HGaTEXBva9I,2364
|
|
19
19
|
stream_chat/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
stream_chat/types/base.py,sha256=JKlOxQVPvMClTo0ev63Ya-K-dX-98j95qSE-KKzziEE,858
|
|
21
21
|
stream_chat/types/campaign.py,sha256=JyAn08oMaEsxPSqmVTdsfJK4xpfErPQV7Xr7zLQm99M,2293
|
|
22
22
|
stream_chat/types/rate_limit.py,sha256=v3Z4Ur0yoEdFLiHa1CNABEej2nxPlHQ6Bpy2XxW-TYQ,165
|
|
23
|
-
stream_chat/types/segment.py,sha256=
|
|
23
|
+
stream_chat/types/segment.py,sha256=KzOi5N-VzLfj0m4zeZ9U_29ey9dxDtewtcNv9g4Aums,1273
|
|
24
24
|
stream_chat/types/stream_response.py,sha256=jWKPrOU7u6dZ2SyOK53uQCXTstrL1HshO9fA7R6Bt_A,2391
|
|
25
|
-
stream_chat-4.
|
|
26
|
-
stream_chat-4.
|
|
27
|
-
stream_chat-4.
|
|
28
|
-
stream_chat-4.
|
|
29
|
-
stream_chat-4.
|
|
25
|
+
stream_chat-4.16.0.dist-info/LICENSE,sha256=H66SBDuPWSRHzKPEdyjAk3C0THQRcGPfqqve4naQuu0,14424
|
|
26
|
+
stream_chat-4.16.0.dist-info/METADATA,sha256=r_oAMWV8d6qT7Ihrst3DFCS01nad7-piG5JMcSBqbh4,7405
|
|
27
|
+
stream_chat-4.16.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
28
|
+
stream_chat-4.16.0.dist-info/top_level.txt,sha256=26uTfg4bWcEaFrVKlzGGgfONH1p5DDe21G07EKfYSvo,12
|
|
29
|
+
stream_chat-4.16.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|