stream-chat 4.28.0__py3-none-any.whl → 4.30.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.28.0"
3
+ __version__ = "4.30.0"
4
4
  __maintainer__ = "Tommaso Barbugli"
5
5
  __email__ = "support@getstream.io"
6
6
  __status__ = "Production"
@@ -0,0 +1,242 @@
1
+ from typing import TYPE_CHECKING, List
2
+
3
+ from stream_chat.types.channel_batch import (
4
+ ChannelBatchMemberRequest,
5
+ ChannelDataUpdate,
6
+ ChannelsBatchFilters,
7
+ ChannelsBatchOptions,
8
+ )
9
+ from stream_chat.types.stream_response import StreamResponse
10
+
11
+ if TYPE_CHECKING:
12
+ from stream_chat.async_chat.client import StreamChatAsync
13
+
14
+
15
+ class ChannelBatchUpdater:
16
+ """
17
+ Provides convenience methods for batch channel operations (async).
18
+ """
19
+
20
+ def __init__(self, client: "StreamChatAsync") -> None:
21
+ self.client = client
22
+
23
+ async def add_members(
24
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
25
+ ) -> StreamResponse:
26
+ """
27
+ Adds members to channels matching the filter.
28
+
29
+ :param filter: The filter to match channels.
30
+ :param members: List of members to add.
31
+ :return: StreamResponse containing task_id.
32
+ """
33
+ options: ChannelsBatchOptions = {
34
+ "operation": "addMembers",
35
+ "filter": filter,
36
+ "members": members,
37
+ }
38
+ return await self.client.update_channels_batch(options)
39
+
40
+ async def remove_members(
41
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
42
+ ) -> StreamResponse:
43
+ """
44
+ Removes members from channels matching the filter.
45
+
46
+ :param filter: The filter to match channels.
47
+ :param members: List of members to remove.
48
+ :return: StreamResponse containing task_id.
49
+ """
50
+ options: ChannelsBatchOptions = {
51
+ "operation": "removeMembers",
52
+ "filter": filter,
53
+ "members": members,
54
+ }
55
+ return await self.client.update_channels_batch(options)
56
+
57
+ async def invite_members(
58
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
59
+ ) -> StreamResponse:
60
+ """
61
+ Invites members to channels matching the filter.
62
+
63
+ :param filter: The filter to match channels.
64
+ :param members: List of members to invite.
65
+ :return: StreamResponse containing task_id.
66
+ """
67
+ options: ChannelsBatchOptions = {
68
+ "operation": "inviteMembers",
69
+ "filter": filter,
70
+ "members": members,
71
+ }
72
+ return await self.client.update_channels_batch(options)
73
+
74
+ async def add_moderators(
75
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
76
+ ) -> StreamResponse:
77
+ """
78
+ Adds moderators to channels matching the filter.
79
+
80
+ :param filter: The filter to match channels.
81
+ :param members: List of members to add as moderators.
82
+ :return: StreamResponse containing task_id.
83
+ """
84
+ options: ChannelsBatchOptions = {
85
+ "operation": "addModerators",
86
+ "filter": filter,
87
+ "members": members,
88
+ }
89
+ return await self.client.update_channels_batch(options)
90
+
91
+ async def demote_moderators(
92
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
93
+ ) -> StreamResponse:
94
+ """
95
+ Removes moderator role from members in channels matching the filter.
96
+
97
+ :param filter: The filter to match channels.
98
+ :param members: List of members to demote from moderators.
99
+ :return: StreamResponse containing task_id.
100
+ """
101
+ options: ChannelsBatchOptions = {
102
+ "operation": "demoteModerators",
103
+ "filter": filter,
104
+ "members": members,
105
+ }
106
+ return await self.client.update_channels_batch(options)
107
+
108
+ async def assign_roles(
109
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
110
+ ) -> StreamResponse:
111
+ """
112
+ Assigns roles to members in channels matching the filter.
113
+
114
+ :param filter: The filter to match channels.
115
+ :param members: List of members with roles to assign.
116
+ :return: StreamResponse containing task_id.
117
+ """
118
+ options: ChannelsBatchOptions = {
119
+ "operation": "assignRoles",
120
+ "filter": filter,
121
+ "members": members,
122
+ }
123
+ return await self.client.update_channels_batch(options)
124
+
125
+ async def hide(
126
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
127
+ ) -> StreamResponse:
128
+ """
129
+ Hides channels matching the filter for the specified members.
130
+
131
+ :param filter: The filter to match channels.
132
+ :param members: List of members for whom to hide channels.
133
+ :return: StreamResponse containing task_id.
134
+ """
135
+ options: ChannelsBatchOptions = {
136
+ "operation": "hide",
137
+ "filter": filter,
138
+ "members": members,
139
+ }
140
+ return await self.client.update_channels_batch(options)
141
+
142
+ async def show(
143
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
144
+ ) -> StreamResponse:
145
+ """
146
+ Shows channels matching the filter for the specified members.
147
+
148
+ :param filter: The filter to match channels.
149
+ :param members: List of members for whom to show channels.
150
+ :return: StreamResponse containing task_id.
151
+ """
152
+ options: ChannelsBatchOptions = {
153
+ "operation": "show",
154
+ "filter": filter,
155
+ "members": members,
156
+ }
157
+ return await self.client.update_channels_batch(options)
158
+
159
+ async def archive(
160
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
161
+ ) -> StreamResponse:
162
+ """
163
+ Archives channels matching the filter for the specified members.
164
+
165
+ :param filter: The filter to match channels.
166
+ :param members: List of members for whom to archive channels.
167
+ :return: StreamResponse containing task_id.
168
+ """
169
+ options: ChannelsBatchOptions = {
170
+ "operation": "archive",
171
+ "filter": filter,
172
+ "members": members,
173
+ }
174
+ return await self.client.update_channels_batch(options)
175
+
176
+ async def unarchive(
177
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
178
+ ) -> StreamResponse:
179
+ """
180
+ Unarchives channels matching the filter for the specified members.
181
+
182
+ :param filter: The filter to match channels.
183
+ :param members: List of members for whom to unarchive channels.
184
+ :return: StreamResponse containing task_id.
185
+ """
186
+ options: ChannelsBatchOptions = {
187
+ "operation": "unarchive",
188
+ "filter": filter,
189
+ "members": members,
190
+ }
191
+ return await self.client.update_channels_batch(options)
192
+
193
+ async def update_data(
194
+ self, filter: ChannelsBatchFilters, data: ChannelDataUpdate
195
+ ) -> StreamResponse:
196
+ """
197
+ Updates data on channels matching the filter.
198
+
199
+ :param filter: The filter to match channels.
200
+ :param data: Channel data to update.
201
+ :return: StreamResponse containing task_id.
202
+ """
203
+ options: ChannelsBatchOptions = {
204
+ "operation": "updateData",
205
+ "filter": filter,
206
+ "data": data,
207
+ }
208
+ return await self.client.update_channels_batch(options)
209
+
210
+ async def add_filter_tags(
211
+ self, filter: ChannelsBatchFilters, tags: List[str]
212
+ ) -> StreamResponse:
213
+ """
214
+ Adds filter tags to channels matching the filter.
215
+
216
+ :param filter: The filter to match channels.
217
+ :param tags: List of filter tags to add.
218
+ :return: StreamResponse containing task_id.
219
+ """
220
+ options: ChannelsBatchOptions = {
221
+ "operation": "addFilterTags",
222
+ "filter": filter,
223
+ "filter_tags_update": tags,
224
+ }
225
+ return await self.client.update_channels_batch(options)
226
+
227
+ async def remove_filter_tags(
228
+ self, filter: ChannelsBatchFilters, tags: List[str]
229
+ ) -> StreamResponse:
230
+ """
231
+ Removes filter tags from channels matching the filter.
232
+
233
+ :param filter: The filter to match channels.
234
+ :param tags: List of filter tags to remove.
235
+ :return: StreamResponse containing task_id.
236
+ """
237
+ options: ChannelsBatchOptions = {
238
+ "operation": "removeFilterTags",
239
+ "filter": filter,
240
+ "filter_tags_update": tags,
241
+ }
242
+ return await self.client.update_channels_batch(options)
@@ -4,6 +4,7 @@ import sys
4
4
  import warnings
5
5
  from types import TracebackType
6
6
  from typing import (
7
+ TYPE_CHECKING,
7
8
  Any,
8
9
  AsyncContextManager,
9
10
  Callable,
@@ -15,12 +16,17 @@ from typing import (
15
16
  Union,
16
17
  cast,
17
18
  )
19
+
20
+ if TYPE_CHECKING:
21
+ from stream_chat.async_chat.channel_batch_updater import ChannelBatchUpdater
22
+
18
23
  from urllib.parse import urlparse
19
24
 
20
25
  from stream_chat.async_chat.campaign import Campaign
21
26
  from stream_chat.async_chat.segment import Segment
22
27
  from stream_chat.types.base import SortParam
23
28
  from stream_chat.types.campaign import CampaignData, QueryCampaignsOptions
29
+ from stream_chat.types.channel_batch import ChannelsBatchOptions
24
30
  from stream_chat.types.draft import QueryDraftsFilter, QueryDraftsOptions
25
31
  from stream_chat.types.segment import (
26
32
  QuerySegmentsOptions,
@@ -226,6 +232,22 @@ class StreamChatAsync(StreamChatInterface, AsyncContextManager):
226
232
  "query_banned_users", params={"payload": json.dumps(query_conditions)}
227
233
  )
228
234
 
235
+ async def query_future_channel_bans(self, **options: Any) -> StreamResponse:
236
+ """
237
+ Query future channel bans created by a user.
238
+
239
+ :param options: Optional parameters including:
240
+ - user_id: The ID of the user who created the bans
241
+ - exclude_expired_bans: Whether to exclude expired bans
242
+ - limit: Maximum number of results to return
243
+ - offset: Number of results to skip
244
+
245
+ :return: A StreamResponse containing the list of future channel bans
246
+ """
247
+ return await self.get(
248
+ "query_future_channel_bans", params={"payload": json.dumps(options)}
249
+ )
250
+
229
251
  async def block_user(
230
252
  self, blocked_user_id: str, user_id: str, **options: Any
231
253
  ) -> StreamResponse:
@@ -965,7 +987,7 @@ class StreamChatAsync(StreamChatInterface, AsyncContextManager):
965
987
  :return: API response with reminders
966
988
  """
967
989
  params = options.copy()
968
- params["filter_conditions"] = filter_conditions or {}
990
+ params["filter"] = filter_conditions or {}
969
991
  params["sort"] = sort or [{"field": "remind_at", "direction": 1}]
970
992
  params["user_id"] = user_id
971
993
  return await self.post("reminders/query", data=params)
@@ -1028,6 +1050,30 @@ class StreamChatAsync(StreamChatInterface, AsyncContextManager):
1028
1050
 
1029
1051
  return await self.mark_delivered(data)
1030
1052
 
1053
+ async def update_channels_batch(
1054
+ self, options: ChannelsBatchOptions
1055
+ ) -> StreamResponse:
1056
+ """
1057
+ Updates channels in batch based on the provided options.
1058
+
1059
+ :param options: ChannelsBatchOptions containing operation, filter, and operation-specific data.
1060
+ :return: StreamResponse containing task_id.
1061
+ """
1062
+ if options is None:
1063
+ raise ValueError("options must not be None")
1064
+
1065
+ return await self.put("channels/batch", data=options)
1066
+
1067
+ def channel_batch_updater(self) -> "ChannelBatchUpdater":
1068
+ """
1069
+ Returns a ChannelBatchUpdater instance for batch channel operations.
1070
+
1071
+ :return: ChannelBatchUpdater instance.
1072
+ """
1073
+ from stream_chat.async_chat.channel_batch_updater import ChannelBatchUpdater
1074
+
1075
+ return ChannelBatchUpdater(self)
1076
+
1031
1077
  async def close(self) -> None:
1032
1078
  await self.session.close()
1033
1079
 
@@ -356,6 +356,23 @@ class StreamChatInterface(abc.ABC):
356
356
  """
357
357
  pass
358
358
 
359
+ @abc.abstractmethod
360
+ def query_future_channel_bans(
361
+ self, **options: Any
362
+ ) -> Union[StreamResponse, Awaitable[StreamResponse]]:
363
+ """
364
+ Query future channel bans created by a user.
365
+
366
+ :param options: Optional parameters including:
367
+ - user_id: The ID of the user who created the bans
368
+ - exclude_expired_bans: Whether to exclude expired bans
369
+ - limit: Maximum number of results to return
370
+ - offset: Number of results to skip
371
+
372
+ :return: A StreamResponse containing the list of future channel bans
373
+ """
374
+ pass
375
+
359
376
  @abc.abstractmethod
360
377
  def block_user(
361
378
  self, blocked_user_id: str, user_id: str, **options: Any
@@ -1302,6 +1319,27 @@ class StreamChatInterface(abc.ABC):
1302
1319
  """
1303
1320
  pass
1304
1321
 
1322
+ @abc.abstractmethod
1323
+ def update_channels_batch(
1324
+ self, options: Any
1325
+ ) -> Union[StreamResponse, Awaitable[StreamResponse]]:
1326
+ """
1327
+ Updates channels in batch based on the provided options.
1328
+
1329
+ :param options: ChannelsBatchOptions containing operation, filter, and operation-specific data.
1330
+ :return: StreamResponse containing task_id.
1331
+ """
1332
+ pass
1333
+
1334
+ @abc.abstractmethod
1335
+ def channel_batch_updater(self) -> Any:
1336
+ """
1337
+ Returns a ChannelBatchUpdater instance for batch channel operations.
1338
+
1339
+ :return: ChannelBatchUpdater instance.
1340
+ """
1341
+ pass
1342
+
1305
1343
  @abc.abstractmethod
1306
1344
  def send_user_custom_event(
1307
1345
  self, user_id: str, event: Dict
@@ -0,0 +1,242 @@
1
+ from typing import TYPE_CHECKING, List
2
+
3
+ from stream_chat.types.channel_batch import (
4
+ ChannelBatchMemberRequest,
5
+ ChannelDataUpdate,
6
+ ChannelsBatchFilters,
7
+ ChannelsBatchOptions,
8
+ )
9
+ from stream_chat.types.stream_response import StreamResponse
10
+
11
+ if TYPE_CHECKING:
12
+ from stream_chat.client import StreamChat
13
+
14
+
15
+ class ChannelBatchUpdater:
16
+ """
17
+ Provides convenience methods for batch channel operations.
18
+ """
19
+
20
+ def __init__(self, client: "StreamChat") -> None:
21
+ self.client = client
22
+
23
+ def add_members(
24
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
25
+ ) -> StreamResponse:
26
+ """
27
+ Adds members to channels matching the filter.
28
+
29
+ :param filter: The filter to match channels.
30
+ :param members: List of members to add.
31
+ :return: StreamResponse containing task_id.
32
+ """
33
+ options: ChannelsBatchOptions = {
34
+ "operation": "addMembers",
35
+ "filter": filter,
36
+ "members": members,
37
+ }
38
+ return self.client.update_channels_batch(options)
39
+
40
+ def remove_members(
41
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
42
+ ) -> StreamResponse:
43
+ """
44
+ Removes members from channels matching the filter.
45
+
46
+ :param filter: The filter to match channels.
47
+ :param members: List of members to remove.
48
+ :return: StreamResponse containing task_id.
49
+ """
50
+ options: ChannelsBatchOptions = {
51
+ "operation": "removeMembers",
52
+ "filter": filter,
53
+ "members": members,
54
+ }
55
+ return self.client.update_channels_batch(options)
56
+
57
+ def invite_members(
58
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
59
+ ) -> StreamResponse:
60
+ """
61
+ Invites members to channels matching the filter.
62
+
63
+ :param filter: The filter to match channels.
64
+ :param members: List of members to invite.
65
+ :return: StreamResponse containing task_id.
66
+ """
67
+ options: ChannelsBatchOptions = {
68
+ "operation": "inviteMembers",
69
+ "filter": filter,
70
+ "members": members,
71
+ }
72
+ return self.client.update_channels_batch(options)
73
+
74
+ def add_moderators(
75
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
76
+ ) -> StreamResponse:
77
+ """
78
+ Adds moderators to channels matching the filter.
79
+
80
+ :param filter: The filter to match channels.
81
+ :param members: List of members to add as moderators.
82
+ :return: StreamResponse containing task_id.
83
+ """
84
+ options: ChannelsBatchOptions = {
85
+ "operation": "addModerators",
86
+ "filter": filter,
87
+ "members": members,
88
+ }
89
+ return self.client.update_channels_batch(options)
90
+
91
+ def demote_moderators(
92
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
93
+ ) -> StreamResponse:
94
+ """
95
+ Removes moderator role from members in channels matching the filter.
96
+
97
+ :param filter: The filter to match channels.
98
+ :param members: List of members to demote from moderators.
99
+ :return: StreamResponse containing task_id.
100
+ """
101
+ options: ChannelsBatchOptions = {
102
+ "operation": "demoteModerators",
103
+ "filter": filter,
104
+ "members": members,
105
+ }
106
+ return self.client.update_channels_batch(options)
107
+
108
+ def assign_roles(
109
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
110
+ ) -> StreamResponse:
111
+ """
112
+ Assigns roles to members in channels matching the filter.
113
+
114
+ :param filter: The filter to match channels.
115
+ :param members: List of members with roles to assign.
116
+ :return: StreamResponse containing task_id.
117
+ """
118
+ options: ChannelsBatchOptions = {
119
+ "operation": "assignRoles",
120
+ "filter": filter,
121
+ "members": members,
122
+ }
123
+ return self.client.update_channels_batch(options)
124
+
125
+ def hide(
126
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
127
+ ) -> StreamResponse:
128
+ """
129
+ Hides channels matching the filter for the specified members.
130
+
131
+ :param filter: The filter to match channels.
132
+ :param members: List of members for whom to hide channels.
133
+ :return: StreamResponse containing task_id.
134
+ """
135
+ options: ChannelsBatchOptions = {
136
+ "operation": "hide",
137
+ "filter": filter,
138
+ "members": members,
139
+ }
140
+ return self.client.update_channels_batch(options)
141
+
142
+ def show(
143
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
144
+ ) -> StreamResponse:
145
+ """
146
+ Shows channels matching the filter for the specified members.
147
+
148
+ :param filter: The filter to match channels.
149
+ :param members: List of members for whom to show channels.
150
+ :return: StreamResponse containing task_id.
151
+ """
152
+ options: ChannelsBatchOptions = {
153
+ "operation": "show",
154
+ "filter": filter,
155
+ "members": members,
156
+ }
157
+ return self.client.update_channels_batch(options)
158
+
159
+ def archive(
160
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
161
+ ) -> StreamResponse:
162
+ """
163
+ Archives channels matching the filter for the specified members.
164
+
165
+ :param filter: The filter to match channels.
166
+ :param members: List of members for whom to archive channels.
167
+ :return: StreamResponse containing task_id.
168
+ """
169
+ options: ChannelsBatchOptions = {
170
+ "operation": "archive",
171
+ "filter": filter,
172
+ "members": members,
173
+ }
174
+ return self.client.update_channels_batch(options)
175
+
176
+ def unarchive(
177
+ self, filter: ChannelsBatchFilters, members: List[ChannelBatchMemberRequest]
178
+ ) -> StreamResponse:
179
+ """
180
+ Unarchives channels matching the filter for the specified members.
181
+
182
+ :param filter: The filter to match channels.
183
+ :param members: List of members for whom to unarchive channels.
184
+ :return: StreamResponse containing task_id.
185
+ """
186
+ options: ChannelsBatchOptions = {
187
+ "operation": "unarchive",
188
+ "filter": filter,
189
+ "members": members,
190
+ }
191
+ return self.client.update_channels_batch(options)
192
+
193
+ def update_data(
194
+ self, filter: ChannelsBatchFilters, data: ChannelDataUpdate
195
+ ) -> StreamResponse:
196
+ """
197
+ Updates data on channels matching the filter.
198
+
199
+ :param filter: The filter to match channels.
200
+ :param data: Channel data to update.
201
+ :return: StreamResponse containing task_id.
202
+ """
203
+ options: ChannelsBatchOptions = {
204
+ "operation": "updateData",
205
+ "filter": filter,
206
+ "data": data,
207
+ }
208
+ return self.client.update_channels_batch(options)
209
+
210
+ def add_filter_tags(
211
+ self, filter: ChannelsBatchFilters, tags: List[str]
212
+ ) -> StreamResponse:
213
+ """
214
+ Adds filter tags to channels matching the filter.
215
+
216
+ :param filter: The filter to match channels.
217
+ :param tags: List of filter tags to add.
218
+ :return: StreamResponse containing task_id.
219
+ """
220
+ options: ChannelsBatchOptions = {
221
+ "operation": "addFilterTags",
222
+ "filter": filter,
223
+ "filter_tags_update": tags,
224
+ }
225
+ return self.client.update_channels_batch(options)
226
+
227
+ def remove_filter_tags(
228
+ self, filter: ChannelsBatchFilters, tags: List[str]
229
+ ) -> StreamResponse:
230
+ """
231
+ Removes filter tags from channels matching the filter.
232
+
233
+ :param filter: The filter to match channels.
234
+ :param tags: List of filter tags to remove.
235
+ :return: StreamResponse containing task_id.
236
+ """
237
+ options: ChannelsBatchOptions = {
238
+ "operation": "removeFilterTags",
239
+ "filter": filter,
240
+ "filter_tags_update": tags,
241
+ }
242
+ return self.client.update_channels_batch(options)
stream_chat/client.py CHANGED
@@ -2,14 +2,28 @@ import datetime
2
2
  import json
3
3
  import sys
4
4
  import warnings
5
- from typing import Any, Callable, Dict, Iterable, List, Optional, Union, cast
5
+ from typing import (
6
+ TYPE_CHECKING,
7
+ Any,
8
+ Callable,
9
+ Dict,
10
+ Iterable,
11
+ List,
12
+ Optional,
13
+ Union,
14
+ cast,
15
+ )
6
16
  from urllib.parse import urlparse
7
17
  from urllib.request import Request, urlopen
8
18
 
19
+ if TYPE_CHECKING:
20
+ from stream_chat.channel_batch_updater import ChannelBatchUpdater
21
+
9
22
  from stream_chat.campaign import Campaign
10
23
  from stream_chat.segment import Segment
11
24
  from stream_chat.types.base import SortParam
12
25
  from stream_chat.types.campaign import CampaignData, QueryCampaignsOptions
26
+ from stream_chat.types.channel_batch import ChannelsBatchOptions
13
27
  from stream_chat.types.draft import QueryDraftsFilter, QueryDraftsOptions
14
28
  from stream_chat.types.segment import (
15
29
  QuerySegmentsOptions,
@@ -218,6 +232,22 @@ class StreamChat(StreamChatInterface):
218
232
  "query_banned_users", params={"payload": json.dumps(query_conditions)}
219
233
  )
220
234
 
235
+ def query_future_channel_bans(self, **options: Any) -> StreamResponse:
236
+ """
237
+ Query future channel bans created by a user.
238
+
239
+ :param options: Optional parameters including:
240
+ - user_id: The ID of the user who created the bans
241
+ - exclude_expired_bans: Whether to exclude expired bans
242
+ - limit: Maximum number of results to return
243
+ - offset: Number of results to skip
244
+
245
+ :return: A StreamResponse containing the list of future channel bans
246
+ """
247
+ return self.get(
248
+ "query_future_channel_bans", params={"payload": json.dumps(options)}
249
+ )
250
+
221
251
  def block_user(
222
252
  self, blocked_user_id: str, user_id: str, **options: Any
223
253
  ) -> StreamResponse:
@@ -919,7 +949,7 @@ class StreamChat(StreamChatInterface):
919
949
  :return: API response with reminders
920
950
  """
921
951
  params = options.copy()
922
- params["filter_conditions"] = filter_conditions or {}
952
+ params["filter"] = filter_conditions or {}
923
953
  params["sort"] = sort or [{"field": "remind_at", "direction": 1}]
924
954
  params["user_id"] = user_id
925
955
  return self.post("reminders/query", data=params)
@@ -985,3 +1015,25 @@ class StreamChat(StreamChatInterface):
985
1015
  "user_id": user_id,
986
1016
  }
987
1017
  return self.mark_delivered(data=data)
1018
+
1019
+ def update_channels_batch(self, options: ChannelsBatchOptions) -> StreamResponse:
1020
+ """
1021
+ Updates channels in batch based on the provided options.
1022
+
1023
+ :param options: ChannelsBatchOptions containing operation, filter, and operation-specific data.
1024
+ :return: StreamResponse containing task_id.
1025
+ """
1026
+ if options is None:
1027
+ raise ValueError("options must not be None")
1028
+
1029
+ return self.put("channels/batch", data=options)
1030
+
1031
+ def channel_batch_updater(self) -> "ChannelBatchUpdater":
1032
+ """
1033
+ Returns a ChannelBatchUpdater instance for batch channel operations.
1034
+
1035
+ :return: ChannelBatchUpdater instance.
1036
+ """
1037
+ from stream_chat.channel_batch_updater import ChannelBatchUpdater
1038
+
1039
+ return ChannelBatchUpdater(self)
stream_chat/types/base.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import sys
2
2
  from enum import IntEnum
3
- from typing import Optional
3
+ from typing import Any, Dict, List, Optional
4
4
 
5
5
  if sys.version_info >= (3, 8):
6
6
  from typing import TypedDict
@@ -43,3 +43,20 @@ class Pager(TypedDict, total=False):
43
43
  limit: Optional[int]
44
44
  next: Optional[str]
45
45
  prev: Optional[str]
46
+
47
+
48
+ class ParsedPredefinedFilterResponse(TypedDict, total=False):
49
+ """
50
+ Represents the parsed/interpolated predefined filter returned in QueryChannels response.
51
+
52
+ This is only present when a predefined filter is used in the query.
53
+
54
+ Parameters:
55
+ name: The name of the predefined filter that was used.
56
+ filter: The interpolated filter with placeholders replaced by actual values.
57
+ sort: The interpolated sort parameters (optional).
58
+ """
59
+
60
+ name: str
61
+ filter: Dict[str, Any]
62
+ sort: Optional[List[SortParam]]
@@ -0,0 +1,93 @@
1
+ import sys
2
+ from typing import Any, Dict, List, Optional
3
+
4
+ if sys.version_info >= (3, 8):
5
+ from typing import Literal, TypedDict
6
+ else:
7
+ from typing_extensions import Literal, TypedDict
8
+
9
+ ChannelBatchOperation = Literal[
10
+ "addMembers",
11
+ "removeMembers",
12
+ "inviteMembers",
13
+ "assignRoles",
14
+ "addModerators",
15
+ "demoteModerators",
16
+ "hide",
17
+ "show",
18
+ "archive",
19
+ "unarchive",
20
+ "updateData",
21
+ "addFilterTags",
22
+ "removeFilterTags",
23
+ ]
24
+
25
+
26
+ class ChannelBatchMemberRequest(TypedDict, total=False):
27
+ """
28
+ Represents a member in batch operations.
29
+
30
+ Parameters:
31
+ user_id: The ID of the user.
32
+ channel_role: The role of the user in the channel (optional).
33
+ """
34
+
35
+ user_id: str
36
+ channel_role: Optional[str]
37
+
38
+
39
+ class ChannelDataUpdate(TypedDict, total=False):
40
+ """
41
+ Represents data that can be updated on channels in batch.
42
+
43
+ Parameters:
44
+ frozen: Whether the channel is frozen.
45
+ disabled: Whether the channel is disabled.
46
+ custom: Custom data for the channel.
47
+ team: The team ID for the channel.
48
+ config_overrides: Configuration overrides for the channel.
49
+ auto_translation_enabled: Whether auto-translation is enabled.
50
+ auto_translation_language: The language for auto-translation.
51
+ """
52
+
53
+ frozen: Optional[bool]
54
+ disabled: Optional[bool]
55
+ custom: Optional[Dict[str, Any]]
56
+ team: Optional[str]
57
+ config_overrides: Optional[Dict[str, Any]]
58
+ auto_translation_enabled: Optional[bool]
59
+ auto_translation_language: Optional[str]
60
+
61
+
62
+ class ChannelsBatchFilters(TypedDict, total=False):
63
+ """
64
+ Represents filters for batch channel updates.
65
+
66
+ Parameters:
67
+ cids: Filter by channel CIDs (can be a dict with operators like $in).
68
+ types: Filter by channel types (can be a dict with operators like $in).
69
+ filter_tags: Filter by filter tags (can be a dict with operators like $in).
70
+ """
71
+
72
+ cids: Optional[Any]
73
+ types: Optional[Any]
74
+ filter_tags: Optional[Any]
75
+
76
+
77
+ class ChannelsBatchOptions(TypedDict, total=False):
78
+ """
79
+ Represents options for batch channel updates.
80
+
81
+ Parameters:
82
+ operation: The batch operation to perform (required).
83
+ filter: The filter to match channels (required).
84
+ members: List of members for member-related operations (optional).
85
+ data: Channel data updates for updateData operation (optional).
86
+ filter_tags_update: List of filter tags for filter tag operations (optional).
87
+ """
88
+
89
+ operation: ChannelBatchOperation
90
+ filter: ChannelsBatchFilters
91
+ members: Optional[List[ChannelBatchMemberRequest]]
92
+ data: Optional[ChannelDataUpdate]
93
+ filter_tags_update: Optional[List[str]]
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stream-chat
3
- Version: 4.28.0
3
+ Version: 4.30.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.28.0
10
+ Project-URL: Release Notes, https://github.com/GetStream/stream-chat-python/releases/tag/v4.30.0
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Intended Audience :: System Administrators
13
13
  Classifier: Operating System :: OS Independent
@@ -1,34 +1,37 @@
1
1
  stream_chat/__init__.py,sha256=xYQuC8xcPLJxJnFWzaNaO-sVUc7IJZYe13OIPRaDBEA,116
2
- stream_chat/__pkg__.py,sha256=fpIg3ZYFBkAJ_dSTRSfYWMRtq6Wb22Vc9affBpGAQWQ,206
2
+ stream_chat/__pkg__.py,sha256=GnrN9f9j_gBmgUVVxVXsMyzcYVmyKp27E4LbAFdPY0Q,206
3
3
  stream_chat/campaign.py,sha256=Z7bBo2rGMs02JkA1k9_206J0spcSLecjdhQuRnrc2Eo,2156
4
4
  stream_chat/channel.py,sha256=40q61hI0A0iy_Q2Xdv6D94oSG47Bu1PYaBXMRX2k03g,11059
5
- stream_chat/client.py,sha256=KOl4FRjlN2Af9p_yhBn5B8WFVYD9CoPDz1tZySfBIqg,37292
5
+ stream_chat/channel_batch_updater.py,sha256=QkO7MlIsD0q0krox_zKqKrqNNsB0wiSRKiwIXALdyd0,8216
6
+ stream_chat/client.py,sha256=U-640jHDkabpeKg9518FWq3cJoghEU--k5drhR7U4dw,38933
6
7
  stream_chat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
8
  stream_chat/query_threads.py,sha256=zz0w7DnTq0FR8OAvNkPH7Q1CSYaWOtoP_NAa8JgsKtE,542
8
9
  stream_chat/segment.py,sha256=MD1de83rVsaqxcyPy8wTXDudFjxz5Mvr70z4pTkW3P0,2691
9
10
  stream_chat/async_chat/__init__.py,sha256=V6x7yDCdXbP3vMuSan6Xm7RE_njZUvflImqOxfKRt4Y,67
10
11
  stream_chat/async_chat/campaign.py,sha256=Bc3iHZigxserUycZK4wDuXU0wXVH2G6fIDiYNVYPkeE,1885
11
12
  stream_chat/async_chat/channel.py,sha256=20dj1jQVm6dU_VUDpFJ1rUqxZVJtLhQeFxjJvcFm56s,11525
12
- stream_chat/async_chat/client.py,sha256=FGJaySh2YeJuWmFGz1s5JncavW4Ig_tjYhKkBdXvSMg,39437
13
+ stream_chat/async_chat/channel_batch_updater.py,sha256=UiPHN8j49tn15RnjxqUBW6p6Ee3enMmvbNZn3gNWEBY,8401
14
+ stream_chat/async_chat/client.py,sha256=PeCjdCunhXPkMWGvtDvWipgLwR8-tOwe5AHxHwu4vuw,41102
13
15
  stream_chat/async_chat/segment.py,sha256=G_YEwW2SXIE7huTW3Zu_rim2XkYcuFNYekLZZGDjFkA,2777
14
16
  stream_chat/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
17
  stream_chat/base/campaign.py,sha256=dAVkTYyirEpgyOPn8JyDebNMKeJu02vTuqgmPvdQoWU,1449
16
18
  stream_chat/base/channel.py,sha256=zaVhpVHXW-e3GHCqOtQO8x2yHqqAQ6MKP-AZXarQOUc,17805
17
- stream_chat/base/client.py,sha256=1n8JQngKNRWT7cnVKzxmVjWTCXrb0Dj2v1e2tc0eEVE,48391
19
+ stream_chat/base/client.py,sha256=XUfW4ZojcGGz2qC52GBhs3IDmzKgezbkv_7_SqdJfQA,49631
18
20
  stream_chat/base/exceptions.py,sha256=eh1qW5d6zjUrlgsHNEBebAr0jVH2UupZ06w8sp2cseI,819
19
21
  stream_chat/base/query_threads.py,sha256=LfC09Atsw6cwL98MJjL-cGzQU4V1r7CRbRLitgBV-x8,934
20
22
  stream_chat/base/segment.py,sha256=X82DX8Y-cERJ1OvF2tz9iIM4CBNW6tx8HGaTEXBva9I,2364
21
23
  stream_chat/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- stream_chat/types/base.py,sha256=JKlOxQVPvMClTo0ev63Ya-K-dX-98j95qSE-KKzziEE,858
24
+ stream_chat/types/base.py,sha256=yMmYa_fH0YJRi5tkOlKCQUCAQccGe3IkMCTzzxsVG_M,1423
23
25
  stream_chat/types/campaign.py,sha256=3Hsgf3SGKA5jh-szQkGLJlmIuswKVTFQBW7vxpJVu-g,2795
26
+ stream_chat/types/channel_batch.py,sha256=KskaIJCwQMXjanJaFOA3q5ipAgQjhw_RiNpyTmv6k_E,2714
24
27
  stream_chat/types/delivery_receipts.py,sha256=ir1EYIvRCKo2pw5nMPJ_JNJck1c_9xRXOANEW_803gk,1607
25
28
  stream_chat/types/draft.py,sha256=EJP1JkCtDFnz-DTC8p7WFWXfTazA8x5XKE7ghag7gJM,288
26
29
  stream_chat/types/rate_limit.py,sha256=v3Z4Ur0yoEdFLiHa1CNABEej2nxPlHQ6Bpy2XxW-TYQ,165
27
30
  stream_chat/types/segment.py,sha256=KzOi5N-VzLfj0m4zeZ9U_29ey9dxDtewtcNv9g4Aums,1273
28
31
  stream_chat/types/shared_locations.py,sha256=2rO4e0G1RX9DXGHcg3HJt5gp33G-LRKox62hfc0skGA,200
29
32
  stream_chat/types/stream_response.py,sha256=jWKPrOU7u6dZ2SyOK53uQCXTstrL1HshO9fA7R6Bt_A,2391
30
- stream_chat-4.28.0.dist-info/licenses/LICENSE,sha256=H66SBDuPWSRHzKPEdyjAk3C0THQRcGPfqqve4naQuu0,14424
31
- stream_chat-4.28.0.dist-info/METADATA,sha256=0GkcPlDkP4Rts1vuS_wdxbVMmapT2u5UDdWCj61DdgU,7638
32
- stream_chat-4.28.0.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
33
- stream_chat-4.28.0.dist-info/top_level.txt,sha256=26uTfg4bWcEaFrVKlzGGgfONH1p5DDe21G07EKfYSvo,12
34
- stream_chat-4.28.0.dist-info/RECORD,,
33
+ stream_chat-4.30.0.dist-info/licenses/LICENSE,sha256=H66SBDuPWSRHzKPEdyjAk3C0THQRcGPfqqve4naQuu0,14424
34
+ stream_chat-4.30.0.dist-info/METADATA,sha256=XqhKdpv8lR3-5lhNMm8Vpaee2H8Q-czOGNJ_UoGLd3Y,7638
35
+ stream_chat-4.30.0.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
36
+ stream_chat-4.30.0.dist-info/top_level.txt,sha256=26uTfg4bWcEaFrVKlzGGgfONH1p5DDe21G07EKfYSvo,12
37
+ stream_chat-4.30.0.dist-info/RECORD,,