Skip to content

Commit

Permalink
fix: Query categories with character ID
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Sep 22, 2024
1 parent fcade3d commit f571cf7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions akasha/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
2 changes: 1 addition & 1 deletion tests/models/test_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit f571cf7

Please # to comment.