diff --git a/pyproject.toml b/pyproject.toml index 8e822b2..ee8aaf8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "osuclient" -version = "0.5.1" +version = "0.5.2" description = "Client for osu! API" readme = "README.md" authors = [ diff --git a/src/osuclient/api.py b/src/osuclient/api.py index 5737305..d794184 100644 --- a/src/osuclient/api.py +++ b/src/osuclient/api.py @@ -47,9 +47,16 @@ class osuAPIClient(AioHTTPXClient): case _: raise s.Error(500, 'Internal Server Error') - async def get_score(self, access_token: str, mode: str, score_id: int): + async def get_score( + self, + access_token: str, + score_id: int, + mode: Literal['fruits', 'mania', 'osu', 'taiko'] | None = None, + ): + url = f'/scores/{mode}/{score_id}' if mode else f'/scores/{score_id}' + req = await self.get( - f'/scores/{mode}/{score_id}', + url, headers=self.clean_dict( { 'Authorization': f'Bearer {access_token}', diff --git a/src/osuclient/schema.py b/src/osuclient/schema.py index a7fc26d..3fa15a3 100644 --- a/src/osuclient/schema.py +++ b/src/osuclient/schema.py @@ -149,7 +149,7 @@ class UserAchievement(BaseModel): class RankHistory(BaseModel): model_config = ConfigDict(extra='forbid') - mode: str + mode: Literal['osu', 'taiko', 'fruits', 'mania'] data: list[int] @@ -331,7 +331,7 @@ class Beatmap(BaseModel): beatmapset_id: int difficulty_rating: float id: int - mode: str + mode: Literal['osu', 'taiko', 'fruits', 'mania'] status: str total_length: int user_id: int @@ -378,7 +378,7 @@ class Score(BaseModel): created_at: str id: int max_combo: int - mode: str + mode: Literal['osu', 'taiko', 'fruits', 'mania'] mode_int: int mods: list[str] passed: bool