|
6 | 6 |
|
7 | 7 | from typing import Any, Dict, List, Optional, Union
|
8 | 8 |
|
9 |
| -from typing_extensions import Literal, TypedDict |
| 9 | +from typing_extensions import Literal, NotRequired, TypedDict |
10 | 10 |
|
11 | 11 | # These are documented in the zulip package (python-zulip-api repo)
|
12 | 12 | from zulip import EditPropagateMode # one/all/later
|
@@ -36,9 +36,38 @@ class StreamComposition(TypedDict):
|
36 | 36 | subject: str # TODO: Migrate to using topic
|
37 | 37 |
|
38 | 38 |
|
| 39 | +# https://zulip.com/api/send-message |
39 | 40 | Composition = Union[PrivateComposition, StreamComposition]
|
40 | 41 |
|
41 | 42 |
|
| 43 | +class PrivateMessageUpdateRequest(TypedDict): |
| 44 | + message_id: int |
| 45 | + content: str |
| 46 | + |
| 47 | + |
| 48 | +class StreamMessageUpdateRequest(TypedDict): |
| 49 | + message_id: int |
| 50 | + |
| 51 | + # May update combination of content for specified message |
| 52 | + # ...and/or topic of that message and potentially others (via mode) |
| 53 | + # ...but content and stream may not be changed together |
| 54 | + content: NotRequired[str] |
| 55 | + topic: NotRequired[str] |
| 56 | + propagate_mode: NotRequired[EditPropagateMode] |
| 57 | + |
| 58 | + # Supported for stream moves in ZFL 9 (Zulip 3) |
| 59 | + # Default values if not passed in ZFL 152 (Zulip 6) |
| 60 | + send_notification_to_old_thread: NotRequired[bool] |
| 61 | + send_notification_to_new_thread: NotRequired[bool] |
| 62 | + |
| 63 | + # TODO: Implement message moves between streams |
| 64 | + # stream_id: int |
| 65 | + |
| 66 | + |
| 67 | +# https://zulip.com/api/update-message |
| 68 | +MessageUpdateRequest = Union[PrivateMessageUpdateRequest, StreamMessageUpdateRequest] |
| 69 | + |
| 70 | + |
42 | 71 | class Message(TypedDict, total=False):
|
43 | 72 | id: int
|
44 | 73 | sender_id: int
|
|
0 commit comments