Skip to content

Commit bd07d0a

Browse files
author
GuangChen2333
committed
doc: add some doc and notification __repr__
1 parent 1026352 commit bd07d0a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/mhyy/_notification.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ def __init__(
2929
self._msg = msg
3030
self._created_at = created_at
3131

32+
def __repr__(self) -> str:
33+
return (f"Notification(id={self._id}, status={self._status}, type={self._type}, priority={self._priority}, "
34+
f"source={self._source}, desc={self._desc}, msg={self.msg}, created_at={self._created_at})")
35+
3236
@classmethod
3337
def from_data_dict(cls, data: dict) -> T:
3438
"""

src/mhyy/_user.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66

77
class User:
8+
"""
9+
用户类。
10+
"""
811
def __init__(
912
self,
1013
combo_token: str,
@@ -17,6 +20,19 @@ def __init__(
1720
client_type: Optional[UserClientType] = UserClientType.Android,
1821
channel: Optional[UserChannel] = UserChannel.Official
1922
):
23+
"""
24+
创建一个用户。
25+
26+
Args:
27+
combo_token (str): 对应 headers 中的 x-rpc-combo_token。
28+
sys_version (str): 对应 headers 中的 x-rpc-sys_version。
29+
device_id (str): 对应 headers 中的 x-rpc-device_id。
30+
device_name (str): 对应 headers 中的 x-rpc-device_name。
31+
device_model (str): 对应 headers 中的 x-rpc-device_model。
32+
game_type (Optional[GameType]): 游戏类型,若为空则将会从 combo_token 中自动识别。
33+
client_type (Optional[UserClientType]): 用户的客户端种类。
34+
channel: 用户的游戏渠道。
35+
"""
2036
self._combo_token = combo_token
2137
self._sys_version = sys_version
2238
self._device_id = device_id

0 commit comments

Comments
 (0)