|
9 | 9 | from stream_chat.__pkg__ import __version__ |
10 | 10 | from stream_chat.base.client import StreamChatInterface |
11 | 11 | from stream_chat.base.exceptions import StreamAPIException |
| 12 | +from stream_chat.channel import Channel |
12 | 13 | from stream_chat.types.stream_response import StreamResponse |
13 | 14 |
|
14 | | -from .channel import Channel |
15 | | - |
16 | 15 |
|
17 | 16 | def get_user_agent() -> str: |
18 | 17 | return f"stream-python-client-{__version__}" |
@@ -106,6 +105,9 @@ def update_app_settings(self, **settings: Any) -> StreamResponse: |
106 | 105 | def get_app_settings(self) -> StreamResponse: |
107 | 106 | return self.get("app") |
108 | 107 |
|
| 108 | + def set_guest_user(self, guest_user: Dict) -> StreamResponse: |
| 109 | + return self.post("guest", data=dict(user=guest_user)) |
| 110 | + |
109 | 111 | def update_users(self, users: List[Dict]) -> StreamResponse: |
110 | 112 | return self.post("users", data={"users": {u["id"]: u for u in users}}) |
111 | 113 |
|
@@ -151,6 +153,14 @@ def unban_user(self, target_id: str, **options: Any) -> StreamResponse: |
151 | 153 | params = {"target_user_id": target_id, **options} |
152 | 154 | return self.delete("moderation/ban", params) |
153 | 155 |
|
| 156 | + def query_banned_users(self, query_conditions: Dict) -> StreamResponse: |
| 157 | + return self.get( |
| 158 | + "query_banned_users", params={"payload": json.dumps(query_conditions)} |
| 159 | + ) |
| 160 | + |
| 161 | + def run_message_action(self, message_id: str, data: Dict) -> StreamResponse: |
| 162 | + return self.post(f"messages/{message_id}/action", data=data) |
| 163 | + |
154 | 164 | def flag_message(self, target_id: str, **options: Any) -> StreamResponse: |
155 | 165 | data = {"target_message_id": target_id, **options} |
156 | 166 | return self.post("moderation/flag", data=data) |
@@ -213,6 +223,11 @@ def unmute_user(self, target_id: str, user_id: str) -> StreamResponse: |
213 | 223 | def mark_all_read(self, user_id: str) -> StreamResponse: |
214 | 224 | return self.post("channels/read", data={"user": {"id": user_id}}) |
215 | 225 |
|
| 226 | + def translate_message(self, message_id: str, language: str) -> StreamResponse: |
| 227 | + return self.post( |
| 228 | + f"messages/{message_id}/translate", data={"language": language} |
| 229 | + ) |
| 230 | + |
216 | 231 | def pin_message( |
217 | 232 | self, message_id: str, user_id: str, expiration: int = None |
218 | 233 | ) -> StreamResponse: |
@@ -400,6 +415,9 @@ def update_blocklist(self, name: str, words: Iterable[str]) -> StreamResponse: |
400 | 415 | def delete_blocklist(self, name: str) -> StreamResponse: |
401 | 416 | return self.delete(f"blocklists/{name}") |
402 | 417 |
|
| 418 | + def check_push(self, push_data: Dict) -> StreamResponse: |
| 419 | + return self.post("check_push", data=push_data) |
| 420 | + |
403 | 421 | def check_sqs( |
404 | 422 | self, sqs_key: str = None, sqs_secret: str = None, sqs_url: str = None |
405 | 423 | ) -> StreamResponse: |
|
0 commit comments