|
28 | 28 |
|
29 | 29 | import distro
|
30 | 30 | import requests
|
| 31 | +from typing_extensions import Literal |
31 | 32 |
|
32 | 33 | __version__ = "0.8.1"
|
33 | 34 |
|
|
44 | 45 |
|
45 | 46 | API_VERSTRING = "v1/"
|
46 | 47 |
|
| 48 | +# An optional parameter to `move_topic` and `update_message` actions |
| 49 | +# See eg. https://zulip.com/api/update-message#parameter-propagate_mode |
| 50 | +EditPropagateMode = Literal["change_one", "change_all", "change_later"] |
| 51 | + |
| 52 | +# Generally a `reaction_type` is present whenever an emoji is specified: |
| 53 | +# - Optional parameters to actions: `add_reaction`, `remove_reaction` |
| 54 | +# - Events: "user_status", "reaction", "message", "update_message" |
| 55 | +# - Inside each reaction in the `reactions` field of returned message objects. |
| 56 | +EmojiType = Literal["realm_emoji", "unicode_emoji", "zulip_extra_emoji"] |
| 57 | + |
| 58 | +# Message flags which may be directly modified by the current user: |
| 59 | +# - Updated by `update_message_flags` (and for the `read` flag, also |
| 60 | +# the `mark_all_as_read`, `mark_stream_as_read`, and |
| 61 | +# `mark_topic_as_read` actions. |
| 62 | +# - User is notified of changes via `update_message_flags` events. |
| 63 | +# See subset of https://zulip.com/api/update-message-flags#available-flags |
| 64 | +ModifiableMessageFlag = Literal["read", "starred", "collapsed"] |
| 65 | + |
| 66 | +# All possible message flags. |
| 67 | +# - Generally present in `flags` object of returned message objects. |
| 68 | +# - User is notified of changes via "update_message_flags" and `update_message` |
| 69 | +# events. The latter is important for clients to learn when a message is |
| 70 | +# edited to mention the current user or contain an alert word. |
| 71 | +# See https://zulip.com/api/update-message-flags#available-flags |
| 72 | +MessageFlag = Literal[ |
| 73 | + ModifiableMessageFlag, |
| 74 | + "mentioned", |
| 75 | + "wildcard_mentioned", |
| 76 | + "has_alert_word", |
| 77 | + "historical", |
| 78 | +] |
| 79 | + |
47 | 80 |
|
48 | 81 | class CountingBackoff:
|
49 | 82 | def __init__(
|
@@ -1638,7 +1671,7 @@ def move_topic(
|
1638 | 1671 | topic: str,
|
1639 | 1672 | new_topic: Optional[str] = None,
|
1640 | 1673 | message_id: Optional[int] = None,
|
1641 |
| - propagate_mode: str = "change_all", |
| 1674 | + propagate_mode: EditPropagateMode = "change_all", |
1642 | 1675 | notify_old_topic: bool = True,
|
1643 | 1676 | notify_new_topic: bool = True,
|
1644 | 1677 | ) -> Dict[str, Any]:
|
|
0 commit comments