diff --git a/pyproject.toml b/pyproject.toml index a398863..04104df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "osuclient" -version = "0.4.1" +version = "0.5.0" description = "Client for osu! API" readme = "README.md" authors = [ diff --git a/src/osuclient/api.py b/src/osuclient/api.py index ee885a2..b68de66 100644 --- a/src/osuclient/api.py +++ b/src/osuclient/api.py @@ -47,6 +47,26 @@ class osuAPIClient(AioHTTPXClient): case _: raise s.Error(500, 'Internal Server Error') + async def get_score(self, access_token: str, score_id: int): + req = await self.get( + f'/scores/{score_id}', + headers=self.clean_dict( + { + 'Authorization': f'Bearer {access_token}', + } + ), + ) + + match req.status_code: + case st.OK: + return s.Score.model_validate(req.json()) + + case st.NOT_FOUND: + raise s.Error(404, 'Score not found') + + case _: + raise s.Error(500, 'Internal Server Error') + async def get_user_scores( self, access_token: str,