From f571cf77e5ca8e30a926b20521c5f93d47f37a34 Mon Sep 17 00:00:00 2001 From: seriaati Date: Sun, 22 Sep 2024 10:26:06 +0800 Subject: [PATCH] fix: Query categories with character ID --- akasha/client.py | 14 ++++---------- tests/models/test_category.py | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/akasha/client.py b/akasha/client.py index 6ea30db..21f0acf 100644 --- a/akasha/client.py +++ b/akasha/client.py @@ -242,21 +242,15 @@ async def get_artifacts(self, uid: int, md5: str, *, use_cache: bool = True) -> data = await self._request(f"artifacts/{uid}/{md5}", use_cache=use_cache) return [Artifact(**artifact) for artifact in data] - async def get_categories(self, character_name: str) -> list[LeaderboardCategory]: - """Get leaderboard categories of a character based on their name. + async def get_categories(self, character_id: str) -> list[LeaderboardCategory]: + """Get leaderboard categories of a character based on their ID. Args: - character_name: The name of the character. + character_id: The character ID. """ data = await self._request( "v2/leaderboards/categories", use_cache=True, - params={ - "characterName": [character_name], - "sort": "count", - "order": "-1", - "size": "20", - "page": "1", - }, + params={"characterId": character_id}, ) return [LeaderboardCategory(**category) for category in data] diff --git a/tests/models/test_category.py b/tests/models/test_category.py index e8f666a..2bf7d45 100644 --- a/tests/models/test_category.py +++ b/tests/models/test_category.py @@ -3,4 +3,4 @@ async def test_get_categories() -> None: async with akasha.AkashaAPI() as api: - await api.get_categories("Clorinde") + await api.get_categories("10000098")