mirror of
https://github.com/PaiGramTeam/SIMNet.git
synced 2024-11-26 07:55:42 +00:00
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
|
from functools import partial
|
||
|
from typing import Optional, List
|
||
|
|
||
|
from simnet.client.components.self_help.base import BaseSelfHelpClient
|
||
|
from simnet.models.starrail.self_help import StarRailSelfHelpActionLog
|
||
|
from simnet.utils.enums import Game
|
||
|
from simnet.utils.paginator import WishPaginator
|
||
|
|
||
|
|
||
|
class StarrailSelfHelpClient(BaseSelfHelpClient):
|
||
|
"""Starrail self-help component."""
|
||
|
|
||
|
async def get_starrail_action_log(
|
||
|
self,
|
||
|
authkey: str,
|
||
|
limit: Optional[int] = None,
|
||
|
end_id: int = 0,
|
||
|
*,
|
||
|
lang: Optional[str] = None,
|
||
|
) -> List[StarRailSelfHelpActionLog]:
|
||
|
"""
|
||
|
Get the action log for a starrail user.
|
||
|
|
||
|
Args:
|
||
|
authkey: The authkey for the user.
|
||
|
limit: The number of logs to get.
|
||
|
end_id: The end ID for the logs.
|
||
|
lang: The language to get the logs in.
|
||
|
|
||
|
Returns:
|
||
|
List[StarRailSelfHelpActionLog]: The action logs.
|
||
|
"""
|
||
|
paginator = WishPaginator(
|
||
|
end_id,
|
||
|
partial(
|
||
|
self.request_self_help,
|
||
|
endpoint="UserInfo/GetActionLog",
|
||
|
game=Game.STARRAIL,
|
||
|
lang=lang,
|
||
|
params={
|
||
|
"authkey": authkey,
|
||
|
"size": 100,
|
||
|
"page_id": 0,
|
||
|
},
|
||
|
),
|
||
|
)
|
||
|
items = await paginator.get(limit)
|
||
|
return [StarRailSelfHelpActionLog(**i) for i in items]
|