Skip to content

Commit d0307fe

Browse files
mkp6781neiljp
authored andcommitted
refactor: api_types/helper: Add typing for emoji types as EmojiType.
`EmojiType` specifies types of emoji in the Zulip API.
1 parent 5756566 commit d0307fe

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

zulipterminal/api_types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55

66
EditPropagateMode = Literal['change_one', 'change_all', 'change_later']
7+
EmojiType = Literal['realm_emoji', 'unicode_emoji', 'zulip_extra_emoji']
78

89

910
class PrivateComposition(TypedDict):
@@ -106,7 +107,7 @@ class ReactionEvent(TypedDict):
106107
type: Literal['reaction']
107108
op: str
108109
user: Dict[str, Any] # 'email', 'user_id', 'full_name'
109-
reaction_type: str
110+
reaction_type: EmojiType
110111
emoji_code: str
111112
emoji_name: str
112113
message_id: int

zulipterminal/helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
from urllib.parse import unquote
2424

2525
import lxml.html
26-
from typing_extensions import Literal, TypedDict
26+
from typing_extensions import TypedDict
2727

28-
from zulipterminal.api_types import Composition, Message
28+
from zulipterminal.api_types import Composition, EmojiType, Message
2929

3030

3131
MACOS = platform.system() == "Darwin"
@@ -43,7 +43,7 @@ class StreamData(TypedDict):
4343

4444
class EmojiData(TypedDict):
4545
code: str
46-
type: Literal['realm_emoji', 'unicode_emoji', 'zulip_extra_emoji']
46+
type: EmojiType
4747

4848

4949
NamedEmojiData = Dict[str, EmojiData]

0 commit comments

Comments
 (0)