summaryrefslogtreecommitdiff
path: root/slixmpp/types.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-02-06 18:05:59 +0100
committermathieui <mathieui@mathieui.net>2021-02-08 23:08:31 +0100
commitbc04da256a0553fbbacf57477d531e96efd19241 (patch)
tree2ca1875ee6f4777330acb5dfe4faa54daf09fe04 /slixmpp/types.py
parentb9e479f213fb761c928ce3fa4b6a20481fd49ec3 (diff)
downloadslixmpp-bc04da256a0553fbbacf57477d531e96efd19241.tar.gz
slixmpp-bc04da256a0553fbbacf57477d531e96efd19241.tar.bz2
slixmpp-bc04da256a0553fbbacf57477d531e96efd19241.tar.xz
slixmpp-bc04da256a0553fbbacf57477d531e96efd19241.zip
XEP-0045: Types, visibility, and documentation
- Make all handlers private (_-prefixed) - Reorder methods in a more thematic order - Add docstrings to public methods - Add types where they were missing - Create new Literal types for closed enums - Make join_muc a wrapper around join_muc_wait and return a Future - Deprecate the current join_muc API - Fix some mypy issues
Diffstat (limited to 'slixmpp/types.py')
-rw-r--r--slixmpp/types.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/slixmpp/types.py b/slixmpp/types.py
index 44e24a1e..c8ab640c 100644
--- a/slixmpp/types.py
+++ b/slixmpp/types.py
@@ -7,15 +7,21 @@
This file contains boilerplate to define types relevant to slixmpp.
"""
+from typing import Optional
+
try:
from typing import (
Literal,
+ TypedDict,
)
except ImportError:
from typing_extensions import (
Literal,
+ TypedDict,
)
+from slixmpp.jid import JID
+
PresenceTypes = Literal[
'error', 'probe', 'subscribe', 'subscribed',
'unavailable', 'unsubscribe', 'unsubscribed',
@@ -35,3 +41,32 @@ IqTypes = Literal[
"error", "get", "set", "result",
]
+MucRole = Literal[
+ 'moderator', 'participant', 'visitor', 'none'
+]
+
+MucAffiliation = Literal[
+ 'outcast', 'member', 'admin', 'owner', 'none'
+]
+
+
+class PresenceArgs(TypedDict, total=False):
+ pfrom: JID
+ pto: JID
+ pshow: PresenceShows
+ ptype: PresenceTypes
+ pstatus: str
+
+
+class MucRoomItem(TypedDict, total=False):
+ jid: JID
+ role: MucRole
+ affiliation: MucAffiliation
+ show: Optional[PresenceShows]
+ status: str
+ alt_nick: str
+
+
+MucRoomItemKeys = Literal[
+ 'jid', 'role', 'affiliation', 'show', 'status', 'alt_nick',
+]