|
| 1 | +## Client |
| 2 | + |
| 3 | +_mhyy.Client()_ |
| 4 | + |
| 5 | +> 米哈云游客户端。 |
| 6 | +
|
| 7 | +`versions`: dict |
| 8 | + |
| 9 | +> 所有游戏类型的版本号字典,若只想获取指定游戏类型的版本号,请使用 get_client_version() 方法。 |
| 10 | +
|
| 11 | +`get_wallet_data`(self, user: [User](#user)) |
| 12 | + |
| 13 | +> 获取指定用户的钱包数据。 |
| 14 | +> |
| 15 | +> **形参:** |
| 16 | +> |
| 17 | +> - user ([**User**](#User)): 发起请求的用户。 |
| 18 | +> |
| 19 | +> **返回值:** [`WalletData`](#walletdata) - 该用户的钱包数据。 |
| 20 | +
|
| 21 | +`get_notifications`(self, user: [User](#user), *, status: Optional[[NotificationStatus](#notificationstatus)] = None, |
| 22 | +type_: Optional[[NotificationType](#notificationtype)] = None, is_sort: Optional[bool] = True) |
| 23 | + |
| 24 | +> 获取指定用户的通知信息。 |
| 25 | +> |
| 26 | +> **形参:** |
| 27 | +> |
| 28 | +> - user ([**User**](#User)): 发起请求的用户。 |
| 29 | +> - status (**Optional[[NotificationStatus](#notificationstatus)]**): 筛选指定的通知状态。 |
| 30 | +> - type_ (**Optional[[NotificationType](#notificationtype)]**): 筛选指定的通知种类。 |
| 31 | +> - Optional (**Optional[bool]**): 是否排序。 |
| 32 | +> |
| 33 | +> **返回值:** `List[`[`Notification`](#notification)`]` - 一个列表,包含了指定用户的通知信息。 |
| 34 | +
|
| 35 | +`get_client_version`(self, game_type: [GameType](#gametype)) |
| 36 | + |
| 37 | +> 获取指定游戏类型的版本号,若想获取字典类型的所有版本号,请使用 versions 属性。 |
| 38 | +> |
| 39 | +> **形参:** |
| 40 | +> |
| 41 | +> - game_type ([GameType](#gametype)): 游戏类型。 |
| 42 | +> |
| 43 | +> **返回值:** `str` - 该游戏类型的版本号。 |
| 44 | +
|
| 45 | +## GameType |
| 46 | + |
| 47 | +_class mhyy.GameType_ |
| 48 | + |
| 49 | +> 游戏类型。 |
| 50 | +
|
| 51 | +`GenshinImpact` = 0 |
| 52 | + |
| 53 | +> 云·原神。 |
| 54 | +
|
| 55 | +`StarRail` = 1 |
| 56 | + |
| 57 | +> 云·星穹铁道。 |
| 58 | +
|
| 59 | +## Notification |
| 60 | + |
| 61 | +> 通知类。 |
| 62 | +
|
| 63 | +_class mhyy.Notification_ |
| 64 | +(id_: str, status: [NotificationStatus](#notificationstatus), type_: |
| 65 | +[NotificationType](#notificationtype), priority: int, source: str, desc: str, msg: str, created_at: str) |
| 66 | + |
| 67 | +!!! Note |
| 68 | + |
| 69 | + 这里不提供构造方法,因为根本没有导出。 |
| 70 | + |
| 71 | +`id`: str |
| 72 | + |
| 73 | +> 通知 ID。 |
| 74 | +
|
| 75 | +`status`: [NotificationStatus](#notificationstatus) |
| 76 | + |
| 77 | +> 通知状态。 |
| 78 | +
|
| 79 | +`type`: [NotificationType](#notificationtype) |
| 80 | + |
| 81 | +> 通知种类。 |
| 82 | +
|
| 83 | +`priority`: int |
| 84 | + |
| 85 | +> 作用未知,根据名称推测是通知的优先级。 |
| 86 | +
|
| 87 | +`source`: str |
| 88 | + |
| 89 | +> 作用未知。 |
| 90 | +
|
| 91 | +`desc`: str |
| 92 | + |
| 93 | +> 作用未知,根据名称推测是通知的描述。 |
| 94 | +
|
| 95 | +`msg`: str |
| 96 | + |
| 97 | +> 一个字符串,包含了 json 文本格式的该通知的内容。 |
| 98 | +
|
| 99 | +`create_at`: str |
| 100 | + |
| 101 | +> 一个字符串,是秒级的时间戳 (10位),描述了该通知何时被创建。 |
| 102 | +
|
| 103 | +`from_data_dict`(cls, data: dict) |
| 104 | + |
| 105 | +> 从特定的数据结构生成 Notification。 |
| 106 | +> |
| 107 | +> **形参:** |
| 108 | +> |
| 109 | +> - data (**dict**): 消息数据。 |
| 110 | +> |
| 111 | +> **返回值:** [`Notification`](#notification) - 包装后的消息数据。 |
| 112 | +
|
| 113 | +## NotificationStatus |
| 114 | + |
| 115 | +_class mhyy.NotificationStatus_ |
| 116 | + |
| 117 | +> 通知状态。 |
| 118 | +
|
| 119 | +`Read` = 'NotificationStatusRead' |
| 120 | + |
| 121 | +> 已读。 |
| 122 | +
|
| 123 | +`Unread` = 'NotificationStatusUnread' |
| 124 | + |
| 125 | +> 未读。 |
| 126 | +
|
| 127 | +`Undefined` = 'NotificationStatusUndefined' |
| 128 | + |
| 129 | +> 未定义。 |
| 130 | +
|
| 131 | +`get_status_by_name`(cls, status: str) |
| 132 | + |
| 133 | +> 从字符串获取枚举成员。 |
| 134 | +> |
| 135 | +> **形参:** |
| 136 | +> |
| 137 | +> - status (**str**): 成员字符串。 |
| 138 | +> |
| 139 | +> **返回值:** [`NotificationStatus`](#notificationstatus) - 枚举成员。 |
| 140 | +
|
| 141 | +## NotificationType |
| 142 | + |
| 143 | +_class mhyy.NotificationType_ |
| 144 | + |
| 145 | +> 通知种类。 |
| 146 | +
|
| 147 | +`Popup` = 'NotificationTypePopup' |
| 148 | + |
| 149 | +> 弹窗通知。 |
| 150 | +
|
| 151 | +`Undefined` = 'NotificationTypeUndefined' |
| 152 | + |
| 153 | +> 未定义。 |
| 154 | +
|
| 155 | +`get_type_by_name`(cls, type_: str) |
| 156 | + |
| 157 | +> 从字符串获取枚举成员。 |
| 158 | +> |
| 159 | +> **形参:** |
| 160 | +> |
| 161 | +> - status (**str**): 成员字符串。 |
| 162 | +> |
| 163 | +> **返回值:** [`NotificationType`](#notificationtype) - 枚举成员。 |
| 164 | +
|
| 165 | +## User |
| 166 | + |
| 167 | +_class mhyy.User(combo_token: str, sys_version: str, device_id: str, device_name: str, device_model: str, |
| 168 | +*, game_type: Optional[[GameType](#gametype)] = None, client_type: Optional[[UserClientType](#userclienttype)] = |
| 169 | +UserClientType.Android, channel: Optional[UserChannel] = UserChannel.Official |
| 170 | +)_ |
| 171 | + |
| 172 | +> 用户类。 |
| 173 | +> |
| 174 | +> 形参: |
| 175 | +> |
| 176 | +> - **combo_token** (str): 对应 headers 中的 x-rpc-combo_token。 |
| 177 | +> - **sys_version** (str): 对应 headers 中的 x-rpc-sys_version。 |
| 178 | +> - **device_id** (str): 对应 headers 中的 x-rpc-device_id。 |
| 179 | +> - **device_name** (str): 对应 headers 中的 x-rpc-device_name。 |
| 180 | +> - **device_model** (str): 对应 headers 中的 x-rpc-device_model。 |
| 181 | +> - **game_type** (Optional[[GameType](#gametype)]): 游戏类型,若为空则将会从 combo_token 中自动识别。 |
| 182 | +> - **client_type** (Optional[[UserClientType](#userclienttype)]): 用户的客户端种类。 |
| 183 | +> - **channel** (Optional[[UserChannel](#userchannel)]): 用户的游戏渠道。 |
| 184 | +
|
| 185 | +!!! Note |
| 186 | + |
| 187 | + 这里不提供成员的文档说明,因为他是形参的 Getter。 |
| 188 | + |
| 189 | +`combo_token`: str |
| 190 | + |
| 191 | +`sys_version`: str |
| 192 | + |
| 193 | +`device_id`: str |
| 194 | + |
| 195 | +`device_name`: str |
| 196 | + |
| 197 | +`device_model`: str |
| 198 | + |
| 199 | +`client_type`: str |
| 200 | + |
| 201 | +`game_type`: [GameType](#gametype) |
| 202 | + |
| 203 | +`channel`: [UserChannel](#userchannel) |
| 204 | + |
| 205 | +`get_user_headers`(self) |
| 206 | + |
| 207 | +> 获取该用户的 headers。 |
| 208 | +> |
| 209 | +> **返回值:** dict - 字典格式的该用户的 headers。 |
| 210 | +
|
| 211 | +## UserChannel |
| 212 | + |
| 213 | +_class mhyy.UserChannel_ |
| 214 | + |
| 215 | +> 游戏渠道。 |
| 216 | +
|
| 217 | +!!! Note |
| 218 | + |
| 219 | + 目前 mhyy.py 仅支持官方服务器的操作。 |
| 220 | + |
| 221 | +`Official` = 0 |
| 222 | + |
| 223 | +> 官方服。 |
| 224 | +
|
| 225 | +## UserClientType |
| 226 | + |
| 227 | +_class mhyy.UserClientType_ |
| 228 | + |
| 229 | +> 客户端类型。 |
| 230 | +
|
| 231 | +!!! Note |
| 232 | + |
| 233 | + 目前 mhyy.py 仅支持模拟安卓设备操作。 |
| 234 | + |
| 235 | +`Android` = 2 |
| 236 | + |
| 237 | +> 安卓。 |
| 238 | +
|
| 239 | +## WalletData |
| 240 | + |
| 241 | +_class mhyy.WalletData_ |
| 242 | + |
| 243 | +!!! Info |
| 244 | + |
| 245 | + 事实上,mhyy.WalletData包含五个子类,分别是 |
| 246 | + `mhyy.CoinData`、`mhyy.FreeTimeData`、`mhyy.StatusData`、 |
| 247 | + `mhyy.StatData`、`mhyy.PlayCardData`。 |
| 248 | + |
| 249 | + 但这些成员子类都没有导出且`mhyy.WalletData`与他的成员子类都是 `dataclass`。 |
| 250 | + 没有构造函数,仅供读取数据。 |
| 251 | + |
| 252 | + 所以在本文档中不会描述其五个子类,仅当作成员描写。 |
| 253 | + |
| 254 | +### `coin` |
| 255 | + |
| 256 | +> 用户的 原点 / 星云币 时长数据。 |
| 257 | +
|
| 258 | +`coin.coin_num`: int |
| 259 | + |
| 260 | +> 原点 / 星云币 数。 |
| 261 | +
|
| 262 | +`coin.free_coin_num`: int |
| 263 | + |
| 264 | +> 免费 原点 / 星云币 数。 |
| 265 | +
|
| 266 | +`coin.coin_limit`: int |
| 267 | + |
| 268 | +> 原点 / 星云币 的数量上限。 |
| 269 | +
|
| 270 | +`coin.exchange`: int |
| 271 | + |
| 272 | +> 与原点时长的汇率。通常来说,10 原点 / 星云币 = 1 游戏时长。 |
| 273 | +
|
| 274 | +### `free_time` |
| 275 | + |
| 276 | +> 用户的免费时长数据。 |
| 277 | +
|
| 278 | +`free_time.send_freetime`: int |
| 279 | + |
| 280 | +> 若该用户是本日第一次登录,那么此处的值为每日赠送的免费时长 (min)。反之,此处恒为 0。 |
| 281 | +
|
| 282 | +`free_time.free_time`: int |
| 283 | + |
| 284 | +> 总免费时长 (min)。 |
| 285 | +
|
| 286 | +`free_time.free_time_limit`: int |
| 287 | + |
| 288 | +> 免费时长上限 (min)。 |
| 289 | +
|
| 290 | +`free_time.over_freetime`: int |
| 291 | + |
| 292 | +> 该用户是本日第一次登录且赠送的时长有一部分超出了免费时长上限,那么此处的值为溢出的免费时长 (min)。 |
| 293 | +
|
| 294 | +### `status` |
| 295 | + |
| 296 | +> 未知数据 |
| 297 | +
|
| 298 | +!!! Warning |
| 299 | + |
| 300 | + 这是一条未知的数据,具体内容待补充。 |
| 301 | + |
| 302 | +`status.status`: int |
| 303 | + |
| 304 | +`status.msg`: str |
| 305 | + |
| 306 | +`status.total_time_status`: int |
| 307 | + |
| 308 | +`status.status_new`: int |
| 309 | + |
| 310 | +### `stat` |
| 311 | + |
| 312 | +> 未知数据 |
| 313 | +
|
| 314 | +!!! Warning |
| 315 | + |
| 316 | + 这是一条未知的数据,具体内容待补充。 |
| 317 | + |
| 318 | +`vip_point`: str |
| 319 | + |
| 320 | +### `play_card` |
| 321 | + |
| 322 | +> 用户的畅玩卡数据 |
| 323 | +
|
| 324 | +`play_card.expire`: str |
| 325 | + |
| 326 | +> 畅玩卡过期时间(格式未知) |
| 327 | +
|
| 328 | +!!! Warning |
| 329 | + |
| 330 | + 这是一条未知的数据,请谨慎使用。 |
| 331 | + |
| 332 | +`play_card.msg`: str |
| 333 | + |
| 334 | +> 畅玩卡信息 |
| 335 | +
|
| 336 | +`play_card.short_msg`: str |
| 337 | + |
| 338 | +> 畅玩卡短信息 / 状态 |
| 339 | +
|
| 340 | +`play_card.play_card_limit`: str |
| 341 | + |
| 342 | +> 未知 |
| 343 | +
|
| 344 | +!!! Warning |
| 345 | + |
| 346 | + 这是一条未知的数据,具体内容待补充。 |
0 commit comments